@@ -77,40 +77,43 @@ public SwaggerSpringMvcPlugin customImplementation() {
7777 .includePatterns ("/stats.*" , "/concepts.*" , "/refsets.*" );
7878 }
7979
80- public static void main (String [] args ) throws IOException {
81- if (args .length > 0 ) {
82- final String option = args [0 ];
80+ public static void main (String [] argsArray ) throws IOException {
81+ if (argsArray .length == 0 ) {
82+ exit ("Not enough arguments. " + USEAGE );
83+ }
84+
85+ boolean meaningfulArgumentsFound = false ;
86+ for (int i = 0 ; i < argsArray .length ; i ++) {
87+ final String option = argsArray [i ];
8388 switch (option ) {
8489 case "--loadRelease" :
85- maxArgs (2 , args );
86- if (args .length > 1 ) {
90+ if (argsArray .length > i + 1 ) {
8791 loadRelease = true ;
88- releasePath = args [1 ];
92+ releasePath = argsArray [1 ];
8993 final File file = new File (releasePath );
9094 if (!file .isFile ()) {
9195 exit ("Is not a file: " + file .getAbsolutePath ());
9296 }
97+ meaningfulArgumentsFound = true ;
9398 } else {
9499 exit ("Please specify RF2 release archive path after the --loadRelease argument." );
95100 }
96101 break ;
97102 case "--loadTestData" :
98- maxArgs (1 , args );
99103 loadTestData = true ;
104+ meaningfulArgumentsFound = true ;
100105 break ;
101106 case "--serve" :
102- maxArgs (1 , args );
103107 serve = true ;
104- break ;
105- default :
106- exit ("Unrecognised option: " + option );
108+ meaningfulArgumentsFound = true ;
107109 break ;
108110 }
109- } else {
111+ }
112+ if (!meaningfulArgumentsFound ) {
110113 exit ("Not enough arguments. " + USEAGE );
111114 }
112115
113- SpringApplication .run (Application .class , args );
116+ SpringApplication .run (Application .class , argsArray );
114117 }
115118
116119 private static void maxArgs (int max , String [] args ) {
0 commit comments