1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-11-22 04:55:10 +00:00

resolves #1086 replace printStackTrace by java.util.logging.Logger

This commit is contained in:
Guillaume Grossetie 2022-08-16 17:22:32 +02:00
parent 1f3dd64f7c
commit aaf3a8ee24
121 changed files with 1007 additions and 717 deletions

Binary file not shown.

View File

@ -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);
}
}
}

View File

@ -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";
}
}

View File

@ -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();
}
}

View File

@ -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);
}
}

View File

@ -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;
@ -299,7 +300,7 @@ public enum FileFormat {
}
} catch (IOException e) {
e.printStackTrace();
Logger.error(e);
}
return false;
}

View File

@ -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());
}

View File

@ -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<String> header2 = new ThreadLocal<>();
//
public static void header(String s) {
// header2.set(s);
}
}

View File

@ -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);
}
}

View File

@ -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 <b>not</b> close {@code System.err}.
*/
@Override
public void close() {
flush();
}
}
}

View File

@ -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());
}

View File

@ -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);
}
}

View File

@ -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);
}
}
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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);
// }
}

View File

@ -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);

View File

@ -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<PSystemXearth> {
@ -100,7 +101,7 @@ public class PSystemXearthFactory extends PSystemBasicFactory<PSystemXearth> {
return system;
}
} catch (Exception e) {
e.printStackTrace();
Logger.error(e);
return null;
}
return null;

View File

@ -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());
}
}

View File

@ -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());
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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);
}
}

View File

@ -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 <T extends Number> 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);
}
}

View File

@ -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);
}
}

View File

@ -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());
}
}

View File

@ -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;
}

View File

@ -64,7 +64,7 @@ public class CommandSkinParam extends SingleLineCommand2<TitledDiagram> {
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.");
}

View File

@ -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<S extends Diagram> implements Command<S> {
@ -58,12 +59,11 @@ public class ProtectedCommand<S extends Diagram> implements Command<S> {
// }
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);
}
}

View File

@ -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.");
}

View File

@ -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;
@ -148,7 +149,7 @@ public class AtomImg extends AbstractAtom implements Atom {
}
return new AtomImg(f.readRasterImageFromFile(), scale, url, src);
} catch (IOException e) {
e.printStackTrace();
Logger.error(e);
if (SecurityUtils.getSecurityProfile() == SecurityProfile.UNSECURE)
return AtomTextUtils.createLegacy("ERROR " + e.toString(), fc);

View File

@ -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("</html>");
} catch (IOException e) {
e.printStackTrace();
Logger.error(e);
}
}

View File

@ -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 {
@ -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("");

View File

@ -51,7 +51,7 @@ public class DebugTrace {
try {
pw = out.createPrintWriter();
} catch (FileNotFoundException e) {
// ignore
}
}
return pw;

View File

@ -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 {

View File

@ -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;
}
}

View File

@ -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);
}
}

View File

@ -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;
}

View File

@ -35,6 +35,8 @@
*/
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;
}
}

View File

@ -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);
}
}

View File

@ -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;
}
}

View File

@ -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;

View File

@ -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;
@ -153,7 +154,7 @@ public class PSystemDonors extends PlainDiagram {
lines.add(st.nextToken());
}
} catch (NoPlantumlCompressionException e) {
e.printStackTrace();
Logger.error(e);
}
return lines;
}

View File

@ -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;

View File

@ -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;

View File

@ -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;
@ -521,7 +522,7 @@ public class CucaDiagramFileMakerElk implements CucaDiagramFileMaker {
}
static private List<String> getFailureText3(Throwable exception) {
exception.printStackTrace();
Logger.error(exception);
final List<String> strings = new ArrayList<>();
strings.add("An error has occured : " + exception);
final String quote = StringUtils.rot(QuoteUtils.getSomeQuote());

View File

@ -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);
}
}

View File

@ -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);
}

View File

@ -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;
}

View File

@ -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);
}
}

View File

@ -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);
}
}
});

View File

@ -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;
}

View File

@ -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);
}
}

View File

@ -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);
// }
}

View File

@ -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) {

View File

@ -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<Help> {
@ -76,7 +77,7 @@ public class CommandHelpTheme extends SingleLineCommand2<Help> {
} catch (IOException e) {
final String message = "Unexpected error listing themes: " + e.getMessage();
Log.error(message);
e.printStackTrace();
Logger.error(e);
return CommandExecutionResult.error(message);
}

View File

@ -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<PSystemJcckit> {
@ -99,7 +100,7 @@ public class PSystemJcckitFactory extends PSystemBasicFactory<PSystemJcckit> {
// 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);

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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;

View File

@ -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;

View File

@ -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() {

View File

@ -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.");
}
}

View File

@ -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;
}
}

View File

@ -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) {

View File

@ -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);
}
}
}

View File

@ -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);
}
}
};

View File

@ -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;

View File

@ -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;
}
}

View File

@ -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());
}

View File

@ -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);

View File

@ -35,6 +35,8 @@
*/
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;
}

View File

@ -35,6 +35,8 @@
*/
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);
}
}

View File

@ -35,6 +35,8 @@
*/
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) {

View File

@ -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<String>());
return ImageDataSimple.error();

View File

@ -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<String> getFailureText3(Throwable exception) {
exception.printStackTrace();
Logger.error(exception);
final List<String> strings = new ArrayList<>();
strings.add("An error has occured : " + exception);
final String quote = StringUtils.rot(QuoteUtils.getSomeQuote());

View File

@ -35,6 +35,8 @@
*/
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<SFile> {
try {
return internal.getCanonicalPath();
} catch (IOException e) {
e.printStackTrace();
Logger.error(e);
}
}
return "";
@ -348,7 +350,7 @@ public class SFile implements Comparable<SFile> {
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<SFile> {
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<SFile> {
try {
return new BufferedInputStream(new FileInputStream(internal));
} catch (FileNotFoundException e) {
e.printStackTrace();
Logger.error(e);
}
return null;
}

View File

@ -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;
@ -154,7 +155,7 @@ public class SURL {
try {
return create(new URL(url));
} catch (MalformedURLException e) {
e.printStackTrace();
Logger.error(e);
}
return null;
}
@ -488,7 +489,7 @@ public class SURL {
try {
return Charset.forName(matcher.group(1));
} catch (Exception e) {
e.printStackTrace();
Logger.error(e);
}
return null;
@ -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;
}

View File

@ -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;
@ -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();

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}

View File

@ -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++;

View File

@ -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);
}
}
}

View File

@ -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());
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -72,7 +72,7 @@ public class CommandStyleMultilinesCSS extends CommandMultilines2<TitledDiagram>
((SkinParam) diagram.getSkinParam()).applyPendingStyleMigration();
return CommandExecutionResult.ok();
} catch (NoStyleAvailableException e) {
// e.printStackTrace();
// Logger.error(e);
return CommandExecutionResult.error("General failure: no style available.");
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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;
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}
});

View File

@ -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);
}
}

View File

@ -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);
}

View File

@ -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);
}
}
}

View File

@ -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);
}
}

Some files were not shown because too many files have changed in this diff Show More