Kaydet (Commit) 49cdc1da authored tarafından Caolán McNamara's avatar Caolán McNamara

coverity#1361587 Dereference null return value

and

coverity#1361588 Dereference null return value

Change-Id: Ia282c37e94d9d4131d18b3ccf6a8b7cb12c12344
üst e141017c
......@@ -69,24 +69,25 @@ public class ScriptEditorForBeanShell implements ScriptEditor, ActionListener {
// try to load the template for BeanShell scripts
static {
BSHTEMPLATE = "// BeanShell script";
try {
URL url = ScriptEditorForBeanShell.class.getResource("template.bsh");
InputStream in = url.openStream();
StringBuilder buf = new StringBuilder();
byte[] b = new byte[1024];
int len;
while ((len = in.read(b)) != -1) {
buf.append(new String(b, 0, len));
}
if (url != null) {
InputStream in = url.openStream();
StringBuilder buf = new StringBuilder();
byte[] b = new byte[1024];
int len;
while ((len = in.read(b)) != -1) {
buf.append(new String(b, 0, len));
}
in.close();
in.close();
BSHTEMPLATE = buf.toString();
BSHTEMPLATE = buf.toString();
}
} catch (IOException ioe) {
BSHTEMPLATE = "// BeanShell script";
} catch (Exception e) {
BSHTEMPLATE = "// BeanShell script";
}
}
......
......@@ -55,24 +55,25 @@ public class ScriptEditorForJavaScript implements ScriptEditor {
HashMap<String, ScriptEditorForJavaScript>();
static {
JSTEMPLATE = "// JavaScript script";
try {
URL url = ScriptEditorForJavaScript.class.getResource("template.js");
InputStream in = url.openStream();
StringBuilder buf = new StringBuilder();
byte[] b = new byte[1024];
int len;
while ((len = in.read(b)) != -1) {
buf.append(new String(b, 0, len));
}
if (url != null) {
InputStream in = url.openStream();
StringBuilder buf = new StringBuilder();
byte[] b = new byte[1024];
int len;
while ((len = in.read(b)) != -1) {
buf.append(new String(b, 0, len));
}
in.close();
in.close();
JSTEMPLATE = buf.toString();
JSTEMPLATE = buf.toString();
}
} catch (IOException ioe) {
JSTEMPLATE = "// JavaScript script";
} catch (Exception e) {
JSTEMPLATE = "// JavaScript script";
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment