Skip to content

Commit

Permalink
Fix loading resource from .jar file (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
schw4rzlicht committed Jul 1, 2020
1 parent 873faaa commit de367ad
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions lib/src/main/java/de/deltaeight/libartnet/descriptors/OemCode.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,8 @@

import com.google.gson.Gson;

import java.io.IOException;
import java.net.URISyntaxException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.HashMap;

/**
Expand All @@ -52,13 +50,8 @@ public class OemCode {

addProduct(unknownProduct);

Product[] products = null;
try {
products = new Gson().fromJson(new String(Files.readAllBytes(Paths.get(OemCode.class
.getResource("OemCodes.json").toURI()))), Product[].class);
} catch (IOException | URISyntaxException e) {
e.printStackTrace();
}
Product[] products = new Gson().fromJson(new BufferedReader(new InputStreamReader(
OemCode.class.getResourceAsStream("OemCodes.json"))), Product[].class);

if (products != null) {
for (Product product : products) {
Expand Down

0 comments on commit de367ad

Please sign in to comment.