diff --git a/CHANGELOG.md b/CHANGELOG.md index 95ad1bc..dbab4d3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Changelog +**1.0.11** +* Close Input Stream Properly + **1.0.10** * Fix Fabric API Update Detection diff --git a/README.md b/README.md index fcc0987..aeebed9 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ Created For [ModFest 1.16](https://modfest.net/1.16) **NOTE:** This is only able to scan mods that have opted-in! ## Mod Users -Go to the Mod Menu and click the configure icon for ModUpdater. +Go to the Mod Menu and click the configure icon for ModUpdater to view available updates. ## Mod Developers Both ```fabric.mod.json``` and ```build.gradle``` must be modified to opt-in to ModUpdater. diff --git a/gradle.properties b/gradle.properties index dd4fc84..c9b2392 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,7 +9,7 @@ org.gradle.jvmargs = -Xmx1G fabric_loader_version = 0.8.8+build.202 # Mod Properties - mod_version = 1.0.10 + mod_version = 1.0.11 maven_group = com.thebrokenrail # Dependencies diff --git a/src/main/java/com/thebrokenrail/modupdater/strategy/MavenStrategy.java b/src/main/java/com/thebrokenrail/modupdater/strategy/MavenStrategy.java index 7abd31c..3d9d027 100644 --- a/src/main/java/com/thebrokenrail/modupdater/strategy/MavenStrategy.java +++ b/src/main/java/com/thebrokenrail/modupdater/strategy/MavenStrategy.java @@ -14,6 +14,7 @@ import org.dom4j.io.SAXReader; import java.io.ByteArrayInputStream; import java.io.IOException; +import java.io.InputStream; import java.util.List; public class MavenStrategy implements ModUpdateStrategy { @@ -42,12 +43,15 @@ public class MavenStrategy implements ModUpdateStrategy { } Document doc; - try { + try (InputStream source = new ByteArrayInputStream(data.getBytes())) { SAXReader reader = new SAXReader(); - doc = reader.read(new ByteArrayInputStream(data.getBytes())); + doc = reader.read(source); } catch (DocumentException e) { ModUpdater.getLogger().warn("Maven Repository Sent Invalid Data: " + name); return null; + } catch (IOException e) { + e.printStackTrace(); + return null; } List versions = doc.selectNodes("/metadata/versioning/versions/*"); @@ -72,7 +76,7 @@ public class MavenStrategy implements ModUpdateStrategy { if (newestVersion != null) { try { if (SemanticVersion.parse(newestVersion).compareTo(SemanticVersion.parse(oldVersion)) > 0) { - return new ModUpdate(oldVersion, newestVersion, mavenRoot + '/' + newestVersion + '/' + artifact + '-' + newestVersion + Util.JAR_EXTENSION, name); + return new ModUpdate(oldVersion, newestVersion, String.format("%s/%s/%s-%s%s", mavenRoot, newestVersion, artifact, newestVersion, Util.JAR_EXTENSION), name); } else { return null; }