public static void checkTracerName ( String tracerName , NotificationSource notificationSource ) throws IllegalArgumentException { if ( tracerName . compareTo ( "" ) == 0 ) { // This is root return ; } // String[] splitName = tracerName.split("\\."); StringTokenizer stringTokenizer = new StringTokenizer ( tracerName , "." , true ) ; int fqdnPartIndex = 0 ; // if(splitName.length==0) // { // throw new IllegalArgumentException("Passed tracer:" + tracerName + // ", name for source: " + notificationSource + ", is illegal"); // } String lastToken = null ; while ( stringTokenizer . hasMoreTokens ( ) ) { String token = stringTokenizer . nextToken ( ) ; if ( lastToken == null ) { // this is start lastToken = token ; } if ( lastToken . compareTo ( token ) == 0 && token . compareTo ( "." ) == 0 ) { throw new IllegalArgumentException ( "Passed tracer:" + tracerName + ", name for source: " + notificationSource + ", is illegal" ) ; } if ( token . compareTo ( "." ) != 0 ) { for ( int charIndex = 0 ; charIndex < token . length ( ) ; charIndex ++ ) { Character c = token . charAt ( charIndex ) ; if ( Character . isLetter ( c ) || Character . isDigit ( c ) ) { // Its ok? } else { throw new IllegalArgumentException ( "Passed tracer:" + tracerName + " Token[" + token + "], name for source: " + notificationSource + ", is illegal, contains illegal character: " + charIndex ) ; } } fqdnPartIndex ++ ; } lastToken = token ; } if ( lastToken . compareTo ( "." ) == 0 ) { throw new IllegalArgumentException ( "Passed tracer:" + tracerName + ", name for source: " + notificationSource + ", is illegal" ) ; } }
This checks if tracer name is ok . It must not be null ;