Skip to content

Commit

Permalink
Merge pull request #4 from jmaicher/fix/jm/issue-2
Browse files Browse the repository at this point in the history
Use getResourceAsStream as getResource won't work
  • Loading branch information
atomfrede committed Mar 17, 2016
2 parents 828a83d + ddefd58 commit 351f6ae
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package com.github.atomfrede.jadenticon;

import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;

import javax.script.Invocable;
import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
import javax.script.ScriptException;
import java.io.File;
import java.io.InputStream;

public class JdenticonWrapper {

Expand All @@ -21,7 +21,10 @@ public JdenticonWrapper() {

invocable = (Invocable) nashorn;

String script = FileUtils.readFileToString(new File(getClass().getResource("/jdenticon.js").toURI()));
InputStream scriptStream = getClass().getResourceAsStream("/jdenticon.js");
String script = IOUtils.toString(scriptStream);
scriptStream.close();

nashorn.eval(script);

jdenticon = nashorn.eval("jdenticon");
Expand Down

0 comments on commit 351f6ae

Please sign in to comment.