< prev index next >

src/java.xml/share/classes/com/sun/org/apache/xerces/internal/parsers/AbstractSAXParser.java

Print this page
rev 52881 : 8214971: Replace use of string.equals("") with isEmpty()
Reviewed-by: jlaskey, prappo, lancea, dfuchs, redestad


2301             // REVISIT: this hides the fact that internally we use
2302             //          null instead of empty string
2303             //          SAX requires URI to be a string or an empty string
2304             String uri= fAttributes.getURI(index);
2305             return uri != null ? uri : "";
2306         }
2307 
2308         public String getLocalName(int index) {
2309             return fAttributes.getLocalName(index);
2310         }
2311 
2312         public String getType(int i) {
2313             return fAttributes.getType(i);
2314         }
2315 
2316         public String getType(String name) {
2317             return fAttributes.getType(name);
2318         }
2319 
2320         public String getType(String uri, String localName) {
2321             return uri.equals("") ? fAttributes.getType(null, localName) :
2322                                     fAttributes.getType(uri, localName);
2323         }
2324 
2325         public String getValue(int i) {
2326             return fAttributes.getValue(i);
2327         }
2328 
2329         public String getValue(String name) {
2330             return fAttributes.getValue(name);
2331         }
2332 
2333         public String getValue(String uri, String localName) {
2334             return uri.equals("") ? fAttributes.getValue(null, localName) :
2335                                     fAttributes.getValue(uri, localName);
2336         }
2337 
2338         public int getIndex(String qName) {
2339             return fAttributes.getIndex(qName);
2340         }
2341 
2342         public int getIndex(String uri, String localPart) {
2343             return uri.equals("") ? fAttributes.getIndex(null, localPart) :
2344                                     fAttributes.getIndex(uri, localPart);
2345         }
2346 
2347         // Attributes2 methods
2348         // REVISIT: Localize exception messages. -- mrglavas
2349         public boolean isDeclared(int index) {
2350             if (index < 0 || index >= fAttributes.getLength()) {
2351                 throw new ArrayIndexOutOfBoundsException(index);
2352             }
2353             return Boolean.TRUE.equals(
2354                 fAttributes.getAugmentations(index).getItem(
2355                 Constants.ATTRIBUTE_DECLARED));
2356         }
2357 
2358         public boolean isDeclared(String qName) {
2359             int index = getIndex(qName);
2360             if (index == -1) {
2361                 throw new IllegalArgumentException(qName);
2362             }
2363             return Boolean.TRUE.equals(




2301             // REVISIT: this hides the fact that internally we use
2302             //          null instead of empty string
2303             //          SAX requires URI to be a string or an empty string
2304             String uri= fAttributes.getURI(index);
2305             return uri != null ? uri : "";
2306         }
2307 
2308         public String getLocalName(int index) {
2309             return fAttributes.getLocalName(index);
2310         }
2311 
2312         public String getType(int i) {
2313             return fAttributes.getType(i);
2314         }
2315 
2316         public String getType(String name) {
2317             return fAttributes.getType(name);
2318         }
2319 
2320         public String getType(String uri, String localName) {
2321             return uri.isEmpty() ? fAttributes.getType(null, localName) :
2322                                     fAttributes.getType(uri, localName);
2323         }
2324 
2325         public String getValue(int i) {
2326             return fAttributes.getValue(i);
2327         }
2328 
2329         public String getValue(String name) {
2330             return fAttributes.getValue(name);
2331         }
2332 
2333         public String getValue(String uri, String localName) {
2334             return uri.isEmpty() ? fAttributes.getValue(null, localName) :
2335                                     fAttributes.getValue(uri, localName);
2336         }
2337 
2338         public int getIndex(String qName) {
2339             return fAttributes.getIndex(qName);
2340         }
2341 
2342         public int getIndex(String uri, String localPart) {
2343             return uri.isEmpty() ? fAttributes.getIndex(null, localPart) :
2344                                     fAttributes.getIndex(uri, localPart);
2345         }
2346 
2347         // Attributes2 methods
2348         // REVISIT: Localize exception messages. -- mrglavas
2349         public boolean isDeclared(int index) {
2350             if (index < 0 || index >= fAttributes.getLength()) {
2351                 throw new ArrayIndexOutOfBoundsException(index);
2352             }
2353             return Boolean.TRUE.equals(
2354                 fAttributes.getAugmentations(index).getItem(
2355                 Constants.ATTRIBUTE_DECLARED));
2356         }
2357 
2358         public boolean isDeclared(String qName) {
2359             int index = getIndex(qName);
2360             if (index == -1) {
2361                 throw new IllegalArgumentException(qName);
2362             }
2363             return Boolean.TRUE.equals(


< prev index next >