public static String [ ] getServiceName ( String [ ] argv , String [ ] serviceId ) throws IllegalArgumentException { ArrayList < String > newArgvList = new ArrayList < String > ( ) ; for ( int i = 0 ; i < argv . length ; i ++ ) { if ( "-service" . equals ( argv [ i ] ) ) { if ( i + 1 == argv . length ) { throw new IllegalArgumentException ( "Doesn't have service id" ) ; } serviceId [ 0 ] = argv [ ++ i ] ; } else { newArgvList . add ( argv [ i ] ) ; } } String [ ] newArgvs = new String [ newArgvList . size ( ) ] ; newArgvList . toArray ( newArgvs ) ; return newArgvs ; }
Get the service name arguments and return the filtered argument list