diff --git a/README.md b/README.md
index abd79c9..cb7f5e7 100755
--- a/README.md
+++ b/README.md
@@ -202,7 +202,7 @@ Get Maven, then run the following command at the project root:
mvn clean package
```
-This will build the project to `target/update-checker-0.6.0.jar`.
+This will build the project to `target/update-checker-0.6.1.jar`.
### Running the project
@@ -213,7 +213,7 @@ First, follow these steps to set it up:
Then, to run the project, browse to where the JAR is in a terminal / command prompt, then run
```
-java -jar update-checker-0.6.0.jar [minutes]
+java -jar update-checker-0.6.1.jar [minutes]
```
[minutes] is the wait delay in minutes between two GameBanana checks (defaults to 30). Be aware that the program makes ~13 API calls per check, and that the GameBanana API has a cap at 250 requests/hour.
diff --git a/pom.xml b/pom.xml
index 4cc760b..2c89a35 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
ovh.maddie480.everest.updatechecker
update-checker
- 0.6.0
+ 0.6.1
21
diff --git a/src/main/java/ovh/maddie480/everest/updatechecker/DatabaseUpdater.java b/src/main/java/ovh/maddie480/everest/updatechecker/DatabaseUpdater.java
index 6a53172..70c04b4 100755
--- a/src/main/java/ovh/maddie480/everest/updatechecker/DatabaseUpdater.java
+++ b/src/main/java/ovh/maddie480/everest/updatechecker/DatabaseUpdater.java
@@ -8,6 +8,7 @@
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
+import org.json.JSONTokener;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -21,8 +22,6 @@
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
-import static java.nio.charset.StandardCharsets.UTF_8;
-
public class DatabaseUpdater {
private static final Logger log = LoggerFactory.getLogger(DatabaseUpdater.class);
@@ -181,7 +180,7 @@ private void crawlModsFromCategoryFully(String category) throws IOException {
try (InputStream is = ConnectionUtils.openStreamWithTimeout("https://gamebanana.com/apiv10/" + category + "/Index?_nPage=1&_nPerpage=" + incrementalPageSize +
"&_aFilters[Generic_Game]=6460&_sSort=Generic_LatestModified")) {
- return new JSONObject(IOUtils.toString(is, UTF_8)).getJSONArray("_aRecords").getJSONObject(0).getInt("_tsDateModified");
+ return new JSONObject(new JSONTokener(is)).getJSONArray("_aRecords").getJSONObject(0).getInt("_tsDateModified");
} catch (JSONException e) {
// turn JSON parse errors into IOExceptions to trigger a retry.
throw new IOException(e);
@@ -199,7 +198,7 @@ private void crawlModsFromCategoryFully(String category) throws IOException {
"_tsDateAdded,_tsDateModified,_tsDateUpdated,_aPreviewMedia,_sProfileUrl,_bIsNsfw" +
"&_sOrderBy=_idRow,ASC&_nPage=" + thisPage + "&_nPerpage=" + fullPageSize)) {
- return new JSONArray(IOUtils.toString(is, UTF_8));
+ return new JSONArray(new JSONTokener(is));
} catch (JSONException e) {
// turn JSON parse errors into IOExceptions to trigger a retry.
throw new IOException(e);
@@ -238,7 +237,7 @@ private void crawlModsFromCategoryIncrementally(String category) throws IOExcept
try (InputStream is = ConnectionUtils.openStreamWithTimeout("https://gamebanana.com/apiv10/" + category + "/Index?_nPage=" + thisPage +
"&_nPerpage=" + incrementalPageSize + "&_aFilters[Generic_Game]=6460&_sSort=Generic_LatestModified")) {
- return new JSONObject(IOUtils.toString(is, UTF_8)).getJSONArray("_aRecords");
+ return new JSONObject(new JSONTokener(is)).getJSONArray("_aRecords");
} catch (JSONException e) {
// turn JSON parse errors into IOExceptions to trigger a retry.
throw new IOException(e);
@@ -258,7 +257,7 @@ private void crawlModsFromCategoryIncrementally(String category) throws IOExcept
"_csvProperties=_idRow,_sName,_aFiles,_aSubmitter,_sDescription,_sText,_nLikeCount,_nViewCount,_nDownloadCount,_aCategory," +
"_tsDateAdded,_tsDateModified,_tsDateUpdated,_aPreviewMedia,_sProfileUrl,_bIsNsfw&ts=" + System.currentTimeMillis())) {
- return new JSONObject(IOUtils.toString(is, UTF_8));
+ return new JSONObject(new JSONTokener(is));
} catch (JSONException e) {
// turn JSON parse errors into IOExceptions to trigger a retry.
throw new IOException(e);
diff --git a/src/main/java/ovh/maddie480/everest/updatechecker/ModSearchDatabaseBuilder.java b/src/main/java/ovh/maddie480/everest/updatechecker/ModSearchDatabaseBuilder.java
index 8f25ddc..02279c5 100755
--- a/src/main/java/ovh/maddie480/everest/updatechecker/ModSearchDatabaseBuilder.java
+++ b/src/main/java/ovh/maddie480/everest/updatechecker/ModSearchDatabaseBuilder.java
@@ -1,10 +1,10 @@
package ovh.maddie480.everest.updatechecker;
-import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringEscapeUtils;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
+import org.json.JSONTokener;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -15,8 +15,6 @@
import java.util.stream.Collectors;
import java.util.stream.StreamSupport;
-import static java.nio.charset.StandardCharsets.UTF_8;
-
public class ModSearchDatabaseBuilder {
private static final Logger log = LoggerFactory.getLogger(ModSearchDatabaseBuilder.class);
@@ -133,7 +131,7 @@ void addMod(String itemtype, int itemid, JSONObject mod) throws IOException {
if (mod.getBoolean("_bIsNsfw")) {
// mod has content warnings! we need to check which ones.
try (InputStream is = ConnectionUtils.openStreamWithTimeout("https://gamebanana.com/apiv11/" + itemtype + "/" + itemid + "/ProfilePage")) {
- JSONObject o = new JSONObject(IOUtils.toString(is, UTF_8));
+ JSONObject o = new JSONObject(new JSONTokener(is));
redactScreenshots = !"show".equals(o.getString("_sInitialVisibility"));
List contentWarnings = new ArrayList<>();
@@ -221,7 +219,7 @@ void saveSearchDatabase(boolean full) throws IOException {
// get featured mods and fill in the info for mods accordingly.
JSONObject featured = ConnectionUtils.runWithRetry(() -> {
try (InputStream is = ConnectionUtils.openStreamWithTimeout("https://gamebanana.com/apiv8/Game/6460/TopSubs")) {
- return new JSONObject(IOUtils.toString(is, UTF_8));
+ return new JSONObject(new JSONTokener(is));
} catch (JSONException e) {
// turn JSON parse errors into IOExceptions to trigger a retry.
throw new IOException(e);
@@ -268,7 +266,7 @@ private void assignCategoryNamesToMods(String itemtype) throws IOException {
try (InputStream is = ConnectionUtils.openStreamWithTimeout("https://gamebanana.com/apiv8/" + itemtype + "Category/ByGame?_aGameRowIds[]=6460&" +
"_csvProperties=_idRow,_idParentCategoryRow,_sName&_sOrderBy=_idRow,ASC&_nPage=1&_nPerpage=50")) {
- return new JSONArray(IOUtils.toString(is, UTF_8));
+ return new JSONArray(new JSONTokener(is));
} catch (JSONException e) {
// turn JSON parse errors into IOExceptions to trigger a retry.
throw new IOException(e);