diff --git a/README.md b/README.md
index 1681d6c..ed88526 100644
--- a/README.md
+++ b/README.md
@@ -16,8 +16,10 @@ Download PNML2NUPN executable jar from its [companion web site](http://pnml.lip6
pnml2nupn simply runs on the command line. It is expecting either a set of paths to
PNML files, or to folders containing them, or a mix of files and folders. It scans folders recursively, looking for PNML files.
-**Requirement:**
- Since version 3.0.0, pnml2nupn runs on Java 11+. Prior versions 2.x.x run on Java 7 to Java 8. Starting from 3.0.0, pnml2nupn will not run on Java below 11.
+### Requirement:
+ - Starting from version 4.0.0, pnml2nupn runs on Java17+.
+ - In versions 3.x.x, it runs on Java 11+ (starting from 3.0.0, pnml2nupn will not run on Java below 11).
+ - Prior versions 2.x.x run on Java 7 to Java 8.
### Command-line invocation
diff --git a/fr.lip6.move.pnml2nupn/META-INF/MANIFEST.MF b/fr.lip6.move.pnml2nupn/META-INF/MANIFEST.MF
index f0e7bd8..650d87d 100644
--- a/fr.lip6.move.pnml2nupn/META-INF/MANIFEST.MF
+++ b/fr.lip6.move.pnml2nupn/META-INF/MANIFEST.MF
@@ -4,7 +4,7 @@ Bundle-ManifestVersion: 2
Bundle-Name: PNML to Nested Units Petri Nets Translation Tool
Bundle-SymbolicName: fr.lip6.pnml.pnml2nupn;singleton:=true
Bundle-Version: 3.3.0
-Bundle-RequiredExecutionEnvironment: JavaSE-11
+Bundle-RequiredExecutionEnvironment: JavaSE-17
Export-Package: fr.lip6.move.pnml2nupn;uses:="org.eclipse.jface.resource,org.eclipse.ui.plugin,org.osgi.framework",
fr.lip6.move.pnml2nupn.exceptions,
fr.lip6.move.pnml2nupn.export;uses:="org.slf4j",
diff --git a/fr.lip6.move.pnml2nupn/pom.xml b/fr.lip6.move.pnml2nupn/pom.xml
index c4ce803..1065ad1 100644
--- a/fr.lip6.move.pnml2nupn/pom.xml
+++ b/fr.lip6.move.pnml2nupn/pom.xml
@@ -6,7 +6,7 @@
fr.lip6.pnml
pnml2nupn
- 3.3.0
+ 4.0.0
jar
@@ -22,8 +22,8 @@
UTF-8
META-INF
java
- 11
- 11
+ 17
+ 17
@@ -143,11 +143,6 @@
jaxb-impl
3.0.2
-
- fr.lip6.pnml
- fr.lip6.pnml.cami2pnml
- 2.2.0
-
com.ximpleware
vtd-xml
@@ -158,6 +153,16 @@
fastutil
8.5.6
+
+ org.slf4j
+ slf4j-api
+ 1.7.36
+
+
+ ch.qos.logback
+ logback-classic
+ 1.2.10
+
@@ -182,9 +187,10 @@
src/main/resources
main/resources
-
- bounds
-
+
+ bounds
+ safety
+
src/main/resources
@@ -314,6 +320,11 @@
+
+ org.cyclonedx
+ cyclonedx-maven-plugin
+ 2.5.3
+
diff --git a/fr.lip6.move.pnml2nupn/src/fr/lip6/move/pnml2nupn/MainPNML2NUPN.java b/fr.lip6.move.pnml2nupn/src/fr/lip6/move/pnml2nupn/MainPNML2NUPN.java
index 61af0f8..3bb31d7 100644
--- a/fr.lip6.move.pnml2nupn/src/fr/lip6/move/pnml2nupn/MainPNML2NUPN.java
+++ b/fr.lip6.move.pnml2nupn/src/fr/lip6/move/pnml2nupn/MainPNML2NUPN.java
@@ -417,22 +417,24 @@ public static boolean isForceNUPNGen() {
}
/**
- * Returns true if unit safeness checking is enabled (default), false otherwise.
+ * Returns true if unit safeness checking is enabled, false otherwise.
+ * Permanently disabled since v4.0.0
*
* @return
*/
public static boolean isUnitSafenessChecking() {
- return boolOptionsMap.getBoolean(UNIT_SAFENESS_CHECKING);
+ return false;
}
/**
* Returns true if unit safeness checking only is enabled, false otherwise
* (default).
+ * Permanently disabled since v4.0.0
*
* @return
*/
public static boolean isUnitSafenessCheckingOnly() {
- return boolOptionsMap.getBoolean(UNIT_SAFENESS_CHECKING_ONLY);
+ return false;
}
public static boolean isPreserveNupnMix() {
diff --git a/fr.lip6.move.pnml2nupn/src/fr/lip6/move/pnml2nupn/export/impl/ExportUtils.java b/fr.lip6.move.pnml2nupn/src/fr/lip6/move/pnml2nupn/export/impl/ExportUtils.java
index 3aaf8f4..784daa5 100644
--- a/fr.lip6.move.pnml2nupn/src/fr/lip6/move/pnml2nupn/export/impl/ExportUtils.java
+++ b/fr.lip6.move.pnml2nupn/src/fr/lip6/move/pnml2nupn/export/impl/ExportUtils.java
@@ -14,9 +14,7 @@
import com.ximpleware.extended.XPathParseExceptionHuge;
import fr.lip6.move.pnml2nupn.MainPNML2NUPN;
-import fr.lip6.move.pnml2nupn.exceptions.PNMLImportExportException;
import fr.lip6.move.pnml2nupn.utils.PNML2NUPNUtils;
-import fr.lip6.move.pnml2nupn.utils.SafePNChecker;
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
/**
@@ -58,19 +56,6 @@ public static boolean isPTNet(AutoPilotHuge ap, VTDNavHuge vn, Logger logger)
return result;
}
- /**
- * Checks that the currently analyzed net is 1-safe
- *
- * @return true if the net is 1-safe
- * @throws IOException
- * @throws PNMLImportExportException
- */
- public static boolean isNet1Safe(SafePNChecker spnc, File inputFile) throws IOException, PNMLImportExportException {
- spnc.setPnmlDocPath(inputFile.getCanonicalPath());
- boolean res = spnc.isNet1Safe();
- return res;
- }
-
/**
* Inserts unit safeness pragma (as reported by the unit safeness checking tool)
* @param nupnQueue the output queue
diff --git a/fr.lip6.move.pnml2nupn/src/fr/lip6/move/pnml2nupn/export/impl/PNML2NUPNExporterImpl.java b/fr.lip6.move.pnml2nupn/src/fr/lip6/move/pnml2nupn/export/impl/PNML2NUPNExporterImpl.java
index ad7f75a..4e73b05 100644
--- a/fr.lip6.move.pnml2nupn/src/fr/lip6/move/pnml2nupn/export/impl/PNML2NUPNExporterImpl.java
+++ b/fr.lip6.move.pnml2nupn/src/fr/lip6/move/pnml2nupn/export/impl/PNML2NUPNExporterImpl.java
@@ -43,7 +43,6 @@
import fr.lip6.move.pnml2nupn.exceptions.PNMLImportExportException;
import fr.lip6.move.pnml2nupn.export.PNML2NUPNExporter;
import fr.lip6.move.pnml2nupn.utils.PNML2NUPNUtils;
-import fr.lip6.move.pnml2nupn.utils.SafePNChecker;
import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap;
import it.unimi.dsi.fastutil.longs.LongAVLTreeSet;
import it.unimi.dsi.fastutil.longs.LongArrayList;
@@ -79,7 +78,6 @@ public final class PNML2NUPNExporterImpl implements PNML2NUPNExporter {
private Object2LongOpenHashMap unsafeArcsMap;
private File currentInputFile;
- private SafePNChecker spnc;
private long nbUnsafeArcs, nbUnsafePlaces, nbUnsafeTrans;
private long nbTransIn, nbTransOut, nbTransInOut;
// For places and transitions id count
@@ -109,9 +107,7 @@ public final class PNML2NUPNExporterImpl implements PNML2NUPNExporter {
/* For greatest label length - since v-3.0.0. */
private int labelLength;
- public PNML2NUPNExporterImpl() {
- spnc = new SafePNChecker();
- }
+ public PNML2NUPNExporterImpl() {}
@Override
public void export2NUPN(URI inFile, URI outFile, Logger journal)
@@ -301,47 +297,9 @@ private void translateIntoNUPN(File inFile, File outFile, Logger journal) throws
"The net in the document is not a P/T Net. Only P/T Nets are supported: "
+ this.currentInputFile.getCanonicalPath());
}
- // The net must be 1-safe, if bounds checking is enabled.
- if (MainPNML2NUPN.isUnitSafenessChecking()) {
- logger.info("Checking if this net is 1-Safe.");
- if (!(isSafe = ExportUtils.isNet1Safe(spnc, this.currentInputFile))) {
- if (SafePNChecker.isBoundsVerdictInconclusive()) {
- journal.warn(
- "This net cannot be proven 1-safe or unsafe (the Bounds tool could not compute the bounds using structural analysis of place bounds): "
- + this.currentInputFile.getCanonicalPath());
- } else {
- journal.error(
- "This net is not 1-safe (proven by the Bounds tool using structural analysis of place bounds): "
- + this.currentInputFile.getCanonicalPath());
- journal.error("\nUNSAFE PLACES: {}", generateUnsafePlacesReport());
- }
-
- if (MainPNML2NUPN.isForceNUPNGen() && !MainPNML2NUPN.isUnitSafenessCheckingOnly()) {
- journal.warn("Forced NUPN generation is set => Continuing NUPN generation.");
- } else {
- if (!MainPNML2NUPN.isUnitSafenessCheckingOnly()) {
- if (SafePNChecker.isBoundsVerdictInconclusive()) {
- journal.warn(
- "Potentially unsafe net (inconclusive verdict by the Bounds tool) => Continuing NUPN generation.");
- } else {
- throw new InvalidSafeNetException(
- "Unsafe net in " + this.currentInputFile.getCanonicalPath());
- }
- }
- }
- } else {
- logger.info(
- "This net is 1-safe (proven by the Bounds tool using structural analysis of place bounds): {}",
- this.currentInputFile.getCanonicalPath());
- }
- if (MainPNML2NUPN.isUnitSafenessCheckingOnly()) {
- journal.info("Unit safeness checking only requested. Will stop here.");
- throw new EarlyStopException(
- "Unit safeness checking only requested on " + this.currentInputFile.getCanonicalPath());
- }
- } else {
- logger.warn("Unit safeness checking is disabled. I don't know if this net is 1-Safe.");
- }
+ // The net must be 1-safe, but bounds checking is no longer supported from v4.0.0
+ logger.warn("Unit safeness checking is permanently disabled. I don't know if this net is 1-Safe.");
+
// Open NUPN and mapping files channels, and init write queues
outTSFile = new File(PNML2NUPNUtils.extractBaseName(outFile.getCanonicalPath()) + NUPNConstants.TRANS_EXT);
outPSFile = new File(PNML2NUPNUtils.extractBaseName(outFile.getCanonicalPath()) + NUPNConstants.STATES_EXT);
@@ -408,9 +366,6 @@ private void translateIntoNUPN(File inFile, File outFile, Logger journal) throws
// clear maps
clearAllCollections();
logger.info("See NUPN file: {}", outFile.getCanonicalPath());
- } catch (EarlyStopException e) {
- normalStop(outFile);
- throw e;
} catch (NavExceptionHuge | XPathParseExceptionHuge | XPathEvalExceptionHuge | InvalidSafeNetException
| InternalException | InvalidNetException e) {
emergencyStop(outFile);
@@ -688,11 +643,11 @@ private void buildUnsafeArcsPragma(BlockingQueue nupnQueue) throws Inter
// they could also have incoming arcs with valuation = 1...
arcVals = tr2InAllArcsMap.get(s);
if (arcVals != null) {
- long arcValsSafe = arcVals.stream().filter(v -> v == 1L).map(x -> x).reduce(0L, (a, b) -> a + b);
+ long arcValsSafe = arcVals.longStream().filter(v -> v == 1L).map(x -> x).reduce(0L, (a, b) -> a + b);
if (arcValsSafe > 0L) {
inValT += arcValsSafe;
warnMsg.append(", safe incoming arc(s) with respective valuation(s):");
- arcVals.stream().filter(v -> v == 1).forEach(v -> {
+ arcVals.longStream().filter(v -> v == 1).forEach(v -> {
warnMsg.append(NUPNConstants.WS).append(v);
});
}
@@ -723,11 +678,11 @@ private void buildUnsafeArcsPragma(BlockingQueue nupnQueue) throws Inter
// they could also have outgoing arcs with valuation = 1...
arcVals = tr2OutAllArcsMap.get(s);
if (arcVals != null) {
- long arcValsSafe = arcVals.stream().filter(v -> v == 1L).map(x -> x).reduce(0L, (a, b) -> a + b);
+ long arcValsSafe = arcVals.longStream().filter(v -> v == 1L).map(x -> x).reduce(0L, (a, b) -> a + b);
if (arcValsSafe > 0L) {
outValT += arcValsSafe;
warnMsg.append(", and safe outgoing arc(s) with respective valuation(s):");
- arcVals.stream().filter(v -> v == 1).forEach(v -> {
+ arcVals.longStream().filter(v -> v == 1).forEach(v -> {
warnMsg.append(NUPNConstants.WS).append(v);
});
}
@@ -770,11 +725,11 @@ private void buildUnsafeArcsPragma(BlockingQueue nupnQueue) throws Inter
// they could also have outgoing arcs with valuation = 1...
arcVals = tr2OutAllArcsMap.get(s);
if (arcVals != null) {
- long arcValsSafe = arcVals.stream().filter(v -> v == 1).map(x -> x).reduce(0L, (a, b) -> a + b);
+ long arcValsSafe = arcVals.longStream().filter(v -> v == 1).map(x -> x).reduce(0L, (a, b) -> a + b);
if (arcValsSafe > 0L) {
outValT += arcValsSafe;
warnMsg.append(", safe outgoing arc(s) with respective valuation(s):");
- arcVals.stream().filter(v -> v == 1).forEach(v -> {
+ arcVals.longStream().filter(v -> v == 1).forEach(v -> {
warnMsg.append(NUPNConstants.WS).append(v);
});
}
@@ -785,10 +740,10 @@ private void buildUnsafeArcsPragma(BlockingQueue nupnQueue) throws Inter
if (arcVals != null) {
warnMsg.append(", and ").append(arcVals.size64())
.append(" safe incoming arc(s) with respective valuation(s):");
- long arcValsSafe = arcVals.stream().filter(v -> v == 1).map(x -> x).reduce(0L, (a, b) -> a + b);
+ long arcValsSafe = arcVals.longStream().filter(v -> v == 1).map(x -> x).reduce(0L, (a, b) -> a + b);
if (arcValsSafe > 0L) {
inValT += arcValsSafe;
- arcVals.stream().filter(v -> v == 1).forEach(v -> {
+ arcVals.longStream().filter(v -> v == 1).forEach(v -> {
warnMsg.append(NUPNConstants.WS).append(v);
});
}
@@ -1160,7 +1115,7 @@ private void exportPlacesIntoUnits(AutoPilotHuge ap, VTDNavHuge vn, BlockingQueu
"List of consecutive places IDs not being in arithmetic progression in unit {} ({}): {}",
unitSId, unitLId, faultyIds.toString());
logger.error("Consequently, the NUPN output for units will not be syntax-compliant.");
- placesIntId.stream().forEach(i -> nupnsb.append(NUPNConstants.WS).append(i));
+ placesIntId.longStream().forEach(i -> nupnsb.append(NUPNConstants.WS).append(i));
faultyIds.clear();
} else {
nupnsb.append(NUPNConstants.WS).append(placesIntId.getLong(0)).append(NUPNConstants.DOTS)
@@ -1246,8 +1201,8 @@ private void exportPlacesIntoUnits(AutoPilotHuge ap, VTDNavHuge vn, BlockingQueu
}
// Then the rest
- List otherPlaces = placesId2NupnMap.values().stream().filter(v -> !initPlaces.contains(v)).sorted()
- .collect(Collectors.toList());
+ List otherPlaces = placesId2NupnMap.values().longStream().filter(v -> !initPlaces.contains(v)).sorted()
+ .collect(ArrayList::new, ArrayList::add, ArrayList::addAll);
for (Long nupnId : otherPlaces) {
nupnsb.append(NUPNConstants.U).append(count).append(NUPNConstants.WS).append(NUPNConstants.HK)
.append(NUPNConstants.ONE).append(NUPNConstants.WS).append(nupnId).append(NUPNConstants.DOTS)
@@ -1311,10 +1266,6 @@ private void exportPlacesIntoUnits(AutoPilotHuge ap, VTDNavHuge vn, BlockingQueu
}
}
- private String generateUnsafePlacesReport() {
- return spnc.getExplanation();
- }
-
/**
* Inits the log.
*
@@ -1410,17 +1361,6 @@ private void emergencyStop(File outFile) throws InterruptedException, IOExceptio
logger.error("Emergency stop. Cancelled the translation and released opened resources.");
}
- /**
- * Normal stop.
- *
- * @param outFile
- * @throws InterruptedException
- * @throws IOException
- */
- private void normalStop(File outFile) throws InterruptedException, IOException {
- stop(outFile);
- }
-
/**
* Stops NUPN writers and releases resources
*
diff --git a/fr.lip6.move.pnml2nupn/src/fr/lip6/move/pnml2nupn/utils/PNML2NUPNUtils.java b/fr.lip6.move.pnml2nupn/src/fr/lip6/move/pnml2nupn/utils/PNML2NUPNUtils.java
index 1cc8d00..74997c5 100644
--- a/fr.lip6.move.pnml2nupn/src/fr/lip6/move/pnml2nupn/utils/PNML2NUPNUtils.java
+++ b/fr.lip6.move.pnml2nupn/src/fr/lip6/move/pnml2nupn/utils/PNML2NUPNUtils.java
@@ -422,7 +422,7 @@ public static final long arithmeticProgression(LongList ll) {
}
public static final long sum(LongList ll) {
- return ll.stream().mapToLong(x -> x).sum();
+ return ll.longStream().sum();
}
/**
diff --git a/fr.lip6.move.pnml2nupn/src/fr/lip6/move/pnml2nupn/utils/SafePNChecker.java b/fr.lip6.move.pnml2nupn/src/fr/lip6/move/pnml2nupn/utils/SafePNChecker.java
deleted file mode 100644
index 1605159..0000000
--- a/fr.lip6.move.pnml2nupn/src/fr/lip6/move/pnml2nupn/utils/SafePNChecker.java
+++ /dev/null
@@ -1,322 +0,0 @@
-/**
- * Copyright 2014-2019 Université Paris Nanterre and Sorbonne Université,
- * CNRS, LIP6
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Project leader / Initial Contributor:
- * Lom Messan Hillah -
- */
-package fr.lip6.move.pnml2nupn.utils;
-
-import java.io.BufferedInputStream;
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Timer;
-import java.util.TimerTask;
-import java.util.concurrent.ExecutionException;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.slf4j.LoggerFactory;
-
-import fr.lip6.move.pnml.cpnami.cami.CamiFactory;
-import fr.lip6.move.pnml.cpnami.cami.Runner;
-import fr.lip6.move.pnml.cpnami.exceptions.CamiException;
-import fr.lip6.move.pnml2nupn.MainPNML2NUPN;
-import fr.lip6.move.pnml2nupn.exceptions.PNMLImportExportException;
-
-public final class SafePNChecker {
-
- private static final String SEP = ", ";
- private static final String CAMI_EXT = ".cami";
- private static final String PNML_EXT = ".pnml";
- private static final String UNKNOWN_CAMI_COMMAND = "Unknown CAMI command";
- private static final String JAVA_IO_TMPDIR = "java.io.tmpdir";
- private static final String TMP_DIR = System.getProperty("user.dir") + "/tmp/";
- private static final int ONE = 1;
- private static final int ZERO = 0;
- private static final String UNSAFE_PLACES_NB_REPORT = "unsafe.places.nb.report";
- private static String P2C_OPT = "-p2c";
- private static String BOUNDS = "bounds";
- private static String EXE = ".exe";
- private static String BOUNDS_INPACKAGE = "main/resources/bounds";
- private static String BOUNDS_PATTERN = "(.*)\\s\\[(\\d+).{3}(\\d+|o{2})\\]$";
-
- private String pnmlDocPath;
- private StringBuffer explain;
- private Timer timer;
- private int boundsExitValue;
- private org.slf4j.Logger log;
- /*The bounds tool might not be able to compute the bounds: [Cannot compute the bound...Cannot compute the bound]*/
- private static boolean inconclusive;
-
- public SafePNChecker(String pnmlDocumentPath) {
- this.setPnmlDocPath(pnmlDocumentPath);
- boundsExitValue = -99;
- initLog();
- }
-
- public SafePNChecker() {
- this.pnmlDocPath = null;
- initLog();
- }
-
- public String getPnmlDocPath() {
- return pnmlDocPath;
- }
-
- public void setPnmlDocPath(String pnmlDocPath) {
- this.pnmlDocPath = pnmlDocPath;
- }
-
- public boolean isNet1Safe() throws PNMLImportExportException {
- boolean res = false;
- if (pnmlDocPath != null) {
- File camiFile = transformPnml2Cami();
- File tmpBoundFile = createJavaTmpBoundsFile();
- try {
- PNML2NUPNUtils.extractFile(BOUNDS_INPACKAGE, tmpBoundFile.getCanonicalPath());
- tmpBoundFile.setExecutable(true);
- res = checkNetIs1Safe(camiFile, tmpBoundFile);
-
- } catch (IOException | ExecutionException e) {
- throw new PNMLImportExportException(e.getMessage(), e.getCause());
- } finally {
- deleteCamiFile(camiFile);
- cleanTmp(tmpBoundFile);
- }
- }
-
- return res;
- }
-
- public String getExplanation() {
- return explain.toString();
- }
-
- public static boolean isBoundsVerdictInconclusive(){
- return inconclusive;
- }
-
- private void initLog() {
- log = LoggerFactory.getLogger(SafePNChecker.class.getCanonicalName());
- explain = new StringBuffer();
- }
-
- private void deleteCamiFile(File camiFile) {
- if (MainPNML2NUPN.isCamiTmpDelete()) {
- camiFile.delete();
- }
- }
-
- private boolean checkNetIs1Safe(File camiFile, File tmpBoundFile) throws IOException, ExecutionException {
- boolean totalRes = true, neverMatched = true;
- boolean ligneRes;
- List command = new ArrayList();
- command.add(tmpBoundFile.getCanonicalPath());
- command.add(camiFile.getCanonicalPath());
- command.add("-i");
- int nbUnsafePlaces = 0; // -1 means all unsafe places must be reported
- String unsafeArcs = System.getProperty(UNSAFE_PLACES_NB_REPORT);
- if (unsafeArcs != null) {
- try {
- nbUnsafePlaces = Integer.valueOf(unsafeArcs).intValue();
- } catch (NumberFormatException e) {
- log.error("Could not convert nb of unsafe places to report from the input string");
- }
- }
- String line;
- Matcher m;
- long startTime = System.nanoTime();
- log.info("Launching the Bounds tool.");
- ProcessBuilder pb = new ProcessBuilder(command);
- Process pr = pb.start();
- InputStream stdOut = pr.getInputStream();
- BufferedReader br = new BufferedReader(new InputStreamReader(new BufferedInputStream(stdOut)));
- Pattern p = Pattern.compile(BOUNDS_PATTERN);
- line = br.readLine();
- if (line != null && UNKNOWN_CAMI_COMMAND.equalsIgnoreCase(line)) {
- totalRes = false;
- } else if (line != null) {
- do {
- m = p.matcher(line);
- if (m.matches()) {
- ligneRes = (checkBoundIsZeroOrOne(m.group(2)) && checkBoundIsZeroOrOne(m.group(3)));
- totalRes &= ligneRes;
- if (!ligneRes) {
- if (nbUnsafePlaces > 0) {
- explain.append(line).append(SEP);
- nbUnsafePlaces--;
- } else if (nbUnsafePlaces == -1) {
- explain.append(line).append(SEP);
- }
- }
- neverMatched = false;
- }
- } while ((line = br.readLine()) != null);
- }
- br.close();
- try {
- // wait for finishing bounds executable during a determined amount
- // of time.
- boundsExitValue = pr.waitFor();
- long endTime = System.nanoTime();
- log.info("The Bounds tool took {} seconds to perform the check.", (endTime - startTime) / 1.0e9);
- } catch (InterruptedException e) {
- totalRes = false;
- throw new ExecutionException("Interrupted while waiting for the Bounds tool to complete", e.getCause());
- }
- if (explain.length() != 0) {
- explain.delete(explain.length() - 2, explain.length());
- }
- if (neverMatched) {
- inconclusive = true;
- totalRes = false;
- } else {
- inconclusive = false;
- }
- return totalRes;
- }
-
- class StopWaitingTask extends TimerTask {
- Thread parent;
-
- public StopWaitingTask(Thread launcher) {
- parent = launcher;
- }
-
- @Override
- public void run() {
- if (boundsExitValue == -99) {
- timer.cancel();
- parent.interrupt();
- }
- }
- }
-
- private boolean checkBoundIsZeroOrOne(String bound) {
- return checkBoundIsZero(bound) || checkBoundIsOne(bound);
- }
-
- private boolean checkBoundIsZero(String bound) {
- try {
- int val = Integer.valueOf(bound).intValue();
- return val == ZERO;
- } catch (NumberFormatException e) {
- if (MainPNML2NUPN.isDebug())
- log.warn("While checking a bound is equal to 0: could not convert bound string {} to a number.", bound);
- return false;
- }
- }
-
- private boolean checkBoundIsOne(String bound) {
- try {
- int val = Integer.valueOf(bound).intValue();
- return val == ONE;
- } catch (NumberFormatException e) {
- if (MainPNML2NUPN.isDebug())
- log.warn("While checking a bound is equal to 1: could not convert bound string {} to a number.", bound);
- return false;
- }
- }
-
- private File createJavaTmpBoundsFile() {
- File tmpExeFile = null;
- boolean successful = true;
- String tmp = System.getProperty(JAVA_IO_TMPDIR);
- if (tmp != null) {
- try {
- tmpExeFile = File.createTempFile(BOUNDS, EXE);
- } catch (IOException e) {
- successful = false;
- e.printStackTrace();
- }
-
- } else { // default behaviour, will work on Linux and Mac only.
- tmp = TMP_DIR;
-
- successful = false;
- }
- if (!successful) {
- File tmpDir = new File(tmp);
- if (!tmpDir.exists()) {
- tmpDir.mkdir();
- }
- tmpExeFile = new File(tmp + BOUNDS);
- }
-
- return tmpExeFile;
- }
-
- @SuppressWarnings("unused")
- private File createSysTmpBoundsFile() {
- // default behaviour, will work on Linux and Mac.
- File dir = new File(TMP_DIR);
- if (!dir.exists()) {
- dir.mkdir();
- }
- File tmpExeFile = new File(TMP_DIR + BOUNDS + EXE);
- return tmpExeFile;
- }
-
- private void cleanTmp(File f) {
- f.delete();
- File tmpDir = new File(TMP_DIR);
- if (tmpDir.exists()) {
- tmpDir.delete();
- }
- }
-
- /**
- * Translates PNML P/T document into Cami The path to the PNML document must
- * be set with {@link #setPnmlDocPath(String)}, or passed to the
- * constructor.
- *
- * @throws PNMLImportExportException
- *
- */
- private File transformPnml2Cami() throws PNMLImportExportException {
- String[] arg = new String[] { P2C_OPT, pnmlDocPath };
-
- final Runner camiRunner = CamiFactory.SINSTANCE.createRunner();
- try {
- camiRunner.run(arg);
- // successful get the path to cami file
- int pnmlLI = pnmlDocPath.lastIndexOf(PNML_EXT);
- String camiFilePath = pnmlDocPath.substring(0, pnmlLI) + CAMI_EXT;
- File camiFile = new File(camiFilePath);
- if (!camiFile.exists()) {
- throw new CamiException("Transformation to Cami finished, but Cami file does not exist: "
- + camiFile.getCanonicalPath());
- }
- return camiFile;
- } catch (CamiException | IOException e) {
- throw new PNMLImportExportException(e.getMessage(), e.getCause());
- }
- }
-
- public static void main(String[] args) {
- // PNML2BPNUtils.extractFile("main/resources/bounds",
- // "resources/bounds");
- Pattern p = Pattern.compile(BOUNDS_PATTERN);
- Matcher m = p.matcher(args[0] + " " + args[1]);
- System.out.println(args[0] + " " + args[1]);
- boolean b = m.matches();
- if (b) {
- System.out.println("Matches!");
- System.out.println(m.group(2) + "..." + m.group(3));
- } else {
- System.out.println("Does not match!");
- }
- }
-
-}
diff --git a/fr.lip6.move.pnml2nupn/src/site/apt/changelog.apt.vm b/fr.lip6.move.pnml2nupn/src/site/apt/changelog.apt.vm
index eae02b5..a036c8e 100644
--- a/fr.lip6.move.pnml2nupn/src/site/apt/changelog.apt.vm
+++ b/fr.lip6.move.pnml2nupn/src/site/apt/changelog.apt.vm
@@ -18,12 +18,24 @@
Changelog of PNML to NUPN Converter ${project.version}
------
------
-2021-12-10
+2022-02-24
------
Changelog
-* What's new in version ${project.version}? (2021-12-10)
+* What's new in version ${project.version}? (2022-02-24)
+
+ * Switch to type-specific stream method on Long collections.
+
+ * Remove support for the Bounds tool.
+
+ * Remove dependency on cami2pnml.
+
+ * Add explicit dependencies on logback and sfl4j.
+
+ * Upgrade runtime environment to Java 17.
+
+* What's new in version 3.3.0? (2021-12-10)
* Merge pull request {{{https://github.com/lip6/pnml2nupn/pull/3}#3}} which allows the initial marking to be the empty set, as defined in the {{{https://cadp.inria.fr/man/nupn.html#sect3}NUPN manual}}.
diff --git a/fr.lip6.move.pnml2nupn/src/site/apt/download.apt.vm b/fr.lip6.move.pnml2nupn/src/site/apt/download.apt.vm
index 6b6a480..03b8b3c 100644
--- a/fr.lip6.move.pnml2nupn/src/site/apt/download.apt.vm
+++ b/fr.lip6.move.pnml2nupn/src/site/apt/download.apt.vm
@@ -15,7 +15,7 @@
Download PNML to NUPN Converter ${project.version}
------
------
-2021-12-10
+2022-02-24
------
Download PNML to NUPN Converter ${project.version}
@@ -36,13 +36,17 @@ Download PNML to NUPN Converter ${project.version}
Requirements
+ * Runs on Java 17+ starting from version 4.0.0
+
* Runs on Java 11+ starting from version 3.0.0.
* Runs on Java 7 to Java 8, up to version 2.3.0.
* Note
- The Bounds tool, integrated in pnml2nupn, was compiled on Mac OS 10.8. Therefore, <>.
+ Starting from version 4.0.0, support for the Bounds tool was removed.
+
+ The Bounds tool, integrated in pnml2nupn until version 3.3.0, was compiled on Mac OS 10.8. Therefore, <>.
There is currently no plan to release a version of Bounds specifically for Windows or Linux.
However, <>. The option that makes use of the Bounds tool is unset by default (see the {{{./usage.html}usage page}}).
@@ -51,6 +55,8 @@ There is currently no plan to release a version of Bounds specifically for Windo
Download previous stable versions
+ * {{{./download/pnml2nupn-3.3.0.jar}version 3.3.0}}
+
* {{{./download/pnml2nupn-3.2.0.jar}version 3.2.0}}
* {{{./download/pnml2nupn-3.1.0.jar}version 3.1.0}}
diff --git a/fr.lip6.move.pnml2nupn/src/site/apt/usage.apt b/fr.lip6.move.pnml2nupn/src/site/apt/usage.apt
index 8b999d2..8693bd8 100644
--- a/fr.lip6.move.pnml2nupn/src/site/apt/usage.apt
+++ b/fr.lip6.move.pnml2nupn/src/site/apt/usage.apt
@@ -27,6 +27,8 @@ Overview
* Important note
+ From version 4.0.0, pnml2nupn runs on Java 17+.
+
Since version 3.0.0, pnml2nupn runs on Java 11+. Consequently, versions 3.x.x of pnml2nupn will not run on Java below 11.
===
@@ -231,7 +233,7 @@ Options
** Supporting versions
- Since v1.4.0.
+ From v1.4.0. to v3.3.0
** Note
Using pnml2nupn does not require the Bounds tool. Just run it with the above property set to false.
@@ -253,7 +255,7 @@ Options
** Supporting versions
- Since v1.4.0.
+ From v1.4.0. to v.3.3.0
* Force NUPN Generation
diff --git a/fr.lip6.move.pnml2nupn/src/site/resources/download/pnml2nupn.sh b/fr.lip6.move.pnml2nupn/src/site/resources/download/pnml2nupn.sh
index 183a4b3..cfbdab0 100755
--- a/fr.lip6.move.pnml2nupn/src/site/resources/download/pnml2nupn.sh
+++ b/fr.lip6.move.pnml2nupn/src/site/resources/download/pnml2nupn.sh
@@ -14,14 +14,14 @@
#############################################################################################
# Script to launch PNML 2 NUPN (1-Safe P/T Net) model transformation. #
-# Version: 2021-12-10 (since v1.5.2) #
+# Version: 2022-02-24 (since v1.5.2) #
# Contributors: Lom M. Hillah #
# Institutions: Sorbonne Université, and Univ. Paris Nanterre, LIP6, CNRS #
# Example: ./pnml2nupn.sh pathToModelsFolder [pathToASingleFile] [pathToOtherFolder] [...] #
#############################################################################################
# Path to executable Jar file
-JAR_FILE=pnml2nupn-3.3.0.jar
+JAR_FILE=pnml2nupn-4.0.0.jar
# Constants
NBPARAM=1
@@ -35,6 +35,7 @@ case $(uname -s) in
esac
# First, you must set below the path to the java executable in your OS.
+# Starting from version 4.0.0, pnml2nupn runs with Java 17+.
# Starting from version 3.0.0, pnml2nupn runs with Java 11+.
# pnml2nupn versions 3.x.x will not run with Java versions before 11.
JAVA="java"
@@ -56,10 +57,12 @@ FORCE_NUPN_GEN="-Dforce.nupn.generation=true"
# Enable or disable unit safeness checking of the PNML model? Default is false.
# This option would work only on *nix systems since it relies on
# the Bounds tool (embedded but deployed locally at runtime)
+# Permanently disabled since v4.0.0
UNIT_SAFENESS_CHECKING="-Dunit.safeness.checking=false"
# Enable or disable unit safeness checking only? Default is false.
# This option also activates UNIT_SAFENESS_CHECKING
+# Permanently disabled since v4.0.0
UNIT_SAFENESS_CHECKING_ONLY="-Dunit.safeness.checking.only=false"
# How many places (at most) to report when the net is unsafe?