From 99883f0e315d2510957c96d0280a64274a40cafb Mon Sep 17 00:00:00 2001 From: Rainer Prosi Date: Fri, 11 Oct 2024 18:30:17 +0200 Subject: [PATCH] remove unneaded exception when reading json --- src/main/java/org/cip4/tools/jdfeditor/JDFTreeModel.java | 1 - .../cip4/tools/jdfeditor/streamloader/ZipStreamLoader.java | 6 ++++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/cip4/tools/jdfeditor/JDFTreeModel.java b/src/main/java/org/cip4/tools/jdfeditor/JDFTreeModel.java index 306e914..af84f99 100644 --- a/src/main/java/org/cip4/tools/jdfeditor/JDFTreeModel.java +++ b/src/main/java/org/cip4/tools/jdfeditor/JDFTreeModel.java @@ -269,7 +269,6 @@ public JDFTreeModel(final JDFTreeNode _root, final boolean ignoreAttributes) public boolean validate() { // this may be what needs to be done (i.e. getFrame()) for the variables in other methods that are being moved from JDFFrame to here. - final JDFFrame m_frame = MainView.getFrame(); final EditorDocument eDoc = MainView.getEditorDoc(); if (eDoc == null) { diff --git a/src/main/java/org/cip4/tools/jdfeditor/streamloader/ZipStreamLoader.java b/src/main/java/org/cip4/tools/jdfeditor/streamloader/ZipStreamLoader.java index cd3cf0e..445dc35 100755 --- a/src/main/java/org/cip4/tools/jdfeditor/streamloader/ZipStreamLoader.java +++ b/src/main/java/org/cip4/tools/jdfeditor/streamloader/ZipStreamLoader.java @@ -71,6 +71,7 @@ import java.io.File; import java.io.IOException; import java.io.InputStream; +import java.util.zip.ZipEntry; import org.cip4.jdflib.core.JDFDoc; import org.cip4.jdflib.util.FileUtil; @@ -79,6 +80,7 @@ /** * simple implementation for a zip stream loader + * * @author rainer prosi * @date Sep 5, 2013 */ @@ -100,9 +102,9 @@ public JDFDoc read(final File fileJDF, final File fileSchema) throws IOException public JDFDoc readStream(final InputStream jdf, final InputStream schema) throws IOException { final ZipReader zr = new ZipReader(jdf); - zr.getNextEntry(); + final ZipEntry e = zr.getNextEntry(); zr.close(); - return zr.getJDFDoc(); + return e == null ? null : zr.getJDFDoc(); } }