[armedbear-cvs] r11982 - trunk/abcl/src/org/armedbear/lisp

Erik Huelsmann ehuelsmann at common-lisp.net
Mon Jun 1 19:18:27 UTC 2009


Author: ehuelsmann
Date: Mon Jun  1 15:18:24 2009
New Revision: 11982

Log:
Don't use exceptions to find out the reader is null;
instead, check it on function entry.

Modified:
   trunk/abcl/src/org/armedbear/lisp/Stream.java

Modified: trunk/abcl/src/org/armedbear/lisp/Stream.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/Stream.java	(original)
+++ trunk/abcl/src/org/armedbear/lisp/Stream.java	Mon Jun  1 15:18:24 2009
@@ -1838,6 +1838,9 @@
    */
   protected void _unreadChar(int n) throws ConditionThrowable
   {
+    if (reader == null)
+        streamNotCharacterInputStream();
+
     try
       {
         reader.unread(n);
@@ -1846,11 +1849,6 @@
         if (n == eolChar)
           --lineNumber;
       }
-    catch (NullPointerException e)
-      {
-        // reader is null
-        streamNotCharacterInputStream();
-      }
     catch (IOException e)
       {
         error(new StreamError(this, e));
@@ -1864,15 +1862,13 @@
    */
   protected boolean _charReady() throws ConditionThrowable
   {
+    if (reader == null)
+        streamNotCharacterInputStream();
+
     try
       {
         return reader.ready();
       }
-    catch (NullPointerException e)
-      {
-        // reader is null
-        streamNotCharacterInputStream();
-      }
     catch (IOException e)
       {
         error(new StreamError(this, e));




More information about the armedbear-cvs mailing list