From aaf3a8ee247b569bc6d600bd828e80ca35f4db89 Mon Sep 17 00:00:00 2001 From: Guillaume Grossetie Date: Tue, 16 Aug 2022 17:22:32 +0200 Subject: [PATCH] resolves #1086 replace printStackTrace by java.util.logging.Logger --- gradle/wrapper/gradle-wrapper.jar | Bin 59536 -> 59821 bytes .../sourceforge/plantuml/AFileZipEntry.java | 11 ++- src/net/sourceforge/plantuml/BlockUml.java | 9 +- src/net/sourceforge/plantuml/DirWatcher2.java | 11 ++- .../sourceforge/plantuml/EmbeddedDiagram.java | 17 ++-- src/net/sourceforge/plantuml/FileFormat.java | 17 ++-- .../plantuml/GeneratedImageImpl.java | 9 +- src/net/sourceforge/plantuml/Log.java | 38 ++++---- src/net/sourceforge/plantuml/OptionFlags.java | 11 ++- src/net/sourceforge/plantuml/ProgressBar.java | 79 ++++++++++++---- src/net/sourceforge/plantuml/Run.java | 13 +-- .../sourceforge/plantuml/SignatureUtils.java | 27 +++--- src/net/sourceforge/plantuml/SkinParam.java | 11 ++- .../plantuml/SourceFileReaderAbstract.java | 9 +- src/net/sourceforge/plantuml/Splash.java | 9 +- .../sourceforge/plantuml/TitledDiagram.java | 8 +- src/net/sourceforge/plantuml/UmlDiagram.java | 15 +-- .../acearth/PSystemXearthFactory.java | 3 +- .../plantuml/ant/CheckZipTask.java | 10 +- .../plantuml/ant/PlantUmlTask.java | 12 ++- .../plantuml/api/NumberAnalyzed.java | 10 +- .../plantuml/api/NumberAnalyzed2.java | 9 +- .../plantuml/api/NumberAnalyzedDated.java | 9 +- .../plantuml/api/TimeoutExecutor.java | 12 ++- .../plantuml/argon2/blake2/Blake2b.java | 3 +- .../plantuml/code/CompressionBrotli.java | 9 +- .../plantuml/code/CompressionZlibAttic.java | 10 +- .../plantuml/code/Upf9Encoder.java | 10 +- .../plantuml/command/CommandSkinParam.java | 10 +- .../plantuml/command/ProtectedCommand.java | 16 ++-- .../plantuml/command/SkinLoader.java | 10 +- .../plantuml/creole/atom/AtomImg.java | 31 +++--- .../plantuml/cucadiagram/GroupPrinter.java | 11 ++- .../cucadiagram/dot/AbstractGraphviz.java | 13 +-- .../plantuml/cucadiagram/dot/DebugTrace.java | 10 +- .../cucadiagram/dot/GraphvizUtils.java | 19 ++-- .../cucadiagram/dot/GraphvizWindowsOld.java | 11 ++- .../cucadiagram/dot/ProcessRunner.java | 23 ++--- .../dedication/DedicationCrypted.java | 11 ++- .../plantuml/dedication/DedicationSimple.java | 12 ++- .../plantuml/dedication/Dedications.java | 11 ++- .../dedication/PSystemDedication.java | 3 +- .../plantuml/ditaa/PSystemDitaa.java | 9 +- .../plantuml/donors/PSystemDonors.java | 13 +-- .../plantuml/eggs/PSystemAppleTwoFactory.java | 11 ++- .../plantuml/eggs/PSystemRIPFactory.java | 11 ++- .../plantuml/elk/CucaDiagramFileMakerElk.java | 19 ++-- .../plantuml/elk/proxy/Reflect.java | 40 ++++---- src/net/sourceforge/plantuml/emoji/Emoji.java | 5 +- .../plantuml/emoji/SpriteSvgNanoParser.java | 11 ++- src/net/sourceforge/plantuml/ftp/FtpLoop.java | 11 ++- .../sourceforge/plantuml/ftp/FtpServer.java | 11 ++- .../sourceforge/plantuml/fun/IconLoader.java | 9 +- src/net/sourceforge/plantuml/graphic/Img.java | 13 +-- .../plantuml/graphic/UnusedSpace.java | 10 +- .../plantuml/hcl/HclDiagramFactory.java | 11 ++- .../plantuml/help/CommandHelpTheme.java | 3 +- .../plantuml/jcckit/PSystemJcckitFactory.java | 11 ++- src/net/sourceforge/plantuml/log/Logger.java | 57 ++++++++++++ .../plantuml/math/ConverterSvg.java | 12 ++- .../plantuml/math/PSystemLatex.java | 13 +-- .../plantuml/math/PSystemMath.java | 13 +-- .../plantuml/math/ScientificEquationSafe.java | 15 +-- .../sourceforge/plantuml/mindmap/MindMap.java | 8 +- .../plantuml/openiconic/OpenIcon.java | 11 ++- .../plantuml/pdf/PdfConverter.java | 10 +- .../plantuml/picoweb/PicoWebServer.java | 15 +-- .../plantuml/picoweb/PicoWebServerTest.java | 3 +- .../preproc/StartDiagramExtractReader.java | 11 ++- .../sourceforge/plantuml/preproc/Stdlib.java | 3 +- .../plantuml/preproc2/PreprocessorUtils.java | 13 +-- .../plantuml/project/GanttDiagram.java | 11 ++- .../plantuml/real/PositiveForce.java | 19 ++-- .../sourceforge/plantuml/real/RealMax.java | 12 ++- .../plantuml/real/RealMoveable.java | 12 ++- .../plantuml/salt/PSystemSalt.java | 11 ++- .../sdot/CucaDiagramFileMakerSmetana.java | 11 ++- .../sourceforge/plantuml/security/SFile.java | 18 ++-- .../sourceforge/plantuml/security/SURL.java | 37 ++++---- .../plantuml/security/SecurityUtils.java | 5 +- .../AbstractOAuth2AccessAuthorizeManager.java | 3 +- .../sequencediagram/SequenceDiagram.java | 9 +- .../plantuml/sprite/RessourcesUtils.java | 11 ++- .../plantuml/sprite/SpriteGrayLevel.java | 11 ++- .../plantuml/sprite/SpriteImage.java | 11 ++- .../plantuml/sprite/StdlibDiagram.java | 11 ++- .../plantuml/stats/FormatCounter.java | 9 +- .../plantuml/stats/HistoricalData.java | 9 +- .../plantuml/stats/StatsUtils.java | 16 ++-- .../plantuml/stats/StatsUtilsIncrement.java | 9 +- .../style/CommandStyleMultilinesCSS.java | 8 +- .../svek/CucaDiagramFileMakerSvek.java | 13 +-- .../plantuml/svek/GeneralImageBuilder.java | 11 ++- .../sourceforge/plantuml/svg/SvgGraphics.java | 8 +- .../plantuml/swing/ImageWindow.java | 9 +- .../plantuml/swing/MainWindow.java | 17 ++-- .../plantuml/telnet/AcceptTelnetClient.java | 11 ++- .../sourceforge/plantuml/tim/EaterTheme.java | 7 +- .../sourceforge/plantuml/tim/TContext.java | 19 ++-- .../sourceforge/plantuml/tim/TimLoader.java | 3 +- .../plantuml/tim/stdlib/LoadJson.java | 17 ++-- .../plantuml/tim/stdlib/LoadJsonLegacy.java | 17 ++-- .../plantuml/timingdiagram/PlayerAnalog.java | 9 +- .../ugraphic/g2d/ExtendedGeneralPath.java | 30 +++--- .../sourceforge/plantuml/utils/Cypher.java | 10 +- .../plantuml/version/LicenseInfo.java | 15 +-- .../plantuml/version/PLSSignature.java | 9 +- .../plantuml/version/PSystemKeycheck.java | 11 ++- .../plantuml/version/PSystemKeygen.java | 9 +- .../plantuml/version/PSystemVersion.java | 13 +-- .../sourceforge/plantuml/version/Version.java | 14 ++- .../plantuml/vizjs/GraphvizJs.java | 13 +-- .../sourceforge/plantuml/wbs/WBSDiagram.java | 10 +- .../sourceforge/plantuml/webp/VP8Decoder.java | 14 +-- .../sourceforge/plantuml/webp/VP8Frame.java | 88 +++++++++--------- .../windowsdot/WindowsDotArchive.java | 11 ++- .../plantuml/xmi/CucaDiagramXmiMaker.java | 13 +-- .../plantuml/xmi/SequenceDiagramXmiMaker.java | 14 +-- .../xmlsc/StateDiagramScxmlMaker.java | 13 +-- .../plantuml/yaml/YamlDiagramFactory.java | 11 ++- .../sourceforge/plantuml/ProgressBarTest.java | 78 ++++++++++++++++ 121 files changed, 1007 insertions(+), 717 deletions(-) create mode 100644 src/net/sourceforge/plantuml/log/Logger.java create mode 100644 test/net/sourceforge/plantuml/ProgressBarTest.java diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 7454180f2ae8848c63b8b4dea2cb829da983f2fa..41d9927a4d4fb3f96a785543079b8df6723c946b 100644 GIT binary patch delta 8958 zcmY+KWl$VIlZIh&f(Hri?gR<$?iyT!TL`X;1^2~W7YVSq1qtqM!JWlDxLm%}UESUM zndj}Uny%^UnjhVhFb!8V3s(a#fIy>`VW15{5nuy;_V&a5O#0S&!a4dSkUMz_VHu3S zGA@p9Q$T|Sj}tYGWdjH;Mpp8m&yu&YURcrt{K;R|kM~(*{v%QwrBJIUF+K1kX5ZmF zty3i{d`y0;DgE+de>vN@yYqFPe1Ud{!&G*Q?iUc^V=|H%4~2|N zW+DM)W!`b&V2mQ0Y4u_)uB=P@-2`v|Wm{>CxER1P^ z>c}ZPZ)xxdOCDu59{X^~2id7+6l6x)U}C4Em?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a_qq;{*dHRXAq157hlB@kL#8%yAm2AgfU|*rDKX@FLlp=HL8ddv zAWLCHe@DcDeB2}fl7#=0+#<05c3=VqM*O3bkr@9X4nO|)q0hU;Gye{L8ZN*NH8Id@mP-u;Fmb8YuorjLrW&ndip8CN%_qp982r w1WEnz9^$&s1hkp_3#lPJQ~!HI7WYYjA7>z!`?f%npAh2%rB@vD|Lau$2O)#1n*aa+ diff --git a/src/net/sourceforge/plantuml/AFileZipEntry.java b/src/net/sourceforge/plantuml/AFileZipEntry.java index d016ddfa8..cd9a945fb 100644 --- a/src/net/sourceforge/plantuml/AFileZipEntry.java +++ b/src/net/sourceforge/plantuml/AFileZipEntry.java @@ -5,12 +5,12 @@ * (C) Copyright 2009-2023, Arnaud Roques * * Project Info: http://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * http://plantuml.com/patreon (only 1$ per month!) * http://plantuml.com/paypal - * + * * This file is part of PlantUML. * * PlantUML is free software; you can redistribute it and/or modify it @@ -40,6 +40,7 @@ import java.io.InputStream; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; +import net.sourceforge.plantuml.log.Logger; import net.sourceforge.plantuml.security.SFile; public class AFileZipEntry implements AFile { @@ -75,7 +76,7 @@ public class AFileZipEntry implements AFile { zis.closeEntry(); zis.close(); } catch (IOException e) { - e.printStackTrace(); + Logger.error(e); } return null; } @@ -88,7 +89,7 @@ public class AFileZipEntry implements AFile { is.close(); return true; } catch (IOException e) { - e.printStackTrace(); + Logger.error(e); } } } diff --git a/src/net/sourceforge/plantuml/BlockUml.java b/src/net/sourceforge/plantuml/BlockUml.java index 62992f1d3..d9104e9cf 100644 --- a/src/net/sourceforge/plantuml/BlockUml.java +++ b/src/net/sourceforge/plantuml/BlockUml.java @@ -5,12 +5,12 @@ * (C) Copyright 2009-2023, Arnaud Roques * * Project Info: http://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * http://plantuml.com/patreon (only 1$ per month!) * http://plantuml.com/paypal - * + * * This file is part of PlantUML. * * PlantUML is free software; you can redistribute it and/or modify it @@ -55,6 +55,7 @@ import net.sourceforge.plantuml.code.TranscoderUtil; import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.core.Diagram; import net.sourceforge.plantuml.error.PSystemErrorPreprocessor; +import net.sourceforge.plantuml.log.Logger; import net.sourceforge.plantuml.preproc.Defines; import net.sourceforge.plantuml.preproc.FileWithSuffix; import net.sourceforge.plantuml.preproc2.PreprocessorModeSet; @@ -197,7 +198,7 @@ public class BlockUml { final byte[] digest = msgDigest.digest(); return coder.encode(digest); } catch (Exception e) { - e.printStackTrace(); + Logger.error(e); return "NOETAG"; } } diff --git a/src/net/sourceforge/plantuml/DirWatcher2.java b/src/net/sourceforge/plantuml/DirWatcher2.java index 71f61d227..08df525b4 100644 --- a/src/net/sourceforge/plantuml/DirWatcher2.java +++ b/src/net/sourceforge/plantuml/DirWatcher2.java @@ -5,12 +5,12 @@ * (C) Copyright 2009-2023, Arnaud Roques * * Project Info: http://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * http://plantuml.com/patreon (only 1$ per month!) * http://plantuml.com/paypal - * + * * This file is part of PlantUML. * * PlantUML is free software; you can redistribute it and/or modify it @@ -31,7 +31,7 @@ * * Original Author: Arnaud Roques * - * + * */ package net.sourceforge.plantuml; @@ -49,6 +49,7 @@ import java.util.concurrent.Executors; import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; +import net.sourceforge.plantuml.log.Logger; import net.sourceforge.plantuml.preproc.FileWithSuffix; public class DirWatcher2 { @@ -98,7 +99,7 @@ public class DirWatcher2 { modifieds.put(f, new FileWatcher(files)); return Collections.unmodifiableList(generatedImages); } catch (Exception e) { - e.printStackTrace(); + Logger.error(e); return Collections.emptyList(); } } diff --git a/src/net/sourceforge/plantuml/EmbeddedDiagram.java b/src/net/sourceforge/plantuml/EmbeddedDiagram.java index 65ec8ca70..574975da2 100644 --- a/src/net/sourceforge/plantuml/EmbeddedDiagram.java +++ b/src/net/sourceforge/plantuml/EmbeddedDiagram.java @@ -5,12 +5,12 @@ * (C) Copyright 2009-2023, Arnaud Roques * * Project Info: http://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * http://plantuml.com/patreon (only 1$ per month!) * http://plantuml.com/paypal - * + * * This file is part of PlantUML. * * PlantUML is free software; you can redistribute it and/or modify it @@ -30,7 +30,7 @@ * * * Original Author: Arnaud Roques - * + * * */ package net.sourceforge.plantuml; @@ -49,6 +49,7 @@ import net.sourceforge.plantuml.graphic.AbstractTextBlock; import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.Line; import net.sourceforge.plantuml.graphic.StringBounder; +import net.sourceforge.plantuml.log.Logger; import net.sourceforge.plantuml.preproc.Defines; import net.sourceforge.plantuml.security.SImageIO; import net.sourceforge.plantuml.ugraphic.AffineTransformType; @@ -81,9 +82,9 @@ class EmbeddedDiagramDraw extends AbstractTextBlock implements Line, Atom { final BufferedImage im = getImage(); return new Dimension2DDouble(im.getWidth(), im.getHeight()); } catch (IOException e) { - e.printStackTrace(); + Logger.error(e); } catch (InterruptedException e) { - e.printStackTrace(); + Logger.error(e); } return new Dimension2DDouble(42, 42); } @@ -101,9 +102,9 @@ class EmbeddedDiagramDraw extends AbstractTextBlock implements Line, Atom { final UShape image = new UImage(new PixelImage(im, AffineTransformType.TYPE_BILINEAR)); ug.draw(image); } catch (IOException e) { - e.printStackTrace(); + Logger.error(e); } catch (InterruptedException e) { - e.printStackTrace(); + Logger.error(e); } } diff --git a/src/net/sourceforge/plantuml/FileFormat.java b/src/net/sourceforge/plantuml/FileFormat.java index 21ae738cf..b2044074d 100644 --- a/src/net/sourceforge/plantuml/FileFormat.java +++ b/src/net/sourceforge/plantuml/FileFormat.java @@ -5,12 +5,12 @@ * (C) Copyright 2009-2023, Arnaud Roques * * Project Info: http://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * http://plantuml.com/patreon (only 1$ per month!) * http://plantuml.com/paypal - * + * * This file is part of PlantUML. * * PlantUML is free software; you can redistribute it and/or modify it @@ -48,6 +48,7 @@ import net.sourceforge.plantuml.braille.BrailleCharFactory; import net.sourceforge.plantuml.braille.UGraphicBraille; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.StringBounderRaw; +import net.sourceforge.plantuml.log.Logger; import net.sourceforge.plantuml.png.MetadataTag; import net.sourceforge.plantuml.security.SFile; import net.sourceforge.plantuml.svg.SvgGraphics; @@ -56,9 +57,9 @@ import net.sourceforge.plantuml.ugraphic.debug.StringBounderDebug; /** * Format for output files generated by PlantUML. - * + * * @author Arnaud Roques - * + * */ public enum FileFormat { PNG("image/png"), @@ -96,7 +97,7 @@ public enum FileFormat { /** * Returns the file format to be used for that format. - * + * * @return a string starting by a point. */ public String getFileSuffix() { @@ -228,7 +229,7 @@ public enum FileFormat { /** * Check if this file format is Encapsulated PostScript. - * + * * @return true for EPS. */ public boolean isEps() { @@ -299,7 +300,7 @@ public enum FileFormat { } } catch (IOException e) { - e.printStackTrace(); + Logger.error(e); } return false; } diff --git a/src/net/sourceforge/plantuml/GeneratedImageImpl.java b/src/net/sourceforge/plantuml/GeneratedImageImpl.java index a90d5fbf6..f949b251b 100644 --- a/src/net/sourceforge/plantuml/GeneratedImageImpl.java +++ b/src/net/sourceforge/plantuml/GeneratedImageImpl.java @@ -5,12 +5,12 @@ * (C) Copyright 2009-2023, Arnaud Roques * * Project Info: http://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * http://plantuml.com/patreon (only 1$ per month!) * http://plantuml.com/paypal - * + * * This file is part of PlantUML. * * PlantUML is free software; you can redistribute it and/or modify it @@ -40,6 +40,7 @@ import java.io.IOException; import net.sourceforge.plantuml.core.Diagram; import net.sourceforge.plantuml.error.PSystemError; +import net.sourceforge.plantuml.log.Logger; import net.sourceforge.plantuml.security.SFile; public class GeneratedImageImpl implements GeneratedImage { @@ -88,7 +89,7 @@ public class GeneratedImageImpl implements GeneratedImage { return cmp; } } catch (IOException e) { - e.printStackTrace(); + Logger.error(e); } return this.description.compareTo(this2.getDescription()); } diff --git a/src/net/sourceforge/plantuml/Log.java b/src/net/sourceforge/plantuml/Log.java index 26be31d3f..9cc45079a 100644 --- a/src/net/sourceforge/plantuml/Log.java +++ b/src/net/sourceforge/plantuml/Log.java @@ -5,12 +5,12 @@ * (C) Copyright 2009-2023, Arnaud Roques * * Project Info: http://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * http://plantuml.com/patreon (only 1$ per month!) * http://plantuml.com/paypal - * + * * This file is part of PlantUML. * * PlantUML is free software; you can redistribute it and/or modify it @@ -35,23 +35,34 @@ */ package net.sourceforge.plantuml; -public abstract class Log { +import net.sourceforge.plantuml.log.Logger; + +public class Log { private static final long start = System.currentTimeMillis(); public synchronized static void debug(String s) { + // noop + } + + public static void println(Object s) { + // noop + } + + public static void header(String s) { + // noop } public synchronized static void info(String s) { if (OptionFlags.getInstance().isVerbose()) { ProgressBar.clear(); - System.err.println(format(s)); + Logger.error(format(s)); } } public synchronized static void error(String s) { ProgressBar.clear(); - System.err.println(s); + Logger.error(s); } private static String format(String s) { @@ -93,20 +104,5 @@ public abstract class Log { sb.append(" Mo - "); sb.append(s); return sb.toString(); - - } - - public static void println(Object s) { - // if (header2.get() == null) { - // System.err.println("L = " + s); - // } else { - // System.err.println(header2.get() + " " + s); - // } - } - - // private static final ThreadLocal header2 = new ThreadLocal<>(); - // - public static void header(String s) { - // header2.set(s); } } diff --git a/src/net/sourceforge/plantuml/OptionFlags.java b/src/net/sourceforge/plantuml/OptionFlags.java index f4b546d04..d981acdec 100644 --- a/src/net/sourceforge/plantuml/OptionFlags.java +++ b/src/net/sourceforge/plantuml/OptionFlags.java @@ -5,12 +5,12 @@ * (C) Copyright 2009-2023, Arnaud Roques * * Project Info: http://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * http://plantuml.com/patreon (only 1$ per month!) * http://plantuml.com/paypal - * + * * This file is part of PlantUML. * * PlantUML is free software; you can redistribute it and/or modify it @@ -41,6 +41,7 @@ import java.util.concurrent.atomic.AtomicBoolean; import net.sourceforge.plantuml.core.Diagram; import net.sourceforge.plantuml.cucadiagram.dot.GraphvizUtils; +import net.sourceforge.plantuml.log.Logger; import net.sourceforge.plantuml.security.SFile; import net.sourceforge.plantuml.security.SecurityUtils; @@ -217,7 +218,7 @@ public class OptionFlags { ps.println(); } catch (FileNotFoundException e) { Log.error("Cannot open " + logData); - e.printStackTrace(); + Logger.error(e); } } } @@ -229,7 +230,7 @@ public class OptionFlags { ps.println(); } catch (FileNotFoundException e) { Log.error("Cannot open " + logData); - e.printStackTrace(); + Logger.error(e); } } diff --git a/src/net/sourceforge/plantuml/ProgressBar.java b/src/net/sourceforge/plantuml/ProgressBar.java index 39264c1a5..119d558d2 100644 --- a/src/net/sourceforge/plantuml/ProgressBar.java +++ b/src/net/sourceforge/plantuml/ProgressBar.java @@ -5,12 +5,12 @@ * (C) Copyright 2009-2023, Arnaud Roques * * Project Info: http://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * http://plantuml.com/patreon (only 1$ per month!) * http://plantuml.com/paypal - * + * * This file is part of PlantUML. * * PlantUML is free software; you can redistribute it and/or modify it @@ -36,35 +36,52 @@ package net.sourceforge.plantuml; import java.util.concurrent.atomic.AtomicInteger; +import java.util.logging.Handler; +import java.util.logging.Level; +import java.util.logging.LogRecord; public class ProgressBar { + private static final java.util.logging.Logger logger; + + static { + logger = java.util.logging.Logger.getLogger("com.plantuml.ProgressBar"); + logger.setUseParentHandlers(false); + logger.addHandler(new StdErrHandler()); + } + private static boolean enable; private static String last = null; private static final AtomicInteger total = new AtomicInteger(); private static final AtomicInteger done = new AtomicInteger(); private synchronized static void print(String message) { - clear(); - System.err.print(message); + logger.log(Level.INFO, buildClearMessage() + message); last = message; } public synchronized static void clear() { - if (last != null) { - for (int i = 0; i < last.length(); i++) { - System.err.print('\b'); - } - for (int i = 0; i < last.length(); i++) { - System.err.print(' '); - } - for (int i = 0; i < last.length(); i++) { - System.err.print('\b'); - } - } + logger.log(Level.INFO, buildClearMessage()); last = null; } + private static String buildClearMessage() { + if (last != null) { + StringBuilder sb = new StringBuilder(); + for (int i = 0; i < last.length(); i++) { + sb.append("\b"); + } + for (int i = 0; i < last.length(); i++) { + sb.append(" "); + } + for (int i = 0; i < last.length(); i++) { + sb.append("\b"); + } + return sb.toString(); + } + return ""; + } + public static void incTotal(int nb) { total.addAndGet(nb); printBar(done.intValue(), total.intValue()); @@ -77,9 +94,7 @@ public class ProgressBar { if (total == 0) { return; } - final String message = "[" + getBar(done, total) + "] " + done + "/" + total; - print(message); - + print("[" + getBar(done, total) + "] " + done + "/" + total); } private static String getBar(int done, int total) { @@ -101,4 +116,30 @@ public class ProgressBar { enable = value; } + private static class StdErrHandler extends Handler { + public StdErrHandler() { + } + + @Override + public void publish(LogRecord record) { + String message = record.getMessage(); + System.err.print(message); + this.flush(); + } + + @Override + public void flush() { + System.err.flush(); + } + + /** + * Override {@code StreamHandler.close} to do a flush but not to close the output stream. + * That is, we do not close {@code System.err}. + */ + @Override + public void close() { + flush(); + } + } } + diff --git a/src/net/sourceforge/plantuml/Run.java b/src/net/sourceforge/plantuml/Run.java index 884ac5497..8bd63d3a4 100644 --- a/src/net/sourceforge/plantuml/Run.java +++ b/src/net/sourceforge/plantuml/Run.java @@ -5,12 +5,12 @@ * (C) Copyright 2009-2023, Arnaud Roques * * Project Info: http://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * http://plantuml.com/patreon (only 1$ per month!) * http://plantuml.com/paypal - * + * * This file is part of PlantUML. * * PlantUML is free software; you can redistribute it and/or modify it @@ -58,6 +58,7 @@ import net.sourceforge.plantuml.code.NoPlantumlCompressionException; import net.sourceforge.plantuml.code.Transcoder; import net.sourceforge.plantuml.code.TranscoderUtil; import net.sourceforge.plantuml.ftp.FtpServer; +import net.sourceforge.plantuml.log.Logger; import net.sourceforge.plantuml.picoweb.PicoWebServer; import net.sourceforge.plantuml.png.MetadataTag; import net.sourceforge.plantuml.preproc.Stdlib; @@ -403,7 +404,7 @@ public class Run { return; } } catch (IOException e) { - e.printStackTrace(); + Logger.error(e); } } } @@ -426,9 +427,9 @@ public class Run { try { manageFileInternal(f, option, error); } catch (IOException e) { - e.printStackTrace(); + Logger.error(e); } catch (InterruptedException e) { - e.printStackTrace(); + Logger.error(e); } incDone(error.hasError()); } diff --git a/src/net/sourceforge/plantuml/SignatureUtils.java b/src/net/sourceforge/plantuml/SignatureUtils.java index 9f28a8f1e..993037993 100644 --- a/src/net/sourceforge/plantuml/SignatureUtils.java +++ b/src/net/sourceforge/plantuml/SignatureUtils.java @@ -5,12 +5,12 @@ * (C) Copyright 2009-2023, Arnaud Roques * * Project Info: http://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * http://plantuml.com/patreon (only 1$ per month!) * http://plantuml.com/paypal - * + * * This file is part of PlantUML. * * PlantUML is free software; you can redistribute it and/or modify it @@ -50,6 +50,7 @@ import javax.crypto.SecretKeyFactory; import javax.crypto.spec.PBEKeySpec; import net.sourceforge.plantuml.code.AsciiEncoder; +import net.sourceforge.plantuml.log.Logger; import net.sourceforge.plantuml.security.SFile; public class SignatureUtils { @@ -77,10 +78,10 @@ public class SignatureUtils { final byte[] digest = getMD5raw(s); return toString(digest); } catch (NoSuchAlgorithmException e) { - e.printStackTrace(); + Logger.error(e); throw new UnsupportedOperationException(e); } catch (UnsupportedEncodingException e) { - e.printStackTrace(); + Logger.error(e); throw new UnsupportedOperationException(e); } } @@ -104,10 +105,10 @@ public class SignatureUtils { assert digest.length == 16; return toHexString(digest); } catch (NoSuchAlgorithmException e) { - e.printStackTrace(); + Logger.error(e); throw new UnsupportedOperationException(e); } catch (UnsupportedEncodingException e) { - e.printStackTrace(); + Logger.error(e); throw new UnsupportedOperationException(e); } } @@ -118,10 +119,10 @@ public class SignatureUtils { assert digest.length == 64; return toHexString(digest); } catch (NoSuchAlgorithmException e) { - e.printStackTrace(); + Logger.error(e); throw new UnsupportedOperationException(e); } catch (UnsupportedEncodingException e) { - e.printStackTrace(); + Logger.error(e); throw new UnsupportedOperationException(e); } } @@ -160,10 +161,10 @@ public class SignatureUtils { final byte[] digest = msgDigest.digest(); return toString(digest); } catch (NoSuchAlgorithmException e) { - e.printStackTrace(); + Logger.error(e); throw new UnsupportedOperationException(e); } catch (UnsupportedEncodingException e) { - e.printStackTrace(); + Logger.error(e); throw new UnsupportedOperationException(e); } } @@ -194,10 +195,10 @@ public class SignatureUtils { final byte[] digest = msgDigest.digest(); return toString(digest); } catch (NoSuchAlgorithmException e) { - e.printStackTrace(); + Logger.error(e); throw new UnsupportedOperationException(e); } catch (UnsupportedEncodingException e) { - e.printStackTrace(); + Logger.error(e); throw new UnsupportedOperationException(e); } } diff --git a/src/net/sourceforge/plantuml/SkinParam.java b/src/net/sourceforge/plantuml/SkinParam.java index 7dd0f6369..5f5e9acf0 100644 --- a/src/net/sourceforge/plantuml/SkinParam.java +++ b/src/net/sourceforge/plantuml/SkinParam.java @@ -5,12 +5,12 @@ * (C) Copyright 2009-2023, Arnaud Roques * * Project Info: http://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * http://plantuml.com/patreon (only 1$ per month!) * http://plantuml.com/paypal - * + * * This file is part of PlantUML. * * PlantUML is free software; you can redistribute it and/or modify it @@ -63,6 +63,7 @@ import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.cucadiagram.dot.DotSplines; import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.color.Colors; +import net.sourceforge.plantuml.log.Logger; import net.sourceforge.plantuml.skin.ActorStyle; import net.sourceforge.plantuml.skin.ArrowDirection; import net.sourceforge.plantuml.skin.Padder; @@ -111,7 +112,7 @@ public class SkinParam implements ISkinParam { try { this.styleBuilder = getCurrentStyleBuilderInternal(); } catch (IOException e) { - e.printStackTrace(); + Logger.error(e); } } return styleBuilder; @@ -178,7 +179,7 @@ public class SkinParam implements ISkinParam { this.muteStyle(modifiedStyle); } catch (IOException e) { - e.printStackTrace(); + Logger.error(e); } } } diff --git a/src/net/sourceforge/plantuml/SourceFileReaderAbstract.java b/src/net/sourceforge/plantuml/SourceFileReaderAbstract.java index 43fdd0e87..35747099f 100644 --- a/src/net/sourceforge/plantuml/SourceFileReaderAbstract.java +++ b/src/net/sourceforge/plantuml/SourceFileReaderAbstract.java @@ -5,12 +5,12 @@ * (C) Copyright 2009-2023, Arnaud Roques * * Project Info: http://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * http://plantuml.com/patreon (only 1$ per month!) * http://plantuml.com/paypal - * + * * This file is part of PlantUML. * * PlantUML is free software; you can redistribute it and/or modify it @@ -57,6 +57,7 @@ import net.sourceforge.plantuml.api.ImageDataSimple; import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.core.Diagram; import net.sourceforge.plantuml.error.PSystemError; +import net.sourceforge.plantuml.log.Logger; import net.sourceforge.plantuml.preproc.Defines; import net.sourceforge.plantuml.preproc.FileWithSuffix; import net.sourceforge.plantuml.security.SFile; @@ -159,7 +160,7 @@ public abstract class SourceFileReaderAbstract implements ISourceFileReader { try { system = blockUml.getDiagram(); } catch (Throwable t) { - t.printStackTrace(); + Logger.error(t); if (OptionFlags.getInstance().isSilentlyCompletelyIgnoreErrors() || noerror) { continue; } diff --git a/src/net/sourceforge/plantuml/Splash.java b/src/net/sourceforge/plantuml/Splash.java index de1871d23..26cbeb5a8 100644 --- a/src/net/sourceforge/plantuml/Splash.java +++ b/src/net/sourceforge/plantuml/Splash.java @@ -5,12 +5,12 @@ * (C) Copyright 2009-2023, Arnaud Roques * * Project Info: http://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * http://plantuml.com/patreon (only 1$ per month!) * http://plantuml.com/paypal - * + * * This file is part of PlantUML. * * PlantUML is free software; you can redistribute it and/or modify it @@ -51,6 +51,7 @@ import java.awt.image.BufferedImage; import java.net.URL; import java.util.concurrent.atomic.AtomicInteger; +import net.sourceforge.plantuml.log.Logger; import net.sourceforge.plantuml.version.PSystemVersion; public class Splash extends Window implements MouseListener, MouseMotionListener { @@ -139,7 +140,7 @@ public class Splash extends Window implements MouseListener, MouseMotionListener try { Desktop.getDesktop().browse(new URL("https://plantuml.com").toURI()); } catch (Exception e) { - e.printStackTrace(); + Logger.error(e); } return; } diff --git a/src/net/sourceforge/plantuml/TitledDiagram.java b/src/net/sourceforge/plantuml/TitledDiagram.java index 33e8425b3..85c73457d 100644 --- a/src/net/sourceforge/plantuml/TitledDiagram.java +++ b/src/net/sourceforge/plantuml/TitledDiagram.java @@ -5,12 +5,12 @@ * (C) Copyright 2009-2023, Arnaud Roques * * Project Info: http://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * http://plantuml.com/patreon (only 1$ per month!) * http://plantuml.com/paypal - * + * * This file is part of PlantUML. * * PlantUML is free software; you can redistribute it and/or modify it @@ -261,7 +261,7 @@ public abstract class TitledDiagram extends AbstractPSystem implements Diagram, final AnimationDecoder animationDecoder = new AnimationDecoder(animationData); this.animation = Animation.create(animationDecoder.decode()); // } catch (ScriptException e) { -// e.printStackTrace(); +// Logger.error(e); // } } diff --git a/src/net/sourceforge/plantuml/UmlDiagram.java b/src/net/sourceforge/plantuml/UmlDiagram.java index e2a717704..b162c4e31 100644 --- a/src/net/sourceforge/plantuml/UmlDiagram.java +++ b/src/net/sourceforge/plantuml/UmlDiagram.java @@ -5,12 +5,12 @@ * (C) Copyright 2009-2023, Arnaud Roques * * Project Info: http://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * http://plantuml.com/patreon (only 1$ per month!) * http://plantuml.com/paypal - * + * * This file is part of PlantUML. * * PlantUML is free software; you can redistribute it and/or modify it @@ -65,6 +65,7 @@ import net.sourceforge.plantuml.fun.IconLoader; import net.sourceforge.plantuml.graphic.GraphicPosition; import net.sourceforge.plantuml.graphic.GraphicStrings; import net.sourceforge.plantuml.graphic.UDrawable; +import net.sourceforge.plantuml.log.Logger; import net.sourceforge.plantuml.mjpeg.MJPEGGenerator; import net.sourceforge.plantuml.pdf.PdfConverter; import net.sourceforge.plantuml.security.SImageIO; @@ -135,13 +136,13 @@ public abstract class UmlDiagram extends TitledDiagram implements Diagram, Annot this.lastInfo = new Dimension2DDouble(imageData.getWidth(), imageData.getHeight()); return imageData; } catch (NoStyleAvailableException e) { - // e.printStackTrace(); + // Logger.error(e); exportDiagramError(os, e, fileFormatOption, null); } catch (UnparsableGraphvizException e) { - e.printStackTrace(); + Logger.error(e); exportDiagramError(os, e.getCause(), fileFormatOption, e.getGraphvizVersion()); } catch (Throwable e) { - // e.printStackTrace(); + // Logger.error(e); exportDiagramError(os, e, fileFormatOption, null); } return ImageDataSimple.error(); @@ -170,7 +171,7 @@ public abstract class UmlDiagram extends TitledDiagram implements Diagram, Annot im2 = utils.exportFlashcode(flash, Color.BLACK, Color.WHITE); } catch (Throwable e) { Log.error("Issue in flashcode generation " + e); - // e.printStackTrace(); + // Logger.error(e); } if (im2 != null) GraphvizCrash.addDecodeHint(strings); diff --git a/src/net/sourceforge/plantuml/acearth/PSystemXearthFactory.java b/src/net/sourceforge/plantuml/acearth/PSystemXearthFactory.java index 0e3979353..b96e7feee 100644 --- a/src/net/sourceforge/plantuml/acearth/PSystemXearthFactory.java +++ b/src/net/sourceforge/plantuml/acearth/PSystemXearthFactory.java @@ -47,6 +47,7 @@ import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.MyPattern; import net.sourceforge.plantuml.command.regex.Pattern2; import net.sourceforge.plantuml.core.UmlSource; +import net.sourceforge.plantuml.log.Logger; public class PSystemXearthFactory extends PSystemBasicFactory { @@ -100,7 +101,7 @@ public class PSystemXearthFactory extends PSystemBasicFactory { return system; } } catch (Exception e) { - e.printStackTrace(); + Logger.error(e); return null; } return null; diff --git a/src/net/sourceforge/plantuml/ant/CheckZipTask.java b/src/net/sourceforge/plantuml/ant/CheckZipTask.java index f30d2fbc7..d8943a080 100644 --- a/src/net/sourceforge/plantuml/ant/CheckZipTask.java +++ b/src/net/sourceforge/plantuml/ant/CheckZipTask.java @@ -5,12 +5,12 @@ * (C) Copyright 2009-2023, Arnaud Roques * * Project Info: http://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * http://plantuml.com/patreon (only 1$ per month!) * http://plantuml.com/paypal - * + * * This file is part of PlantUML. * * PlantUML is free software; you can redistribute it and/or modify it @@ -44,6 +44,8 @@ import java.util.List; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; +import net.sourceforge.plantuml.log.Logger; + import org.apache.tools.ant.BuildException; import org.apache.tools.ant.Task; import org.apache.tools.ant.types.FileList; @@ -84,7 +86,7 @@ public class CheckZipTask extends Task { manageFileList(fileList); } } catch (IOException e) { - e.printStackTrace(); + Logger.error(e); throw new BuildException(e.toString()); } } diff --git a/src/net/sourceforge/plantuml/ant/PlantUmlTask.java b/src/net/sourceforge/plantuml/ant/PlantUmlTask.java index 1dc486735..14cf1f34d 100644 --- a/src/net/sourceforge/plantuml/ant/PlantUmlTask.java +++ b/src/net/sourceforge/plantuml/ant/PlantUmlTask.java @@ -5,12 +5,12 @@ * (C) Copyright 2009-2023, Arnaud Roques * * Project Info: http://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * http://plantuml.com/patreon (only 1$ per month!) * http://plantuml.com/paypal - * + * * This file is part of PlantUML. * * PlantUML is free software; you can redistribute it and/or modify it @@ -46,6 +46,8 @@ import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; +import net.sourceforge.plantuml.log.Logger; + import org.apache.tools.ant.BuildException; import org.apache.tools.ant.DirectoryScanner; import org.apache.tools.ant.Task; @@ -130,10 +132,10 @@ public class PlantUmlTask extends Task { } this.log("Nb images generated: " + nbFiles.get()); } catch (IOException e) { - e.printStackTrace(); + Logger.error(e); throw new BuildException(e.toString()); } catch (InterruptedException e) { - e.printStackTrace(); + Logger.error(e); throw new BuildException(e.toString()); } diff --git a/src/net/sourceforge/plantuml/api/NumberAnalyzed.java b/src/net/sourceforge/plantuml/api/NumberAnalyzed.java index 00dc6c846..3e35fbd24 100644 --- a/src/net/sourceforge/plantuml/api/NumberAnalyzed.java +++ b/src/net/sourceforge/plantuml/api/NumberAnalyzed.java @@ -3,12 +3,12 @@ * ======================================================================== * * Project Info: http://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * http://plantuml.com/patreon (only 1$ per month!) * http://plantuml.com/paypal - * + * * This file is part of PlantUML. * * PlantUML is free software; you can redistribute it and/or modify it @@ -35,6 +35,8 @@ import java.util.prefs.Preferences; import net.sourceforge.plantuml.Log; import net.sourceforge.plantuml.annotation.HaxeIgnored; +import net.sourceforge.plantuml.log.Logger; + @HaxeIgnored public class NumberAnalyzed implements INumberAnalyzed { @@ -121,7 +123,7 @@ public class NumberAnalyzed implements INumberAnalyzed { Long.parseLong(st.nextToken(), 36), Long.parseLong(st.nextToken(), 36), Long.parseLong( st.nextToken(), 36), Long.parseLong(st.nextToken(), 36)); } catch (Exception e) { - e.printStackTrace(); + Logger.error(e); Log.info("Error reading " + value); return null; } diff --git a/src/net/sourceforge/plantuml/api/NumberAnalyzed2.java b/src/net/sourceforge/plantuml/api/NumberAnalyzed2.java index 3048c9adb..61810caca 100644 --- a/src/net/sourceforge/plantuml/api/NumberAnalyzed2.java +++ b/src/net/sourceforge/plantuml/api/NumberAnalyzed2.java @@ -3,12 +3,12 @@ * ======================================================================== * * Project Info: http://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * http://plantuml.com/patreon (only 1$ per month!) * http://plantuml.com/paypal - * + * * This file is part of PlantUML. * * PlantUML is free software; you can redistribute it and/or modify it @@ -34,6 +34,7 @@ import java.util.prefs.Preferences; import net.sourceforge.plantuml.Log; import net.sourceforge.plantuml.annotation.HaxeIgnored; +import net.sourceforge.plantuml.log.Logger; @HaxeIgnored public class NumberAnalyzed2 implements INumberAnalyzed { @@ -95,7 +96,7 @@ public class NumberAnalyzed2 implements INumberAnalyzed { Long.parseLong(st.nextToken(), 36), Long.parseLong(st.nextToken(), 36), Long.parseLong( st.nextToken(), 36), Long.parseLong(st.nextToken(), 36)); } catch (Exception e) { - e.printStackTrace(); + Logger.error(e); Log.info("Error reading " + value); return null; } diff --git a/src/net/sourceforge/plantuml/api/NumberAnalyzedDated.java b/src/net/sourceforge/plantuml/api/NumberAnalyzedDated.java index 19bc3aaf3..3cfb2062c 100644 --- a/src/net/sourceforge/plantuml/api/NumberAnalyzedDated.java +++ b/src/net/sourceforge/plantuml/api/NumberAnalyzedDated.java @@ -3,12 +3,12 @@ * ======================================================================== * * Project Info: http://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * http://plantuml.com/patreon (only 1$ per month!) * http://plantuml.com/paypal - * + * * This file is part of PlantUML. * * PlantUML is free software; you can redistribute it and/or modify it @@ -34,6 +34,7 @@ import java.util.prefs.Preferences; import net.sourceforge.plantuml.Log; import net.sourceforge.plantuml.annotation.HaxeIgnored; +import net.sourceforge.plantuml.log.Logger; @HaxeIgnored public class NumberAnalyzedDated extends NumberAnalyzed { @@ -104,7 +105,7 @@ public class NumberAnalyzedDated extends NumberAnalyzed { Long.parseLong(st.nextToken(), 36), Long.parseLong(st.nextToken(), 36), Long.parseLong( st.nextToken(), 36), st.nextToken()); } catch (Exception e) { - e.printStackTrace(); + Logger.error(e); Log.info("Error reading " + value); return null; } diff --git a/src/net/sourceforge/plantuml/api/TimeoutExecutor.java b/src/net/sourceforge/plantuml/api/TimeoutExecutor.java index 8be93fa57..a24a9f95b 100644 --- a/src/net/sourceforge/plantuml/api/TimeoutExecutor.java +++ b/src/net/sourceforge/plantuml/api/TimeoutExecutor.java @@ -5,12 +5,12 @@ * (C) Copyright 2009-2023, Arnaud Roques * * Project Info: http://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * http://plantuml.com/patreon (only 1$ per month!) * http://plantuml.com/paypal - * + * * This file is part of PlantUML. * * PlantUML is free software; you can redistribute it and/or modify it @@ -35,6 +35,8 @@ */ package net.sourceforge.plantuml.api; +import net.sourceforge.plantuml.log.Logger; + import java.util.concurrent.atomic.AtomicBoolean; public final class TimeoutExecutor { @@ -53,7 +55,7 @@ public final class TimeoutExecutor { mainThread.join(ms); } catch (InterruptedException e) { System.err.println("TimeoutExecutorA " + e); - e.printStackTrace(); + Logger.error(e); return false; } finally { done = mainThread.done.get(); @@ -80,7 +82,7 @@ public final class TimeoutExecutor { done.set(true); } catch (InterruptedException e) { System.err.println("TimeoutExecutorB " + e); - e.printStackTrace(); + Logger.error(e); } } diff --git a/src/net/sourceforge/plantuml/argon2/blake2/Blake2b.java b/src/net/sourceforge/plantuml/argon2/blake2/Blake2b.java index 05c4bc64a..8112dfc62 100644 --- a/src/net/sourceforge/plantuml/argon2/blake2/Blake2b.java +++ b/src/net/sourceforge/plantuml/argon2/blake2/Blake2b.java @@ -26,6 +26,7 @@ package net.sourceforge.plantuml.argon2.blake2; +import net.sourceforge.plantuml.log.Logger; import static net.sourceforge.plantuml.argon2.blake2.Blake2b.Engine.Assert.*; import static net.sourceforge.plantuml.argon2.blake2.Blake2b.Engine.LittleEndian.*; @@ -896,7 +897,7 @@ public interface Blake2b { public final static String exclusiveLowerBound = "'%s' %d is <= %d"; public final static String inclusiveLowerBound = "'%s' %d is < %d"; static String assertFail(final String name, final T v, final String err, final T spec) { - new Exception().printStackTrace(); + Logger.error(new Exception()); return String.format(err, name, v, spec); } } diff --git a/src/net/sourceforge/plantuml/code/CompressionBrotli.java b/src/net/sourceforge/plantuml/code/CompressionBrotli.java index 12eff3780..57a1a2bd8 100644 --- a/src/net/sourceforge/plantuml/code/CompressionBrotli.java +++ b/src/net/sourceforge/plantuml/code/CompressionBrotli.java @@ -5,12 +5,12 @@ * (C) Copyright 2009-2023, Arnaud Roques * * Project Info: http://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * http://plantuml.com/patreon (only 1$ per month!) * http://plantuml.com/paypal - * + * * This file is part of PlantUML. * * PlantUML is free software; you can redistribute it and/or modify it @@ -41,6 +41,7 @@ import java.io.IOException; import net.sourceforge.plantuml.FileUtils; import net.sourceforge.plantuml.brotli.BrotliInputStream; +import net.sourceforge.plantuml.log.Logger; public class CompressionBrotli implements Compression { @@ -56,7 +57,7 @@ public class CompressionBrotli implements Compression { FileUtils.copyToStream(brotli, result); return ByteArray.from(result.toByteArray()); } catch (IOException e) { - e.printStackTrace(); + Logger.error(e); throw new NoPlantumlCompressionException(e); } } diff --git a/src/net/sourceforge/plantuml/code/CompressionZlibAttic.java b/src/net/sourceforge/plantuml/code/CompressionZlibAttic.java index be572fa40..1095dee16 100644 --- a/src/net/sourceforge/plantuml/code/CompressionZlibAttic.java +++ b/src/net/sourceforge/plantuml/code/CompressionZlibAttic.java @@ -5,12 +5,12 @@ * (C) Copyright 2009-2023, Arnaud Roques * * Project Info: http://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * http://plantuml.com/patreon (only 1$ per month!) * http://plantuml.com/paypal - * + * * This file is part of PlantUML. * * PlantUML is free software; you can redistribute it and/or modify it @@ -91,7 +91,7 @@ public class CompressionZlibAttic implements Compression { return ByteArray.from(result); } catch (IOException e) { - // e.printStackTrace(); + // Logger.error(e); throw new NoPlantumlCompressionException(e); } @@ -115,7 +115,7 @@ public class CompressionZlibAttic implements Compression { final byte[] result = copyArray(tmp, resultLength); return result; } catch (DataFormatException e) { - // e.printStackTrace(); + // Logger.error(e); throw new IOException(e.toString()); } } diff --git a/src/net/sourceforge/plantuml/code/Upf9Encoder.java b/src/net/sourceforge/plantuml/code/Upf9Encoder.java index 9b41f8e17..e59e00ef8 100644 --- a/src/net/sourceforge/plantuml/code/Upf9Encoder.java +++ b/src/net/sourceforge/plantuml/code/Upf9Encoder.java @@ -5,12 +5,12 @@ * (C) Copyright 2009-2023, Arnaud Roques * * Project Info: http://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * http://plantuml.com/patreon (only 1$ per month!) * http://plantuml.com/paypal - * + * * This file is part of PlantUML. * * PlantUML is free software; you can redistribute it and/or modify it @@ -35,6 +35,8 @@ */ package net.sourceforge.plantuml.code; +import net.sourceforge.plantuml.log.Logger; + import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; @@ -56,7 +58,7 @@ public class Upf9Encoder { if (c == Upf9Decoder.decodeChar(new ByteArrayInputStream(result))) return true; } catch (IOException e) { - e.printStackTrace(); + Logger.error(e); } return false; } diff --git a/src/net/sourceforge/plantuml/command/CommandSkinParam.java b/src/net/sourceforge/plantuml/command/CommandSkinParam.java index e22667172..ebd8c0ebf 100644 --- a/src/net/sourceforge/plantuml/command/CommandSkinParam.java +++ b/src/net/sourceforge/plantuml/command/CommandSkinParam.java @@ -5,12 +5,12 @@ * (C) Copyright 2009-2023, Arnaud Roques * * Project Info: http://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * http://plantuml.com/patreon (only 1$ per month!) * http://plantuml.com/paypal - * + * * This file is part of PlantUML. * * PlantUML is free software; you can redistribute it and/or modify it @@ -30,7 +30,7 @@ * * * Original Author: Arnaud Roques - * + * * */ package net.sourceforge.plantuml.command; @@ -64,7 +64,7 @@ public class CommandSkinParam extends SingleLineCommand2 { diagram.setParam(arg.get("NAME", 0), arg.get("VALUE", 0)); return CommandExecutionResult.ok(); } catch (NoStyleAvailableException e) { - // e.printStackTrace(); + // Logger.error(e); return CommandExecutionResult.error("General failure: no style available."); } diff --git a/src/net/sourceforge/plantuml/command/ProtectedCommand.java b/src/net/sourceforge/plantuml/command/ProtectedCommand.java index d1295039e..85cad91fc 100644 --- a/src/net/sourceforge/plantuml/command/ProtectedCommand.java +++ b/src/net/sourceforge/plantuml/command/ProtectedCommand.java @@ -5,12 +5,12 @@ * (C) Copyright 2009-2023, Arnaud Roques * * Project Info: http://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * http://plantuml.com/patreon (only 1$ per month!) * http://plantuml.com/paypal - * + * * This file is part of PlantUML. * * PlantUML is free software; you can redistribute it and/or modify it @@ -30,7 +30,7 @@ * * * Original Author: Arnaud Roques - * + * * */ package net.sourceforge.plantuml.command; @@ -39,6 +39,7 @@ import java.util.Objects; import net.sourceforge.plantuml.Log; import net.sourceforge.plantuml.core.Diagram; +import net.sourceforge.plantuml.log.Logger; import net.sourceforge.plantuml.version.Version; public class ProtectedCommand implements Command { @@ -58,12 +59,11 @@ public class ProtectedCommand implements Command { // } return result; } catch (Throwable t) { - Log.error("Error " + t); - t.printStackTrace(); + Logger.error("Error ", t); String msg = "You should send a mail to plantuml@gmail.com or post to http://plantuml.com/qa with this log (V" + Version.versionString() + ")"; - Log.error(msg); - msg += " " + t.toString(); + Logger.error(msg); + msg += " " + t; return CommandExecutionResult.error(msg, t); } } diff --git a/src/net/sourceforge/plantuml/command/SkinLoader.java b/src/net/sourceforge/plantuml/command/SkinLoader.java index cd707806b..7905f6735 100644 --- a/src/net/sourceforge/plantuml/command/SkinLoader.java +++ b/src/net/sourceforge/plantuml/command/SkinLoader.java @@ -5,12 +5,12 @@ * (C) Copyright 2009-2023, Arnaud Roques * * Project Info: http://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * http://plantuml.com/patreon (only 1$ per month!) * http://plantuml.com/paypal - * + * * This file is part of PlantUML. * * PlantUML is free software; you can redistribute it and/or modify it @@ -30,7 +30,7 @@ * * * Original Author: Arnaud Roques - * + * * */ package net.sourceforge.plantuml.command; @@ -106,7 +106,7 @@ public class SkinLoader { } return CommandExecutionResult.ok(); } catch (NoStyleAvailableException e) { - // e.printStackTrace(); + // Logger.error(e); return CommandExecutionResult.error("General failure: no style available."); } diff --git a/src/net/sourceforge/plantuml/creole/atom/AtomImg.java b/src/net/sourceforge/plantuml/creole/atom/AtomImg.java index b93252a88..ab689df4b 100644 --- a/src/net/sourceforge/plantuml/creole/atom/AtomImg.java +++ b/src/net/sourceforge/plantuml/creole/atom/AtomImg.java @@ -5,12 +5,12 @@ * (C) Copyright 2009-2023, Arnaud Roques * * Project Info: http://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * http://plantuml.com/patreon (only 1$ per month!) * http://plantuml.com/paypal - * + * * This file is part of PlantUML. * * PlantUML is free software; you can redistribute it and/or modify it @@ -30,7 +30,7 @@ * * * Original Author: Arnaud Roques - * + * * */ package net.sourceforge.plantuml.creole.atom; @@ -54,6 +54,7 @@ import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.ImgValign; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TileImageSvg; +import net.sourceforge.plantuml.log.Logger; import net.sourceforge.plantuml.security.SImageIO; import net.sourceforge.plantuml.security.SFile; import net.sourceforge.plantuml.security.SURL; @@ -120,38 +121,38 @@ public class AtomImg extends AbstractAtom implements Atom { try { // Check if valid URL if (src.startsWith("http:") || src.startsWith("https:")) { - if (src.endsWith(".svg")) + if (src.endsWith(".svg")) return buildSvgFromUrl(src, fc, SURL.create(src), scale, url); - + return buildRasterFromUrl(src, fc, SURL.create(src), scale, url); } final SFile f = FileSystem.getInstance().getFile(src); if (f.exists() == false) { - if (SecurityUtils.getSecurityProfile() == SecurityProfile.UNSECURE) + if (SecurityUtils.getSecurityProfile() == SecurityProfile.UNSECURE) return AtomTextUtils.createLegacy("(File not found: " + f.getPrintablePath() + ")", fc); - + return AtomTextUtils.createLegacy("(Cannot decode)", fc); } if (f.getName().endsWith(".svg")) { final String tmp = FileUtils.readSvg(f); - if (tmp == null) + if (tmp == null) return AtomTextUtils.createLegacy("(Cannot decode)", fc); - + return new AtomImgSvg(new TileImageSvg(tmp, scale)); } final BufferedImage read = f.readRasterImageFromFile(); if (read == null) { - if (SecurityUtils.getSecurityProfile() == SecurityProfile.UNSECURE) + if (SecurityUtils.getSecurityProfile() == SecurityProfile.UNSECURE) return AtomTextUtils.createLegacy("(Cannot decode: " + f.getPrintablePath() + ")", fc); - + return AtomTextUtils.createLegacy("(Cannot decode)", fc); } return new AtomImg(f.readRasterImageFromFile(), scale, url, src); } catch (IOException e) { - e.printStackTrace(); - if (SecurityUtils.getSecurityProfile() == SecurityProfile.UNSECURE) + Logger.error(e); + if (SecurityUtils.getSecurityProfile() == SecurityProfile.UNSECURE) return AtomTextUtils.createLegacy("ERROR " + e.toString(), fc); - + return AtomTextUtils.createLegacy("ERROR", fc); } } diff --git a/src/net/sourceforge/plantuml/cucadiagram/GroupPrinter.java b/src/net/sourceforge/plantuml/cucadiagram/GroupPrinter.java index 7f2edaa2a..f6cdda0e9 100644 --- a/src/net/sourceforge/plantuml/cucadiagram/GroupPrinter.java +++ b/src/net/sourceforge/plantuml/cucadiagram/GroupPrinter.java @@ -5,12 +5,12 @@ * (C) Copyright 2009-2023, Arnaud Roques * * Project Info: http://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * http://plantuml.com/patreon (only 1$ per month!) * http://plantuml.com/paypal - * + * * This file is part of PlantUML. * * PlantUML is free software; you can redistribute it and/or modify it @@ -30,7 +30,7 @@ * * * Original Author: Arnaud Roques - * + * * */ package net.sourceforge.plantuml.cucadiagram; @@ -38,6 +38,7 @@ package net.sourceforge.plantuml.cucadiagram; import java.io.IOException; import java.io.PrintWriter; +import net.sourceforge.plantuml.log.Logger; import net.sourceforge.plantuml.security.SFile; public class GroupPrinter { @@ -90,7 +91,7 @@ public class GroupPrinter { new GroupPrinter(pw).printGroup(rootGroup); pw.println(""); } catch (IOException e) { - e.printStackTrace(); + Logger.error(e); } } diff --git a/src/net/sourceforge/plantuml/cucadiagram/dot/AbstractGraphviz.java b/src/net/sourceforge/plantuml/cucadiagram/dot/AbstractGraphviz.java index 65875bc08..e33626825 100644 --- a/src/net/sourceforge/plantuml/cucadiagram/dot/AbstractGraphviz.java +++ b/src/net/sourceforge/plantuml/cucadiagram/dot/AbstractGraphviz.java @@ -5,12 +5,12 @@ * (C) Copyright 2009-2023, Arnaud Roques * * Project Info: http://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * http://plantuml.com/patreon (only 1$ per month!) * http://plantuml.com/paypal - * + * * This file is part of PlantUML. * * PlantUML is free software; you can redistribute it and/or modify it @@ -30,7 +30,7 @@ * * * Original Author: Arnaud Roques - * + * * */ package net.sourceforge.plantuml.cucadiagram.dot; @@ -45,6 +45,7 @@ import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.Log; import net.sourceforge.plantuml.OptionFlags; import net.sourceforge.plantuml.StringUtils; +import net.sourceforge.plantuml.log.Logger; import net.sourceforge.plantuml.security.SFile; abstract class AbstractGraphviz implements Graphviz { @@ -75,7 +76,7 @@ abstract class AbstractGraphviz implements Graphviz { this.dotString = dotString; this.type = Objects.requireNonNull(type); } - + protected boolean findExecutableOnPath() { return true; } @@ -116,7 +117,7 @@ abstract class AbstractGraphviz implements Graphviz { // } Log.info("Ending process ok"); } catch (Throwable e) { - e.printStackTrace(); + Logger.error(e); Log.error("Error: " + e); Log.error("The command was " + cmd); Log.error(""); diff --git a/src/net/sourceforge/plantuml/cucadiagram/dot/DebugTrace.java b/src/net/sourceforge/plantuml/cucadiagram/dot/DebugTrace.java index 9dc468758..7f03fb1e4 100644 --- a/src/net/sourceforge/plantuml/cucadiagram/dot/DebugTrace.java +++ b/src/net/sourceforge/plantuml/cucadiagram/dot/DebugTrace.java @@ -5,12 +5,12 @@ * (C) Copyright 2009-2023, Arnaud Roques * * Project Info: http://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * http://plantuml.com/patreon (only 1$ per month!) * http://plantuml.com/paypal - * + * * This file is part of PlantUML. * * PlantUML is free software; you can redistribute it and/or modify it @@ -30,7 +30,7 @@ * * * Original Author: Arnaud Roques - * + * * */ package net.sourceforge.plantuml.cucadiagram.dot; @@ -51,7 +51,7 @@ public class DebugTrace { try { pw = out.createPrintWriter(); } catch (FileNotFoundException e) { - + // ignore } } return pw; diff --git a/src/net/sourceforge/plantuml/cucadiagram/dot/GraphvizUtils.java b/src/net/sourceforge/plantuml/cucadiagram/dot/GraphvizUtils.java index c320205fa..384d63772 100644 --- a/src/net/sourceforge/plantuml/cucadiagram/dot/GraphvizUtils.java +++ b/src/net/sourceforge/plantuml/cucadiagram/dot/GraphvizUtils.java @@ -5,12 +5,12 @@ * (C) Copyright 2009-2023, Arnaud Roques * * Project Info: http://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * http://plantuml.com/patreon (only 1$ per month!) * http://plantuml.com/paypal - * + * * This file is part of PlantUML. * * PlantUML is free software; you can redistribute it and/or modify it @@ -30,7 +30,7 @@ * * * Original Author: Arnaud Roques - * + * * */ package net.sourceforge.plantuml.cucadiagram.dot; @@ -45,6 +45,7 @@ import java.util.regex.Pattern; import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.Log; import net.sourceforge.plantuml.StringUtils; +import net.sourceforge.plantuml.log.Logger; import net.sourceforge.plantuml.security.SFile; import net.sourceforge.plantuml.security.SecurityProfile; import net.sourceforge.plantuml.security.SecurityUtils; @@ -186,7 +187,7 @@ public class GraphvizUtils { try { return create(null, "png").graphviz244onWindows(); } catch (Exception e) { - e.printStackTrace(); + Logger.error(e); return false; } } @@ -227,8 +228,8 @@ public class GraphvizUtils { result.add(red + err); } catch (Exception e) { - result.add(red + e.toString()); - e.printStackTrace(); + result.add(red + e); + Logger.error(e); error = -1; } return error; @@ -268,8 +269,8 @@ public class GraphvizUtils { } } } catch (Exception e) { - result.add(red + e.toString()); - e.printStackTrace(); + result.add(red + e); + Logger.error(e); error = -5; } } else { diff --git a/src/net/sourceforge/plantuml/cucadiagram/dot/GraphvizWindowsOld.java b/src/net/sourceforge/plantuml/cucadiagram/dot/GraphvizWindowsOld.java index e794f3796..6fed2e3e1 100644 --- a/src/net/sourceforge/plantuml/cucadiagram/dot/GraphvizWindowsOld.java +++ b/src/net/sourceforge/plantuml/cucadiagram/dot/GraphvizWindowsOld.java @@ -5,12 +5,12 @@ * (C) Copyright 2009-2023, Arnaud Roques * * Project Info: http://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * http://plantuml.com/patreon (only 1$ per month!) * http://plantuml.com/paypal - * + * * This file is part of PlantUML. * * PlantUML is free software; you can redistribute it and/or modify it @@ -30,7 +30,7 @@ * * * Original Author: Arnaud Roques - * + * * */ package net.sourceforge.plantuml.cucadiagram.dot; @@ -43,6 +43,7 @@ import java.util.List; import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.StringUtils; +import net.sourceforge.plantuml.log.Logger; import net.sourceforge.plantuml.windowsdot.WindowsDotArchive; class GraphvizWindowsOld extends AbstractGraphviz { @@ -66,7 +67,7 @@ class GraphvizWindowsOld extends AbstractGraphviz { try { return GraphvizUtils.getDotVersion() == 244; } catch (Exception e) { - e.printStackTrace(); + Logger.error(e); return false; } } diff --git a/src/net/sourceforge/plantuml/cucadiagram/dot/ProcessRunner.java b/src/net/sourceforge/plantuml/cucadiagram/dot/ProcessRunner.java index 216cb99b4..50fe8f5b6 100644 --- a/src/net/sourceforge/plantuml/cucadiagram/dot/ProcessRunner.java +++ b/src/net/sourceforge/plantuml/cucadiagram/dot/ProcessRunner.java @@ -5,12 +5,12 @@ * (C) Copyright 2009-2023, Arnaud Roques * * Project Info: http://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * http://plantuml.com/patreon (only 1$ per month!) * http://plantuml.com/paypal - * + * * This file is part of PlantUML. * * PlantUML is free software; you can redistribute it and/or modify it @@ -30,7 +30,7 @@ * * * Original Author: Arnaud Roques - * + * * */ package net.sourceforge.plantuml.cucadiagram.dot; @@ -44,6 +44,7 @@ import java.util.concurrent.locks.ReentrantLock; import net.sourceforge.plantuml.OptionFlags; import net.sourceforge.plantuml.api.MyRunnable; import net.sourceforge.plantuml.api.TimeoutExecutor; +import net.sourceforge.plantuml.log.Logger; import net.sourceforge.plantuml.security.SFile; public class ProcessRunner { @@ -162,14 +163,14 @@ public class ProcessRunner { try { process = Runtime.getRuntime().exec(cmd, null, dir == null ? null : dir.conv()); } catch (IOException e) { - e.printStackTrace(); + Logger.error(e); changeState.lock(); try { state = ProcessState.IO_EXCEPTION1(e); } finally { changeState.unlock(); } - e.printStackTrace(); + Logger.error(e); return; } errorStream = new ThreadStream(process.getErrorStream(), null); @@ -191,7 +192,7 @@ public class ProcessRunner { } finally { changeState.unlock(); } - e.printStackTrace(); + Logger.error(e); } } } @@ -248,9 +249,9 @@ public class ProcessRunner { } } catch (Throwable e) { System.err.println("ProcessRunnerA " + e); - e.printStackTrace(); + Logger.error(e); sb.append('\n'); - sb.append(e.toString()); + sb.append(e); } } } @@ -269,7 +270,7 @@ public class ProcessRunner { is.close(); } } catch (IOException e) { - e.printStackTrace(); + Logger.error(e); } } @@ -279,7 +280,7 @@ public class ProcessRunner { os.close(); } } catch (IOException e) { - e.printStackTrace(); + Logger.error(e); } } diff --git a/src/net/sourceforge/plantuml/dedication/DedicationCrypted.java b/src/net/sourceforge/plantuml/dedication/DedicationCrypted.java index 1ba11a0db..07c2515e4 100644 --- a/src/net/sourceforge/plantuml/dedication/DedicationCrypted.java +++ b/src/net/sourceforge/plantuml/dedication/DedicationCrypted.java @@ -5,12 +5,12 @@ * (C) Copyright 2009-2023, Arnaud Roques * * Project Info: http://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * http://plantuml.com/patreon (only 1$ per month!) * http://plantuml.com/paypal - * + * * This file is part of PlantUML. * * PlantUML is free software; you can redistribute it and/or modify it @@ -30,7 +30,7 @@ * * * Original Author: Arnaud Roques - * + * * */ package net.sourceforge.plantuml.dedication; @@ -41,6 +41,7 @@ import java.awt.image.BufferedImage; import java.io.ByteArrayInputStream; import java.math.BigInteger; +import net.sourceforge.plantuml.log.Logger; import net.sourceforge.plantuml.utils.MTRandom; public class DedicationCrypted implements Dedication { @@ -113,7 +114,7 @@ public class DedicationCrypted implements Dedication { this.solution = line; return img; } catch (Throwable t) { - t.printStackTrace(); + Logger.error(t); return null; } diff --git a/src/net/sourceforge/plantuml/dedication/DedicationSimple.java b/src/net/sourceforge/plantuml/dedication/DedicationSimple.java index e98e82347..016e2642e 100644 --- a/src/net/sourceforge/plantuml/dedication/DedicationSimple.java +++ b/src/net/sourceforge/plantuml/dedication/DedicationSimple.java @@ -5,12 +5,12 @@ * (C) Copyright 2009-2023, Arnaud Roques * * Project Info: http://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * http://plantuml.com/patreon (only 1$ per month!) * http://plantuml.com/paypal - * + * * This file is part of PlantUML. * * PlantUML is free software; you can redistribute it and/or modify it @@ -30,11 +30,13 @@ * * * Original Author: Arnaud Roques - * + * * */ package net.sourceforge.plantuml.dedication; +import net.sourceforge.plantuml.log.Logger; + import java.awt.image.BufferedImage; import java.io.ByteArrayInputStream; @@ -61,7 +63,7 @@ public class DedicationSimple implements Dedication { current = decoded.toByteArray(512); return PSystemDedication.getBufferedImage(new ByteArrayInputStream(current)); } catch (Throwable t) { - t.printStackTrace(); + Logger.error(t); return null; } } diff --git a/src/net/sourceforge/plantuml/dedication/Dedications.java b/src/net/sourceforge/plantuml/dedication/Dedications.java index b05c9f069..f3f9c8121 100644 --- a/src/net/sourceforge/plantuml/dedication/Dedications.java +++ b/src/net/sourceforge/plantuml/dedication/Dedications.java @@ -5,12 +5,12 @@ * (C) Copyright 2009-2023, Arnaud Roques * * Project Info: http://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * http://plantuml.com/patreon (only 1$ per month!) * http://plantuml.com/paypal - * + * * This file is part of PlantUML. * * PlantUML is free software; you can redistribute it and/or modify it @@ -30,7 +30,7 @@ * * * Original Author: Arnaud Roques - * + * * */ package net.sourceforge.plantuml.dedication; @@ -44,6 +44,7 @@ import java.util.ArrayList; import java.util.List; import net.sourceforge.plantuml.FileUtils; +import net.sourceforge.plantuml.log.Logger; public class Dedications { @@ -64,7 +65,7 @@ public class Dedications { all.add(secret(1, "ae8a7cf3997ccd6418866fc59e596502e1bd1c0265bba2fc380ad7f51c76518f", new BigInteger( "987988542836850639056829173787067531749177506648884857100630852970876999799588072360773169026225182488073794585127241896588994816566037813451743416913613428321215803586563629080034406083114565732322220091545330060636171674602040157"))); } catch (Throwable t) { - t.printStackTrace(); + Logger.error(t); } } diff --git a/src/net/sourceforge/plantuml/dedication/PSystemDedication.java b/src/net/sourceforge/plantuml/dedication/PSystemDedication.java index 2a972cb6d..3bb56b3e0 100644 --- a/src/net/sourceforge/plantuml/dedication/PSystemDedication.java +++ b/src/net/sourceforge/plantuml/dedication/PSystemDedication.java @@ -47,6 +47,7 @@ import net.sourceforge.plantuml.PlainDiagram; import net.sourceforge.plantuml.core.DiagramDescription; import net.sourceforge.plantuml.core.UmlSource; import net.sourceforge.plantuml.graphic.UDrawable; +import net.sourceforge.plantuml.log.Logger; import net.sourceforge.plantuml.security.SImageIO; import net.sourceforge.plantuml.ugraphic.AffineTransformType; import net.sourceforge.plantuml.ugraphic.PixelImage; @@ -87,7 +88,7 @@ public class PSystemDedication extends PlainDiagram { // final VP8Frame frame = vp8Decoder.getFrame(); // return frame.getBufferedImage(); } catch (Exception e) { - e.printStackTrace(); + Logger.error(e); return null; } } diff --git a/src/net/sourceforge/plantuml/ditaa/PSystemDitaa.java b/src/net/sourceforge/plantuml/ditaa/PSystemDitaa.java index 3488df52a..4316a7599 100644 --- a/src/net/sourceforge/plantuml/ditaa/PSystemDitaa.java +++ b/src/net/sourceforge/plantuml/ditaa/PSystemDitaa.java @@ -5,12 +5,12 @@ * (C) Copyright 2009-2023, Arnaud Roques * * Project Info: http://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * http://plantuml.com/patreon (only 1$ per month!) * http://plantuml.com/paypal - * + * * This file is part of PlantUML. * * PlantUML is free software; you can redistribute it and/or modify it @@ -53,6 +53,7 @@ import net.sourceforge.plantuml.api.ImageDataSimple; import net.sourceforge.plantuml.core.DiagramDescription; import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.core.UmlSource; +import net.sourceforge.plantuml.log.Logger; import net.sourceforge.plantuml.security.SImageIO; import net.sourceforge.plantuml.svek.GraphvizCrash; @@ -85,7 +86,7 @@ public class PSystemDitaa extends AbstractPSystem { this.processingOptions.getClass().getMethod("setAllCornersAreRound", boolean.class) .invoke(this.processingOptions, allCornersAreRound); } catch (Exception e) { - e.printStackTrace(); + Logger.error(e); this.processingOptions = null; } this.transparentBackground = transparentBackground; diff --git a/src/net/sourceforge/plantuml/donors/PSystemDonors.java b/src/net/sourceforge/plantuml/donors/PSystemDonors.java index ff5c76b46..d1a20b905 100644 --- a/src/net/sourceforge/plantuml/donors/PSystemDonors.java +++ b/src/net/sourceforge/plantuml/donors/PSystemDonors.java @@ -5,12 +5,12 @@ * (C) Copyright 2009-2023, Arnaud Roques * * Project Info: http://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * http://plantuml.com/patreon (only 1$ per month!) * http://plantuml.com/paypal - * + * * This file is part of PlantUML. * * PlantUML is free software; you can redistribute it and/or modify it @@ -30,7 +30,7 @@ * * * Original Author: Arnaud Roques - * + * * */ package net.sourceforge.plantuml.donors; @@ -57,6 +57,7 @@ import net.sourceforge.plantuml.graphic.GraphicStrings; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.UDrawable; +import net.sourceforge.plantuml.log.Logger; import net.sourceforge.plantuml.svek.TextBlockBackcolored; import net.sourceforge.plantuml.ugraphic.AffineTransformType; import net.sourceforge.plantuml.ugraphic.PixelImage; @@ -97,7 +98,7 @@ public class PSystemDonors extends PlainDiagram { /* * Special thanks to our sponsors and donors: - * + * * - Noam Tamim */ @@ -153,7 +154,7 @@ public class PSystemDonors extends PlainDiagram { lines.add(st.nextToken()); } } catch (NoPlantumlCompressionException e) { - e.printStackTrace(); + Logger.error(e); } return lines; } diff --git a/src/net/sourceforge/plantuml/eggs/PSystemAppleTwoFactory.java b/src/net/sourceforge/plantuml/eggs/PSystemAppleTwoFactory.java index 9b7aa71ad..8f9a872d4 100644 --- a/src/net/sourceforge/plantuml/eggs/PSystemAppleTwoFactory.java +++ b/src/net/sourceforge/plantuml/eggs/PSystemAppleTwoFactory.java @@ -5,12 +5,12 @@ * (C) Copyright 2009-2023, Arnaud Roques * * Project Info: http://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * http://plantuml.com/patreon (only 1$ per month!) * http://plantuml.com/paypal - * + * * This file is part of PlantUML. * * PlantUML is free software; you can redistribute it and/or modify it @@ -30,7 +30,7 @@ * * * Original Author: Arnaud Roques - * + * * */ package net.sourceforge.plantuml.eggs; @@ -41,6 +41,7 @@ import net.sourceforge.plantuml.AbstractPSystem; import net.sourceforge.plantuml.Log; import net.sourceforge.plantuml.command.PSystemSingleLineFactory; import net.sourceforge.plantuml.core.UmlSource; +import net.sourceforge.plantuml.log.Logger; public class PSystemAppleTwoFactory extends PSystemSingleLineFactory { @@ -53,7 +54,7 @@ public class PSystemAppleTwoFactory extends PSystemSingleLineFactory { return new PSystemAppleTwo(source); } catch (IOException e) { Log.error("Error " + e); - e.printStackTrace(); + Logger.error(e); } } return null; diff --git a/src/net/sourceforge/plantuml/eggs/PSystemRIPFactory.java b/src/net/sourceforge/plantuml/eggs/PSystemRIPFactory.java index 6c2a27458..50efda9a6 100644 --- a/src/net/sourceforge/plantuml/eggs/PSystemRIPFactory.java +++ b/src/net/sourceforge/plantuml/eggs/PSystemRIPFactory.java @@ -5,12 +5,12 @@ * (C) Copyright 2009-2023, Arnaud Roques * * Project Info: http://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * http://plantuml.com/patreon (only 1$ per month!) * http://plantuml.com/paypal - * + * * This file is part of PlantUML. * * PlantUML is free software; you can redistribute it and/or modify it @@ -30,7 +30,7 @@ * * * Original Author: Arnaud Roques - * + * * */ package net.sourceforge.plantuml.eggs; @@ -41,6 +41,7 @@ import net.sourceforge.plantuml.AbstractPSystem; import net.sourceforge.plantuml.Log; import net.sourceforge.plantuml.command.PSystemSingleLineFactory; import net.sourceforge.plantuml.core.UmlSource; +import net.sourceforge.plantuml.log.Logger; public class PSystemRIPFactory extends PSystemSingleLineFactory { @@ -51,7 +52,7 @@ public class PSystemRIPFactory extends PSystemSingleLineFactory { return new PSystemRIP(source); } catch (IOException e) { Log.error("Error " + e); - e.printStackTrace(); + Logger.error(e); } } return null; diff --git a/src/net/sourceforge/plantuml/elk/CucaDiagramFileMakerElk.java b/src/net/sourceforge/plantuml/elk/CucaDiagramFileMakerElk.java index 0b9f80c6d..ee959c89b 100644 --- a/src/net/sourceforge/plantuml/elk/CucaDiagramFileMakerElk.java +++ b/src/net/sourceforge/plantuml/elk/CucaDiagramFileMakerElk.java @@ -5,12 +5,12 @@ * (C) Copyright 2009-2023, Arnaud Roques * * Project Info: http://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * http://plantuml.com/patreon (only 1$ per month!) * http://plantuml.com/paypal - * + * * This file is part of PlantUML. * * PlantUML is free software; you can redistribute it and/or modify it @@ -30,7 +30,7 @@ * * * Original Author: Arnaud Roques - * + * * */ package net.sourceforge.plantuml.elk; @@ -67,13 +67,13 @@ import net.sourceforge.plantuml.cucadiagram.entity.EntityFactory; /* * You can choose between real "org.eclipse.elk..." classes or proxied "net.sourceforge.plantuml.elk.proxy..." - * + * * Using proxied classes allows to compile PlantUML without having ELK available on the classpath. * Since GraphViz is the default layout engine up to now, we do not want to enforce the use of ELK just for compilation. * (for people not using maven) - * + * * If you are debugging, you should probably switch to "org.eclipse.elk..." classes - * + * */ /* @@ -111,6 +111,7 @@ import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.graphic.USymbolFolder; +import net.sourceforge.plantuml.log.Logger; import net.sourceforge.plantuml.style.PName; import net.sourceforge.plantuml.style.SName; import net.sourceforge.plantuml.style.Style; @@ -134,7 +135,7 @@ import net.sourceforge.plantuml.ugraphic.color.HColorUtils; /* * Some notes: - * + * https://www.eclipse.org/elk/documentation/tooldevelopers/graphdatastructure.html https://www.eclipse.org/elk/documentation/tooldevelopers/graphdatastructure/coordinatesystem.html @@ -521,7 +522,7 @@ public class CucaDiagramFileMakerElk implements CucaDiagramFileMaker { } static private List getFailureText3(Throwable exception) { - exception.printStackTrace(); + Logger.error(exception); final List strings = new ArrayList<>(); strings.add("An error has occured : " + exception); final String quote = StringUtils.rot(QuoteUtils.getSomeQuote()); diff --git a/src/net/sourceforge/plantuml/elk/proxy/Reflect.java b/src/net/sourceforge/plantuml/elk/proxy/Reflect.java index ac066b60f..dac8108c6 100644 --- a/src/net/sourceforge/plantuml/elk/proxy/Reflect.java +++ b/src/net/sourceforge/plantuml/elk/proxy/Reflect.java @@ -5,12 +5,12 @@ * (C) Copyright 2009-2023, Arnaud Roques * * Project Info: http://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * http://plantuml.com/patreon (only 1$ per month!) * http://plantuml.com/paypal - * + * * This file is part of PlantUML. * * PlantUML is free software; you can redistribute it and/or modify it @@ -35,6 +35,8 @@ */ package net.sourceforge.plantuml.elk.proxy; +import net.sourceforge.plantuml.log.Logger; + import java.lang.reflect.Constructor; import java.lang.reflect.Field; import java.lang.reflect.Method; @@ -48,7 +50,7 @@ public class Reflect { try { return Class.forName(className); } catch (Throwable t) { - t.printStackTrace(); + Logger.error(t); throw new IllegalArgumentException(t); } } @@ -63,7 +65,7 @@ public class Reflect { } throw new UnsupportedOperationException(name); } catch (Throwable t) { - t.printStackTrace(); + Logger.error(t); throw new IllegalArgumentException(t); } } @@ -74,7 +76,7 @@ public class Reflect { final Field field = cl.getField(fieldname); return field.get(null); } catch (Throwable t) { - t.printStackTrace(); + Logger.error(t); throw new IllegalArgumentException(t); } } @@ -84,7 +86,7 @@ public class Reflect { final Class cl = Class.forName(className); return cl.newInstance(); } catch (Throwable t) { - t.printStackTrace(); + Logger.error(t); throw new IllegalArgumentException(t); } } @@ -95,7 +97,7 @@ public class Reflect { final Constructor m = cl.getConstructor(arg1.getClass()); return m.newInstance(arg1); } catch (Throwable t) { - t.printStackTrace(); + Logger.error(t); throw new IllegalArgumentException(t); } } @@ -106,7 +108,7 @@ public class Reflect { final Constructor m = cl.getConstructor(Double.TYPE, Double.TYPE, Double.TYPE, Double.TYPE); return m.newInstance(arg1, arg2, arg3, arg4); } catch (Throwable t) { - t.printStackTrace(); + Logger.error(t); throw new IllegalArgumentException(t); } } @@ -117,7 +119,7 @@ public class Reflect { final Field f = cl.getField(fieldName); return f.get(null); } catch (Throwable t) { - t.printStackTrace(); + Logger.error(t); throw new IllegalArgumentException(t); } } @@ -128,7 +130,7 @@ public class Reflect { final Method m = cl.getMethod(method); return m.invoke(null); } catch (Throwable t) { - t.printStackTrace(); + Logger.error(t); throw new IllegalArgumentException(t); } } @@ -139,7 +141,7 @@ public class Reflect { final Method m = cl.getMethod(method, arg1.getClass()); return m.invoke(null, arg1); } catch (Throwable t) { - t.printStackTrace(); + Logger.error(t); throw new IllegalArgumentException(t); } } @@ -150,7 +152,7 @@ public class Reflect { final Method m = cl.getMethod(method, arg1.getClass(), arg2.getClass()); return m.invoke(null, arg1, arg2); } catch (Throwable t) { - t.printStackTrace(); + Logger.error(t); throw new IllegalArgumentException(t); } } @@ -161,7 +163,7 @@ public class Reflect { final Method m = getStaticMethod(cl, method, 1); return m.invoke(null, arg1); } catch (Throwable t) { - t.printStackTrace(); + Logger.error(t); throw new IllegalArgumentException(t); } } @@ -172,7 +174,7 @@ public class Reflect { final Method m = getStaticMethod(cl, method, 2); return m.invoke(null, arg1, arg2); } catch (Throwable t) { - t.printStackTrace(); + Logger.error(t); throw new IllegalArgumentException(t); } } @@ -191,7 +193,7 @@ public class Reflect { final Method m = instance.getClass().getMethod(method); return m.invoke(instance); } catch (Throwable t) { - t.printStackTrace(); + Logger.error(t); throw new IllegalArgumentException(t); } } @@ -201,7 +203,7 @@ public class Reflect { final Method m = instance.getClass().getMethod(method, arg1.getClass()); return m.invoke(instance, arg1); } catch (Throwable t) { - t.printStackTrace(); + Logger.error(t); throw new IllegalArgumentException(t); } } @@ -211,7 +213,7 @@ public class Reflect { final Method m = instance.getClass().getMethod(method, arg1.getClass(), arg2.getClass()); return m.invoke(instance, arg1, arg2); } catch (Throwable t) { - t.printStackTrace(); + Logger.error(t); throw new IllegalArgumentException(t); } } @@ -221,7 +223,7 @@ public class Reflect { final Method m = getMethod(instance, method, 2); return m.invoke(instance, arg1, arg2); } catch (Throwable t) { - t.printStackTrace(); + Logger.error(t); throw new IllegalArgumentException(t); } } diff --git a/src/net/sourceforge/plantuml/emoji/Emoji.java b/src/net/sourceforge/plantuml/emoji/Emoji.java index e5da1f837..1533e5efb 100644 --- a/src/net/sourceforge/plantuml/emoji/Emoji.java +++ b/src/net/sourceforge/plantuml/emoji/Emoji.java @@ -12,6 +12,7 @@ import java.util.Map; import java.util.TreeMap; import net.sourceforge.plantuml.emoji.data.Dummy; +import net.sourceforge.plantuml.log.Logger; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.color.HColor; @@ -29,7 +30,7 @@ public class Emoji { new Emoji(s); } } catch (IOException e) { - e.printStackTrace(); + Logger.error(e); } } @@ -87,7 +88,7 @@ public class Emoji { try { loadIfNeed(); } catch (IOException e) { - e.printStackTrace(); + Logger.error(e); } nano.drawU(ug, scale, colorForMonochrome); } diff --git a/src/net/sourceforge/plantuml/emoji/SpriteSvgNanoParser.java b/src/net/sourceforge/plantuml/emoji/SpriteSvgNanoParser.java index 74e39fb1b..b9cb922a8 100644 --- a/src/net/sourceforge/plantuml/emoji/SpriteSvgNanoParser.java +++ b/src/net/sourceforge/plantuml/emoji/SpriteSvgNanoParser.java @@ -5,12 +5,12 @@ * (C) Copyright 2009-2023, Arnaud Roques * * Project Info: http://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * http://plantuml.com/patreon (only 1$ per month!) * http://plantuml.com/paypal - * + * * This file is part of PlantUML. * * PlantUML is free software; you can redistribute it and/or modify it @@ -30,7 +30,7 @@ * * * Original Author: Arnaud Roques - * + * * */ package net.sourceforge.plantuml.emoji; @@ -45,6 +45,7 @@ import net.sourceforge.plantuml.awt.geom.Dimension2D; import net.sourceforge.plantuml.graphic.AbstractTextBlock; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; +import net.sourceforge.plantuml.log.Logger; import net.sourceforge.plantuml.security.SImageIO; import net.sourceforge.plantuml.sprite.Sprite; import net.sourceforge.plantuml.ugraphic.AffineTransformType; @@ -95,7 +96,7 @@ public class SpriteSvgNanoParser implements Sprite { try { return new SpriteSvgNanoParser(SImageIO.read(is)); } catch (IOException e) { - e.printStackTrace(); + Logger.error(e); return null; } diff --git a/src/net/sourceforge/plantuml/ftp/FtpLoop.java b/src/net/sourceforge/plantuml/ftp/FtpLoop.java index 045c38fbc..297e2a228 100644 --- a/src/net/sourceforge/plantuml/ftp/FtpLoop.java +++ b/src/net/sourceforge/plantuml/ftp/FtpLoop.java @@ -5,12 +5,12 @@ * (C) Copyright 2009-2023, Arnaud Roques * * Project Info: http://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * http://plantuml.com/patreon (only 1$ per month!) * http://plantuml.com/paypal - * + * * This file is part of PlantUML. * * PlantUML is free software; you can redistribute it and/or modify it @@ -30,7 +30,7 @@ * * * Original Author: Arnaud Roques - * + * * */ package net.sourceforge.plantuml.ftp; @@ -54,6 +54,7 @@ import java.util.StringTokenizer; import net.sourceforge.plantuml.FileFormat; import net.sourceforge.plantuml.FileUtils; import net.sourceforge.plantuml.StringUtils; +import net.sourceforge.plantuml.log.Logger; import net.sourceforge.plantuml.security.SecurityUtils; class FtpLoop implements Runnable { @@ -327,7 +328,7 @@ class FtpLoop implements Runnable { try { runInternal(); } catch (Throwable t) { - t.printStackTrace(); + Logger.error(t); } } diff --git a/src/net/sourceforge/plantuml/ftp/FtpServer.java b/src/net/sourceforge/plantuml/ftp/FtpServer.java index a3c7cf71e..d7206ad96 100644 --- a/src/net/sourceforge/plantuml/ftp/FtpServer.java +++ b/src/net/sourceforge/plantuml/ftp/FtpServer.java @@ -5,12 +5,12 @@ * (C) Copyright 2009-2023, Arnaud Roques * * Project Info: http://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * http://plantuml.com/patreon (only 1$ per month!) * http://plantuml.com/paypal - * + * * This file is part of PlantUML. * * PlantUML is free software; you can redistribute it and/or modify it @@ -30,7 +30,7 @@ * * * Original Author: Arnaud Roques - * + * * */ package net.sourceforge.plantuml.ftp; @@ -50,6 +50,7 @@ import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import net.sourceforge.plantuml.FileFormat; +import net.sourceforge.plantuml.log.Logger; public class FtpServer { @@ -114,7 +115,7 @@ public class FtpServer { try { connexion.processImage(name); } catch (IOException e) { - e.printStackTrace(); + Logger.error(e); } } }); diff --git a/src/net/sourceforge/plantuml/fun/IconLoader.java b/src/net/sourceforge/plantuml/fun/IconLoader.java index 446c99735..3a332da3e 100644 --- a/src/net/sourceforge/plantuml/fun/IconLoader.java +++ b/src/net/sourceforge/plantuml/fun/IconLoader.java @@ -5,12 +5,12 @@ * (C) Copyright 2009-2023, Arnaud Roques * * Project Info: http://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * http://plantuml.com/patreon (only 1$ per month!) * http://plantuml.com/paypal - * + * * This file is part of PlantUML. * * PlantUML is free software; you can redistribute it and/or modify it @@ -43,6 +43,7 @@ import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; +import net.sourceforge.plantuml.log.Logger; import net.sourceforge.plantuml.security.SImageIO; public class IconLoader { @@ -93,7 +94,7 @@ public class IconLoader { is.close(); return image; } catch (IOException e) { - e.printStackTrace(); + Logger.error(e); } return null; } diff --git a/src/net/sourceforge/plantuml/graphic/Img.java b/src/net/sourceforge/plantuml/graphic/Img.java index 840a19d2d..8e2908710 100644 --- a/src/net/sourceforge/plantuml/graphic/Img.java +++ b/src/net/sourceforge/plantuml/graphic/Img.java @@ -5,12 +5,12 @@ * (C) Copyright 2009-2023, Arnaud Roques * * Project Info: http://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * http://plantuml.com/patreon (only 1$ per month!) * http://plantuml.com/paypal - * + * * This file is part of PlantUML. * * PlantUML is free software; you can redistribute it and/or modify it @@ -30,7 +30,7 @@ * * * Original Author: Arnaud Roques - * + * * */ package net.sourceforge.plantuml.graphic; @@ -44,6 +44,7 @@ import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.MyPattern; import net.sourceforge.plantuml.command.regex.Pattern2; +import net.sourceforge.plantuml.log.Logger; import net.sourceforge.plantuml.security.SFile; import net.sourceforge.plantuml.security.SURL; @@ -123,8 +124,8 @@ public class Img implements HtmlCommand { return new Img(new TileImage(f.readRasterImageFromFile(), valign, vspace)); } catch (IOException e) { - e.printStackTrace(); - return new Text("ERROR " + e.toString()); + Logger.error(e); + return new Text("ERROR " + e); } } diff --git a/src/net/sourceforge/plantuml/graphic/UnusedSpace.java b/src/net/sourceforge/plantuml/graphic/UnusedSpace.java index 2ae8522f5..9f236c2ea 100644 --- a/src/net/sourceforge/plantuml/graphic/UnusedSpace.java +++ b/src/net/sourceforge/plantuml/graphic/UnusedSpace.java @@ -5,12 +5,12 @@ * (C) Copyright 2009-2023, Arnaud Roques * * Project Info: http://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * http://plantuml.com/patreon (only 1$ per month!) * http://plantuml.com/paypal - * + * * This file is part of PlantUML. * * PlantUML is free software; you can redistribute it and/or modify it @@ -30,7 +30,7 @@ * * * Original Author: Arnaud Roques - * + * * */ package net.sourceforge.plantuml.graphic; @@ -139,7 +139,7 @@ public class UnusedSpace { // ImageIO.write(im, "png", SecurityUtils.File("c:/img" + cpt + ".png")); // cpt++; // } catch (IOException e) { - // e.printStackTrace(); + // Logger.error(e); // } } diff --git a/src/net/sourceforge/plantuml/hcl/HclDiagramFactory.java b/src/net/sourceforge/plantuml/hcl/HclDiagramFactory.java index 9afd9b09e..d186e9019 100644 --- a/src/net/sourceforge/plantuml/hcl/HclDiagramFactory.java +++ b/src/net/sourceforge/plantuml/hcl/HclDiagramFactory.java @@ -5,12 +5,12 @@ * (C) Copyright 2009-2023, Arnaud Roques * * Project Info: http://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * http://plantuml.com/patreon (only 1$ per month!) * http://plantuml.com/paypal - * + * * This file is part of PlantUML. * * PlantUML is free software; you can redistribute it and/or modify it @@ -30,7 +30,7 @@ * * * Original Author: Arnaud Roques - * + * * */ package net.sourceforge.plantuml.hcl; @@ -49,6 +49,7 @@ import net.sourceforge.plantuml.core.UmlSource; import net.sourceforge.plantuml.json.JsonValue; import net.sourceforge.plantuml.jsondiagram.JsonDiagram; import net.sourceforge.plantuml.jsondiagram.StyleExtractor; +import net.sourceforge.plantuml.log.Logger; public class HclDiagramFactory extends PSystemAbstractFactory { @@ -76,7 +77,7 @@ public class HclDiagramFactory extends PSystemAbstractFactory { HclParser parser = new HclParser(list); data = parser.parseMe(); } catch (Exception e) { - e.printStackTrace(); + Logger.error(e); } final JsonDiagram result = new JsonDiagram(style, source, UmlDiagramType.HCL, data, highlighted); // if (styleExtractor != null) { diff --git a/src/net/sourceforge/plantuml/help/CommandHelpTheme.java b/src/net/sourceforge/plantuml/help/CommandHelpTheme.java index b9aad1b49..53fae1832 100644 --- a/src/net/sourceforge/plantuml/help/CommandHelpTheme.java +++ b/src/net/sourceforge/plantuml/help/CommandHelpTheme.java @@ -45,6 +45,7 @@ import net.sourceforge.plantuml.command.regex.IRegex; import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; +import net.sourceforge.plantuml.log.Logger; import net.sourceforge.plantuml.theme.ThemeUtils; public class CommandHelpTheme extends SingleLineCommand2 { @@ -76,7 +77,7 @@ public class CommandHelpTheme extends SingleLineCommand2 { } catch (IOException e) { final String message = "Unexpected error listing themes: " + e.getMessage(); Log.error(message); - e.printStackTrace(); + Logger.error(e); return CommandExecutionResult.error(message); } diff --git a/src/net/sourceforge/plantuml/jcckit/PSystemJcckitFactory.java b/src/net/sourceforge/plantuml/jcckit/PSystemJcckitFactory.java index a05a7eeed..a33016c84 100644 --- a/src/net/sourceforge/plantuml/jcckit/PSystemJcckitFactory.java +++ b/src/net/sourceforge/plantuml/jcckit/PSystemJcckitFactory.java @@ -5,12 +5,12 @@ * (C) Copyright 2009-2023, Arnaud Roques * * Project Info: http://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * http://plantuml.com/patreon (only 1$ per month!) * http://plantuml.com/paypal - * + * * This file is part of PlantUML. * * PlantUML is free software; you can redistribute it and/or modify it @@ -30,7 +30,7 @@ * * * Original Author: Arnaud Roques - * + * * */ package net.sourceforge.plantuml.jcckit; @@ -49,6 +49,7 @@ import net.sourceforge.plantuml.command.regex.MyPattern; import net.sourceforge.plantuml.command.regex.Pattern2; import net.sourceforge.plantuml.core.DiagramType; import net.sourceforge.plantuml.core.UmlSource; +import net.sourceforge.plantuml.log.Logger; public class PSystemJcckitFactory extends PSystemBasicFactory { @@ -99,7 +100,7 @@ public class PSystemJcckitFactory extends PSystemBasicFactory { // p.load(new ByteArrayInputStream(data.toString().getBytes("ISO-8859-1"))); } catch (IOException e) { Log.error("Error " + e); - e.printStackTrace(); + Logger.error(e); return null; } return new PSystemJcckit(source, p, width, height); diff --git a/src/net/sourceforge/plantuml/log/Logger.java b/src/net/sourceforge/plantuml/log/Logger.java new file mode 100644 index 000000000..e1407e7f0 --- /dev/null +++ b/src/net/sourceforge/plantuml/log/Logger.java @@ -0,0 +1,57 @@ +package net.sourceforge.plantuml.log; + +import java.io.PrintWriter; +import java.io.StringWriter; +import java.util.logging.ConsoleHandler; +import java.util.logging.Formatter; +import java.util.logging.Level; +import java.util.logging.LogRecord; + +public class Logger { + + private static final java.util.logging.Logger logger; + + static { + logger = java.util.logging.Logger.getLogger("com.plantuml"); + logger.setUseParentHandlers(false); + ConsoleHandler handler = new ConsoleHandler(); + handler.setFormatter(new Formatter() { + @Override + public synchronized String format(LogRecord lr) { + String throwable = ""; + if (lr.getThrown() != null) { + StringWriter sw = new StringWriter(); + PrintWriter pw = new PrintWriter(sw); + pw.println(); + lr.getThrown().printStackTrace(pw); + pw.close(); + throwable = sw.toString().trim(); + } + String message = lr.getMessage(); + StringBuilder sb = new StringBuilder(); + if (message.trim().length() > 0) { + sb.append(message); + sb.append(System.lineSeparator()); + } + if (throwable.length() > 0) { + sb.append(throwable); + sb.append(System.lineSeparator()); + } + return sb.toString(); + } + }); + logger.addHandler(handler); + } + + public static void error(Throwable thrown) { + logger.log(Level.SEVERE, "", thrown); + } + + public static void error(String msg, Throwable thrown) { + logger.log(Level.SEVERE, msg, thrown); + } + + public static void error(String msg) { + logger.log(Level.SEVERE, msg); + } +} diff --git a/src/net/sourceforge/plantuml/math/ConverterSvg.java b/src/net/sourceforge/plantuml/math/ConverterSvg.java index ba889d012..46862314d 100644 --- a/src/net/sourceforge/plantuml/math/ConverterSvg.java +++ b/src/net/sourceforge/plantuml/math/ConverterSvg.java @@ -5,12 +5,12 @@ * (C) Copyright 2009-2023, Arnaud Roques * * Project Info: http://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * http://plantuml.com/patreon (only 1$ per month!) * http://plantuml.com/paypal - * + * * This file is part of PlantUML. * * PlantUML is free software; you can redistribute it and/or modify it @@ -30,7 +30,7 @@ * * * Original Author: Arnaud Roques - * + * * */ package net.sourceforge.plantuml.math; @@ -47,6 +47,8 @@ import java.lang.reflect.Method; import javax.swing.Icon; +import net.sourceforge.plantuml.log.Logger; + import org.w3c.dom.DOMImplementation; import org.w3c.dom.Document; @@ -73,7 +75,7 @@ public class ConverterSvg { Class.forName("org.scilab.forge.jlatexmath.greek.GreekRegistration").newInstance()); } catch (Exception e) { - e.printStackTrace(); + Logger.error(e); } } diff --git a/src/net/sourceforge/plantuml/math/PSystemLatex.java b/src/net/sourceforge/plantuml/math/PSystemLatex.java index 7dca93198..abcc18da9 100644 --- a/src/net/sourceforge/plantuml/math/PSystemLatex.java +++ b/src/net/sourceforge/plantuml/math/PSystemLatex.java @@ -5,12 +5,12 @@ * (C) Copyright 2009-2023, Arnaud Roques * * Project Info: http://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * http://plantuml.com/patreon (only 1$ per month!) * http://plantuml.com/paypal - * + * * This file is part of PlantUML. * * PlantUML is free software; you can redistribute it and/or modify it @@ -30,7 +30,7 @@ * * * Original Author: Arnaud Roques - * + * * */ package net.sourceforge.plantuml.math; @@ -45,6 +45,7 @@ import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.core.DiagramDescription; import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.core.UmlSource; +import net.sourceforge.plantuml.log.Logger; import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.ugraphic.color.HColorSet; @@ -93,7 +94,7 @@ public class PSystemLatex extends AbstractPSystem { scale = scale1; } } catch (Exception e) { - e.printStackTrace(); + Logger.error(e); } } else if (lineLower.startsWith("dpi ")) { final String value = line.substring("dpi ".length()); @@ -103,7 +104,7 @@ public class PSystemLatex extends AbstractPSystem { scale = dpi1 / 96; } } catch (Exception e) { - e.printStackTrace(); + Logger.error(e); } } else { this.latex = line; diff --git a/src/net/sourceforge/plantuml/math/PSystemMath.java b/src/net/sourceforge/plantuml/math/PSystemMath.java index 32f245cb4..43b7ce6ce 100644 --- a/src/net/sourceforge/plantuml/math/PSystemMath.java +++ b/src/net/sourceforge/plantuml/math/PSystemMath.java @@ -5,12 +5,12 @@ * (C) Copyright 2009-2023, Arnaud Roques * * Project Info: http://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * http://plantuml.com/patreon (only 1$ per month!) * http://plantuml.com/paypal - * + * * This file is part of PlantUML. * * PlantUML is free software; you can redistribute it and/or modify it @@ -30,7 +30,7 @@ * * * Original Author: Arnaud Roques - * + * * */ package net.sourceforge.plantuml.math; @@ -45,6 +45,7 @@ import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.core.DiagramDescription; import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.core.UmlSource; +import net.sourceforge.plantuml.log.Logger; import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.ugraphic.color.HColorSet; @@ -93,7 +94,7 @@ public class PSystemMath extends AbstractPSystem { scale = scale1; } } catch (Exception e) { - e.printStackTrace(); + Logger.error(e); } } else if (lineLower.startsWith("dpi ")) { final String value = line.substring("dpi ".length()); @@ -103,7 +104,7 @@ public class PSystemMath extends AbstractPSystem { scale = dpi1 / 96; } } catch (Exception e) { - e.printStackTrace(); + Logger.error(e); } } else { this.math = line; diff --git a/src/net/sourceforge/plantuml/math/ScientificEquationSafe.java b/src/net/sourceforge/plantuml/math/ScientificEquationSafe.java index 983b0cd39..1387f09fb 100644 --- a/src/net/sourceforge/plantuml/math/ScientificEquationSafe.java +++ b/src/net/sourceforge/plantuml/math/ScientificEquationSafe.java @@ -5,12 +5,12 @@ * (C) Copyright 2009-2023, Arnaud Roques * * Project Info: http://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * http://plantuml.com/patreon (only 1$ per month!) * http://plantuml.com/paypal - * + * * This file is part of PlantUML. * * PlantUML is free software; you can redistribute it and/or modify it @@ -30,7 +30,7 @@ * * * Original Author: Arnaud Roques - * + * * */ package net.sourceforge.plantuml.math; @@ -52,6 +52,7 @@ import net.sourceforge.plantuml.api.ImageDataSimple; import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.eps.EpsGraphics; import net.sourceforge.plantuml.graphic.GraphicStrings; +import net.sourceforge.plantuml.log.Logger; import net.sourceforge.plantuml.security.SImageIO; import net.sourceforge.plantuml.svek.TextBlockBackcolored; import net.sourceforge.plantuml.ugraphic.AffineTransformType; @@ -73,7 +74,7 @@ public class ScientificEquationSafe { try { return new ScientificEquationSafe(formula, new AsciiMath(formula)); } catch (Exception e) { - e.printStackTrace(); + Logger.error(e); Log.info("Error parsing " + formula); return new ScientificEquationSafe(formula, null); } @@ -83,7 +84,7 @@ public class ScientificEquationSafe { try { return new ScientificEquationSafe(formula, new LatexBuilder(formula)); } catch (Exception e) { - e.printStackTrace(); + Logger.error(e); Log.info("Error parsing " + formula); return new ScientificEquationSafe(formula, null); } @@ -129,7 +130,7 @@ public class ScientificEquationSafe { if (equation != null) { System.err.println("Latex=" + equation.getSource()); } - e.printStackTrace(); + Logger.error(e); } private TextBlockBackcolored getRollback() { diff --git a/src/net/sourceforge/plantuml/mindmap/MindMap.java b/src/net/sourceforge/plantuml/mindmap/MindMap.java index c34424213..bd805a0c1 100644 --- a/src/net/sourceforge/plantuml/mindmap/MindMap.java +++ b/src/net/sourceforge/plantuml/mindmap/MindMap.java @@ -5,12 +5,12 @@ * (C) Copyright 2009-2023, Arnaud Roques * * Project Info: http://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * http://plantuml.com/patreon (only 1$ per month!) * http://plantuml.com/paypal - * + * * This file is part of PlantUML. * * PlantUML is free software; you can redistribute it and/or modify it @@ -126,7 +126,7 @@ public class MindMap implements UDrawable { return this.regular.add(skinParam.getCurrentStyleBuilder(), backColor, level, label, shape, stereotype); } catch (NoStyleAvailableException e) { - // e.printStackTrace(); + // Logger.error(e); return CommandExecutionResult.error("General failure: no style available."); } } diff --git a/src/net/sourceforge/plantuml/openiconic/OpenIcon.java b/src/net/sourceforge/plantuml/openiconic/OpenIcon.java index 96726e156..b5c4c40d3 100644 --- a/src/net/sourceforge/plantuml/openiconic/OpenIcon.java +++ b/src/net/sourceforge/plantuml/openiconic/OpenIcon.java @@ -5,12 +5,12 @@ * (C) Copyright 2009-2023, Arnaud Roques * * Project Info: http://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * http://plantuml.com/patreon (only 1$ per month!) * http://plantuml.com/paypal - * + * * This file is part of PlantUML. * * PlantUML is free software; you can redistribute it and/or modify it @@ -30,7 +30,7 @@ * * * Original Author: Arnaud Roques - * + * * */ package net.sourceforge.plantuml.openiconic; @@ -48,6 +48,7 @@ import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.graphic.AbstractTextBlock; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; +import net.sourceforge.plantuml.log.Logger; import net.sourceforge.plantuml.openiconic.data.DummyIcon; import net.sourceforge.plantuml.security.SFile; import net.sourceforge.plantuml.ugraphic.UGraphic; @@ -69,7 +70,7 @@ public class OpenIcon { try { return new OpenIcon(is, name); } catch (IOException e) { - e.printStackTrace(); + Logger.error(e); return null; } } diff --git a/src/net/sourceforge/plantuml/pdf/PdfConverter.java b/src/net/sourceforge/plantuml/pdf/PdfConverter.java index 47bb6aa65..5802fd2dd 100644 --- a/src/net/sourceforge/plantuml/pdf/PdfConverter.java +++ b/src/net/sourceforge/plantuml/pdf/PdfConverter.java @@ -5,12 +5,12 @@ * (C) Copyright 2009-2023, Arnaud Roques * * Project Info: http://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * http://plantuml.com/patreon (only 1$ per month!) * http://plantuml.com/paypal - * + * * This file is part of PlantUML. * * PlantUML is free software; you can redistribute it and/or modify it @@ -35,6 +35,8 @@ */ package net.sourceforge.plantuml.pdf; +import net.sourceforge.plantuml.log.Logger; + import java.io.File; import java.lang.reflect.Method; @@ -72,7 +74,7 @@ public class PdfConverter { final Method execute = clSVGConverter.getMethod("execute"); execute.invoke(converter); } catch (Exception e) { - e.printStackTrace(); + Logger.error(e); throw new UnsupportedOperationException(); } if (pdfFile.exists() == false) { diff --git a/src/net/sourceforge/plantuml/picoweb/PicoWebServer.java b/src/net/sourceforge/plantuml/picoweb/PicoWebServer.java index b23cfd118..13c470ab5 100644 --- a/src/net/sourceforge/plantuml/picoweb/PicoWebServer.java +++ b/src/net/sourceforge/plantuml/picoweb/PicoWebServer.java @@ -5,12 +5,12 @@ * (C) Copyright 2009-2023, Arnaud Roques * * Project Info: http://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * http://plantuml.com/patreon (only 1$ per month!) * http://plantuml.com/paypal - * + * * This file is part of PlantUML. * * PlantUML is free software; you can redistribute it and/or modify it @@ -30,9 +30,9 @@ * * * Original Author: Arnaud Roques - * + * * Highly inspired from https://www.ssaurel.com/blog/create-a-simple-http-web-server-in-java - * + * */ package net.sourceforge.plantuml.picoweb; @@ -69,6 +69,7 @@ import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.error.PSystemError; import net.sourceforge.plantuml.error.PSystemErrorUtils; import net.sourceforge.plantuml.graphic.QuoteUtils; +import net.sourceforge.plantuml.log.Logger; import net.sourceforge.plantuml.security.SFile; import net.sourceforge.plantuml.version.Version; @@ -138,7 +139,7 @@ public class PicoWebServer implements Runnable { try { sendError(e, out); } catch (Throwable e1) { - e.printStackTrace(); + Logger.error(e); } } finally { try { @@ -146,7 +147,7 @@ public class PicoWebServer implements Runnable { out.close(); connect.close(); } catch (Throwable e) { - e.printStackTrace(); + Logger.error(e); } } } diff --git a/src/net/sourceforge/plantuml/picoweb/PicoWebServerTest.java b/src/net/sourceforge/plantuml/picoweb/PicoWebServerTest.java index 991621171..09b8eefb5 100644 --- a/src/net/sourceforge/plantuml/picoweb/PicoWebServerTest.java +++ b/src/net/sourceforge/plantuml/picoweb/PicoWebServerTest.java @@ -2,6 +2,7 @@ package net.sourceforge.plantuml.picoweb; import net.sourceforge.plantuml.json.Json; import net.sourceforge.plantuml.json.JsonObject; +import net.sourceforge.plantuml.log.Logger; import javax.imageio.ImageIO; import javax.imageio.stream.MemoryCacheImageInputStream; @@ -294,7 +295,7 @@ public class PicoWebServerTest { try { PicoWebServer.serverLoop(serverSocket); } catch (IOException e) { - e.printStackTrace(); + Logger.error(e); } } }; diff --git a/src/net/sourceforge/plantuml/preproc/StartDiagramExtractReader.java b/src/net/sourceforge/plantuml/preproc/StartDiagramExtractReader.java index 94ae85f33..bca22893c 100644 --- a/src/net/sourceforge/plantuml/preproc/StartDiagramExtractReader.java +++ b/src/net/sourceforge/plantuml/preproc/StartDiagramExtractReader.java @@ -5,12 +5,12 @@ * (C) Copyright 2009-2023, Arnaud Roques * * Project Info: http://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * http://plantuml.com/patreon (only 1$ per month!) * http://plantuml.com/paypal - * + * * This file is part of PlantUML. * * PlantUML is free software; you can redistribute it and/or modify it @@ -30,7 +30,7 @@ * * * Original Author: Arnaud Roques - * + * * */ package net.sourceforge.plantuml.preproc; @@ -43,6 +43,7 @@ import java.nio.charset.Charset; import net.sourceforge.plantuml.Log; import net.sourceforge.plantuml.StringLocated; +import net.sourceforge.plantuml.log.Logger; import net.sourceforge.plantuml.security.SURL; import net.sourceforge.plantuml.utils.StartUtils; @@ -86,7 +87,7 @@ public class StartDiagramExtractReader implements ReadLine { } } } catch (IOException e) { - e.printStackTrace(); + Logger.error(e); Log.error("Error " + e); } finished = true; diff --git a/src/net/sourceforge/plantuml/preproc/Stdlib.java b/src/net/sourceforge/plantuml/preproc/Stdlib.java index fb50fcbfb..4ad42807e 100644 --- a/src/net/sourceforge/plantuml/preproc/Stdlib.java +++ b/src/net/sourceforge/plantuml/preproc/Stdlib.java @@ -24,6 +24,7 @@ import java.util.regex.Pattern; import net.sourceforge.plantuml.Log; import net.sourceforge.plantuml.brotli.BrotliInputStream; +import net.sourceforge.plantuml.log.Logger; import net.sourceforge.plantuml.security.SFile; public class Stdlib { @@ -53,7 +54,7 @@ public class Stdlib { } return new ByteArrayInputStream(data.getBytes(UTF_8)); } catch (IOException e) { - e.printStackTrace(); + Logger.error(e); return null; } } diff --git a/src/net/sourceforge/plantuml/preproc2/PreprocessorUtils.java b/src/net/sourceforge/plantuml/preproc2/PreprocessorUtils.java index 35c785849..c20aabf3f 100644 --- a/src/net/sourceforge/plantuml/preproc2/PreprocessorUtils.java +++ b/src/net/sourceforge/plantuml/preproc2/PreprocessorUtils.java @@ -5,12 +5,12 @@ * (C) Copyright 2009-2023, Arnaud Roques * * Project Info: http://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * http://plantuml.com/patreon (only 1$ per month!) * http://plantuml.com/paypal - * + * * This file is part of PlantUML. * * PlantUML is free software; you can redistribute it and/or modify it @@ -31,7 +31,7 @@ * * Original Author: Arnaud Roques * Modified by: Nicolas Jouanin - * + * * */ package net.sourceforge.plantuml.preproc2; @@ -48,6 +48,7 @@ import net.sourceforge.plantuml.LineLocation; import net.sourceforge.plantuml.Log; import net.sourceforge.plantuml.StringLocated; import net.sourceforge.plantuml.StringUtils; +import net.sourceforge.plantuml.log.Logger; import net.sourceforge.plantuml.preproc.ReadLine; import net.sourceforge.plantuml.preproc.ReadLineReader; import net.sourceforge.plantuml.preproc.ReadLineSimple; @@ -111,7 +112,7 @@ public class PreprocessorUtils { } return ReadLineReader.create(new InputStreamReader(is), description); } catch (IOException e) { - e.printStackTrace(); + Logger.error(e); return new ReadLineSimple(s, e.toString()); } } @@ -124,7 +125,7 @@ public class PreprocessorUtils { } return getReaderInclude(url, s.getLocation(), charset); } catch (IOException e) { - e.printStackTrace(); + Logger.error(e); throw EaterException.located("Cannot open URL " + e.getMessage()); } diff --git a/src/net/sourceforge/plantuml/project/GanttDiagram.java b/src/net/sourceforge/plantuml/project/GanttDiagram.java index 24b3fcd1b..4fe06ec57 100644 --- a/src/net/sourceforge/plantuml/project/GanttDiagram.java +++ b/src/net/sourceforge/plantuml/project/GanttDiagram.java @@ -5,12 +5,12 @@ * (C) Copyright 2009-2023, Arnaud Roques * * Project Info: http://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * http://plantuml.com/patreon (only 1$ per month!) * http://plantuml.com/paypal - * + * * This file is part of PlantUML. * * PlantUML is free software; you can redistribute it and/or modify it @@ -30,7 +30,7 @@ * * * Original Author: Arnaud Roques - * + * * */ package net.sourceforge.plantuml.project; @@ -66,6 +66,7 @@ import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.InnerStrategy; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.UDrawable; +import net.sourceforge.plantuml.log.Logger; import net.sourceforge.plantuml.project.core.Moment; import net.sourceforge.plantuml.project.core.MomentImpl; import net.sourceforge.plantuml.project.core.PrintScale; @@ -247,7 +248,7 @@ public class GanttDiagram extends TitledDiagram implements ToTaskDraw, WithSprit timeHeader.drawTimeFooter(ug.apply(UTranslate.dy(totalHeightWithoutFooter))); } catch (Throwable t) { - t.printStackTrace(); + Logger.error(t); final UDrawable crash = new GraphvizCrash(getSource().getPlainString(), false, t); crash.drawU(ug); diff --git a/src/net/sourceforge/plantuml/real/PositiveForce.java b/src/net/sourceforge/plantuml/real/PositiveForce.java index 5976b1548..49e9a7c27 100644 --- a/src/net/sourceforge/plantuml/real/PositiveForce.java +++ b/src/net/sourceforge/plantuml/real/PositiveForce.java @@ -5,12 +5,12 @@ * (C) Copyright 2009-2023, Arnaud Roques * * Project Info: http://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * http://plantuml.com/patreon (only 1$ per month!) * http://plantuml.com/paypal - * + * * This file is part of PlantUML. * * PlantUML is free software; you can redistribute it and/or modify it @@ -30,11 +30,13 @@ * * * Original Author: Arnaud Roques - * + * * */ package net.sourceforge.plantuml.real; +import net.sourceforge.plantuml.log.Logger; + class PositiveForce { private final Real fixedPoint; @@ -68,10 +70,11 @@ class PositiveForce { try { fixedPointValue = fixedPoint.getCurrentValue(); } catch (IllegalStateException e) { - System.err.println("Pb with force " + this); - System.err.println("This force has been created here:"); - creationPoint.printStackTrace(); - System.err.println("The fixed point has been created here: " + fixedPoint); + Logger.error("Pb with force " + this); + Logger.error("Pb with force " + this); + Logger.error("This force has been created here:"); + Logger.error(creationPoint); + Logger.error("The fixed point has been created here: " + fixedPoint); fixedPoint.printCreationStackTrace(); throw e; } diff --git a/src/net/sourceforge/plantuml/real/RealMax.java b/src/net/sourceforge/plantuml/real/RealMax.java index d26fa3b4f..7f16f39e7 100644 --- a/src/net/sourceforge/plantuml/real/RealMax.java +++ b/src/net/sourceforge/plantuml/real/RealMax.java @@ -5,12 +5,12 @@ * (C) Copyright 2009-2023, Arnaud Roques * * Project Info: http://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * http://plantuml.com/patreon (only 1$ per month!) * http://plantuml.com/paypal - * + * * This file is part of PlantUML. * * PlantUML is free software; you can redistribute it and/or modify it @@ -30,11 +30,13 @@ * * * Original Author: Arnaud Roques - * + * * */ package net.sourceforge.plantuml.real; +import net.sourceforge.plantuml.log.Logger; + import java.util.ArrayList; import java.util.Collection; import java.util.List; @@ -93,7 +95,7 @@ class RealMax extends AbstractReal implements Real { } public void printCreationStackTrace() { - creationPoint.printStackTrace(); + Logger.error(creationPoint); } } diff --git a/src/net/sourceforge/plantuml/real/RealMoveable.java b/src/net/sourceforge/plantuml/real/RealMoveable.java index 6f0e2d612..acb1a69ae 100644 --- a/src/net/sourceforge/plantuml/real/RealMoveable.java +++ b/src/net/sourceforge/plantuml/real/RealMoveable.java @@ -5,12 +5,12 @@ * (C) Copyright 2009-2023, Arnaud Roques * * Project Info: http://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * http://plantuml.com/patreon (only 1$ per month!) * http://plantuml.com/paypal - * + * * This file is part of PlantUML. * * PlantUML is free software; you can redistribute it and/or modify it @@ -30,11 +30,13 @@ * * * Original Author: Arnaud Roques - * + * * */ package net.sourceforge.plantuml.real; +import net.sourceforge.plantuml.log.Logger; + import java.util.concurrent.atomic.AtomicInteger; abstract class RealMoveable extends AbstractReal implements Real { @@ -54,7 +56,7 @@ abstract class RealMoveable extends AbstractReal implements Real { abstract void move(double delta); final public void printCreationStackTrace() { - creationPoint.printStackTrace(); + Logger.error(creationPoint); } final public Real addFixed(double delta) { diff --git a/src/net/sourceforge/plantuml/salt/PSystemSalt.java b/src/net/sourceforge/plantuml/salt/PSystemSalt.java index 775a87035..fda90abad 100644 --- a/src/net/sourceforge/plantuml/salt/PSystemSalt.java +++ b/src/net/sourceforge/plantuml/salt/PSystemSalt.java @@ -5,12 +5,12 @@ * (C) Copyright 2009-2023, Arnaud Roques * * Project Info: http://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * http://plantuml.com/patreon (only 1$ per month!) * http://plantuml.com/paypal - * + * * This file is part of PlantUML. * * PlantUML is free software; you can redistribute it and/or modify it @@ -30,7 +30,7 @@ * * * Original Author: Arnaud Roques - * + * * */ package net.sourceforge.plantuml.salt; @@ -63,6 +63,7 @@ import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.core.UmlSource; import net.sourceforge.plantuml.graphic.InnerStrategy; import net.sourceforge.plantuml.graphic.StringBounder; +import net.sourceforge.plantuml.log.Logger; import net.sourceforge.plantuml.salt.element.Element; import net.sourceforge.plantuml.salt.factory.AbstractElementFactoryComplex; import net.sourceforge.plantuml.salt.factory.ElementFactory; @@ -120,7 +121,7 @@ public class PSystemSalt extends TitledDiagram implements WithSprite { final Dimension2D size = salt.getPreferredDimension(stringBounder, 0, 0); return createImageBuilder(fileFormatOption).drawable(getTextBlock(salt, size)).write(os); } catch (Exception e) { - e.printStackTrace(); + Logger.error(e); UmlDiagram.exportDiagramError(os, e, fileFormatOption, seed(), getMetadata(), "none", new ArrayList()); return ImageDataSimple.error(); diff --git a/src/net/sourceforge/plantuml/sdot/CucaDiagramFileMakerSmetana.java b/src/net/sourceforge/plantuml/sdot/CucaDiagramFileMakerSmetana.java index 12ad2632b..883db3d5f 100644 --- a/src/net/sourceforge/plantuml/sdot/CucaDiagramFileMakerSmetana.java +++ b/src/net/sourceforge/plantuml/sdot/CucaDiagramFileMakerSmetana.java @@ -5,12 +5,12 @@ * (C) Copyright 2009-2023, Arnaud Roques * * Project Info: http://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * http://plantuml.com/patreon (only 1$ per month!) * http://plantuml.com/paypal - * + * * This file is part of PlantUML. * * PlantUML is free software; you can redistribute it and/or modify it @@ -30,7 +30,7 @@ * * * Original Author: Arnaud Roques - * + * * */ package net.sourceforge.plantuml.sdot; @@ -88,6 +88,7 @@ import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.graphic.USymbol; +import net.sourceforge.plantuml.log.Logger; import net.sourceforge.plantuml.style.SName; import net.sourceforge.plantuml.style.Style; import net.sourceforge.plantuml.svek.Bibliotekon; @@ -598,7 +599,7 @@ public class CucaDiagramFileMakerSmetana implements CucaDiagramFileMaker { } static private List getFailureText3(Throwable exception) { - exception.printStackTrace(); + Logger.error(exception); final List strings = new ArrayList<>(); strings.add("An error has occured : " + exception); final String quote = StringUtils.rot(QuoteUtils.getSomeQuote()); diff --git a/src/net/sourceforge/plantuml/security/SFile.java b/src/net/sourceforge/plantuml/security/SFile.java index f573155e3..1f1bcd2db 100644 --- a/src/net/sourceforge/plantuml/security/SFile.java +++ b/src/net/sourceforge/plantuml/security/SFile.java @@ -5,12 +5,12 @@ * (C) Copyright 2009-2023, Arnaud Roques * * Project Info: http://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * http://plantuml.com/patreon (only 1$ per month!) * http://plantuml.com/paypal - * + * * This file is part of PlantUML. * * PlantUML is free software; you can redistribute it and/or modify it @@ -30,11 +30,13 @@ * * * Original Author: Arnaud Roques - * + * * */ package net.sourceforge.plantuml.security; +import net.sourceforge.plantuml.log.Logger; + import java.awt.image.BufferedImage; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; @@ -219,7 +221,7 @@ public class SFile implements Comparable { try { return internal.getCanonicalPath(); } catch (IOException e) { - e.printStackTrace(); + Logger.error(e); } } return ""; @@ -348,7 +350,7 @@ public class SFile implements Comparable { try { return SecurityUtils.readRasterImage(new ImageIcon(this.getAbsolutePath())); } catch (Exception e) { - e.printStackTrace(); + Logger.error(e); } return null; } @@ -358,7 +360,7 @@ public class SFile implements Comparable { try { return new BufferedReader(new FileReader(internal)); } catch (FileNotFoundException e) { - e.printStackTrace(); + Logger.error(e); } } return null; @@ -373,7 +375,7 @@ public class SFile implements Comparable { try { return new BufferedInputStream(new FileInputStream(internal)); } catch (FileNotFoundException e) { - e.printStackTrace(); + Logger.error(e); } return null; } diff --git a/src/net/sourceforge/plantuml/security/SURL.java b/src/net/sourceforge/plantuml/security/SURL.java index c8533b84d..e9fa566cc 100644 --- a/src/net/sourceforge/plantuml/security/SURL.java +++ b/src/net/sourceforge/plantuml/security/SURL.java @@ -5,12 +5,12 @@ * (C) Copyright 2009-2023, Arnaud Roques * * Project Info: http://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * http://plantuml.com/patreon (only 1$ per month!) * http://plantuml.com/paypal - * + * * This file is part of PlantUML. * * PlantUML is free software; you can redistribute it and/or modify it @@ -30,7 +30,7 @@ * * * Original Author: Arnaud Roques - * + * * */ package net.sourceforge.plantuml.security; @@ -68,6 +68,7 @@ import javax.net.ssl.HttpsURLConnection; import javax.swing.ImageIcon; import net.sourceforge.plantuml.StringUtils; +import net.sourceforge.plantuml.log.Logger; import net.sourceforge.plantuml.security.authentication.SecurityAccessInterceptor; import net.sourceforge.plantuml.security.authentication.SecurityAuthentication; import net.sourceforge.plantuml.security.authentication.SecurityCredentials; @@ -83,11 +84,11 @@ import net.sourceforge.plantuml.security.authentication.SecurityCredentials; * host. *

* Example:
- * + * *

  *     SURL url = SURL.create ("https://jenkins-access@jenkins.mycompany.com/api/json")
  * 
- * + * * The {@code jenkins-access} will checked against the Security context access * token configuration. If a configuration exists for this token name, the token * will be removed from the URL and the credentials will be added to the @@ -142,7 +143,7 @@ public class SURL { *

* The url must be http or https. Return null in case of error or if * url is null - * + * * @param url plain url starting by http:// or https// * @return the secure URL or null */ @@ -154,7 +155,7 @@ public class SURL { try { return create(new URL(url)); } catch (MalformedURLException e) { - e.printStackTrace(); + Logger.error(e); } return null; } @@ -163,7 +164,7 @@ public class SURL { * Create a secure URL from a java.net.URL object. *

* It takes into account credentials. - * + * * @param url * @return the secure URL * @throws MalformedURLException if url is null @@ -399,7 +400,7 @@ public class SURL { /** * Creates a GET request and response handler - * + * * @param url URL to request * @param proxy proxy to apply * @param authentication the authentication to use @@ -443,7 +444,7 @@ public class SURL { * content will be identified as form or JSON data. The charset encoding can be * set by header parameters or will be set to UTF-8. The method to some fancy * logic to simplify it for the user. - * + * * @param url URL to request via POST method * @param proxy proxy to apply * @param authentication the authentication to use @@ -488,7 +489,7 @@ public class SURL { try { return Charset.forName(matcher.group(1)); } catch (Exception e) { - e.printStackTrace(); + Logger.error(e); } return null; @@ -519,7 +520,7 @@ public class SURL { /** * Reads data in a byte[] array. - * + * * @param input input stream * @return byte data * @throws IOException if something went wrong @@ -537,7 +538,7 @@ public class SURL { /** * Sends a request content payload to an endpoint. - * + * * @param connection HTTP connection * @param data data as byte array * @throws IOException if something went wrong @@ -568,7 +569,7 @@ public class SURL { final ImageIcon tmp = new ImageIcon(bytes); return SecurityUtils.readRasterImage(tmp); } catch (Exception e) { - e.printStackTrace(); + Logger.error(e); } return null; } @@ -609,7 +610,7 @@ public class SURL { /** * Set the headers for a URL connection - * + * * @param headers map Keys with values (can be String or list of String) */ private static void applyAdditionalHeaders(URLConnection http, Map headers) { @@ -631,7 +632,7 @@ public class SURL { /** * Removes the userInfo part from the URL, because we want to use the * SecurityCredentials instead. - * + * * @param url URL with UserInfo part * @return url without UserInfo part * @throws MalformedURLException @@ -643,7 +644,7 @@ public class SURL { /** * Removes the userInfo part from the URL, because we want to use the * SecurityCredentials instead. - * + * * @param url URL with UserInfo part * @return url without UserInfo part */ diff --git a/src/net/sourceforge/plantuml/security/SecurityUtils.java b/src/net/sourceforge/plantuml/security/SecurityUtils.java index 3c102b82a..5ed09faa9 100644 --- a/src/net/sourceforge/plantuml/security/SecurityUtils.java +++ b/src/net/sourceforge/plantuml/security/SecurityUtils.java @@ -61,6 +61,7 @@ import net.sourceforge.plantuml.Log; import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.json.Json; import net.sourceforge.plantuml.json.JsonValue; +import net.sourceforge.plantuml.log.Logger; import net.sourceforge.plantuml.security.authentication.SecurityAccessInterceptor; import net.sourceforge.plantuml.security.authentication.SecurityAuthentication; import net.sourceforge.plantuml.security.authentication.SecurityAuthorizeManager; @@ -96,7 +97,7 @@ public class SecurityUtils { * Whitelist of paths from where scripts can load data. */ public static final String ALLOWLIST_LOCAL_PATHS = "plantuml.allowlist.path"; - + /** * Whitelist of urls */ @@ -426,7 +427,7 @@ public class SecurityUtils { try (Reader r = new BufferedReader(new FileReader(jsonFile))) { return Json.parse(r); } catch (IOException e) { - e.printStackTrace(); + Logger.error(e); } } return Json.object(); diff --git a/src/net/sourceforge/plantuml/security/authentication/oauth/AbstractOAuth2AccessAuthorizeManager.java b/src/net/sourceforge/plantuml/security/authentication/oauth/AbstractOAuth2AccessAuthorizeManager.java index 5d76f1348..a5e57c2b6 100644 --- a/src/net/sourceforge/plantuml/security/authentication/oauth/AbstractOAuth2AccessAuthorizeManager.java +++ b/src/net/sourceforge/plantuml/security/authentication/oauth/AbstractOAuth2AccessAuthorizeManager.java @@ -38,6 +38,7 @@ package net.sourceforge.plantuml.security.authentication.oauth; import net.sourceforge.plantuml.json.Json; import net.sourceforge.plantuml.json.JsonObject; import net.sourceforge.plantuml.json.JsonValue; +import net.sourceforge.plantuml.log.Logger; import net.sourceforge.plantuml.security.SURL; import net.sourceforge.plantuml.security.authentication.SecurityAuthentication; import net.sourceforge.plantuml.security.authentication.SecurityAuthorizeManager; @@ -133,7 +134,7 @@ public abstract class AbstractOAuth2AccessAuthorizeManager implements SecurityAu try { return URLEncoder.encode(data, "UTF-8"); } catch (UnsupportedEncodingException e) { - e.printStackTrace(); + Logger.error(e); return data; } } diff --git a/src/net/sourceforge/plantuml/sequencediagram/SequenceDiagram.java b/src/net/sourceforge/plantuml/sequencediagram/SequenceDiagram.java index 10e02d5bd..797c0204f 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/SequenceDiagram.java +++ b/src/net/sourceforge/plantuml/sequencediagram/SequenceDiagram.java @@ -5,12 +5,12 @@ * (C) Copyright 2009-2023, Arnaud Roques * * Project Info: http://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * http://plantuml.com/patreon (only 1$ per month!) * http://plantuml.com/paypal - * + * * This file is part of PlantUML. * * PlantUML is free software; you can redistribute it and/or modify it @@ -64,6 +64,7 @@ import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.EntityPortion; import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.graphic.SymbolContext; +import net.sourceforge.plantuml.log.Logger; import net.sourceforge.plantuml.sequencediagram.graphic.FileMaker; import net.sourceforge.plantuml.sequencediagram.graphic.SequenceDiagramFileMakerPuma2; import net.sourceforge.plantuml.sequencediagram.graphic.SequenceDiagramTxtMaker; @@ -444,7 +445,7 @@ public class SequenceDiagram extends UmlDiagram { // The DEBUG StringBounder is ok just to compute the number of pages here. return getSequenceDiagramPngMaker(1, new FileFormatOption(FileFormat.DEBUG)).getNbPages(); } catch (Throwable t) { - t.printStackTrace(); + Logger.error(t); return 1; } } diff --git a/src/net/sourceforge/plantuml/sprite/RessourcesUtils.java b/src/net/sourceforge/plantuml/sprite/RessourcesUtils.java index 5d7c990c3..b0ae67273 100644 --- a/src/net/sourceforge/plantuml/sprite/RessourcesUtils.java +++ b/src/net/sourceforge/plantuml/sprite/RessourcesUtils.java @@ -5,12 +5,12 @@ * (C) Copyright 2009-2023, Arnaud Roques * * Project Info: http://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * http://plantuml.com/patreon (only 1$ per month!) * http://plantuml.com/paypal - * + * * This file is part of PlantUML. * * PlantUML is free software; you can redistribute it and/or modify it @@ -30,7 +30,7 @@ * * * Original Author: Arnaud Roques - * + * * */ package net.sourceforge.plantuml.sprite; @@ -48,6 +48,7 @@ import java.util.TreeSet; import java.util.jar.JarEntry; import java.util.jar.JarFile; +import net.sourceforge.plantuml.log.Logger; import net.sourceforge.plantuml.security.SFile; import net.sourceforge.plantuml.version.Version; @@ -63,7 +64,7 @@ public class RessourcesUtils { try { return listEntry(new SFile(local.toURI())); } catch (URISyntaxException e) { - e.printStackTrace(); + Logger.error(e); return null; } } diff --git a/src/net/sourceforge/plantuml/sprite/SpriteGrayLevel.java b/src/net/sourceforge/plantuml/sprite/SpriteGrayLevel.java index f2a74c6a4..298f6d3a6 100644 --- a/src/net/sourceforge/plantuml/sprite/SpriteGrayLevel.java +++ b/src/net/sourceforge/plantuml/sprite/SpriteGrayLevel.java @@ -5,12 +5,12 @@ * (C) Copyright 2009-2023, Arnaud Roques * * Project Info: http://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * http://plantuml.com/patreon (only 1$ per month!) * http://plantuml.com/paypal - * + * * This file is part of PlantUML. * * PlantUML is free software; you can redistribute it and/or modify it @@ -30,7 +30,7 @@ * * * Original Author: Arnaud Roques - * + * * */ package net.sourceforge.plantuml.sprite; @@ -50,6 +50,7 @@ import net.sourceforge.plantuml.code.CompressionZopfliZlib; import net.sourceforge.plantuml.code.NoPlantumlCompressionException; import net.sourceforge.plantuml.code.PairInt; import net.sourceforge.plantuml.code.SpiralOnRectangle; +import net.sourceforge.plantuml.log.Logger; import net.sourceforge.plantuml.ugraphic.color.ColorChangerMonochrome; public enum SpriteGrayLevel { @@ -296,7 +297,7 @@ public enum SpriteGrayLevel { } return result; } catch (NoPlantumlCompressionException e) { - e.printStackTrace(); + Logger.error(e); return null; } } diff --git a/src/net/sourceforge/plantuml/sprite/SpriteImage.java b/src/net/sourceforge/plantuml/sprite/SpriteImage.java index 7739ac272..f87aea07c 100644 --- a/src/net/sourceforge/plantuml/sprite/SpriteImage.java +++ b/src/net/sourceforge/plantuml/sprite/SpriteImage.java @@ -5,12 +5,12 @@ * (C) Copyright 2009-2023, Arnaud Roques * * Project Info: http://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * http://plantuml.com/patreon (only 1$ per month!) * http://plantuml.com/paypal - * + * * This file is part of PlantUML. * * PlantUML is free software; you can redistribute it and/or modify it @@ -30,7 +30,7 @@ * * * Original Author: Arnaud Roques - * + * * */ package net.sourceforge.plantuml.sprite; @@ -45,6 +45,7 @@ import net.sourceforge.plantuml.awt.geom.Dimension2D; import net.sourceforge.plantuml.graphic.AbstractTextBlock; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; +import net.sourceforge.plantuml.log.Logger; import net.sourceforge.plantuml.security.SImageIO; import net.sourceforge.plantuml.ugraphic.AffineTransformType; import net.sourceforge.plantuml.ugraphic.PixelImage; @@ -91,7 +92,7 @@ public class SpriteImage implements Sprite { try { return new SpriteImage(SImageIO.read(is)); } catch (IOException e) { - e.printStackTrace(); + Logger.error(e); return null; } diff --git a/src/net/sourceforge/plantuml/sprite/StdlibDiagram.java b/src/net/sourceforge/plantuml/sprite/StdlibDiagram.java index 898cb3680..517695bad 100644 --- a/src/net/sourceforge/plantuml/sprite/StdlibDiagram.java +++ b/src/net/sourceforge/plantuml/sprite/StdlibDiagram.java @@ -5,12 +5,12 @@ * (C) Copyright 2009-2023, Arnaud Roques * * Project Info: http://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * http://plantuml.com/patreon (only 1$ per month!) * http://plantuml.com/paypal - * + * * This file is part of PlantUML. * * PlantUML is free software; you can redistribute it and/or modify it @@ -60,6 +60,7 @@ import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockUtils; +import net.sourceforge.plantuml.log.Logger; import net.sourceforge.plantuml.preproc.Stdlib; import net.sourceforge.plantuml.ugraphic.ImageBuilder; import net.sourceforge.plantuml.ugraphic.UFont; @@ -101,7 +102,7 @@ public class StdlibDiagram extends UmlDiagram { try { drawInternal(ug); } catch (IOException e) { - e.printStackTrace(); + Logger.error(e); } } @@ -133,7 +134,7 @@ public class StdlibDiagram extends UmlDiagram { try { cmd.execute(this, bloc); } catch (NoSuchColorException e) { - e.printStackTrace(); + Logger.error(e); } // System.err.println("nb=" + nb); nb++; diff --git a/src/net/sourceforge/plantuml/stats/FormatCounter.java b/src/net/sourceforge/plantuml/stats/FormatCounter.java index 32b873a1d..caeaedc25 100644 --- a/src/net/sourceforge/plantuml/stats/FormatCounter.java +++ b/src/net/sourceforge/plantuml/stats/FormatCounter.java @@ -5,12 +5,12 @@ * (C) Copyright 2009-2023, Arnaud Roques * * Project Info: http://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * http://plantuml.com/patreon (only 1$ per month!) * http://plantuml.com/paypal - * + * * This file is part of PlantUML. * * PlantUML is free software; you can redistribute it and/or modify it @@ -44,6 +44,7 @@ import java.util.prefs.Preferences; import net.sourceforge.plantuml.FileFormat; import net.sourceforge.plantuml.api.NumberAnalyzed; +import net.sourceforge.plantuml.log.Logger; import net.sourceforge.plantuml.stats.api.StatsColumn; import net.sourceforge.plantuml.stats.api.StatsLine; import net.sourceforge.plantuml.stats.api.StatsTable; @@ -100,7 +101,7 @@ public class FormatCounter { data.put(format, value); } } catch (Exception e) { - e.printStackTrace(); + Logger.error(e); } } } diff --git a/src/net/sourceforge/plantuml/stats/HistoricalData.java b/src/net/sourceforge/plantuml/stats/HistoricalData.java index 0778afa47..a04b1abf3 100644 --- a/src/net/sourceforge/plantuml/stats/HistoricalData.java +++ b/src/net/sourceforge/plantuml/stats/HistoricalData.java @@ -5,12 +5,12 @@ * (C) Copyright 2009-2023, Arnaud Roques * * Project Info: http://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * http://plantuml.com/patreon (only 1$ per month!) * http://plantuml.com/paypal - * + * * This file is part of PlantUML. * * PlantUML is free software; you can redistribute it and/or modify it @@ -42,6 +42,7 @@ import java.util.List; import java.util.prefs.BackingStoreException; import java.util.prefs.Preferences; +import net.sourceforge.plantuml.log.Logger; import net.sourceforge.plantuml.version.Version; public class HistoricalData { @@ -55,7 +56,7 @@ public class HistoricalData { try { historical.addAll(reload()); } catch (BackingStoreException e) { - e.printStackTrace(); + Logger.error(e); } Collections.sort(historical, getIdComparator()); } diff --git a/src/net/sourceforge/plantuml/stats/StatsUtils.java b/src/net/sourceforge/plantuml/stats/StatsUtils.java index 2a3ba4095..e10c5ab7a 100644 --- a/src/net/sourceforge/plantuml/stats/StatsUtils.java +++ b/src/net/sourceforge/plantuml/stats/StatsUtils.java @@ -5,12 +5,12 @@ * (C) Copyright 2009-2023, Arnaud Roques * * Project Info: http://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * http://plantuml.com/patreon (only 1$ per month!) * http://plantuml.com/paypal - * + * * This file is part of PlantUML. * * PlantUML is free software; you can redistribute it and/or modify it @@ -44,7 +44,6 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; import java.util.logging.Filter; import java.util.logging.LogRecord; -import java.util.logging.Logger; import java.util.prefs.BackingStoreException; import java.util.prefs.Preferences; @@ -52,6 +51,7 @@ import javax.xml.parsers.ParserConfigurationException; import javax.xml.transform.TransformerException; import net.sourceforge.plantuml.Log; +import net.sourceforge.plantuml.log.Logger; import net.sourceforge.plantuml.security.SFile; import net.sourceforge.plantuml.security.SecurityUtils; import net.sourceforge.plantuml.stats.api.Stats; @@ -84,7 +84,7 @@ public class StatsUtils { static { try { // Logger.getLogger("java.util.prefs").setLevel(Level.OFF); - Logger.getLogger("java.util.prefs").setFilter(new Filter() { + java.util.logging.Logger.getLogger("java.util.prefs").setFilter(new Filter() { public boolean isLoggable(LogRecord record) { final String message = record.getMessage(); System.err.println("SPECIAL TRACE FOR PLANTUML: " + message); @@ -92,13 +92,13 @@ public class StatsUtils { } }); } catch (Exception e) { - e.printStackTrace(); + Logger.error(e); } if (prefs.getInt("VERSION", 0) != VERSION) { try { prefs.clear(); } catch (BackingStoreException e1) { - e1.printStackTrace(); + Logger.error(e1); } prefs.putInt("VERSION", VERSION); } @@ -154,7 +154,7 @@ public class StatsUtils { htmlOutput(stats); } } catch (Exception e) { - e.printStackTrace(); + Logger.error(e); } } diff --git a/src/net/sourceforge/plantuml/stats/StatsUtilsIncrement.java b/src/net/sourceforge/plantuml/stats/StatsUtilsIncrement.java index b8f9f48dd..35928b43b 100644 --- a/src/net/sourceforge/plantuml/stats/StatsUtilsIncrement.java +++ b/src/net/sourceforge/plantuml/stats/StatsUtilsIncrement.java @@ -5,12 +5,12 @@ * (C) Copyright 2009-2023, Arnaud Roques * * Project Info: http://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * http://plantuml.com/patreon (only 1$ per month!) * http://plantuml.com/paypal - * + * * This file is part of PlantUML. * * PlantUML is free software; you can redistribute it and/or modify it @@ -46,6 +46,7 @@ import net.sourceforge.plantuml.core.Diagram; import net.sourceforge.plantuml.directdot.PSystemDot; import net.sourceforge.plantuml.eggs.PSystemWelcome; import net.sourceforge.plantuml.error.PSystemErrorUtils; +import net.sourceforge.plantuml.log.Logger; import net.sourceforge.plantuml.math.PSystemMath; import net.sourceforge.plantuml.salt.PSystemSalt; import net.sourceforge.plantuml.stats.api.Stats; @@ -174,7 +175,7 @@ public class StatsUtilsIncrement { lockHtml.unlock(); } } catch (Exception e) { - e.printStackTrace(); + Logger.error(e); } } diff --git a/src/net/sourceforge/plantuml/style/CommandStyleMultilinesCSS.java b/src/net/sourceforge/plantuml/style/CommandStyleMultilinesCSS.java index fa3bfebbe..d24228663 100644 --- a/src/net/sourceforge/plantuml/style/CommandStyleMultilinesCSS.java +++ b/src/net/sourceforge/plantuml/style/CommandStyleMultilinesCSS.java @@ -5,12 +5,12 @@ * (C) Copyright 2009-2023, Arnaud Roques * * Project Info: http://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * http://plantuml.com/patreon (only 1$ per month!) * http://plantuml.com/paypal - * + * * This file is part of PlantUML. * * PlantUML is free software; you can redistribute it and/or modify it @@ -72,7 +72,7 @@ public class CommandStyleMultilinesCSS extends CommandMultilines2 ((SkinParam) diagram.getSkinParam()).applyPendingStyleMigration(); return CommandExecutionResult.ok(); } catch (NoStyleAvailableException e) { - // e.printStackTrace(); + // Logger.error(e); return CommandExecutionResult.error("General failure: no style available."); } } diff --git a/src/net/sourceforge/plantuml/svek/CucaDiagramFileMakerSvek.java b/src/net/sourceforge/plantuml/svek/CucaDiagramFileMakerSvek.java index 2f6f251dd..d056ec259 100644 --- a/src/net/sourceforge/plantuml/svek/CucaDiagramFileMakerSvek.java +++ b/src/net/sourceforge/plantuml/svek/CucaDiagramFileMakerSvek.java @@ -5,12 +5,12 @@ * (C) Copyright 2009-2023, Arnaud Roques * * Project Info: http://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * http://plantuml.com/patreon (only 1$ per month!) * http://plantuml.com/paypal - * + * * This file is part of PlantUML. * * PlantUML is free software; you can redistribute it and/or modify it @@ -30,7 +30,7 @@ * * * Original Author: Arnaud Roques - * + * * */ package net.sourceforge.plantuml.svek; @@ -52,6 +52,7 @@ import net.sourceforge.plantuml.cucadiagram.dot.CucaDiagramSimplifierActivity; import net.sourceforge.plantuml.cucadiagram.dot.CucaDiagramSimplifierState; import net.sourceforge.plantuml.cucadiagram.dot.DotData; import net.sourceforge.plantuml.graphic.StringBounder; +import net.sourceforge.plantuml.log.Logger; public final class CucaDiagramFileMakerSvek implements CucaDiagramFileMaker { @@ -66,7 +67,7 @@ public final class CucaDiagramFileMakerSvek implements CucaDiagramFileMaker { try { return createFileInternal(os, dotStrings, fileFormatOption); } catch (InterruptedException e) { - e.printStackTrace(); + Logger.error(e); throw new IOException(e); } } @@ -114,7 +115,7 @@ public final class CucaDiagramFileMakerSvek implements CucaDiagramFileMaker { if (widthwarning != null && widthwarning.matches("\\d+")) { warningOrError = svek2.getWarningOrError(Integer.parseInt(widthwarning)); } - + // Sorry about this hack. There is a side effect in SvekResult::calculateDimension() result.calculateDimension(stringBounder); // Ensure text near the margins is not cut off diff --git a/src/net/sourceforge/plantuml/svek/GeneralImageBuilder.java b/src/net/sourceforge/plantuml/svek/GeneralImageBuilder.java index 9abf2aecb..c14fd7dce 100644 --- a/src/net/sourceforge/plantuml/svek/GeneralImageBuilder.java +++ b/src/net/sourceforge/plantuml/svek/GeneralImageBuilder.java @@ -5,12 +5,12 @@ * (C) Copyright 2009-2023, Arnaud Roques * * Project Info: http://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * http://plantuml.com/patreon (only 1$ per month!) * http://plantuml.com/paypal - * + * * This file is part of PlantUML. * * PlantUML is free software; you can redistribute it and/or modify it @@ -32,7 +32,7 @@ * Original Author: Arnaud Roques * Contribution : Hisashi Miyashita * Contribution : Serge Wenger - * + * * */ package net.sourceforge.plantuml.svek; @@ -98,6 +98,7 @@ import net.sourceforge.plantuml.graphic.USymbol; import net.sourceforge.plantuml.graphic.USymbolHexagon; import net.sourceforge.plantuml.graphic.USymbolInterface; import net.sourceforge.plantuml.graphic.USymbols; +import net.sourceforge.plantuml.log.Logger; import net.sourceforge.plantuml.style.PName; import net.sourceforge.plantuml.style.SName; import net.sourceforge.plantuml.style.Style; @@ -437,7 +438,7 @@ public final class GeneralImageBuilder { } } } catch (IllegalStateException e) { - e.printStackTrace(); + Logger.error(e); } } diff --git a/src/net/sourceforge/plantuml/svg/SvgGraphics.java b/src/net/sourceforge/plantuml/svg/SvgGraphics.java index 213a624e7..24ad35ae0 100644 --- a/src/net/sourceforge/plantuml/svg/SvgGraphics.java +++ b/src/net/sourceforge/plantuml/svg/SvgGraphics.java @@ -60,6 +60,8 @@ import javax.xml.transform.TransformerException; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; +import net.sourceforge.plantuml.log.Logger; + import org.w3c.dom.CDATASection; import org.w3c.dom.Comment; import org.w3c.dom.Document; @@ -178,7 +180,7 @@ public class SvgGraphics { defs.appendChild(script); } } catch (ParserConfigurationException e) { - e.printStackTrace(); + Logger.error(e); throw new IllegalStateException(e); } } @@ -238,7 +240,7 @@ public class SvgGraphics { final InputStream is = SvgGraphics.class.getResourceAsStream("/svg/" + name); return FileUtils.readText(is); } catch (IOException e) { - e.printStackTrace(); + Logger.error(e); return null; } } @@ -896,7 +898,7 @@ public class SvgGraphics { private final Map images = new HashMap(); - + private void svgImageUnsecure(UImageSvg image, double x, double y) { if (hidden == false) { String svg = manageScale(image); diff --git a/src/net/sourceforge/plantuml/swing/ImageWindow.java b/src/net/sourceforge/plantuml/swing/ImageWindow.java index 0a8217378..d098cfe7d 100644 --- a/src/net/sourceforge/plantuml/swing/ImageWindow.java +++ b/src/net/sourceforge/plantuml/swing/ImageWindow.java @@ -5,9 +5,9 @@ * (C) Copyright 2009-2023, Arnaud Roques * * Project Info: http://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * http://plantuml.com/patreon (only 1$ per month!) * http://plantuml.com/paypal * @@ -71,6 +71,7 @@ import javax.swing.WindowConstants; import net.sourceforge.plantuml.GeneratedImage; import net.sourceforge.plantuml.ImageSelection; import net.sourceforge.plantuml.graphic.GraphicStrings; +import net.sourceforge.plantuml.log.Logger; import net.sourceforge.plantuml.security.SImageIO; import net.sourceforge.plantuml.security.SFile; import net.sourceforge.plantuml.svek.TextBlockBackcolored; @@ -337,7 +338,7 @@ class ImageWindow extends JFrame { final byte[] bytes = plainPngBuilder(error).writeByteArray(); image = SImageIO.read(bytes); } catch (IOException e) { - e.printStackTrace(); + Logger.error(e); } } final ImageIcon imageIcon = new ImageIcon(image, simpleLine.toString()); @@ -393,7 +394,7 @@ class ImageWindow extends JFrame { final ImageSelection imgSel = new ImageSelection(image); Toolkit.getDefaultToolkit().getSystemClipboard().setContents(imgSel, null); } catch (IOException e) { - e.printStackTrace(); + Logger.error(e); } } diff --git a/src/net/sourceforge/plantuml/swing/MainWindow.java b/src/net/sourceforge/plantuml/swing/MainWindow.java index 6b4f87a18..3dfcb1baf 100644 --- a/src/net/sourceforge/plantuml/swing/MainWindow.java +++ b/src/net/sourceforge/plantuml/swing/MainWindow.java @@ -5,12 +5,12 @@ * (C) Copyright 2009-2023, Arnaud Roques * * Project Info: http://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * http://plantuml.com/patreon (only 1$ per month!) * http://plantuml.com/paypal - * + * * This file is part of PlantUML. * * PlantUML is free software; you can redistribute it and/or modify it @@ -30,7 +30,7 @@ * * * Original Author: Arnaud Roques - * + * * */ package net.sourceforge.plantuml.swing; @@ -83,6 +83,7 @@ import net.sourceforge.plantuml.DirWatcher2; import net.sourceforge.plantuml.GeneratedImage; import net.sourceforge.plantuml.Log; import net.sourceforge.plantuml.Option; +import net.sourceforge.plantuml.log.Logger; import net.sourceforge.plantuml.version.PSystemVersion; public class MainWindow extends JFrame { @@ -337,12 +338,8 @@ public class MainWindow extends JFrame { jList1.setListData(new Vector<>(currentDirectoryListing2)); jList1.setVisible(true); } - } catch (IOException e) { - e.printStackTrace(); - } catch (InterruptedException e) { - e.printStackTrace(); - } catch (ExecutionException e) { - e.printStackTrace(); + } catch (IOException | InterruptedException | ExecutionException e) { + Logger.error(e); } } }); diff --git a/src/net/sourceforge/plantuml/telnet/AcceptTelnetClient.java b/src/net/sourceforge/plantuml/telnet/AcceptTelnetClient.java index 241cc2051..8b75719a1 100644 --- a/src/net/sourceforge/plantuml/telnet/AcceptTelnetClient.java +++ b/src/net/sourceforge/plantuml/telnet/AcceptTelnetClient.java @@ -5,12 +5,12 @@ * (C) Copyright 2009-2023, Arnaud Roques * * Project Info: http://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * http://plantuml.com/patreon (only 1$ per month!) * http://plantuml.com/paypal - * + * * This file is part of PlantUML. * * PlantUML is free software; you can redistribute it and/or modify it @@ -30,7 +30,7 @@ * * * Original Author: Arnaud Roques - * + * * */ package net.sourceforge.plantuml.telnet; @@ -45,6 +45,7 @@ import net.sourceforge.plantuml.FileFormat; import net.sourceforge.plantuml.FileFormatOption; import net.sourceforge.plantuml.Log; import net.sourceforge.plantuml.SourceStringReader; +import net.sourceforge.plantuml.log.Logger; class AcceptTelnetClient extends Thread { final private Socket clientSocket; @@ -85,7 +86,7 @@ class AcceptTelnetClient extends Thread { os.close(); br.close(); } catch (IOException e) { - e.printStackTrace(); + Logger.error(e); } } diff --git a/src/net/sourceforge/plantuml/tim/EaterTheme.java b/src/net/sourceforge/plantuml/tim/EaterTheme.java index 782a93ce6..7999a32ad 100644 --- a/src/net/sourceforge/plantuml/tim/EaterTheme.java +++ b/src/net/sourceforge/plantuml/tim/EaterTheme.java @@ -43,6 +43,7 @@ import java.io.UnsupportedEncodingException; import net.sourceforge.plantuml.AFile; import net.sourceforge.plantuml.StringLocated; +import net.sourceforge.plantuml.log.Logger; import net.sourceforge.plantuml.preproc.FileWithSuffix; import net.sourceforge.plantuml.preproc.ImportedFiles; import net.sourceforge.plantuml.preproc.ReadLine; @@ -96,7 +97,7 @@ public class EaterTheme extends Eater { return ReadLineReader.create(br, "theme " + realName); } } catch (IOException e) { - e.printStackTrace(); + Logger.error(e); } throw EaterException.located("Cannot load " + realName); @@ -108,7 +109,7 @@ public class EaterTheme extends Eater { try { return PreprocessorUtils.getReaderInclude(url, getLineLocation(), UTF_8); } catch (UnsupportedEncodingException e) { - e.printStackTrace(); + Logger.error(e); throw EaterException.located("Cannot decode charset"); } } @@ -121,7 +122,7 @@ public class EaterTheme extends Eater { return ReadLineReader.create(tmp, "theme " + realName); } catch (IOException e) { - e.printStackTrace(); + Logger.error(e); throw EaterException.located("Cannot load " + realName); } diff --git a/src/net/sourceforge/plantuml/tim/TContext.java b/src/net/sourceforge/plantuml/tim/TContext.java index 92ae88c72..a8407fdf5 100644 --- a/src/net/sourceforge/plantuml/tim/TContext.java +++ b/src/net/sourceforge/plantuml/tim/TContext.java @@ -54,6 +54,7 @@ import net.sourceforge.plantuml.StringLocated; import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.json.Json; import net.sourceforge.plantuml.json.JsonValue; +import net.sourceforge.plantuml.log.Logger; import net.sourceforge.plantuml.preproc.Defines; import net.sourceforge.plantuml.preproc.FileWithSuffix; import net.sourceforge.plantuml.preproc.ImportedFiles; @@ -300,7 +301,7 @@ public class TContext { throw (EaterException) e; if (e instanceof EaterExceptionLocated) throw (EaterExceptionLocated) e; - e.printStackTrace(); + Logger.error(e); throw EaterException.located("Fatal parsing error"); } } @@ -501,7 +502,7 @@ public class TContext { return; } } catch (IOException e) { - e.printStackTrace(); + Logger.error(e); throw EaterException.located("Cannot import " + e.getMessage()); } @@ -549,7 +550,7 @@ public class TContext { } } } catch (IOException e) { - e.printStackTrace(); + Logger.error(e); throw EaterException.located("cannot include " + location); } } @@ -585,13 +586,13 @@ public class TContext { body.add(sl); } while (true); } catch (IOException e) { - e.printStackTrace(); + Logger.error(e); throw EaterException.located("" + e); } finally { try { reader2.close(); } catch (IOException e) { - e.printStackTrace(); + Logger.error(e); } } } @@ -614,13 +615,13 @@ public class TContext { body.add(sl); } while (true); } catch (IOException e) { - e.printStackTrace(); + Logger.error(e); throw EaterException.located("Error reading theme " + e); } finally { try { reader.close(); } catch (IOException e) { - e.printStackTrace(); + Logger.error(e); } } } @@ -691,14 +692,14 @@ public class TContext { } } } catch (IOException e) { - e.printStackTrace(); + Logger.error(e); throw EaterException.located("cannot include " + e); } finally { if (reader != null) { try { reader.close(); } catch (IOException e) { - e.printStackTrace(); + Logger.error(e); } } } diff --git a/src/net/sourceforge/plantuml/tim/TimLoader.java b/src/net/sourceforge/plantuml/tim/TimLoader.java index 5d9a1d38f..2d302e33a 100644 --- a/src/net/sourceforge/plantuml/tim/TimLoader.java +++ b/src/net/sourceforge/plantuml/tim/TimLoader.java @@ -40,6 +40,7 @@ import java.util.Set; import net.sourceforge.plantuml.DefinitionsContainer; import net.sourceforge.plantuml.StringLocated; +import net.sourceforge.plantuml.log.Logger; import net.sourceforge.plantuml.preproc.Defines; import net.sourceforge.plantuml.preproc.FileWithSuffix; import net.sourceforge.plantuml.preproc.ImportedFiles; @@ -57,7 +58,7 @@ public class TimLoader { try { defines.copyTo(global); } catch (EaterException e) { - e.printStackTrace(); + Logger.error(e); } } diff --git a/src/net/sourceforge/plantuml/tim/stdlib/LoadJson.java b/src/net/sourceforge/plantuml/tim/stdlib/LoadJson.java index f2020ee39..662113822 100755 --- a/src/net/sourceforge/plantuml/tim/stdlib/LoadJson.java +++ b/src/net/sourceforge/plantuml/tim/stdlib/LoadJson.java @@ -47,6 +47,7 @@ import net.sourceforge.plantuml.LineLocation; import net.sourceforge.plantuml.json.Json; import net.sourceforge.plantuml.json.JsonValue; import net.sourceforge.plantuml.json.ParseException; +import net.sourceforge.plantuml.log.Logger; import net.sourceforge.plantuml.security.SFile; import net.sourceforge.plantuml.security.SURL; import net.sourceforge.plantuml.tim.EaterException; @@ -63,7 +64,7 @@ import net.sourceforge.plantuml.tim.expression.TValue; * datasource will be checked against the security rules. *

* Examples:
- * + * *

  *     @ startuml
  *     ' loads a local file
@@ -88,7 +89,7 @@ import net.sourceforge.plantuml.tim.expression.TValue;
  *     status -> $JSON_REMOTE_DEF.status
  *     @ enduml
  * 
- * + * * @author Aljoscha Rittner */ public class LoadJson extends SimpleReturnFunction { @@ -116,17 +117,17 @@ public class LoadJson extends SimpleReturnFunction { JsonValue jsonValue = Json.parse(data); return TValue.fromJson(jsonValue); } catch (ParseException pe) { - pe.printStackTrace(); + Logger.error(pe); throw EaterException.unlocated("JSON parse issue in source " + path + " on location " + pe.getLocation()); } catch (UnsupportedEncodingException e) { - e.printStackTrace(); + Logger.error(e); throw EaterException.unlocated("JSON encoding issue in source " + path + ": " + e.getMessage()); } } /** * Returns the JSON default, if the data source contains no data. - * + * * @param values value parameters * @return the defined default JSON or {@code "{}"} */ @@ -139,7 +140,7 @@ public class LoadJson extends SimpleReturnFunction { /** * Returns the charset name (if set) - * + * * @param values value parameters * @return defined charset or {@code "UTF-8"} */ @@ -153,7 +154,7 @@ public class LoadJson extends SimpleReturnFunction { /** * Loads String data from a data source {@code path} (file or URL) and expects * the data encoded in {@code charset}. - * + * * @param path path to data source (http(s)-URL or file). * @param charset character set to encode the string data * @return the decoded String from the data source @@ -176,7 +177,7 @@ public class LoadJson extends SimpleReturnFunction { byteData = out.toByteArray(); } } catch (IOException e) { - e.printStackTrace(); + Logger.error(e); throw EaterException.located("load JSON: Cannot read file " + path + ". " + e.getMessage()); } } diff --git a/src/net/sourceforge/plantuml/tim/stdlib/LoadJsonLegacy.java b/src/net/sourceforge/plantuml/tim/stdlib/LoadJsonLegacy.java index 09468824f..3dd3e738d 100644 --- a/src/net/sourceforge/plantuml/tim/stdlib/LoadJsonLegacy.java +++ b/src/net/sourceforge/plantuml/tim/stdlib/LoadJsonLegacy.java @@ -47,6 +47,7 @@ import net.sourceforge.plantuml.LineLocation; import net.sourceforge.plantuml.json.Json; import net.sourceforge.plantuml.json.JsonValue; import net.sourceforge.plantuml.json.ParseException; +import net.sourceforge.plantuml.log.Logger; import net.sourceforge.plantuml.security.SFile; import net.sourceforge.plantuml.security.SURL; import net.sourceforge.plantuml.tim.EaterException; @@ -63,7 +64,7 @@ import net.sourceforge.plantuml.tim.expression.TValue; * datasource will be checked against the security rules. *

* Examples:
- * + * *

  *     @ startuml
  *     ' loads a local file
@@ -88,7 +89,7 @@ import net.sourceforge.plantuml.tim.expression.TValue;
  *     status -> $JSON_REMOTE_DEF.status
  *     @ enduml
  * 
- * + * * @author Aljoscha Rittner */ public class LoadJsonLegacy extends SimpleReturnFunction { @@ -116,17 +117,17 @@ public class LoadJsonLegacy extends SimpleReturnFunction { JsonValue jsonValue = Json.parse(data); return TValue.fromJson(jsonValue); } catch (ParseException pe) { - pe.printStackTrace(); + Logger.error(pe); throw EaterException.unlocated("JSON parse issue in source " + path + " on location " + pe.getLocation()); } catch (UnsupportedEncodingException e) { - e.printStackTrace(); + Logger.error(e); throw EaterException.unlocated("JSON encoding issue in source " + path + ": " + e.getMessage()); } } /** * Returns the JSON default, if the data source contains no data. - * + * * @param values value parameters * @return the defined default JSON or {@code "{}"} */ @@ -139,7 +140,7 @@ public class LoadJsonLegacy extends SimpleReturnFunction { /** * Returns the charset name (if set) - * + * * @param values value parameters * @return defined charset or {@code "UTF-8"} */ @@ -153,7 +154,7 @@ public class LoadJsonLegacy extends SimpleReturnFunction { /** * Loads String data from a data source {@code path} (file or URL) and expects * the data encoded in {@code charset}. - * + * * @param path path to data source (http(s)-URL or file). * @param charset character set to encode the string data * @return the decoded String from the data source @@ -176,7 +177,7 @@ public class LoadJsonLegacy extends SimpleReturnFunction { byteData = out.toByteArray(); } } catch (IOException e) { - e.printStackTrace(); + Logger.error(e); throw EaterException.located("load JSON: Cannot read file " + path + ". " + e.getMessage()); } } diff --git a/src/net/sourceforge/plantuml/timingdiagram/PlayerAnalog.java b/src/net/sourceforge/plantuml/timingdiagram/PlayerAnalog.java index ccfd23e3d..5f679f10d 100644 --- a/src/net/sourceforge/plantuml/timingdiagram/PlayerAnalog.java +++ b/src/net/sourceforge/plantuml/timingdiagram/PlayerAnalog.java @@ -5,12 +5,12 @@ * (C) Copyright 2009-2023, Arnaud Roques * * Project Info: http://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * http://plantuml.com/patreon (only 1$ per month!) * http://plantuml.com/paypal - * + * * This file is part of PlantUML. * * PlantUML is free software; you can redistribute it and/or modify it @@ -54,6 +54,7 @@ import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.UDrawable; import net.sourceforge.plantuml.graphic.color.Colors; +import net.sourceforge.plantuml.log.Logger; import net.sourceforge.plantuml.style.SName; import net.sourceforge.plantuml.style.StyleSignature; import net.sourceforge.plantuml.style.StyleSignatureBasic; @@ -158,7 +159,7 @@ public class PlayerAnalog extends Player { try { return Double.parseDouble(value); } catch (Exception e) { - e.printStackTrace(); + Logger.error(e); return 0; } } diff --git a/src/net/sourceforge/plantuml/ugraphic/g2d/ExtendedGeneralPath.java b/src/net/sourceforge/plantuml/ugraphic/g2d/ExtendedGeneralPath.java index 7c2cbdba3..cb7ed9046 100644 --- a/src/net/sourceforge/plantuml/ugraphic/g2d/ExtendedGeneralPath.java +++ b/src/net/sourceforge/plantuml/ugraphic/g2d/ExtendedGeneralPath.java @@ -5,12 +5,12 @@ * (C) Copyright 2009-2023, Arnaud Roques * * Project Info: http://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * http://plantuml.com/patreon (only 1$ per month!) * http://plantuml.com/paypal - * + * * This file is part of PlantUML. * * PlantUML is free software; you can redistribute it and/or modify it @@ -30,7 +30,7 @@ * * * Original Author: Thierry Kormann - * + * * */ package net.sourceforge.plantuml.ugraphic.g2d; @@ -54,6 +54,8 @@ package net.sourceforge.plantuml.ugraphic.g2d; */ +import net.sourceforge.plantuml.log.Logger; + import java.awt.Rectangle; import java.awt.Shape; import java.awt.geom.AffineTransform; @@ -68,11 +70,11 @@ import java.util.Arrays; * The ExtendedGeneralPath class represents a geometric path constructed from straight lines, quadratic and * cubic (Bezier) curves and elliptical arc. This class delegates lines and curves to an enclosed * GeneralPath. Elliptical arc is implemented using an Arc2D in double precision. - * + * *

* Warning : An elliptical arc may be composed of several path segments. For further details, see the SVG * Appendix F.6 - * + * * @author Thierry Kormann * @version $Id: ExtendedGeneralPath.java 594018 2007-11-12 04:17:41Z cam $ */ @@ -125,23 +127,23 @@ public class ExtendedGeneralPath implements Shape, Cloneable { /** * Adds an elliptical arc, defined by two radii, an angle from the x-axis, a flag to choose the large arc or not, a * flag to indicate if we increase or decrease the angles and the final point of the arc. - * + * * @param rx * the x radius of the ellipse * @param ry * the y radius of the ellipse - * + * * @param angle * the angle from the x-axis of the current coordinate system to the x-axis of the ellipse in degrees. - * + * * @param largeArcFlag * the large arc flag. If true the arc spanning less than or equal to 180 degrees is chosen, otherwise * the arc spanning greater than 180 degrees is chosen - * + * * @param sweepFlag * the sweep flag. If true the line joining center to arc sweeps through decreasing angles otherwise it * sweeps through increasing angles - * + * * @param x * the absolute x coordinate of the final point of the arc. * @param y @@ -191,7 +193,7 @@ public class ExtendedGeneralPath implements Shape, Cloneable { /** * This constructs an unrotated Arc2D from the SVG specification of an Elliptical arc. To get the final arc you need * to apply a rotation transform such as: - * + * * AffineTransform.getRotateInstance (angle, arc.getX()+arc.getWidth()/2, arc.getY()+arc.getHeight()/2); */ public static Arc2D computeArc(double x0, double y0, double rx, double ry, double angle, boolean largeArcFlag, @@ -725,7 +727,7 @@ public class ExtendedGeneralPath implements Shape, Cloneable { return result; } catch (CloneNotSupportedException ex) { - ex.printStackTrace(); + Logger.error(ex); } return null; } @@ -733,7 +735,7 @@ public class ExtendedGeneralPath implements Shape, Cloneable { /** * Make sure, that the requested number of slots in vales[] are available. Must be called even for numValues = 0, * because it is also used for initialization of those arrays. - * + * * @param numValues * number of requested coordinates */ diff --git a/src/net/sourceforge/plantuml/utils/Cypher.java b/src/net/sourceforge/plantuml/utils/Cypher.java index 3c0b48ddf..440546721 100644 --- a/src/net/sourceforge/plantuml/utils/Cypher.java +++ b/src/net/sourceforge/plantuml/utils/Cypher.java @@ -5,12 +5,12 @@ * (C) Copyright 2009-2023, Arnaud Roques * * Project Info: http://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * http://plantuml.com/patreon (only 1$ per month!) * http://plantuml.com/paypal - * + * * This file is part of PlantUML. * * PlantUML is free software; you can redistribute it and/or modify it @@ -35,6 +35,8 @@ */ package net.sourceforge.plantuml.utils; +import net.sourceforge.plantuml.log.Logger; + import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; @@ -71,7 +73,7 @@ public class Cypher { } is.close(); } catch (Exception e) { - e.printStackTrace(); + Logger.error(e); } Collections.shuffle(words, rnd); diff --git a/src/net/sourceforge/plantuml/version/LicenseInfo.java b/src/net/sourceforge/plantuml/version/LicenseInfo.java index 1206ff764..840b28b93 100644 --- a/src/net/sourceforge/plantuml/version/LicenseInfo.java +++ b/src/net/sourceforge/plantuml/version/LicenseInfo.java @@ -5,12 +5,12 @@ * (C) Copyright 2009-2023, Arnaud Roques * * Project Info: http://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * http://plantuml.com/patreon (only 1$ per month!) * http://plantuml.com/paypal - * + * * This file is part of PlantUML. * * PlantUML is free software; you can redistribute it and/or modify it @@ -49,6 +49,7 @@ import java.util.prefs.Preferences; import net.sourceforge.plantuml.Log; import net.sourceforge.plantuml.OptionFlags; import net.sourceforge.plantuml.SignatureUtils; +import net.sourceforge.plantuml.log.Logger; import net.sourceforge.plantuml.security.SImageIO; import net.sourceforge.plantuml.security.SFile; @@ -121,7 +122,7 @@ public class LicenseInfo { } } catch (IOException e) { Log.info("Error " + e); - // e.printStackTrace(); + // Logger.error(e); } } return cache; @@ -133,7 +134,7 @@ public class LicenseInfo { final String sig = SignatureUtils.toHexString(PLSSignature.signature()); return PLSSignature.retrieveNamed(sig, key, true); } catch (Exception e) { - // e.printStackTrace(); + // Logger.error(e); Log.info("Error retrieving license info" + e); } } @@ -160,7 +161,7 @@ public class LicenseInfo { dis.close(); } } catch (Exception e) { - e.printStackTrace(); + Logger.error(e); } return null; } @@ -184,7 +185,7 @@ public class LicenseInfo { } return null; } catch (Exception e) { - e.printStackTrace(); + Logger.error(e); return null; } } diff --git a/src/net/sourceforge/plantuml/version/PLSSignature.java b/src/net/sourceforge/plantuml/version/PLSSignature.java index 873a55f5a..ca42b99d1 100644 --- a/src/net/sourceforge/plantuml/version/PLSSignature.java +++ b/src/net/sourceforge/plantuml/version/PLSSignature.java @@ -5,12 +5,12 @@ * (C) Copyright 2009-2023, Arnaud Roques * * Project Info: http://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * http://plantuml.com/patreon (only 1$ per month!) * http://plantuml.com/paypal - * + * * This file is part of PlantUML. * * PlantUML is free software; you can redistribute it and/or modify it @@ -54,6 +54,7 @@ import net.sourceforge.plantuml.SignatureUtils; import net.sourceforge.plantuml.dedication.Dedication; import net.sourceforge.plantuml.dedication.QBlock; import net.sourceforge.plantuml.dedication.TurningBytes; +import net.sourceforge.plantuml.log.Logger; public class PLSSignature { @@ -228,7 +229,7 @@ public class PLSSignature { try { return SignatureUtils.getSHA512raw(SignatureUtils.salting(signature, getSalt(signature))); } catch (Exception e) { - e.printStackTrace(); + Logger.error(e); throw new IOException(); } } diff --git a/src/net/sourceforge/plantuml/version/PSystemKeycheck.java b/src/net/sourceforge/plantuml/version/PSystemKeycheck.java index 6f869846d..9ef2f65a3 100644 --- a/src/net/sourceforge/plantuml/version/PSystemKeycheck.java +++ b/src/net/sourceforge/plantuml/version/PSystemKeycheck.java @@ -5,12 +5,12 @@ * (C) Copyright 2009-2023, Arnaud Roques * * Project Info: http://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * http://plantuml.com/patreon (only 1$ per month!) * http://plantuml.com/paypal - * + * * This file is part of PlantUML. * * PlantUML is free software; you can redistribute it and/or modify it @@ -52,6 +52,7 @@ import net.sourceforge.plantuml.flashcode.FlashCodeUtils; import net.sourceforge.plantuml.graphic.GraphicStrings; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.UDrawable; +import net.sourceforge.plantuml.log.Logger; import net.sourceforge.plantuml.ugraphic.AffineTransformType; import net.sourceforge.plantuml.ugraphic.PixelImage; import net.sourceforge.plantuml.ugraphic.UGraphic; @@ -76,7 +77,7 @@ public class PSystemKeycheck extends PlainDiagram { try { drawInternal(ug); } catch (Exception e) { - e.printStackTrace(); + Logger.error(e); } } }; @@ -94,7 +95,7 @@ public class PSystemKeycheck extends PlainDiagram { License.addLicenseInfo(strings, info); strings.add(" "); } catch (Exception e) { - e.printStackTrace(); + Logger.error(e); strings.add("Error: " + e); } diff --git a/src/net/sourceforge/plantuml/version/PSystemKeygen.java b/src/net/sourceforge/plantuml/version/PSystemKeygen.java index e575c8f4c..f11b41a71 100644 --- a/src/net/sourceforge/plantuml/version/PSystemKeygen.java +++ b/src/net/sourceforge/plantuml/version/PSystemKeygen.java @@ -5,12 +5,12 @@ * (C) Copyright 2009-2023, Arnaud Roques * * Project Info: http://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * http://plantuml.com/patreon (only 1$ per month!) * http://plantuml.com/paypal - * + * * This file is part of PlantUML. * * PlantUML is free software; you can redistribute it and/or modify it @@ -51,6 +51,7 @@ import net.sourceforge.plantuml.flashcode.FlashCodeUtils; import net.sourceforge.plantuml.graphic.GraphicStrings; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.UDrawable; +import net.sourceforge.plantuml.log.Logger; import net.sourceforge.plantuml.security.SFile; import net.sourceforge.plantuml.ugraphic.AffineTransformType; import net.sourceforge.plantuml.ugraphic.PixelImage; @@ -74,7 +75,7 @@ public class PSystemKeygen extends PlainDiagram { try { drawInternal(ug); } catch (IOException e) { - e.printStackTrace(); + Logger.error(e); } } }; diff --git a/src/net/sourceforge/plantuml/version/PSystemVersion.java b/src/net/sourceforge/plantuml/version/PSystemVersion.java index 0234f1dff..8a8e0234d 100644 --- a/src/net/sourceforge/plantuml/version/PSystemVersion.java +++ b/src/net/sourceforge/plantuml/version/PSystemVersion.java @@ -5,12 +5,12 @@ * (C) Copyright 2009-2023, Arnaud Roques * * Project Info: http://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * http://plantuml.com/patreon (only 1$ per month!) * http://plantuml.com/paypal - * + * * This file is part of PlantUML. * * PlantUML is free software; you can redistribute it and/or modify it @@ -51,6 +51,7 @@ import net.sourceforge.plantuml.core.DiagramDescription; import net.sourceforge.plantuml.core.UmlSource; import net.sourceforge.plantuml.cucadiagram.dot.GraphvizUtils; import net.sourceforge.plantuml.dedication.PSystemDedication; +import net.sourceforge.plantuml.log.Logger; import net.sourceforge.plantuml.preproc.Stdlib; import net.sourceforge.plantuml.preproc2.PreprocessorUtils; import net.sourceforge.plantuml.security.SImageIO; @@ -120,7 +121,7 @@ public class PSystemVersion extends PlainStringsDiagram { is.close(); return image; } catch (IOException e) { - e.printStackTrace(); + Logger.error(e); } return new BufferedImage(10, 10, BufferedImage.TYPE_INT_ARGB); } @@ -129,7 +130,7 @@ public class PSystemVersion extends PlainStringsDiagram { try (InputStream is = PSystemVersion.class.getResourceAsStream(name)) { return PSystemDedication.getBufferedImage(is); } catch (IOException e) { - e.printStackTrace(); + Logger.error(e); } return new BufferedImage(10, 10, BufferedImage.TYPE_INT_ARGB); } @@ -185,7 +186,7 @@ public class PSystemVersion extends PlainStringsDiagram { for (String v : OptionPrint.interestingValues()) { strings.add(v); } - + return new PSystemVersion(source, true, strings); } diff --git a/src/net/sourceforge/plantuml/version/Version.java b/src/net/sourceforge/plantuml/version/Version.java index c9bb2f706..2d8919f01 100644 --- a/src/net/sourceforge/plantuml/version/Version.java +++ b/src/net/sourceforge/plantuml/version/Version.java @@ -5,12 +5,12 @@ * (C) Copyright 2009-2023, Arnaud Roques * * Project Info: http://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * http://plantuml.com/patreon (only 1$ per month!) * http://plantuml.com/paypal - * + * * This file is part of PlantUML. * * PlantUML is free software; you can redistribute it and/or modify it @@ -30,13 +30,14 @@ * * * Original Author: Arnaud Roques - * + * * */ package net.sourceforge.plantuml.version; import java.util.Date; +import net.sourceforge.plantuml.log.Logger; import net.sourceforge.plantuml.security.SURL; public class Version { @@ -110,14 +111,11 @@ public class Version { return "No ClassLoader?"; } final SURL url = SURL.create(loader.getResource("net/sourceforge/plantuml/version/Version.class")); - if (url == null) { - return "No URL?"; - } String fullpath = url.toString(); fullpath = fullpath.replaceAll("net/sourceforge/plantuml/version/Version\\.class", ""); return fullpath; } catch (Throwable t) { - t.printStackTrace(); + Logger.error(t); return t.toString(); } } diff --git a/src/net/sourceforge/plantuml/vizjs/GraphvizJs.java b/src/net/sourceforge/plantuml/vizjs/GraphvizJs.java index 1d160d23f..b3c11cc9d 100644 --- a/src/net/sourceforge/plantuml/vizjs/GraphvizJs.java +++ b/src/net/sourceforge/plantuml/vizjs/GraphvizJs.java @@ -5,12 +5,12 @@ * (C) Copyright 2009-2023, Arnaud Roques * * Project Info: http://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * http://plantuml.com/patreon (only 1$ per month!) * http://plantuml.com/paypal - * + * * This file is part of PlantUML. * * PlantUML is free software; you can redistribute it and/or modify it @@ -30,7 +30,7 @@ * * * Original Author: Arnaud Roques - * + * * */ package net.sourceforge.plantuml.vizjs; @@ -47,6 +47,7 @@ import net.sourceforge.plantuml.cucadiagram.dot.ExeState; import net.sourceforge.plantuml.cucadiagram.dot.Graphviz; import net.sourceforge.plantuml.cucadiagram.dot.GraphvizVersion; import net.sourceforge.plantuml.cucadiagram.dot.ProcessState; +import net.sourceforge.plantuml.log.Logger; public class GraphvizJs implements Graphviz { @@ -72,7 +73,7 @@ public class GraphvizJs implements Graphviz { try { this.engine = new VizJsEngine(); } catch (Exception e) { - e.printStackTrace(); + Logger.error(e); } } runnable.run(); @@ -92,7 +93,7 @@ public class GraphvizJs implements Graphviz { os.write(svg.getBytes()); return ProcessState.TERMINATED_OK(); } catch (Exception e) { - e.printStackTrace(); + Logger.error(e); throw new GraphvizJsRuntimeException(e); } } diff --git a/src/net/sourceforge/plantuml/wbs/WBSDiagram.java b/src/net/sourceforge/plantuml/wbs/WBSDiagram.java index 9fbfc1fb0..555095c77 100644 --- a/src/net/sourceforge/plantuml/wbs/WBSDiagram.java +++ b/src/net/sourceforge/plantuml/wbs/WBSDiagram.java @@ -5,12 +5,12 @@ * (C) Copyright 2009-2023, Arnaud Roques * * Project Info: http://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * http://plantuml.com/patreon (only 1$ per month!) * http://plantuml.com/paypal - * + * * This file is part of PlantUML. * * PlantUML is free software; you can redistribute it and/or modify it @@ -142,7 +142,7 @@ public class WBSDiagram extends UmlDiagram { } return add(backColor, level, display, stereotype, direction, shape); } catch (NoStyleAvailableException e) { - // e.printStackTrace(); + // Logger.error(e); return CommandExecutionResult.error("General failure: no style available."); } } @@ -204,7 +204,7 @@ public class WBSDiagram extends UmlDiagram { } return CommandExecutionResult.error("Bad tree structure"); } catch (NoStyleAvailableException e) { - // e.printStackTrace(); + // Logger.error(e); return CommandExecutionResult.error("General failure: no style available."); } } diff --git a/src/net/sourceforge/plantuml/webp/VP8Decoder.java b/src/net/sourceforge/plantuml/webp/VP8Decoder.java index 0a1ef9690..273a6ef8f 100644 --- a/src/net/sourceforge/plantuml/webp/VP8Decoder.java +++ b/src/net/sourceforge/plantuml/webp/VP8Decoder.java @@ -15,6 +15,8 @@ */ package net.sourceforge.plantuml.webp; +import net.sourceforge.plantuml.log.Logger; + import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; @@ -71,7 +73,7 @@ public class VP8Decoder { out.write((byte) ' '); out.write(("" + (f.getHeight() + uvHeight)).getBytes()); - + out.write((byte) 0x0a); out.write(("255").getBytes()); out.write((byte) 0xa); @@ -93,12 +95,12 @@ public class VP8Decoder { } } catch (FileNotFoundException e) { - e.printStackTrace(); + Logger.error(e); } catch (IOException e) { - e.printStackTrace(); + Logger.error(e); } } - + public void writeYV12File(String fileName, VP8Frame frame) { FileOutputStream out; @@ -132,9 +134,9 @@ public class VP8Decoder { out.write(vData[x][y]); } } catch (FileNotFoundException e) { - e.printStackTrace(); + Logger.error(e); } catch (IOException e) { - e.printStackTrace(); + Logger.error(e); } } } diff --git a/src/net/sourceforge/plantuml/webp/VP8Frame.java b/src/net/sourceforge/plantuml/webp/VP8Frame.java index fd0695668..c1fbd98ca 100644 --- a/src/net/sourceforge/plantuml/webp/VP8Frame.java +++ b/src/net/sourceforge/plantuml/webp/VP8Frame.java @@ -15,6 +15,8 @@ */ package net.sourceforge.plantuml.webp; +import net.sourceforge.plantuml.log.Logger; + import java.awt.image.BufferedImage; import java.awt.image.WritableRaster; import java.io.IOException; @@ -32,7 +34,7 @@ public class VP8Frame { private static int MAX_MODE_LF_DELTAS = 4; private static int MAX_REF_LF_DELTAS = 4; private static int PREV_COEF_CONTEXTS = 3; - + private ArrayList _listeners = new ArrayList<>(); @@ -92,13 +94,13 @@ public class VP8Frame { for(int x=0; x 0 ) { - + macroBlockSegementAbsoluteDelta = bc.readBit(); /* For each segmentation feature (Quant and loop filter level) */ for (int i = 0; i < Globals.MAX_MB_SEGMENTS; i++) { @@ -192,7 +194,7 @@ public class VP8Frame { } simpleFilter = bc.readBit(); filterLevel = bc.readLiteral(6); - + sharpnessLevel = bc.readLiteral(3); modeRefLoopFilterDeltaEnabled = bc.readBit(); if (modeRefLoopFilterDeltaEnabled > 0) { @@ -266,7 +268,7 @@ public class VP8Frame { for (int mb_row = 0; mb_row < macroBlockRows; mb_row++) { if (num_part > 1) { - + tokenBoolDecoder = tokenBoolDecoders.elementAt(ibc); tokenBoolDecoder.seek(); @@ -297,7 +299,7 @@ public class VP8Frame { } } - + public void fireLFProgressUpdate(float p) { java.util.Iterator listeners = _listeners.iterator(); while( listeners.hasNext() ) { @@ -325,7 +327,7 @@ public class VP8Frame { int y = mb.getSubblockY(sb); if(plane==SubBlock.PLANE.Y1) { - + // top row if(y==0 && x<3) { @@ -340,7 +342,7 @@ public class VP8Frame { r = mb2.getSubBlock(plane, 0, 3); if(mb2.getX()==this.getMacroBlockCols()) { - + int dest[][] = new int [4][4]; for(int b=0; b<4; b++) for(int a=0; a<4; a++) { @@ -351,10 +353,10 @@ public class VP8Frame { } r=new SubBlock(mb2,null, null, SubBlock.PLANE.Y1); r.setDest(dest); - + } - + return r; } //not right edge or top row @@ -380,7 +382,7 @@ public class VP8Frame { if(r==null) { MacroBlock mb = sb.getMacroBlock(); int x = mb.getSubblockX(sb); - + MacroBlock mb2 = getMacroBlock(mb.getX(), mb.getY()-1); //TODO: SPLIT while(plane==SubBlock.PLANE.Y2 && mb2.getYMode()== Globals.B_PRED) { @@ -399,7 +401,7 @@ public class VP8Frame { return true; return false; } - + private int getBitAsInt(int data, int bit) { int r = data & (1 << bit); if (r > 0) @@ -657,7 +659,7 @@ public class VP8Frame { bufferCount++; return bi; } - + public BufferedImage getDebugImageYDiffBuffer() { BufferedImage bi = new BufferedImage(getWidth(), getHeight(), BufferedImage.TYPE_INT_RGB); WritableRaster imRas = bi.getWritableTile(0, 0); @@ -683,7 +685,7 @@ public class VP8Frame { bufferCount++; return bi; } - + public BufferedImage getDebugImageYPredBuffer() { BufferedImage bi = new BufferedImage(getWidth(), getHeight(), BufferedImage.TYPE_INT_RGB); WritableRaster imRas = bi.getWritableTile(0, 0); @@ -709,7 +711,7 @@ public class VP8Frame { bufferCount++; return bi; } - + public int getFilterLevel() { return filterLevel; } @@ -719,7 +721,7 @@ public class VP8Frame { public int getFrameType() { return frameType; } - + public int getHeight() { return height; } @@ -733,7 +735,7 @@ public class VP8Frame { while(plane==SubBlock.PLANE.Y2 && mb2.getYMode()== Globals.B_PRED) mb2 = getMacroBlock(mb2.getX()-1, mb2.getY()); - + r = mb2.getRightSubBlock(y, sb.getPlane()); } @@ -767,7 +769,7 @@ public class VP8Frame { public int getMacroBlockRows() { return macroBlockRows; } - + public int getQIndex() { return segmentQuants.getqIndex(); } @@ -781,7 +783,7 @@ public class VP8Frame { tokenBoolDecoder.seek(); return tokenBoolDecoder; } - + public int[][] getUBuffer() { int r[][]= new int [macroBlockCols*8][macroBlockRows*8]; for(int y=0; y 0) { prob_skip_false = bc.readLiteral(8); } @@ -871,12 +873,12 @@ public class VP8Frame { // Read the macroblock coeff skip flag if this feature is in // use, else default to 0 MacroBlock mb = getMacroBlock(mb_col, mb_row); - + if ((segmentationIsEnabled >0) &&( updateMacroBlockSegmentationMap > 0)) { int value = bc.readTree(Globals.macroBlockSegmentTree, this.macroBlockSegmentTreeProbs); mb.setSegmentId(value); } - + if(modeRefLoopFilterDeltaEnabled > 0) { int level = filterLevel; level = level + refLoopFilterDeltas[0]; @@ -887,7 +889,7 @@ public class VP8Frame { mb.setFilterLevel(segmentQuants.getSegQuants()[mb.getSegmentId()].getFilterStrength()); // logger.error("TODO:"); } - + int mb_skip_coeff = 0; if (macroBlockNoCoeffSkip > 0) mb_skip_coeff = bc.readBool(prob_skip_false); @@ -896,7 +898,7 @@ public class VP8Frame { mb.setSkipCoeff(mb_skip_coeff); int y_mode = readYMode(bc); - + mb.setYMode(y_mode); if (y_mode == Globals.B_PRED) { @@ -955,14 +957,14 @@ public class VP8Frame { } } } - - - + + + private int readPartitionSize(long l) throws IOException { frame.seek(l); int size =frame.readUnsignedByte() + (frame.readUnsignedByte() << 8) + (frame.readUnsignedByte() << 16); return size; - + } private int readSubBlockMode(BoolDecoder bc, int A, int L) throws IOException { int i = bc.readTree(Globals.vp8SubBlockModeTree, Globals.vp8KeyFrameSubBlockModeProb[A][L]); @@ -972,21 +974,21 @@ public class VP8Frame { int i = bc.readTree(Globals.vp8UVModeTree, Globals.vp8KeyFrameUVModeProb); return i; } - + private int readYMode(BoolDecoder bc) throws IOException { int i = bc.readTree(Globals.vp8KeyFrameYModeTree, Globals.vp8KeyFrameYModeProb); return i; } - + public void removeIIOReadProgressListener(IIOReadProgressListener listener) { _listeners.remove(listener); } - + public void setBuffersToCreate (int count) { this.buffersToCreate = 3+count; this.bufferCount=0; } - + private void setupTokenDecoder(BoolDecoder bc, int first_partition_length_in_bytes, long offset) throws IOException { long partitionSize = 0; @@ -1015,7 +1017,7 @@ public class VP8Frame { } tokenBoolDecoder = tokenBoolDecoders.elementAt(0); } - + public void useBufferedImage(BufferedImage dst) { WritableRaster imRas = dst.getWritableTile(0, 0); @@ -1050,7 +1052,7 @@ public class VP8Frame { this.coefProbs=Globals.getDefaultCoefProbs(); tokenBoolDecoders = new Vector<>(); } catch (IOException e) { - e.printStackTrace(); + Logger.error(e); } } } diff --git a/src/net/sourceforge/plantuml/windowsdot/WindowsDotArchive.java b/src/net/sourceforge/plantuml/windowsdot/WindowsDotArchive.java index 1a9d0adc3..9c84850ab 100644 --- a/src/net/sourceforge/plantuml/windowsdot/WindowsDotArchive.java +++ b/src/net/sourceforge/plantuml/windowsdot/WindowsDotArchive.java @@ -5,12 +5,12 @@ * (C) Copyright 2009-2023, Arnaud Roques * * Project Info: http://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * http://plantuml.com/patreon (only 1$ per month!) * http://plantuml.com/paypal - * + * * This file is part of PlantUML. * * PlantUML is free software; you can redistribute it and/or modify it @@ -30,7 +30,7 @@ * * * Original Author: Arnaud Roques - * + * * */ package net.sourceforge.plantuml.windowsdot; @@ -43,6 +43,7 @@ import java.io.InputStream; import java.io.OutputStream; import net.sourceforge.plantuml.brotli.BrotliInputStream; +import net.sourceforge.plantuml.log.Logger; public final class WindowsDotArchive { @@ -121,7 +122,7 @@ public final class WindowsDotArchive { extract(tmp); exe = new File(tmp, "dot.exe"); } catch (IOException e) { - e.printStackTrace(); + Logger.error(e); } return exe; } diff --git a/src/net/sourceforge/plantuml/xmi/CucaDiagramXmiMaker.java b/src/net/sourceforge/plantuml/xmi/CucaDiagramXmiMaker.java index da1c99d9b..e478e04c1 100644 --- a/src/net/sourceforge/plantuml/xmi/CucaDiagramXmiMaker.java +++ b/src/net/sourceforge/plantuml/xmi/CucaDiagramXmiMaker.java @@ -5,12 +5,12 @@ * (C) Copyright 2009-2023, Arnaud Roques * * Project Info: http://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * http://plantuml.com/patreon (only 1$ per month!) * http://plantuml.com/paypal - * + * * This file is part of PlantUML. * * PlantUML is free software; you can redistribute it and/or modify it @@ -30,7 +30,7 @@ * * * Original Author: Arnaud Roques - * + * * */ package net.sourceforge.plantuml.xmi; @@ -47,6 +47,7 @@ import net.sourceforge.plantuml.UmlDiagram; import net.sourceforge.plantuml.classdiagram.ClassDiagram; import net.sourceforge.plantuml.cucadiagram.CucaDiagram; import net.sourceforge.plantuml.descdiagram.DescriptionDiagram; +import net.sourceforge.plantuml.log.Logger; import net.sourceforge.plantuml.statediagram.StateDiagram; public final class CucaDiagramXmiMaker { @@ -82,11 +83,11 @@ public final class CucaDiagramXmiMaker { xmi.transformerXml(fos); } catch (ParserConfigurationException e) { Log.error(e.toString()); - e.printStackTrace(); + Logger.error(e); throw new IOException(e.toString()); } catch (TransformerException e) { Log.error(e.toString()); - e.printStackTrace(); + Logger.error(e); throw new IOException(e.toString()); } } diff --git a/src/net/sourceforge/plantuml/xmi/SequenceDiagramXmiMaker.java b/src/net/sourceforge/plantuml/xmi/SequenceDiagramXmiMaker.java index 50453e5b9..2b312ccd1 100644 --- a/src/net/sourceforge/plantuml/xmi/SequenceDiagramXmiMaker.java +++ b/src/net/sourceforge/plantuml/xmi/SequenceDiagramXmiMaker.java @@ -15,6 +15,8 @@ import javax.xml.transform.TransformerException; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; +import net.sourceforge.plantuml.log.Logger; + import org.w3c.dom.Document; import net.sourceforge.plantuml.FileFormat; @@ -41,7 +43,7 @@ public final class SequenceDiagramXmiMaker implements FileMaker { try { builder = XmlFactories.newDocumentBuilder(); } catch (ParserConfigurationException e) { - e.printStackTrace(); + Logger.error(e); return imageData; } Document document = builder.newDocument(); @@ -53,18 +55,18 @@ public final class SequenceDiagramXmiMaker implements FileMaker { xmi = new XmiSequenceDiagramArgo(diagram, document); else xmi = new XmiSequenceDiagramStandard(diagram, document); - + xmi.build(); - + try { writeDocument(document, os); } catch (TransformerException | ParserConfigurationException e) { - e.printStackTrace(); + Logger.error(e); } return imageData; } - - + + @Override public int getNbPages() { return 1; diff --git a/src/net/sourceforge/plantuml/xmlsc/StateDiagramScxmlMaker.java b/src/net/sourceforge/plantuml/xmlsc/StateDiagramScxmlMaker.java index 24c3136a5..183be639c 100644 --- a/src/net/sourceforge/plantuml/xmlsc/StateDiagramScxmlMaker.java +++ b/src/net/sourceforge/plantuml/xmlsc/StateDiagramScxmlMaker.java @@ -5,12 +5,12 @@ * (C) Copyright 2009-2023, Arnaud Roques * * Project Info: http://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * http://plantuml.com/patreon (only 1$ per month!) * http://plantuml.com/paypal - * + * * This file is part of PlantUML. * * PlantUML is free software; you can redistribute it and/or modify it @@ -30,7 +30,7 @@ * * * Original Author: Arnaud Roques - * + * * */ package net.sourceforge.plantuml.xmlsc; @@ -42,6 +42,7 @@ import javax.xml.parsers.ParserConfigurationException; import javax.xml.transform.TransformerException; import net.sourceforge.plantuml.Log; +import net.sourceforge.plantuml.log.Logger; import net.sourceforge.plantuml.statediagram.StateDiagram; public final class StateDiagramScxmlMaker { @@ -59,11 +60,11 @@ public final class StateDiagramScxmlMaker { xmi.transformerXml(fos); } catch (ParserConfigurationException e) { Log.error(e.toString()); - e.printStackTrace(); + Logger.error(e); throw new IOException(e.toString()); } catch (TransformerException e) { Log.error(e.toString()); - e.printStackTrace(); + Logger.error(e); throw new IOException(e.toString()); } } diff --git a/src/net/sourceforge/plantuml/yaml/YamlDiagramFactory.java b/src/net/sourceforge/plantuml/yaml/YamlDiagramFactory.java index 9d04a071c..77150bb61 100644 --- a/src/net/sourceforge/plantuml/yaml/YamlDiagramFactory.java +++ b/src/net/sourceforge/plantuml/yaml/YamlDiagramFactory.java @@ -5,12 +5,12 @@ * (C) Copyright 2009-2023, Arnaud Roques * * Project Info: http://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * http://plantuml.com/patreon (only 1$ per month!) * http://plantuml.com/paypal - * + * * This file is part of PlantUML. * * PlantUML is free software; you can redistribute it and/or modify it @@ -30,7 +30,7 @@ * * * Original Author: Arnaud Roques - * + * * */ package net.sourceforge.plantuml.yaml; @@ -53,6 +53,7 @@ import net.sourceforge.plantuml.graphic.VerticalAlignment; import net.sourceforge.plantuml.json.JsonValue; import net.sourceforge.plantuml.jsondiagram.JsonDiagram; import net.sourceforge.plantuml.jsondiagram.StyleExtractor; +import net.sourceforge.plantuml.log.Logger; public class YamlDiagramFactory extends PSystemAbstractFactory { @@ -83,7 +84,7 @@ public class YamlDiagramFactory extends PSystemAbstractFactory { } yaml = new SimpleYamlParser().parse(list); } catch (Exception e) { - e.printStackTrace(); + Logger.error(e); } final JsonDiagram result = new JsonDiagram(style, source, UmlDiagramType.YAML, yaml, highlighted); if (styleExtractor != null) { diff --git a/test/net/sourceforge/plantuml/ProgressBarTest.java b/test/net/sourceforge/plantuml/ProgressBarTest.java new file mode 100644 index 000000000..9198cadbe --- /dev/null +++ b/test/net/sourceforge/plantuml/ProgressBarTest.java @@ -0,0 +1,78 @@ +package net.sourceforge.plantuml; + +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; + +import static org.assertj.core.api.AssertionsForClassTypes.assertThat; + + +public class ProgressBarTest { + + private static final PrintStream standardErr = System.err; + private static final ByteArrayOutputStream outputStreamCaptor = new ByteArrayOutputStream(); + + @BeforeAll + public static void beforeAll() { + System.setErr(new PrintStream(outputStreamCaptor)); + } + + @AfterAll + public static void afterAll() { + System.setErr(standardErr); // restore default stderr + } + + @Test + void test_progressbar() throws Exception { + ProgressBar.setEnable(true); + ProgressBar.incTotal(2); + ProgressBar.incTotal(2); + PeriodicIncrementDone t2 = new PeriodicIncrementDone(4); + t2.start(); + t2.join(); + StringBuilder expected = new StringBuilder(); + expected.append("[ ] 0/2"); + appendClear(expected); + // increment total from 2 to 4 + expected.append("[ ] 0/4"); + appendClear(expected); + expected.append("[####### ] 1/4"); + appendClear(expected); + expected.append("[############### ] 2/4"); + appendClear(expected); + expected.append("[###################### ] 3/4"); + appendClear(expected); + expected.append("[##############################] 4/4"); + assertThat(outputStreamCaptor.toString().trim()).isEqualTo(expected.toString()); + } + + private void appendClear(StringBuilder sb) { + sb.append("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"); + sb.append(" "); + sb.append("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"); + } + + private static class PeriodicIncrementDone extends Thread { + + private int count; + + public PeriodicIncrementDone(int count) { + this.count = count; + } + + @Override + public void run() { + while (count-- > 0) { + ProgressBar.incDone(false); + try { + Thread.sleep(50); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } + } + } + } +}