public static void initializeArg ( final RemoteProgram remoteProgram , final String [ ] arguments , final Launch < ? > launch ) throws OptionException , ParserException { int numberOfEquals = 0 ; for ( String argument : arguments ) { if ( argument . indexOf ( ' ' ) > - 1 ) numberOfEquals ++ ; } if ( numberOfEquals != arguments . length ) throw new OptionException ( LaunchingMessageKind . WREMOTE001 . format ( remoteProgram . getClass ( ) . getCanonicalName ( ) ) ) ; for ( String argument : arguments ) { if ( argument . indexOf ( "=" ) > 0 ) { String [ ] arg = argument . split ( "=" ) ; String argName = arg [ 0 ] ; String argValue = null ; if ( arg . length > 1 ) argValue = arg [ 1 ] ; if ( argValue != null && argValue . trim ( ) . length ( ) == 0 ) argValue = null ; if ( argValue != null && argValue . charAt ( 0 ) == ' ' && argValue . charAt ( argValue . length ( ) - 1 ) == ' ' ) { argValue = argValue . substring ( 1 , argValue . length ( ) - 1 ) ; } if ( argValue != null && argValue . charAt ( 0 ) == ' ' && argValue . charAt ( argValue . length ( ) - 1 ) == ' ' ) { argValue = argValue . substring ( 1 , argValue . length ( ) - 1 ) ; } if ( argValue != null && argValue . equals ( "''" ) ) { argValue = "" ; } Iterator < Argument > argumentIterator = remoteProgram . getArguments ( ) . iterator ( ) ; boolean found = false ; while ( argumentIterator . hasNext ( ) && ! found ) { Argument a = argumentIterator . next ( ) ; try { if ( a . getName ( ) . equals ( argName ) ) { a . setValueUsingParser ( argValue ) ; found = true ; } } catch ( Exception e ) { throw new OptionException ( LaunchingMessageKind . EREMOTE0010 . format ( a . getName ( ) , remoteProgram . getClass ( ) . getCanonicalName ( ) ) , e ) ; } } if ( ! found ) { throw new OptionException ( LaunchingMessageKind . EREMOTE0012 . format ( argument , remoteProgram . getClass ( ) . getCanonicalName ( ) , argument ) ) ; } } else { throw new OptionException ( LaunchingMessageKind . EREMOTE0011 . format ( remoteProgram . getClass ( ) . getCanonicalName ( ) ) ) ; } } }
Check the validity of arguments values coming from remote launching with regard to types . If not done the Quartz Exception thrown doesn t stop the launch and Program may be launched with invalid arguments values .