From: brian Date: Wed, 12 May 2004 04:07:18 +0000 (-0700) Subject: inputoutputstream fd fix X-Git-Url: http://git.megacz.com/?p=nestedvm.git;a=commitdiff_plain;h=b6be9bcc91cf8e995a0e616a480813cdbef09dc2;hp=abe7c48fc6762412703430702e60db9cd834b55a inputoutputstream fd fix darcs-hash:20040512040718-24bed-fca30a23831de2b6049261ced7439137fbcf8439.gz --- diff --git a/src/org/ibex/nestedvm/Runtime.java b/src/org/ibex/nestedvm/Runtime.java index c501d0d..50b5162 100644 --- a/src/org/ibex/nestedvm/Runtime.java +++ b/src/org/ibex/nestedvm/Runtime.java @@ -1194,8 +1194,8 @@ public abstract class Runtime implements UsermodeConstants,Registers,Cloneable { } public void _close() { - try {is.close(); } catch(IOException e) { /*ignore*/ } - try {os.close(); } catch(IOException e) { /*ignore*/ } + if(is != null) try { is.close(); } catch(IOException e) { /*ignore*/ } + if(os != null) try { os.close(); } catch(IOException e) { /*ignore*/ } } public int read(byte[] a, int off, int length) throws ErrnoException { diff --git a/src/tests/CallTest.java b/src/tests/CallTest.java index 978eb87..95184ce 100644 --- a/src/tests/CallTest.java +++ b/src/tests/CallTest.java @@ -26,7 +26,7 @@ public class CallTest { case 1: return rt.strdup("OS: " + System.getProperty("os.name")); case 2: return rt.strdup(System.getProperty("os.version")); case 3: return rt.strdup(new Date().toString()); - case 4: return rt.addFD(new Runtime.OutputStreamFD(new CustomOS())); + case 4: return rt.addFD(new Runtime.InputOutputStreamFD(null,new CustomOS())); case 5: System.out.println("In callJava() in Java"); try { rt.call("backinmips"); } catch(Runtime.CallException e) { }