1.0.11
All checks were successful
ModUpdater/pipeline/head This commit looks good

This commit is contained in:
TheBrokenRail 2020-06-25 09:16:27 -04:00
parent e5ca6e5e7b
commit 1a48e714b0
4 changed files with 12 additions and 5 deletions

View File

@ -1,5 +1,8 @@
# Changelog
**1.0.11**
* Close Input Stream Properly
**1.0.10**
* Fix Fabric API Update Detection

View File

@ -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.

View File

@ -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

View File

@ -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<Node> 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;
}