@ Override public void processArguments ( String [ ] args ) throws IOException { List < File > classFiles = new ArrayList < File > ( ) ; List < File > jarFiles = new ArrayList < File > ( ) ; String [ ] fileArgs = null ; for ( int i = 0 ; i < args . length ; i ++ ) { if ( args [ i ] . equalsIgnoreCase ( "--debug" ) || args [ i ] . equals ( "-d" ) ) { setDebug ( true ) ; } else if ( args [ i ] . equalsIgnoreCase ( "--config" ) ) { // TODO: Handle config file parsing File configFile = new File ( args [ ++ i ] ) ; System . out . println ( "Config file not currently supported" + configFile ) ; } else if ( args [ i ] . equalsIgnoreCase ( "--ffdc" ) ) { addFfdc = true ; } else if ( args [ i ] . equalsIgnoreCase ( "--static" ) ) { injectStatic = true ; } else if ( args [ i ] . equalsIgnoreCase ( "--liberty" ) ) { defaultTraceType = TraceType . LIBERTY ; } else if ( args [ i ] . equalsIgnoreCase ( "--tr" ) ) { defaultTraceType = TraceType . TR ; } else if ( args [ i ] . equalsIgnoreCase ( "--java-logging" ) ) { defaultTraceType = TraceType . JAVA_LOGGING ; } else { fileArgs = new String [ args . length - i ] ; System . arraycopy ( args , i , fileArgs , 0 , fileArgs . length ) ; break ; } } if ( fileArgs == null || fileArgs . length == 0 ) { throw new IllegalArgumentException ( "No file specified" ) ; } // Add jar files, zip files, and class files to the appropriate collections for ( int i = 0 ; i < fileArgs . length ; i ++ ) { File f = new File ( fileArgs [ i ] ) ; if ( ! f . exists ( ) ) { throw new IllegalArgumentException ( "File \"" + f + "\" does not exist" ) ; } else if ( f . isDirectory ( ) ) { classFiles . addAll ( getClassFiles ( f , null ) ) ; jarFiles . addAll ( getJarFiles ( f , null ) ) ; } else if ( f . getName ( ) . endsWith ( ".class" ) ) { classFiles . add ( f ) ; } else if ( f . getName ( ) . endsWith ( ".jar" ) ) { jarFiles . add ( f ) ; } else if ( f . getName ( ) . endsWith ( ".zip" ) ) { jarFiles . add ( f ) ; } else { System . err . println ( f + " is an unexpected file type; ignoring" ) ; } } setClassFiles ( classFiles ) ; setJarFiles ( jarFiles ) ; }
Process the command line arguments for the tool