src/share/classes/com/sun/jndi/toolkit/dir/SearchFilter.java

Print this page
rev 10203 : 8048874: Replace uses of 'new Byte', 'new Short' and 'new Character' with appropriate alternative across core classes
Reviewed-by: chegar, prappo
Contributed-by: Otavio Santana <otaviojava@java.net>


 362                         return true;
 363                     }
 364                     break;
 365                 case LESS_MATCH:
 366                     if (debug) {System.out.println("Atomic: LESS match");}
 367                     if(val.compareTo(this.value) <= 0) {
 368                         return true;
 369                     }
 370                     break;
 371                 default:
 372                     if (debug) {System.out.println("AtomicFilter: unkown " +
 373                                                    "matchType");}
 374                 }
 375             }
 376             return false;
 377         }
 378 
 379         // used for substring comparisons (where proto has "*" wildcards
 380         private boolean substringMatch(String proto, String value) {
 381             // simple case 1: "*" means attribute presence is being tested
 382             if(proto.equals(new Character(WILDCARD_TOKEN).toString())) {
 383                 if(debug) {System.out.println("simple presence assertion");}
 384                 return true;
 385             }
 386 
 387             // simple case 2: if there are no wildcards, call String.equals()
 388             if(proto.indexOf(WILDCARD_TOKEN) == -1) {
 389                 return proto.equalsIgnoreCase(value);
 390             }
 391 
 392             if(debug) {System.out.println("doing substring comparison");}
 393             // do the work: make sure all the substrings are present
 394             int currentPos = 0;
 395             StringTokenizer subStrs = new StringTokenizer(proto, "*", false);
 396 
 397             // do we need to begin with the first token?
 398             if(proto.charAt(0) != WILDCARD_TOKEN &&
 399                     !value.toLowerCase(Locale.ENGLISH).startsWith(
 400                         subStrs.nextToken().toLowerCase(Locale.ENGLISH))) {
 401                 if(debug) {
 402                     System.out.println("faild initial test");




 362                         return true;
 363                     }
 364                     break;
 365                 case LESS_MATCH:
 366                     if (debug) {System.out.println("Atomic: LESS match");}
 367                     if(val.compareTo(this.value) <= 0) {
 368                         return true;
 369                     }
 370                     break;
 371                 default:
 372                     if (debug) {System.out.println("AtomicFilter: unkown " +
 373                                                    "matchType");}
 374                 }
 375             }
 376             return false;
 377         }
 378 
 379         // used for substring comparisons (where proto has "*" wildcards
 380         private boolean substringMatch(String proto, String value) {
 381             // simple case 1: "*" means attribute presence is being tested
 382             if(proto.equals(Character.toString(WILDCARD_TOKEN))) {
 383                 if(debug) {System.out.println("simple presence assertion");}
 384                 return true;
 385             }
 386 
 387             // simple case 2: if there are no wildcards, call String.equals()
 388             if(proto.indexOf(WILDCARD_TOKEN) == -1) {
 389                 return proto.equalsIgnoreCase(value);
 390             }
 391 
 392             if(debug) {System.out.println("doing substring comparison");}
 393             // do the work: make sure all the substrings are present
 394             int currentPos = 0;
 395             StringTokenizer subStrs = new StringTokenizer(proto, "*", false);
 396 
 397             // do we need to begin with the first token?
 398             if(proto.charAt(0) != WILDCARD_TOKEN &&
 399                     !value.toLowerCase(Locale.ENGLISH).startsWith(
 400                         subStrs.nextToken().toLowerCase(Locale.ENGLISH))) {
 401                 if(debug) {
 402                     System.out.println("faild initial test");