85 */ |
85 */ |
86 public String encoding; |
86 public String encoding; |
87 |
87 |
88 public String classpath = System.getProperty("java.class.path"); |
88 public String classpath = System.getProperty("java.class.path"); |
89 |
89 |
|
90 /** |
|
91 * -javacOptions |
|
92 * |
|
93 * @since 2.2.9 |
|
94 */ |
|
95 public List<String> javacOptions; |
|
96 |
90 |
97 |
91 /** |
98 /** |
92 * -Xnocompile |
99 * -Xnocompile |
93 */ |
100 */ |
94 public boolean nocompile; |
101 public boolean nocompile; |
95 |
102 |
96 /** |
103 /** |
97 * Disable secure xml processing. |
104 * If true XML security features when parsing XML documents will be disabled. |
98 * -XdisableSecureXmlProcessing |
105 * The default value is false. |
99 */ |
106 * |
100 public boolean disableSecureXmlProcessing = false; |
107 * Boolean |
|
108 * @since 2.2.9 |
|
109 */ |
|
110 public boolean disableXmlSecurity; |
101 |
111 |
102 public enum Target { |
112 public enum Target { |
103 V2_0, V2_1, V2_2; |
113 V2_0, V2_1, V2_2; |
104 |
114 |
105 /** |
115 /** |
352 } |
362 } |
353 } catch (IllegalCharsetNameException icne) { |
363 } catch (IllegalCharsetNameException icne) { |
354 throw new BadCommandLineException(WscompileMessages.WSCOMPILE_UNSUPPORTED_ENCODING(encoding)); |
364 throw new BadCommandLineException(WscompileMessages.WSCOMPILE_UNSUPPORTED_ENCODING(encoding)); |
355 } |
365 } |
356 return 2; |
366 return 2; |
357 } else if (args[i].equals("-XdisableSecureXmlProcessing")) { |
367 } else if (args[i].equals("-disableXmlSecurity")) { |
358 disableSecureXmlProcessing= true; |
368 disableXmlSecurity(); |
|
369 return 1; |
|
370 } else if (args[i].startsWith("-J")) { |
|
371 if (javacOptions == null) { |
|
372 javacOptions = new ArrayList<String>(); |
|
373 } |
|
374 javacOptions.add(args[i].substring(2)); |
359 return 1; |
375 return 1; |
360 } |
376 } |
361 return 0; |
377 return 0; |
|
378 } |
|
379 |
|
380 // protected method to allow overriding |
|
381 protected void disableXmlSecurity() { |
|
382 disableXmlSecurity= true; |
362 } |
383 } |
363 |
384 |
364 /** |
385 /** |
365 * Obtains an operand and reports an error if it's not there. |
386 * Obtains an operand and reports an error if it's not there. |
366 */ |
387 */ |
370 throw new BadCommandLineException(WscompileMessages.WSCOMPILE_MISSING_OPTION_ARGUMENT(optionName)); |
391 throw new BadCommandLineException(WscompileMessages.WSCOMPILE_MISSING_OPTION_ARGUMENT(optionName)); |
371 } |
392 } |
372 return args[i]; |
393 return args[i]; |
373 } |
394 } |
374 |
395 |
375 |
396 List<String> getJavacOptions(List<String> existingOptions, WsimportListener listener) { |
|
397 List<String> result = new ArrayList<String>(); |
|
398 for (String o: javacOptions) { |
|
399 if (o.contains("=") && !o.startsWith("A")) { |
|
400 int i = o.indexOf('='); |
|
401 String key = o.substring(0, i); |
|
402 if (existingOptions.contains(key)) { |
|
403 listener.message(WscompileMessages.WSCOMPILE_EXISTING_OPTION(key)); |
|
404 } else { |
|
405 result.add(key); |
|
406 result.add(o.substring(i + 1)); |
|
407 } |
|
408 } else { |
|
409 if (existingOptions.contains(o)) { |
|
410 listener.message(WscompileMessages.WSCOMPILE_EXISTING_OPTION(o)); |
|
411 } else { |
|
412 result.add(o); |
|
413 } |
|
414 } |
|
415 } |
|
416 return result; |
|
417 } |
376 |
418 |
377 /** |
419 /** |
378 * Used to signal that we've finished processing. |
420 * Used to signal that we've finished processing. |
379 */ |
421 */ |
380 public static final class WeAreDone extends BadCommandLineException {} |
422 public static final class WeAreDone extends BadCommandLineException {} |