Skip to content

Commit

Permalink
version 1.2019.10
Browse files Browse the repository at this point in the history
  • Loading branch information
arnaudroques committed Sep 14, 2019
1 parent 0d43b32 commit 90372b9
Show file tree
Hide file tree
Showing 105 changed files with 1,087 additions and 724 deletions.
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,12 @@
Script Author: Julien Eluard
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>net.sourceforge.plantuml</groupId>
<artifactId>plantuml</artifactId>
<version>1.2019.9-SNAPSHOT</version>
<version>1.2019.11-SNAPSHOT</version>
<packaging>jar</packaging>

<name>PlantUML</name>
Expand Down Expand Up @@ -125,6 +124,7 @@
<directory>${project.basedir}</directory>
<includes>
<include>stdlib/**/*.repx</include>
<include>skin/**/*.skin</include>
</includes>
</resource>
</resources>
Expand Down
9 changes: 7 additions & 2 deletions skin/plantuml.skin
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ title {
HorizontalAlignment center
FontSize 14
FontStyle bold
Padding 0
Margin 4
Padding 5
Margin 5
LineColor none
BackGroundColor none
}
Expand Down Expand Up @@ -145,21 +145,26 @@ actor {
}

boundary {
LineThickness 2.0
}

control {
LineThickness 2.0
}

entity {
LineThickness 2.0
}

queue {
LineThickness 2.0
}

database {
}

collections {
LineThickness 1.5
}

swimlane {
Expand Down
8 changes: 4 additions & 4 deletions src/net/sourceforge/plantuml/AParentFolderRegular.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public class AParentFolderRegular implements AParentFolder {

public AParentFolderRegular(File dir) {
this.dir = dir;
Log.info("Creating AParentFolderRegular " + dir);
// Log.info("Creating AParentFolderRegular " + dir);
}

@Override
Expand All @@ -54,14 +54,14 @@ public String toString() {

public AFile getAFile(String nameOrPath) throws IOException {
final File filecurrent;
Log.info("AParentFolderRegular::looking for " + nameOrPath);
Log.info("AParentFolderRegular::dir = " + dir);
// Log.info("AParentFolderRegular::looking for " + nameOrPath);
// Log.info("AParentFolderRegular::dir = " + dir);
if (dir == null) {
filecurrent = new File(nameOrPath);
} else {
filecurrent = new File(dir.getAbsoluteFile(), nameOrPath);
}
Log.info("AParentFolderRegular::Filecurrent " + filecurrent);
// Log.info("AParentFolderRegular::Filecurrent " + filecurrent);
if (filecurrent.exists()) {
return new AFileRegular(filecurrent.getCanonicalFile());
}
Expand Down
1 change: 1 addition & 0 deletions src/net/sourceforge/plantuml/BlockUmlBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ public BlockUmlBuilder(List<String> config, String charset, Defines defines, Rea
includer.close();
usedFiles = includer.getFilesUsed();
}
reader.close();
}
}

Expand Down
31 changes: 31 additions & 0 deletions src/net/sourceforge/plantuml/FileFormat.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,13 @@
import java.awt.geom.Rectangle2D;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;

import net.sourceforge.plantuml.braille.BrailleCharFactory;
import net.sourceforge.plantuml.braille.UGraphicBraille;
import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.png.MetadataTag;
import net.sourceforge.plantuml.svg.SvgGraphics;
import net.sourceforge.plantuml.ugraphic.UFont;

/**
Expand Down Expand Up @@ -202,4 +205,32 @@ private String computeFilenameInternal(String name, int i) {
return name.replaceAll("\\" + getFileSuffix() + "$",
OptionFlags.getInstance().getFileSeparator() + String.format("%03d", i) + getFileSuffix());
}

public boolean doesSupportMetadata() {
return this == PNG || this == SVG;
}

public boolean equalsMetadata(String currentMetadata, File existingFile) {
try {
if (this == PNG) {
final MetadataTag tag = new MetadataTag(existingFile, "plantuml");
final String previousMetadata = tag.getData();
final boolean sameMetadata = currentMetadata.equals(previousMetadata);
return sameMetadata;
}
if (this == SVG) {
final String svg = FileUtils.readSvg(existingFile);
final String currentSignature = SvgGraphics.getMD5Hex(currentMetadata);
final int idx = svg.lastIndexOf(SvgGraphics.MD5_HEADER);
if (idx != -1) {
final String part = svg.substring(idx + SvgGraphics.MD5_HEADER.length());
return part.startsWith(currentSignature);
}

}
} catch (IOException e) {
e.printStackTrace();
}
return false;
}
}
16 changes: 8 additions & 8 deletions src/net/sourceforge/plantuml/Log.java
Original file line number Diff line number Diff line change
Expand Up @@ -97,16 +97,16 @@ private static String format(String s) {
}

public static void println(Object s) {
if (header2.get() == null) {
System.err.println("L = " + s);
} else {
System.err.println(header2.get() + " " + 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<String>();

// private static final ThreadLocal<String> header2 = new ThreadLocal<String>();
//
public static void header(String s) {
header2.set(s);
// header2.set(s);
}
}
11 changes: 6 additions & 5 deletions src/net/sourceforge/plantuml/OptionPrint.java
Original file line number Diff line number Diff line change
Expand Up @@ -192,12 +192,13 @@ public static void printVersion() throws InterruptedException {

public static Collection<String> interestingProperties() {
final Properties p = System.getProperties();
final List<String> all = withIp() ? Arrays.asList("java.runtime.name", "Java Runtime", "java.vm.name", "JVM",
final List<String> list1 = Arrays.asList("java.runtime.name", "Java Runtime", "java.vm.name", "JVM",
"java.runtime.version", "Java Version", "os.name", "Operating System", "file.encoding",
"Default Encoding", "user.language", "Language", "user.country", "Country") : Arrays.asList(
"java.runtime.name", "Java Runtime", "java.vm.name", "JVM", "java.runtime.version", "Java Version",
"os.name", "Operating System", "os.version", "OS Version", "file.encoding", "Default Encoding",
"user.language", "Language", "user.country", "Country");
"Default Encoding", "user.language", "Language", "user.country", "Country");
final List<String> list2 = Arrays.asList("java.runtime.name", "Java Runtime", "java.vm.name", "JVM",
"java.runtime.version", "Java Version", "os.name", "Operating System", /* "os.version", "OS Version", */
"file.encoding", "Default Encoding", "user.language", "Language", "user.country", "Country");
final List<String> all = withIp() ? list1 : list2;
final List<String> result = new ArrayList<String>();
for (int i = 0; i < all.size(); i += 2) {
result.add(all.get(i + 1) + ": " + p.getProperty(all.get(i)));
Expand Down
4 changes: 2 additions & 2 deletions src/net/sourceforge/plantuml/PSystemBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -145,14 +145,13 @@ private static List<PSystemFactory> getAllFactories(ISkinSimple skinParam) {
final List<PSystemFactory> factories = new ArrayList<PSystemFactory>();
factories.add(new PSystemWelcomeFactory());
factories.add(new PSystemColorsFactory());
factories.add(new ListSpriteDiagramFactory(skinParam));
factories.add(new SequenceDiagramFactory(skinParam));
factories.add(new ClassDiagramFactory(skinParam));
factories.add(new ActivityDiagramFactory(skinParam));
factories.add(new DescriptionDiagramFactory(skinParam));
factories.add(new StateDiagramFactory(skinParam));
factories.add(new ActivityDiagramFactory3(skinParam));
factories.add(new CompositeDiagramFactory(skinParam));
// factories.add(new CompositeDiagramFactory(skinParam));
factories.add(new BpmDiagramFactory(DiagramType.BPM));
// factories.add(new PostIdDiagramFactory());
factories.add(new PSystemLicenseFactory());
Expand All @@ -179,6 +178,7 @@ private static List<PSystemFactory> getAllFactories(ISkinSimple skinParam) {
factories.add(new PSystemSudokuFactory());
}
factories.add(new PSystemDefinitionFactory());
factories.add(new ListSpriteDiagramFactory(skinParam));
factories.add(new PSystemMathFactory(DiagramType.MATH));
factories.add(new PSystemLatexFactory(DiagramType.LATEX));
// factories.add(new PSystemStatsFactory());
Expand Down
15 changes: 7 additions & 8 deletions src/net/sourceforge/plantuml/PSystemUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
import net.sourceforge.plantuml.cucadiagram.CucaDiagram;
import net.sourceforge.plantuml.graphic.HtmlColorUtils;
import net.sourceforge.plantuml.html.CucaDiagramHtmlMaker;
import net.sourceforge.plantuml.png.MetadataTag;
import net.sourceforge.plantuml.png.PngSplitter;
import net.sourceforge.plantuml.project3.GanttDiagram;
import net.sourceforge.plantuml.sequencediagram.SequenceDiagram;
Expand All @@ -66,19 +65,19 @@ public static List<FileImageData> exportDiagrams(Diagram system, SuggestedFile s
public static List<FileImageData> exportDiagrams(Diagram system, SuggestedFile suggestedFile,
FileFormatOption fileFormatOption, boolean checkMetadata) throws IOException {

final File existing = suggestedFile.getFile(0);
if (checkMetadata && existing.exists() && system.getNbImages() == 1) {
final MetadataTag tag = new MetadataTag(existing, "plantuml");
final String previousMetadata = tag.getData();
final File existingFile = suggestedFile.getFile(0);
if (checkMetadata && fileFormatOption.getFileFormat().doesSupportMetadata() && existingFile.exists()
&& system.getNbImages() == 1) {
// final String version = Version.versionString();
// System.out.println(system.getMetadata());
// System.out.println(data);
// System.out.println(version);
// System.out.println(data.contains(version));
final boolean sameMetadata = system.getMetadata().equals(previousMetadata);
final boolean sameMetadata = fileFormatOption.getFileFormat().equalsMetadata(system.getMetadata(),
existingFile);
if (sameMetadata) {
Log.info("Skipping " + existing.getAbsolutePath() + " because metadata has not changed.");
return Arrays.asList(new FileImageData(existing, null));
Log.info("Skipping " + existingFile.getAbsolutePath() + " because metadata has not changed.");
return Arrays.asList(new FileImageData(existingFile, null));
}
}

Expand Down
4 changes: 3 additions & 1 deletion src/net/sourceforge/plantuml/Pipe.java
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,13 @@ public void managePipe(ErrorStatus error) throws IOException {
} else if (option.isPipeMap()) {
final String result = sourceStringReader.getCMapData(option.getImageIndex(),
option.getFileFormatOption());
// https://forum.plantuml.net/10049/2019-pipemap-diagrams-containing-links-give-zero-exit-code
// We don't check errors
error.goOk();
if (result == null) {
ps.println();
} else {
ps.println(result);
error.goOk();
}
} else {
final OutputStream os = noStdErr ? new ByteArrayOutputStream() : ps;
Expand Down
24 changes: 13 additions & 11 deletions src/net/sourceforge/plantuml/SignatureUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,14 @@

public class SignatureUtils {

// private static byte[] salting(String pass, byte[] salt) throws NoSuchAlgorithmException, InvalidKeySpecException,
// UnsupportedEncodingException {
// final byte[] tmp = salting2(pass, salt);
// return SignatureUtils.getSHA512raw(tmp);
// }

public static byte[] salting(String pass, byte[] salt) throws NoSuchAlgorithmException, InvalidKeySpecException {
// private static byte[] salting(String pass, byte[] salt) throws NoSuchAlgorithmException, InvalidKeySpecException,
// UnsupportedEncodingException {
// final byte[] tmp = salting2(pass, salt);
// return SignatureUtils.getSHA512raw(tmp);
// }

public static synchronized byte[] salting(String pass, byte[] salt) throws NoSuchAlgorithmException,
InvalidKeySpecException {
final int iterations = 500;
final int keyLength = 512;
final SecretKeyFactory skf = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA1");
Expand Down Expand Up @@ -122,7 +123,7 @@ public static String getSHA512Hex(String s) {
}
}

public static byte[] getMD5raw(String s) throws NoSuchAlgorithmException, UnsupportedEncodingException {
public static synchronized byte[] getMD5raw(String s) throws NoSuchAlgorithmException, UnsupportedEncodingException {
final MessageDigest msgDigest = MessageDigest.getInstance("MD5");
msgDigest.update(s.getBytes("UTF-8"));
return msgDigest.digest();
Expand All @@ -132,7 +133,8 @@ public static byte[] getSHA512raw(String s) throws NoSuchAlgorithmException, Uns
return getSHA512raw(s.getBytes("UTF-8"));
}

public static byte[] getSHA512raw(byte data[]) throws NoSuchAlgorithmException, UnsupportedEncodingException {
public static synchronized byte[] getSHA512raw(byte data[]) throws NoSuchAlgorithmException,
UnsupportedEncodingException {
final MessageDigest msgDigest = MessageDigest.getInstance("SHA-512");
msgDigest.update(data);
return msgDigest.digest();
Expand All @@ -147,7 +149,7 @@ public static String getSignatureSha512(File f) throws IOException {
}
}

public static String getSignatureSha512(InputStream is) throws IOException {
public static synchronized String getSignatureSha512(InputStream is) throws IOException {
try {
final MessageDigest msgDigest = MessageDigest.getInstance("SHA-512");
int read = 0;
Expand Down Expand Up @@ -178,7 +180,7 @@ public static String purge(String s) {
return s;
}

public static String getSignature(File f) throws IOException {
public static synchronized String getSignature(File f) throws IOException {
try {
final MessageDigest msgDigest = MessageDigest.getInstance("MD5");
final FileInputStream is = new FileInputStream(f);
Expand Down
13 changes: 6 additions & 7 deletions src/net/sourceforge/plantuml/SkinParam.java
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,12 @@ private SkinParam(UmlDiagramType type) {
if (type == UmlDiagramType.WBS) {
USE_STYLE2.set(true);
}
// if (type == UmlDiagramType.SEQUENCE) {
// skin = "debug.skin";
// USE_STYLE2.set(true);
// }
// if (type == UmlDiagramType.SEQUENCE) {
// // skin = "debug.skin";
// USE_STYLE2.set(true);
// }
// if (type == UmlDiagramType.ACTIVITY) {
// skin = "debug.skin";
// // skin = "debug.skin";
// USE_STYLE2.set(true);
// }
}
Expand Down Expand Up @@ -177,8 +177,7 @@ public void setParam(String key, String value) {
}
if (USE_STYLES()) {
final FromSkinparamToStyle convertor = new FromSkinparamToStyle(key2, value, getCurrentStyleBuilder());
final Style style = convertor.getStyle();
if (style != null) {
for (Style style : convertor.getStyles()) {
muteStyle(style);
}
}
Expand Down
4 changes: 3 additions & 1 deletion src/net/sourceforge/plantuml/SourceFileReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@

import java.io.File;
import java.io.IOException;
import java.io.Reader;
import java.util.Collections;
import java.util.List;

Expand Down Expand Up @@ -83,7 +84,8 @@ public SourceFileReader(Defines defines, final File file, File outputDirectory,
}
this.outputDirectory = outputDirectory;

builder = new BlockUmlBuilder(config, charset, defines, getReader(charset), file.getAbsoluteFile()
final Reader reader = getReader(charset);
builder = new BlockUmlBuilder(config, charset, defines, reader, file.getAbsoluteFile()
.getParentFile(), FileWithSuffix.getFileName(file));
}

Expand Down
1 change: 1 addition & 0 deletions src/net/sourceforge/plantuml/SourceFileReaderAbstract.java
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ final public List<GeneratedImage> getGeneratedImages() throws IOException {
try {
system = blockUml.getDiagram();
} catch (Throwable t) {
t.printStackTrace();
return getCrashedImage(blockUml, t, suggested.getFile(0));
}

Expand Down
1 change: 0 additions & 1 deletion src/net/sourceforge/plantuml/SourceFileReaderCopyCat.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@

import java.io.File;
import java.io.IOException;
import java.util.Collections;
import java.util.List;

import net.sourceforge.plantuml.preproc.Defines;
Expand Down
5 changes: 5 additions & 0 deletions src/net/sourceforge/plantuml/StringLocated.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ public String toString() {
return s;
}

public StringLocated append(String endOfLine) {
return new StringLocated(s + endOfLine, location, preprocessorError);
}

public StringLocated(String s, LineLocation location, String preprocessorError) {
if (s == null) {
throw new IllegalArgumentException();
Expand Down Expand Up @@ -131,4 +135,5 @@ public long getFoxSignature() {
}
return fox;
}

}
Loading

0 comments on commit 90372b9

Please sign in to comment.