diff --git a/.classpath b/.classpath
index e70af8d1..bd920db7 100644
--- a/.classpath
+++ b/.classpath
@@ -59,5 +59,6 @@
+
diff --git a/Elsinore.jar b/Elsinore.jar
index 47ae7bf8..54ffa557 100644
Binary files a/Elsinore.jar and b/Elsinore.jar differ
diff --git a/SB_Elsinore_Server.eml b/SB_Elsinore_Server.eml
index 1dd51ede..fdc2ab2d 100644
--- a/SB_Elsinore_Server.eml
+++ b/SB_Elsinore_Server.eml
@@ -74,5 +74,6 @@
+
diff --git a/pom.xml b/pom.xml
index 0d6e3edb..d20d639a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -167,6 +167,11 @@
${powermock.version}
test
+
+ org.apache.tika
+ tika-core
+ 1.11
+
diff --git a/src/main/java/ca/strangebrew/recipe/Mash.java b/src/main/java/ca/strangebrew/recipe/Mash.java
index be862101..8c1c72de 100644
--- a/src/main/java/ca/strangebrew/recipe/Mash.java
+++ b/src/main/java/ca/strangebrew/recipe/Mash.java
@@ -358,12 +358,35 @@ public String getInfuseTemp() {
public void setMashRatio(String mashRatio) {
try {
- this.mashRatio = Double.parseDouble(mashRatio);
+ mashRatio = mashRatio.trim();
+
+ this.mashRatio = readDouble(mashRatio);
} catch (NumberFormatException nfe) {
nfe.printStackTrace();
}
}
+ public double readDouble(String s)
+ {
+ s = s.trim();
+ StringBuilder sb = new StringBuilder(s);
+ int i = sb.indexOf(",");
+ while (i > 0)
+ {
+ // if we're at the decimal point, change it to a .
+ if (i == (sb.length() - 2))
+ {
+ sb.replace(i, i+1, ",");
+ }
+ // otherwise remove it
+ else
+ {
+ sb.replace(i, i+1, "");
+ }
+ i = sb.indexOf(",");
+ }
+ return Double.parseDouble(sb.toString());
+ }
public double getMashRatio() {
return mashRatio;
}
diff --git a/src/main/java/com/sb/elsinore/UrlEndpoints.java b/src/main/java/com/sb/elsinore/UrlEndpoints.java
index 7b807dc6..71008577 100644
--- a/src/main/java/com/sb/elsinore/UrlEndpoints.java
+++ b/src/main/java/com/sb/elsinore/UrlEndpoints.java
@@ -13,6 +13,7 @@
import java.util.*;
import java.util.Map.Entry;
+import org.apache.tika.Tika;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
@@ -2113,8 +2114,8 @@ public Response uploadBeerXML() {
try {
File uploadedFile = new File(entry.getValue());
- String fileType = Files.probeContentType(
- uploadedFile.toPath());
+ String fileType = new Tika().detect(
+ uploadedFile);
if (fileType.endsWith("/xml"))
{