1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-09-27 14:39:02 +00:00

version 1.2018.6

This commit is contained in:
Arnaud Roques 2018-05-21 15:07:09 +02:00
parent 14e1e6671c
commit d7ecae5722
10 changed files with 53 additions and 23 deletions

View File

@ -30,7 +30,8 @@
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>

View File

@ -40,6 +40,9 @@ import java.io.File;
import net.sourceforge.plantuml.core.ImageData;
public class FileImageData {
public static final int ERROR = 400;
public static final int CRASH = 503;
private final File file;
private final ImageData imageData;
@ -57,4 +60,11 @@ public class FileImageData {
return imageData;
}
public int getStatus() {
if (imageData == null) {
return 0;
}
return imageData.getStatus();
}
}

View File

@ -150,7 +150,7 @@ public class PSystemError extends AbstractPSystem {
}
imageBuilder.setUDrawable(udrawable);
final ImageData imageData = imageBuilder.writeImageTOBEMOVED(fileFormat, seed(), os);
((ImageDataAbstract) imageData).setStatus(400);
((ImageDataAbstract) imageData).setStatus(FileImageData.ERROR);
return imageData;
}

View File

@ -195,12 +195,24 @@ public class Run {
}
public static void forceOpenJdkResourceLoad() {
final BufferedImage imDummy = new BufferedImage(10, 10, BufferedImage.TYPE_INT_RGB);
final Graphics2D gg = imDummy.createGraphics();
final String text = "Alice";
final Font font = new Font("SansSerif", Font.PLAIN, 12);
final FontMetrics fm = gg.getFontMetrics(font);
final Rectangle2D rect = fm.getStringBounds(text, gg);
if (isOpenJdkRunning()) {
// see https://github.com/plantuml/plantuml/issues/123
Log.info("Forcing resource load on OpenJdk");
final BufferedImage imDummy = new BufferedImage(10, 10, BufferedImage.TYPE_INT_RGB);
final Graphics2D gg = imDummy.createGraphics();
final String text = "Alice";
final Font font = new Font("SansSerif", Font.PLAIN, 12);
final FontMetrics fm = gg.getFontMetrics(font);
final Rectangle2D rect = fm.getStringBounds(text, gg);
}
}
public static boolean isOpenJdkRunning() {
final String jvmName = System.getProperty("java.vm.name");
if (jvmName != null && jvmName.toLowerCase().contains("openjdk")) {
return true;
}
return false;
}
private static void encodeSprite(List<String> result) throws IOException {

View File

@ -103,7 +103,7 @@ public abstract class SourceFileReaderAbstract {
}
private List<GeneratedImage> getCrashedImage(BlockUml blockUml, Throwable t, File outputFile) throws IOException {
final GeneratedImage image = new GeneratedImageImpl(outputFile, "Crash Error", blockUml, 503);
final GeneratedImage image = new GeneratedImageImpl(outputFile, "Crash Error", blockUml, FileImageData.CRASH);
OutputStream os = null;
try {
os = new BufferedOutputStream(new FileOutputStream(outputFile));
@ -150,7 +150,8 @@ public abstract class SourceFileReaderAbstract {
}
OptionFlags.getInstance().logData(file, system);
final List<FileImageData> exportDiagrams = PSystemUtils.exportDiagrams(system, suggested, fileFormatOption, checkMetadata);
final List<FileImageData> exportDiagrams = PSystemUtils.exportDiagrams(system, suggested, fileFormatOption,
checkMetadata);
if (exportDiagrams.size() > 1) {
cpt += exportDiagrams.size() - 1;
}
@ -159,7 +160,7 @@ public abstract class SourceFileReaderAbstract {
final String desc = "[" + file.getName() + "] " + system.getDescription();
final File f = fdata.getFile();
exportWarnOrErrIfWord(f, system);
final GeneratedImage generatedImage = new GeneratedImageImpl(f, desc, blockUml, fdata.getImageData().getStatus());
final GeneratedImage generatedImage = new GeneratedImageImpl(f, desc, blockUml, fdata.getStatus());
result.add(generatedImage);
}

View File

@ -101,7 +101,7 @@ public class ActivityDiagram extends CucaDiagram {
}
private void updateLasts(final IEntity result) {
if (result.getLeafType() == LeafType.NOTE) {
if (result == null || result.getLeafType() == LeafType.NOTE) {
return;
}
this.lastEntityConsulted = result;

View File

@ -113,6 +113,9 @@ public class CommandLinkLongActivity extends CommandMultilines2<ActivityDiagram>
final RegexResult line0 = getStartingPattern().matcher(StringUtils.trin(lines.getFirst499()));
final IEntity entity1 = CommandLinkActivity.getEntity(diagram, line0, true);
if (entity1 == null) {
return CommandExecutionResult.error("No such entity");
}
if (line0.get("STEREOTYPE", 0) != null) {
entity1.setStereotype(new Stereotype(line0.get("STEREOTYPE", 0)));
@ -168,7 +171,11 @@ public class CommandLinkLongActivity extends CommandMultilines2<ActivityDiagram>
diagram.gotoGroup2(Code.of(partition), Display.getWithNewlines(partition), GroupType.PACKAGE, null,
NamespaceStrategy.SINGLE);
}
final IEntity entity2 = diagram.createLeaf(code, Display.getWithNewlines(display), LeafType.ACTIVITY, null);
final IEntity entity2 = diagram.getOrCreate(code, Display.getWithNewlines(display), LeafType.ACTIVITY);
if (entity2 == null) {
return CommandExecutionResult.error("No such entity");
}
if (partition != null) {
diagram.endGroup();
}
@ -184,10 +191,6 @@ public class CommandLinkLongActivity extends CommandMultilines2<ActivityDiagram>
.getColorIfValid(lineLast.get(4)));
}
if (entity1 == null || entity2 == null) {
return CommandExecutionResult.error("No such entity");
}
final String arrowBody1 = CommandLinkClass.notNull(line0.get("ARROW_BODY1", 0));
final String arrowBody2 = CommandLinkClass.notNull(line0.get("ARROW_BODY2", 0));
final String arrowDirection = CommandLinkClass.notNull(line0.get("ARROW_DIRECTION", 0));

View File

@ -76,8 +76,8 @@ public class TranscoderSmart implements Transcoder {
}
// Text prefix
// Just a wild try: use them only for testing
if (code.startsWith("-zlib-")) {
return zlibBase64.decode(code.substring("-zlib-".length()));
if (code.startsWith("-deflate-")) {
return zlibBase64.decode(code.substring("-deflate-".length()));
}
if (code.startsWith("-brotli-")) {
return brotliBase64.decode(code.substring("-brotli-".length()));

View File

@ -48,12 +48,15 @@ class GraphvizLinux extends AbstractGraphviz {
@Override
protected File specificDotExe() {
final File usrLocalBinDot = new File("/usr/local/bin/dot");
if (usrLocalBinDot.exists()) {
return usrLocalBinDot;
}
final File usrBinDot = new File("/usr/bin/dot");
return usrBinDot;
if (usrBinDot.exists()) {
return usrBinDot;
}
final File optLocalBinDot = new File("/opt/local/bin/dot");
return optLocalBinDot;
}
}

View File

@ -43,7 +43,7 @@ public class Version {
private static final int MAJOR_SEPARATOR = 1000000;
public static int version() {
return 1201805;
return 1201806;
}
public static int versionPatched() {
@ -88,7 +88,7 @@ public class Version {
}
public static long compileTime() {
return 1525550417984L;
return 1526898893430L;
}
public static String compileTimeString() {