diff --git a/src/net/sourceforge/plantuml/OptionPrint.java b/src/net/sourceforge/plantuml/OptionPrint.java index fd2a48b0a..df6938de7 100644 --- a/src/net/sourceforge/plantuml/OptionPrint.java +++ b/src/net/sourceforge/plantuml/OptionPrint.java @@ -62,13 +62,12 @@ public class OptionPrint { static public void printTestDot() throws InterruptedException { final List result = new ArrayList<>(); final int errorCode = GraphvizUtils.addDotStatus(result, false); - for (String s : result) { - if (errorCode == 0) { + for (String s : result) + if (errorCode == 0) System.out.println(s); - } else { + else System.err.println(s); - } - } + exit(errorCode); } @@ -169,35 +168,34 @@ public class OptionPrint { } static private void exit(int errorCode) throws InterruptedException { - if (OptionFlags.getInstance().isSystemExit() || errorCode != 0) { + if (OptionFlags.getInstance().isSystemExit() || errorCode != 0) System.exit(errorCode); - } + throw new InterruptedException("exit"); } public static void printLicense() throws InterruptedException { - for (String s : License.getCurrent().getTextFull()) { + for (String s : License.getCurrent().getTextFull()) System.out.println(s); - } - exit(0); + System.exit(0); } public static void printVersion() throws InterruptedException { System.out.println(Version.fullDescription()); System.out.println("(" + License.getCurrent() + " source distribution)"); - for (String v : interestingProperties()) { + for (String v : interestingProperties()) System.out.println(v); - } - for (String v : interestingValues()) { + + for (String v : interestingValues()) System.out.println(v); - } + System.out.println(); final List result = new ArrayList<>(); final int errorCode = GraphvizUtils.addDotStatus(result, false); - for (String s : result) { + for (String s : result) System.out.println(s); - } - exit(errorCode); + + System.exit(0); } public static Collection interestingProperties() { diff --git a/src/net/sourceforge/plantuml/Run.java b/src/net/sourceforge/plantuml/Run.java index 9f9558e5a..7686fe44c 100644 --- a/src/net/sourceforge/plantuml/Run.java +++ b/src/net/sourceforge/plantuml/Run.java @@ -87,14 +87,10 @@ public class Run { throws NoPlantumlCompressionException, IOException, InterruptedException { System.setProperty("log4j.debug", "false"); final long start = System.currentTimeMillis(); - if (argsArray.length > 0 && argsArray[0].equalsIgnoreCase("-headless")) { + if (argsArray.length > 0 && argsArray[0].equalsIgnoreCase("-headless")) System.setProperty("java.awt.headless", "true"); - } -// if (argsArray.length > 0 && argsArray[0].equalsIgnoreCase("--de")) { -// debugGantt(); -// return; -// } saveCommandLine(argsArray); + final Option option = new Option(argsArray); ProgressBar.setEnable(option.isTextProgressBar()); if (OptionFlags.getInstance().isClipboardLoop()) { @@ -156,9 +152,9 @@ public class Run { } forceOpenJdkResourceLoad(); - if (option.getPreprocessorOutputMode() == OptionPreprocOutputMode.CYPHER) { + if (option.getPreprocessorOutputMode() == OptionPreprocOutputMode.CYPHER) cypher = new LanguageDescriptor().getCypher(); - } + final ErrorStatus error = ErrorStatus.init(); boolean forceQuit = false; if (OptionFlags.getInstance().isGui()) { @@ -170,9 +166,9 @@ public class Run { File dir = null; if (list.size() == 1) { final File f = new File(list.get(0)); - if (f.exists() && f.isDirectory()) { + if (f.exists() && f.isDirectory()) dir = f; - } + } try { new MainWindow(option, dir); @@ -187,9 +183,9 @@ public class Run { managePipe(option, error); forceQuit = true; } else if (option.isFailfast2()) { - if (option.isSplash()) { + if (option.isSplash()) Splash.createSplash(); - } + final long start2 = System.currentTimeMillis(); option.setCheckOnly(true); manageAllFiles(option, error); @@ -198,14 +194,14 @@ public class Run { final double duration = (System.currentTimeMillis() - start2) / 1000.0; Log.error("Check Duration = " + duration + " seconds"); } - if (error.hasError() == false) { + if (error.hasError() == false) manageAllFiles(option, error); - } + forceQuit = true; } else { - if (option.isSplash()) { + if (option.isSplash()) Splash.createSplash(); - } + manageAllFiles(option, error); forceQuit = true; } @@ -216,16 +212,15 @@ public class Run { } if (OptionFlags.getInstance().isGui() == false) { - if (error.hasError() || error.isNoData()) { + if (error.hasError() || error.isNoData()) option.getStdrpt().finalMessage(error); - } - if (error.hasError()) { - System.exit(error.getExitCode()); - } - if (forceQuit && OptionFlags.getInstance().isSystemExit()) { + if (error.hasError()) + System.exit(error.getExitCode()); + + if (forceQuit && OptionFlags.getInstance().isSystemExit()) System.exit(0); - } + } } diff --git a/src/net/sourceforge/plantuml/core/UmlSource.java b/src/net/sourceforge/plantuml/core/UmlSource.java index b39eb40e8..bda5c52e2 100755 --- a/src/net/sourceforge/plantuml/core/UmlSource.java +++ b/src/net/sourceforge/plantuml/core/UmlSource.java @@ -159,6 +159,12 @@ final public class UmlSource { // return Collections.unmodifiableCollection(rawSource).iterator(); // } + + @Deprecated() + public String getPlainString() { + return getPlainString("\n"); + } + /** * Return the source as a single String. *