Fix migration issue for split and zipped model files Change-Id: I4199c431c4a788a802d0206c25fd273c963d39f6 Signed-off-by: Dirk Fauth <dirk.fauth@de.bosch.com>
diff --git a/plugins/org.eclipse.app4mc.amalthea.converters.common/src/org/eclipse/app4mc/amalthea/converters/common/MigrationHelper.java b/plugins/org.eclipse.app4mc.amalthea.converters.common/src/org/eclipse/app4mc/amalthea/converters/common/MigrationHelper.java index 9e36227..0df925a 100644 --- a/plugins/org.eclipse.app4mc.amalthea.converters.common/src/org/eclipse/app4mc/amalthea/converters/common/MigrationHelper.java +++ b/plugins/org.eclipse.app4mc.amalthea.converters.common/src/org/eclipse/app4mc/amalthea/converters/common/MigrationHelper.java
@@ -463,9 +463,10 @@ Path inputPath = Paths.get(input.toURI()); byte[] buffer = new byte[1024]; try (ZipInputStream zis = new ZipInputStream(Files.newInputStream(inputPath))) { - ZipEntry zipEntry = zis.getNextEntry(); - - Path unzipped = Paths.get(inputPath.getParent().toString(), UNZIPPED_PREFIX + zipEntry.getName()); + // use the filename of the input file instead of the name of the zipentry to + // handle cases where multiple zipped model files are located in the same folder + // and contain model files with the same filename, e.g. SCA2Amalthea results + Path unzipped = Paths.get(inputPath.getParent().toString(), UNZIPPED_PREFIX + input.getName()); try (OutputStream fos = Files.newOutputStream(unzipped)) { int len; while ((len = zis.read(buffer)) > 0) {