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

Erik Huelsmann ehuelsmann at common-lisp.net
Fri Dec 18 21:50:57 UTC 2009


Author: ehuelsmann
Date: Fri Dec 18 16:50:54 2009
New Revision: 12298

Log:
Full source scan of "catch (Throwable";
  remove lots of instances, or make the catch statement more
  specific, e.g. replace Throwable by IOException.

Modified:
   trunk/abcl/src/org/armedbear/lisp/AbstractArray.java
   trunk/abcl/src/org/armedbear/lisp/AbstractVector.java
   trunk/abcl/src/org/armedbear/lisp/BuiltInClass.java
   trunk/abcl/src/org/armedbear/lisp/Condition.java
   trunk/abcl/src/org/armedbear/lisp/Go.java
   trunk/abcl/src/org/armedbear/lisp/Interpreter.java
   trunk/abcl/src/org/armedbear/lisp/Java.java
   trunk/abcl/src/org/armedbear/lisp/JavaClassLoader.java
   trunk/abcl/src/org/armedbear/lisp/Layout.java
   trunk/abcl/src/org/armedbear/lisp/Lisp.java
   trunk/abcl/src/org/armedbear/lisp/LispStackFrame.java
   trunk/abcl/src/org/armedbear/lisp/LispThread.java
   trunk/abcl/src/org/armedbear/lisp/Load.java
   trunk/abcl/src/org/armedbear/lisp/MathFunctions.java
   trunk/abcl/src/org/armedbear/lisp/Package.java
   trunk/abcl/src/org/armedbear/lisp/Pathname.java
   trunk/abcl/src/org/armedbear/lisp/PrintNotReadable.java
   trunk/abcl/src/org/armedbear/lisp/RandomState.java
   trunk/abcl/src/org/armedbear/lisp/Return.java
   trunk/abcl/src/org/armedbear/lisp/RuntimeClass.java
   trunk/abcl/src/org/armedbear/lisp/ShellCommand.java
   trunk/abcl/src/org/armedbear/lisp/SimpleTypeError.java
   trunk/abcl/src/org/armedbear/lisp/Site.java
   trunk/abcl/src/org/armedbear/lisp/SiteName.java
   trunk/abcl/src/org/armedbear/lisp/SlimeInputStream.java
   trunk/abcl/src/org/armedbear/lisp/SlotClass.java
   trunk/abcl/src/org/armedbear/lisp/SlotDefinition.java
   trunk/abcl/src/org/armedbear/lisp/Symbol.java
   trunk/abcl/src/org/armedbear/lisp/SymbolHashTable.java
   trunk/abcl/src/org/armedbear/lisp/Throw.java
   trunk/abcl/src/org/armedbear/lisp/TypeError.java
   trunk/abcl/src/org/armedbear/lisp/UnboundVariable.java
   trunk/abcl/src/org/armedbear/lisp/WrongNumberOfArgumentsException.java

Modified: trunk/abcl/src/org/armedbear/lisp/AbstractArray.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/AbstractArray.java	(original)
+++ trunk/abcl/src/org/armedbear/lisp/AbstractArray.java	Fri Dec 18 16:50:54 2009
@@ -294,23 +294,16 @@
     @Override
     public int psxhash()
     {
-        try {
-            long result = 128387; // Chosen at random.
-            final int rank = getRank();
-            int limit = rank < 4 ? rank : 4;
-            for (int i = 0; i < limit; i++)
-                result = mix(result, getDimension(i));
-            final int length = getTotalSize();
-            limit = length < 4 ? length : 4;
-            for (int i = 0; i < length; i++)
-                result = mix(result, AREF(i).psxhash());
-            return (int) (result & 0x7fffffff);
-        }
-        catch (Throwable t) {
-            // Shouldn't happen.
-            Debug.trace(t);
-            return 0;
-        }
+        long result = 128387; // Chosen at random.
+        final int rank = getRank();
+        int limit = rank < 4 ? rank : 4;
+        for (int i = 0; i < limit; i++)
+            result = mix(result, getDimension(i));
+        final int length = getTotalSize();
+        limit = length < 4 ? length : 4;
+        for (int i = 0; i < length; i++)
+            result = mix(result, AREF(i).psxhash());
+        return (int) (result & 0x7fffffff);
     }
 
     /** Returns a newly allocated array or the current array with

Modified: trunk/abcl/src/org/armedbear/lisp/AbstractVector.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/AbstractVector.java	(original)
+++ trunk/abcl/src/org/armedbear/lisp/AbstractVector.java	Fri Dec 18 16:50:54 2009
@@ -276,21 +276,12 @@
   @Override
   public int psxhash()
   {
-    try
-      {
-        final int length = length();
-        final int limit = length < 4 ? length : 4;
-        long result = 48920713; // Chosen at random.
-        for (int i = 0; i < limit; i++)
-          result = mix(result, AREF(i).psxhash());
-        return (int) (result & 0x7fffffff);
-      }
-    catch (Throwable t)
-      {
-        // Shouldn't happen.
-        Debug.trace(t);
-        return 0;
-      }
+    final int length = length();
+    final int limit = length < 4 ? length : 4;
+    long result = 48920713; // Chosen at random.
+    for (int i = 0; i < limit; i++)
+      result = mix(result, AREF(i).psxhash());
+    return (int) (result & 0x7fffffff);
   }
 
   public abstract AbstractArray adjustArray(int size,

Modified: trunk/abcl/src/org/armedbear/lisp/BuiltInClass.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/BuiltInClass.java	(original)
+++ trunk/abcl/src/org/armedbear/lisp/BuiltInClass.java	Fri Dec 18 16:50:54 2009
@@ -291,13 +291,6 @@
 
   static
   {
-    try
-      {
-        StandardClass.initializeStandardClasses();
-      }
-    catch (Throwable t)
-      {
-        Debug.trace(t);
-      }
+    StandardClass.initializeStandardClasses();
   }
 }

Modified: trunk/abcl/src/org/armedbear/lisp/Condition.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/Condition.java	(original)
+++ trunk/abcl/src/org/armedbear/lisp/Condition.java	Fri Dec 18 16:50:54 2009
@@ -98,15 +98,8 @@
   {
     super(StandardClass.CONDITION);
     Debug.assertTrue(slots.length == 2);
-    try
-      {
-        setFormatControl(message);
-        setFormatArguments(NIL);
-      }
-    catch (Throwable t)
-      {
-        Debug.trace(t);
-      }
+    setFormatControl(message);
+    setFormatArguments(NIL);
   }
 
   public final LispObject getFormatControl()
@@ -177,11 +170,7 @@
     LispObject formatControl = getFormatControl();
     if (formatControl != NIL)
       {
-        try
-          {
-            return format(formatControl, getFormatArguments());
-          }
-        catch (Throwable t) {}
+        return format(formatControl, getFormatArguments());
       }
     return unreadableString(typeOf().writeToString());
   }

Modified: trunk/abcl/src/org/armedbear/lisp/Go.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/Go.java	(original)
+++ trunk/abcl/src/org/armedbear/lisp/Go.java	Fri Dec 18 16:50:54 2009
@@ -57,15 +57,9 @@
     @Override
     public LispObject getCondition()
     {
-        try {
-            StringBuffer sb = new StringBuffer("No tag named ");
-            sb.append(tag.writeToString());
-            sb.append(" is currently visible");
-            return new ControlError(sb.toString());
-        }
-        catch (Throwable t) {
-            Debug.trace(t);
-            return new Condition();
-        }
+        StringBuffer sb = new StringBuffer("No tag named ");
+        sb.append(tag.writeToString());
+        sb.append(" is currently visible");
+        return new ControlError(sb.toString());
     }
 }

Modified: trunk/abcl/src/org/armedbear/lisp/Interpreter.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/Interpreter.java	(original)
+++ trunk/abcl/src/org/armedbear/lisp/Interpreter.java	Fri Dec 18 16:50:54 2009
@@ -75,31 +75,28 @@
         if (interpreter != null)
             return null;
         interpreter = new Interpreter();
-        try {
-            if (args != null)
-                preprocessCommandLineArguments(args);
-            if (!noinform) {
-                Stream out = getStandardOutput();
-                out._writeString(banner());
-                out._finishOutput();
-            }
-            if (noinform)
-                _NOINFORM_.setSymbolValue(T);
-            else {
-                double uptime = (System.currentTimeMillis() - Main.startTimeMillis) / 1000.0;
-                getStandardOutput()._writeString("Low-level initialization completed in " +
-                                                 uptime + " seconds.\n");
-            }
-            initializeLisp();
-            initializeTopLevel();
-            if (!noinit)
-                processInitializationFile();
-            if (args != null)
-                postprocessCommandLineArguments(args);
+
+        if (args != null)
+            preprocessCommandLineArguments(args);
+        if (!noinform) {
+            Stream out = getStandardOutput();
+            out._writeString(banner());
+            out._finishOutput();
         }
-        catch (Throwable t) {
-            t.printStackTrace();
+        if (noinform)
+            _NOINFORM_.setSymbolValue(T);
+        else {
+            double uptime = (System.currentTimeMillis() - Main.startTimeMillis) / 1000.0;
+            getStandardOutput()._writeString("Low-level initialization completed in " +
+                                             uptime + " seconds.\n");
         }
+        initializeLisp();
+        initializeTopLevel();
+        if (!noinit)
+            processInitializationFile();
+        if (args != null)
+            postprocessCommandLineArguments(args);
+
         return interpreter;
     }
 
@@ -112,15 +109,12 @@
         if (interpreter != null)
             return null;
         interpreter = new Interpreter(in, out, initialDirectory);
-        try {
-            Stream stdout = getStandardOutput();
-            stdout._writeLine(version);
-            stdout._writeString(banner());
-            stdout._finishOutput();
-        }
-        catch (Throwable t) {
-            t.printStackTrace();
-        }
+
+        Stream stdout = getStandardOutput();
+        stdout._writeLine(version);
+        stdout._writeString(banner());
+        stdout._finishOutput();
+
         initializeJLisp();
         initializeTopLevel();
         processInitializationFile();
@@ -144,12 +138,7 @@
                 new Stream(outputStream, Symbol.CHARACTER));
         if (!initialDirectory.endsWith(File.separator))
             initialDirectory = initialDirectory.concat(File.separator);
-        try {
-            Symbol.DEFAULT_PATHNAME_DEFAULTS.setSymbolValue(new Pathname(initialDirectory));
-        }
-        catch (Throwable t) {
-            Debug.trace(t);
-        }
+        Symbol.DEFAULT_PATHNAME_DEFAULTS.setSymbolValue(new Pathname(initialDirectory));
     }
 
     // Interface.
@@ -170,17 +159,17 @@
     public static synchronized void initializeJLisp()
     {
         if (!initialized) {
+            Symbol.FEATURES.setSymbolValue(new Cons(Keyword.J,
+                                               Symbol.FEATURES.getSymbolValue()));
+            Load.loadSystemFile("boot.lisp", false, false, false);
+
             try {
-                Symbol.FEATURES.setSymbolValue(new Cons(Keyword.J,
-                                                   Symbol.FEATURES.getSymbolValue()));
-                Load.loadSystemFile("boot.lisp", false, false, false);
                 Class.forName("org.armedbear.j.LispAPI");
-                Load.loadSystemFile("j.lisp");
-            }
-            catch (Throwable t) {
-                // ### FIXME exception
-                t.printStackTrace();
             }
+            catch (ClassNotFoundException e) { } // FIXME: what to do?
+
+            Load.loadSystemFile("j.lisp");
+
             initialized = true;
         }
     }
@@ -190,18 +179,14 @@
     private static synchronized void initializeTopLevel()
     {
         if (!topLevelInitialized) {
-            try {
-                // Resolve top-level-loop autoload.
-                Symbol TOP_LEVEL_LOOP = intern("TOP-LEVEL-LOOP", PACKAGE_TPL);
-                LispObject tplFun = TOP_LEVEL_LOOP.getSymbolFunction();
-                if (tplFun instanceof Autoload) {
-                    Autoload autoload = (Autoload) tplFun;
-                    autoload.load();
-                }
-            }
-            catch (Throwable t) {
-                t.printStackTrace();
+            // Resolve top-level-loop autoload.
+            Symbol TOP_LEVEL_LOOP = intern("TOP-LEVEL-LOOP", PACKAGE_TPL);
+            LispObject tplFun = TOP_LEVEL_LOOP.getSymbolFunction();
+            if (tplFun instanceof Autoload) {
+                Autoload autoload = (Autoload) tplFun;
+                autoload.load();
             }
+
             topLevelInitialized = true;
         }
     }
@@ -216,8 +201,8 @@
                 return;
             }
         }
-        catch (Throwable t) {
-            t.printStackTrace();
+        catch (IOException e) {
+            e.printStackTrace();
         }
     }
 
@@ -385,36 +370,26 @@
 
     private static void reportError(ControlTransfer c, LispThread thread)
     {
-        try {
-            getStandardInput().clearInput();
-            Stream out = getStandardOutput();
-            out.freshLine();
-            Condition condition = (Condition) c.getCondition();
-            out._writeLine("Error: unhandled condition: " +
-                           condition.writeToString());
-            if (thread != null)
-                thread.printBacktrace();
-        }
-        catch (Throwable t) {
-            
-        }
+        getStandardInput().clearInput();
+        Stream out = getStandardOutput();
+        out.freshLine();
+        Condition condition = (Condition) c.getCondition();
+        out._writeLine("Error: unhandled condition: " +
+                       condition.writeToString());
+        if (thread != null)
+            thread.printBacktrace();
     }
 
     private static void reportError(UnhandledCondition c, LispThread thread)
     {
-        try {
-            getStandardInput().clearInput();
-            Stream out = getStandardOutput();
-            out.freshLine();
-            Condition condition = (Condition) c.getCondition();
-            out._writeLine("Error: unhandled condition: " +
-                           condition.writeToString());
-            if (thread != null)
-                thread.printBacktrace();
-        }
-        catch (Throwable t) {
-            
-        }
+        getStandardInput().clearInput();
+        Stream out = getStandardOutput();
+        out.freshLine();
+        Condition condition = (Condition) c.getCondition();
+        out._writeLine("Error: unhandled condition: " +
+                       condition.writeToString());
+        if (thread != null)
+            thread.printBacktrace();
     }
 
     public void kill()
@@ -500,7 +475,7 @@
                                 condition.typeOf().writeToString() + ':');
                     Debug.trace("  " + condition.writeToString());
                 }
-                catch (Throwable t) {}
+                catch (Throwable t) {} // catch any exception to throw below
                 finally {
                     thread.resetSpecialBindings(mark);
                 }
@@ -511,13 +486,8 @@
 
     public static final LispObject readFromString(String s)
     {
-        try {
-            return new StringInputStream(s).read(true, NIL, false,
-                                                 LispThread.currentThread());
-        }
-        catch (Throwable t) {
-            return null;
-        }
+        return new StringInputStream(s).read(true, NIL, false,
+                                             LispThread.currentThread());
     }
 
     // For j.

Modified: trunk/abcl/src/org/armedbear/lisp/Java.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/Java.java	(original)
+++ trunk/abcl/src/org/armedbear/lisp/Java.java	Fri Dec 18 16:50:54 2009
@@ -696,30 +696,23 @@
             if (args.length < 1)
                 error(new WrongNumberOfArgumentsException(this));
             LispObject object = args[0];
-            try {
-                if (args.length > 1) {
-                    LispObject type = args[1];
-                    if (type == Keyword.BOOLEAN) {
-                        if (object == NIL)
-                            return JavaObject.getInstance(Boolean.FALSE);
-                        else
-                            return JavaObject.getInstance(Boolean.TRUE);
-                    }
-                    if (type == Keyword.REF) {
-                        if (object == NIL)
-                            return JavaObject.getInstance(null);
-                        else
-                            throw new Error();
-                    }
-                    // other special cases come here
+            if (args.length > 1) {
+                LispObject type = args[1];
+                if (type == Keyword.BOOLEAN) {
+                    if (object == NIL)
+                        return JavaObject.getInstance(Boolean.FALSE);
+                    else
+                        return JavaObject.getInstance(Boolean.TRUE);
                 }
-                return JavaObject.getInstance(object.javaInstance());
-            }
-            catch (Throwable t) {
-                error(new LispError("MAKE-IMMEDIATE-OBJECT: not implemented"));
+                if (type == Keyword.REF) {
+                    if (object == NIL)
+                        return JavaObject.getInstance(null);
+                    else
+                        error(new LispError("MAKE-IMMEDIATE-OBJECT: not implemented"));
+                }
+                // other special cases come here
             }
-            // Not reached.
-            return NIL;
+            return JavaObject.getInstance(object.javaInstance());
         }
     };
 

Modified: trunk/abcl/src/org/armedbear/lisp/JavaClassLoader.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/JavaClassLoader.java	(original)
+++ trunk/abcl/src/org/armedbear/lisp/JavaClassLoader.java	Fri Dec 18 16:50:54 2009
@@ -33,6 +33,8 @@
 
 package org.armedbear.lisp;
 
+import static org.armedbear.lisp.Lisp.*;
+
 import java.util.Collections;
 import java.util.HashSet;
 import java.util.Set;
@@ -70,7 +72,7 @@
     }
 
     public Class<?> loadClassFromByteArray(byte[] classbytes) {
-	return loadClassFromByteArray(null, classbytes);
+        return loadClassFromByteArray(null, classbytes);
     }
 
     public Class<?> loadClassFromByteArray(String className,
@@ -87,9 +89,9 @@
                 }
             }
         }
-	catch (LinkageError e) {
-            throw e;
-	}
+    	catch (LinkageError e) {
+                throw e;
+    	}
         catch (Throwable t) {
             Debug.trace(t);
         }
@@ -106,6 +108,10 @@
                 return c;
             }
         }
+        catch (VerifyError e)
+          {
+            error(new LispError("Class verification failed: " + e.getMessage()));
+          }
         catch (Throwable t) {
             Debug.trace(t);
         }

Modified: trunk/abcl/src/org/armedbear/lisp/Layout.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/Layout.java	(original)
+++ trunk/abcl/src/org/armedbear/lisp/Layout.java	Fri Dec 18 16:50:54 2009
@@ -49,31 +49,16 @@
   {
     this.lispClass = lispClass;
     Debug.assertTrue(instanceSlots.listp());
-    int length = 0;
-    try
-      {
-        length = instanceSlots.length();
-      }
-    catch (Throwable t)
-      {
-        // Shouldn't happen.
-        Debug.trace(t);
-      }
+    int length = instanceSlots.length();
     slotNames = new LispObject[length];
     int i = 0;
-    try
-      {
-        while (instanceSlots != NIL)
-          {
-            slotNames[i++] = instanceSlots.car();
-            instanceSlots = instanceSlots.cdr();
-          }
-      }
-    catch (Throwable t)
+
+    while (instanceSlots != NIL)
       {
-        // Shouldn't happen.
-        Debug.trace(t);
+        slotNames[i++] = instanceSlots.car();
+        instanceSlots = instanceSlots.cdr();
       }
+
     Debug.assertTrue(i == length);
     this.sharedSlots = sharedSlots;
     slotTable = initializeSlotTable(slotNames);
@@ -153,16 +138,9 @@
   protected LispObject generateSlotDefinitions()
   {
     LispObject list = NIL;
-    try
-      {
-        for (int i = slotNames.length; i-- > 0;)
-          list = list.push(new SlotDefinition(slotNames[i], NIL));
-      }
-    catch (Throwable t)
-      {
-        // Shouldn't happen.
-        Debug.trace(t);
-      }
+    for (int i = slotNames.length; i-- > 0;)
+      list = list.push(new SlotDefinition(slotNames[i], NIL));
+
     return list;
   }
 

Modified: trunk/abcl/src/org/armedbear/lisp/Lisp.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/Lisp.java	(original)
+++ trunk/abcl/src/org/armedbear/lisp/Lisp.java	Fri Dec 18 16:50:54 2009
@@ -35,9 +35,9 @@
 
 import java.io.File;
 import java.io.FileInputStream;
+import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.InputStream;
-import java.lang.reflect.Constructor;
 import java.math.BigInteger;
 import java.net.MalformedURLException;
 import java.net.URL;
@@ -95,52 +95,45 @@
   // We need NIL before we can call usePackage().
   static
   {
-    try
-      {
-        PACKAGE_CL.addNickname("CL");
-        PACKAGE_CL_USER.addNickname("CL-USER");
-        PACKAGE_CL_USER.usePackage(PACKAGE_CL);
-        PACKAGE_CL_USER.usePackage(PACKAGE_EXT);
-        PACKAGE_CL_USER.usePackage(PACKAGE_JAVA);
-        PACKAGE_SYS.addNickname("SYS");
-        PACKAGE_SYS.usePackage(PACKAGE_CL);
-        PACKAGE_SYS.usePackage(PACKAGE_EXT);
-        PACKAGE_MOP.usePackage(PACKAGE_CL);
-        PACKAGE_MOP.usePackage(PACKAGE_EXT);
-        PACKAGE_MOP.usePackage(PACKAGE_SYS);
-        PACKAGE_TPL.addNickname("TPL");
-        PACKAGE_TPL.usePackage(PACKAGE_CL);
-        PACKAGE_TPL.usePackage(PACKAGE_EXT);
-        PACKAGE_EXT.addNickname("EXT");
-        PACKAGE_EXT.usePackage(PACKAGE_CL);
-        PACKAGE_EXT.usePackage(PACKAGE_THREADS);
-        PACKAGE_JVM.usePackage(PACKAGE_CL);
-        PACKAGE_JVM.usePackage(PACKAGE_EXT);
-        PACKAGE_JVM.usePackage(PACKAGE_SYS);
-        PACKAGE_LOOP.usePackage(PACKAGE_CL);
-        PACKAGE_PROF.addNickname("PROF");
-        PACKAGE_PROF.usePackage(PACKAGE_CL);
-        PACKAGE_PROF.usePackage(PACKAGE_EXT);
-        PACKAGE_JAVA.usePackage(PACKAGE_CL);
-        PACKAGE_JAVA.usePackage(PACKAGE_EXT);
-        PACKAGE_LISP.usePackage(PACKAGE_CL);
-        PACKAGE_LISP.usePackage(PACKAGE_EXT);
-        PACKAGE_LISP.usePackage(PACKAGE_SYS);
-        PACKAGE_THREADS.usePackage(PACKAGE_CL);
-        PACKAGE_THREADS.usePackage(PACKAGE_EXT);
-        PACKAGE_THREADS.usePackage(PACKAGE_SYS);
-        PACKAGE_FORMAT.usePackage(PACKAGE_CL);
-        PACKAGE_FORMAT.usePackage(PACKAGE_EXT);
-        PACKAGE_XP.usePackage(PACKAGE_CL);
-        PACKAGE_PRECOMPILER.addNickname("PRE");
-        PACKAGE_PRECOMPILER.usePackage(PACKAGE_CL);
-        PACKAGE_PRECOMPILER.usePackage(PACKAGE_EXT);
-        PACKAGE_PRECOMPILER.usePackage(PACKAGE_SYS);
-      }
-    catch (Throwable t)
-      {
-        Debug.trace(t);
-      }
+    PACKAGE_CL.addNickname("CL");
+    PACKAGE_CL_USER.addNickname("CL-USER");
+    PACKAGE_CL_USER.usePackage(PACKAGE_CL);
+    PACKAGE_CL_USER.usePackage(PACKAGE_EXT);
+    PACKAGE_CL_USER.usePackage(PACKAGE_JAVA);
+    PACKAGE_SYS.addNickname("SYS");
+    PACKAGE_SYS.usePackage(PACKAGE_CL);
+    PACKAGE_SYS.usePackage(PACKAGE_EXT);
+    PACKAGE_MOP.usePackage(PACKAGE_CL);
+    PACKAGE_MOP.usePackage(PACKAGE_EXT);
+    PACKAGE_MOP.usePackage(PACKAGE_SYS);
+    PACKAGE_TPL.addNickname("TPL");
+    PACKAGE_TPL.usePackage(PACKAGE_CL);
+    PACKAGE_TPL.usePackage(PACKAGE_EXT);
+    PACKAGE_EXT.addNickname("EXT");
+    PACKAGE_EXT.usePackage(PACKAGE_CL);
+    PACKAGE_EXT.usePackage(PACKAGE_THREADS);
+    PACKAGE_JVM.usePackage(PACKAGE_CL);
+    PACKAGE_JVM.usePackage(PACKAGE_EXT);
+    PACKAGE_JVM.usePackage(PACKAGE_SYS);
+    PACKAGE_LOOP.usePackage(PACKAGE_CL);
+    PACKAGE_PROF.addNickname("PROF");
+    PACKAGE_PROF.usePackage(PACKAGE_CL);
+    PACKAGE_PROF.usePackage(PACKAGE_EXT);
+    PACKAGE_JAVA.usePackage(PACKAGE_CL);
+    PACKAGE_JAVA.usePackage(PACKAGE_EXT);
+    PACKAGE_LISP.usePackage(PACKAGE_CL);
+    PACKAGE_LISP.usePackage(PACKAGE_EXT);
+    PACKAGE_LISP.usePackage(PACKAGE_SYS);
+    PACKAGE_THREADS.usePackage(PACKAGE_CL);
+    PACKAGE_THREADS.usePackage(PACKAGE_EXT);
+    PACKAGE_THREADS.usePackage(PACKAGE_SYS);
+    PACKAGE_FORMAT.usePackage(PACKAGE_CL);
+    PACKAGE_FORMAT.usePackage(PACKAGE_EXT);
+    PACKAGE_XP.usePackage(PACKAGE_CL);
+    PACKAGE_PRECOMPILER.addNickname("PRE");
+    PACKAGE_PRECOMPILER.usePackage(PACKAGE_CL);
+    PACKAGE_PRECOMPILER.usePackage(PACKAGE_EXT);
+    PACKAGE_PRECOMPILER.usePackage(PACKAGE_SYS);
   }
 
   // End-of-file marker.
@@ -291,14 +284,9 @@
                                       thread.backtrace(0));
             return error(new StorageCondition("Stack overflow."));
           }
-        catch (Go go)
-          {
-            throw go;
-          }
-        catch (Throw t)
+        catch (ControlTransfer c)
           {
-            return error(new ControlError("Attempt to throw to the nonexistent tag " +
-                                           t.tag.writeToString() + "."));
+            throw c;
           }
         catch (Throwable t)
           {
@@ -1209,16 +1197,8 @@
   // Used by the compiler.
   public static final LispObject readObjectFromString(String s)
   {
-    try
-      {
-        return new StringInputStream(s).faslRead(true, NIL, false,
-                                                 LispThread.currentThread());
-      }
-    catch (Throwable t)
-      {
-        Debug.trace(t);
-        return null;
-      }
+    return new StringInputStream(s).faslRead(true, NIL, false,
+                                             LispThread.currentThread());
   }
 
   public static final LispObject loadCompiledFunction(final String namestring)
@@ -1321,19 +1301,10 @@
                       }
                   }
               }
-            catch (VerifyError e)
-              {
-                return error(new LispError("Class verification failed: " +
-                                            e.getMessage()));
-              }
             catch (IOException e)
               {
                 Debug.trace(e);
               }
-            catch (Throwable t)
-              {
-                Debug.trace(t);
-              }
           }
         return error(new LispError("Unable to load " + namestring));
       }
@@ -1342,74 +1313,76 @@
     if (file != null && file.isFile())
       {
         // The .cls file exists.
-        try
-          {
-            LispObject obj = loadCompiledFunction(new FileInputStream(file),
-                                                  (int) file.length());
-            // FIXME close stream!
-            if (obj != null)
-              return obj;
-          }
-        catch (VerifyError e)
-          {
-            return error(new LispError("Class verification failed: " +
-                                        e.getMessage()));
-          }
-        catch (Throwable t)
-          {
-            Debug.trace(t);
-          }
+        LispObject obj = null;
+        try {
+            obj = loadCompiledFunction(new FileInputStream(file),
+                                       (int) file.length());
+        }
+        catch (FileNotFoundException e) {
+            return error(new LispError("Unable to load " +
+                         pathname.writeToString() + ": Not found."));
+        }
+        // FIXME close stream!
+        if (obj != null)
+          return obj;
         return error(new LispError("Unable to load " +
                                     pathname.writeToString()));
       }
+    LispObject loadTruename = Symbol.LOAD_TRUENAME.symbolValue(thread);
+    String zipFileName = ((Pathname)loadTruename).getNamestring();
+    ZipFile zipFile = null;
     try
       {
-        LispObject loadTruename = Symbol.LOAD_TRUENAME.symbolValue(thread);
-        String zipFileName = ((Pathname)loadTruename).getNamestring();
-        ZipFile zipFile = ZipCache.getZip(zipFileName);
-        try
-          {
-            ZipEntry entry = zipFile.getEntry(namestring);
-            if (entry != null)
-              {
-                LispObject obj = loadCompiledFunction(zipFile.getInputStream(entry),
-                                                      (int) entry.getSize());
-                if (obj != null)
-                  return obj;
-                Debug.trace("Unable to load " + namestring);
-                return error(new LispError("Unable to load " + namestring));
-              }
-          }
-        finally
+        zipFile = ZipCache.getZip(zipFileName);
+        ZipEntry entry = zipFile.getEntry(namestring);
+        if (entry != null)
           {
-            ZipCache.removeZip(zipFile.getName());
+            LispObject obj = null;
+            try {
+                obj = loadCompiledFunction(zipFile.getInputStream(entry),
+                                                  (int) entry.getSize());
+            }
+            catch (IOException ignore) { };
+            if (obj != null)
+              return obj;
+            Debug.trace("Unable to load " + namestring);
+            return error(new LispError("Unable to load " + namestring));
           }
       }
-    catch (Throwable t)
+    catch (IOException ignore) {
+        //ignore IOException from ZipCache.getZip()
+    }
+    finally
       {
-        Debug.trace(t);
+        try {
+            ZipCache.removeZip(zipFile.getName());
+        }
+        catch (IOException ignore) { } // ignore
       }
     return error(new FileError("File not found: " + namestring,
                                 new Pathname(namestring)));
   }
 
-    public static final LispObject makeCompiledFunctionFromClass(Class<?> c)
-	throws Exception {
-	if (c != null) {
-	    LispObject obj = (LispObject)c.newInstance();
-	    return obj;
-        } else {
-            return null;
+    public static final LispObject makeCompiledFunctionFromClass(Class<?> c) {
+	if (c != null)
+        try {
+            return (LispObject)c.newInstance();
+        }
+        catch (InstantiationException ignore) {
+            // ignore
         }
+        catch (IllegalAccessException ignore) {
+            // ignore
+        }
+    return null;
     }
 
   private static final LispObject loadCompiledFunction(InputStream in, int size)
   {
-    try
-      {
-        byte[] bytes = new byte[size];
-        int bytesRemaining = size;
-        int bytesRead = 0;
+    byte[] bytes = new byte[size];
+    int bytesRemaining = size;
+    int bytesRead = 0;
+    try {
         while (bytesRemaining > 0)
           {
             int n = in.read(bytes, bytesRead, bytesRemaining);
@@ -1419,29 +1392,27 @@
             bytesRemaining -= n;
           }
         in.close();
-        if (bytesRemaining > 0)
-          Debug.trace("bytesRemaining = " + bytesRemaining);
+    }
+    catch (IOException e) {
+        return null; // fixme: return an error?
+    }
+    if (bytesRemaining > 0)
+      Debug.trace("bytesRemaining = " + bytesRemaining);
 
-        return loadCompiledFunction(bytes);
-      }
-    catch (Throwable t)
-      {
-        Debug.trace(t);
-      }
-    return null;
+    return loadCompiledFunction(bytes);
   }
 
-    public static final LispObject loadCompiledFunction(byte[] bytes) throws Throwable {
-	return loadCompiledFunction(bytes, new JavaClassLoader());
+    public static final LispObject loadCompiledFunction(byte[] bytes) {
+        return loadCompiledFunction(bytes, new JavaClassLoader());
     }
 
-    public static final LispObject loadCompiledFunction(byte[] bytes, JavaClassLoader cl) throws Throwable {
+    public static final LispObject loadCompiledFunction(byte[] bytes, JavaClassLoader cl) {
         Class<?> c = cl.loadClassFromByteArray(null, bytes, 0, bytes.length);
-	LispObject obj = makeCompiledFunctionFromClass(c);
-	if (obj instanceof Function) {
-	    ((Function)obj).setClassBytes(bytes);
-	}
-	return obj;
+        LispObject obj = makeCompiledFunctionFromClass(c);
+        if (obj instanceof Function) {
+            ((Function)obj).setClassBytes(bytes);
+        }
+        return obj;
     }
 
 

Modified: trunk/abcl/src/org/armedbear/lisp/LispStackFrame.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/LispStackFrame.java	(original)
+++ trunk/abcl/src/org/armedbear/lisp/LispStackFrame.java	Fri Dec 18 16:50:54 2009
@@ -121,7 +121,7 @@
      try {
        result =  unreadableString(LISP_STACK_FRAME + " " 
 				  + toLispString().getStringValue());
-     } catch (Throwable t) {
+     } catch (Throwable t) { // error while printing stack
        Debug.trace("Serious printing error: ");
        Debug.trace(t);
        result = unreadableString(LISP_STACK_FRAME);
@@ -192,7 +192,7 @@
     String result;
     try {
       result = this.toLispList().writeToString();
-    } catch (Throwable t) {
+    } catch (Throwable t) { // error while printing stack
       Debug.trace("Serious printing error: ");
       Debug.trace(t);
       result = unreadableString("LISP-STACK-FRAME");

Modified: trunk/abcl/src/org/armedbear/lisp/LispThread.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/LispThread.java	(original)
+++ trunk/abcl/src/org/armedbear/lisp/LispThread.java	Fri Dec 18 16:50:54 2009
@@ -90,7 +90,7 @@
                 catch (ThreadDestroyed ignored) {
                       // Might happen.
                 }
-                catch (Throwable t) {
+                catch (Throwable t) { // any error: process thread interrupts
                     if (isInterrupted()) {
                         processThreadInterrupts();
                     }
@@ -723,29 +723,24 @@
     public void printBacktrace(int limit)
     {
         if (stack != null) {
-            try {
-                int count = 0;
-                Stream out =
-                    checkCharacterOutputStream(Symbol.TRACE_OUTPUT.symbolValue());
-                out._writeLine("Evaluation stack:");
-                out._finishOutput();
+            int count = 0;
+            Stream out =
+                checkCharacterOutputStream(Symbol.TRACE_OUTPUT.symbolValue());
+            out._writeLine("Evaluation stack:");
+            out._finishOutput();
+
+            StackFrame s = stack;
+            while (s != null) {
+                out._writeString("  ");
+                out._writeString(String.valueOf(count));
+                out._writeString(": ");
 
-                StackFrame s = stack;
-                while (s != null) {
-                    out._writeString("  ");
-                    out._writeString(String.valueOf(count));
-                    out._writeString(": ");
-                    
-                    pprint(s.toLispList(), out.getCharPos(), out);
-                    out.terpri();
-                    out._finishOutput();
-                    if (limit > 0 && ++count == limit)
-                        break;
-                    s = s.next;
-                }
-            }
-            catch (Throwable t) {
-                t.printStackTrace();
+                pprint(s.toLispList(), out.getCharPos(), out);
+                out.terpri();
+                out._finishOutput();
+                if (limit > 0 && ++count == limit)
+                    break;
+                s = s.next;
             }
         }
     }
@@ -755,17 +750,12 @@
         LispObject result = NIL;
         if (stack != null) {
             int count = 0;
-            try {
-                StackFrame s = stack;
-                while (s != null) {
-                    result = result.push(s);
-                    if (limit > 0 && ++count == limit)
-                        break;
-                    s = s.getNext();
-                }
-            }
-            catch (Throwable t) {
-                t.printStackTrace();
+            StackFrame s = stack;
+            while (s != null) {
+                result = result.push(s);
+                if (limit > 0 && ++count == limit)
+                    break;
+                s = s.getNext();
             }
         }
         return result.nreverse();

Modified: trunk/abcl/src/org/armedbear/lisp/Load.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/Load.java	(original)
+++ trunk/abcl/src/org/armedbear/lisp/Load.java	Fri Dec 18 16:50:54 2009
@@ -179,7 +179,7 @@
             try {
                 zipfile = ZipCache.getZip(zipFileName);
             }
-            catch (Throwable t) {
+            catch (IOException e) {
                 return error (new FileError("Zip file not found: " + filename, pathname));
             }
             ZipEntry entry = zipfile.getEntry(zipEntryName);
@@ -373,10 +373,8 @@
                             catch (ZipException e) {
                                 // Fall through.
                             }
-                            catch (Throwable t) {
-                                Debug.trace(t);
-                                in = null;
-                                // Fall through.
+                            catch (IOException e) {
+                                // fall through
                             }
                         }
                         if (in == null) {
@@ -672,7 +670,7 @@
                     && bytes[2] == 0x03
                     && bytes[3] == 0x04);
         }
-        catch (Throwable t) {
+        catch (Throwable t) { // any error probably means 'no'
             return false;
         }
         finally {
@@ -680,7 +678,7 @@
                 try {
                     in.close();
                 }
-                catch (Throwable t) {}
+                catch (IOException e) {} // ignore exceptions
             }
         }
     }

Modified: trunk/abcl/src/org/armedbear/lisp/MathFunctions.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/MathFunctions.java	(original)
+++ trunk/abcl/src/org/armedbear/lisp/MathFunctions.java	Fri Dec 18 16:50:54 2009
@@ -268,23 +268,11 @@
                                            im);
         }
         if (arg instanceof SingleFloat) {
-            try {
-                double d = Math.sinh(((SingleFloat)arg).value);
-                return new SingleFloat((float)d);
-            }
-            catch (Throwable t) {
-                Debug.trace(t);
-                // Fall through...
-            }
+            double d = Math.sinh(((SingleFloat)arg).value);
+            return new SingleFloat((float)d);
         } else if (arg instanceof DoubleFloat) {
-            try {
-                double d = Math.sinh(((DoubleFloat)arg).value);
-                return new DoubleFloat(d);
-            }
-            catch (Throwable t) {
-                Debug.trace(t);
-                // Fall through...
-            }
+            double d = Math.sinh(((DoubleFloat)arg).value);
+            return new DoubleFloat(d);
         }
         LispObject result = exp(arg);
         result = result.subtract(exp(arg.multiplyBy(Fixnum.MINUS_ONE)));
@@ -318,23 +306,11 @@
                                            im);
         }
         if (arg instanceof SingleFloat) {
-            try {
-                double d = Math.cosh(((SingleFloat)arg).value);
-                return new SingleFloat((float)d);
-            }
-            catch (Throwable t) {
-                Debug.trace(t);
-                // Fall through...
-            }
+            double d = Math.cosh(((SingleFloat)arg).value);
+            return new SingleFloat((float)d);
         } else if (arg instanceof DoubleFloat) {
-            try {
-                double d = Math.cosh(((DoubleFloat)arg).value);
-                return new DoubleFloat(d);
-            }
-            catch (Throwable t) {
-                Debug.trace(t);
-                // Fall through...
-            }
+            double d = Math.cosh(((DoubleFloat)arg).value);
+            return new DoubleFloat(d);
         }
         LispObject result = exp(arg);
         result = result.add(exp(arg.multiplyBy(Fixnum.MINUS_ONE)));
@@ -356,23 +332,11 @@
         public LispObject execute(LispObject arg)
         {
             if (arg instanceof SingleFloat) {
-                try {
-                    double d = Math.tanh(((SingleFloat)arg).value);
-                    return new SingleFloat((float)d);
-                }
-                catch (Throwable t) {
-                    Debug.trace(t);
-                    // Fall through...
-                }
+                double d = Math.tanh(((SingleFloat)arg).value);
+                return new SingleFloat((float)d);
             } else if (arg instanceof DoubleFloat) {
-                try {
-                    double d = Math.tanh(((DoubleFloat)arg).value);
-                    return new DoubleFloat(d);
-                }
-                catch (Throwable t) {
-                    Debug.trace(t);
-                    // Fall through...
-                }
+                double d = Math.tanh(((DoubleFloat)arg).value);
+                return new DoubleFloat(d);
             }
             return sinh(arg).divideBy(cosh(arg));
         }
@@ -576,19 +540,13 @@
         {
             if (number.realp() && !number.minusp()
                 && base.isEqualTo(Fixnum.getInstance(10))) {
-                try {
-                    double d =
-                        Math.log10(DoubleFloat.coerceToFloat(number).value);
-                    if (number instanceof DoubleFloat
-                        || base instanceof DoubleFloat)
-                        return new DoubleFloat(d);
-                    else
-                        return new SingleFloat((float)d);
-                }
-                catch (Throwable t) {
-                    Debug.trace(t);
-                    // Fall through...
-                }
+                double d =
+                    Math.log10(DoubleFloat.coerceToFloat(number).value);
+                if (number instanceof DoubleFloat
+                    || base instanceof DoubleFloat)
+                    return new DoubleFloat(d);
+                else
+                    return new SingleFloat((float)d);
             }
             return log(number).divideBy(log(base));
         }

Modified: trunk/abcl/src/org/armedbear/lisp/Package.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/Package.java	(original)
+++ trunk/abcl/src/org/armedbear/lisp/Package.java	Fri Dec 18 16:50:54 2009
@@ -263,27 +263,18 @@
     {
         Debug.assertTrue(symbol.getPackage() == this);
         Debug.assertTrue(symbol.getName().equals("NIL"));
-        try {
-            externalSymbols.put(symbol.name, symbol);
-        }
-        catch (Throwable t) {
-            Debug.trace(t); // FIXME
-        }
+        externalSymbols.put(symbol.name, symbol);
     }
 
     private synchronized Symbol addSymbol(SimpleString name, int hash)
     {
         Symbol symbol = new Symbol(name, hash, this);
-        try {
-            if (this == PACKAGE_KEYWORD) {
-                symbol.initializeConstant(symbol);
-                externalSymbols.put(name, symbol);
-            } else
-                internalSymbols.put(name, symbol);
-        }
-        catch (Throwable t) {
-            Debug.trace(t); // FIXME
-        }
+        if (this == PACKAGE_KEYWORD) {
+            symbol.initializeConstant(symbol);
+            externalSymbols.put(name, symbol);
+        } else
+            internalSymbols.put(name, symbol);
+        
         return symbol;
     }
 
@@ -318,18 +309,13 @@
             return symbol;
         // Look in external symbols of used packages.
         if (useList instanceof Cons) {
-            try {
-                LispObject usedPackages = useList;
-                while (usedPackages != NIL) {
-                    Package pkg = (Package) usedPackages.car();
-                    symbol = pkg.findExternalSymbol(symbolName, hash);
-                    if (symbol != null)
-                        return symbol;
-                    usedPackages = usedPackages.cdr();
-                }
-            }
-            catch (Throwable t) {
-                Debug.trace(t);
+            LispObject usedPackages = useList;
+            while (usedPackages != NIL) {
+                Package pkg = (Package) usedPackages.car();
+                symbol = pkg.findExternalSymbol(symbolName, hash);
+                if (symbol != null)
+                    return symbol;
+                usedPackages = usedPackages.cdr();
             }
         }
         // Not found.
@@ -349,18 +335,13 @@
             return (Symbol) thread.setValues(symbol, Keyword.INTERNAL);
         // Look in external symbols of used packages.
         if (useList instanceof Cons) {
-            try {
-                LispObject usedPackages = useList;
-                while (usedPackages != NIL) {
-                    Package pkg = (Package) usedPackages.car();
-                    symbol = pkg.findExternalSymbol(s, hash);
-                    if (symbol != null)
-                        return (Symbol) thread.setValues(symbol, Keyword.INHERITED);
-                    usedPackages = usedPackages.cdr();
-                }
-            }
-            catch (Throwable t) {
-                Debug.trace(t);
+            LispObject usedPackages = useList;
+            while (usedPackages != NIL) {
+                Package pkg = (Package) usedPackages.car();
+                symbol = pkg.findExternalSymbol(s, hash);
+                if (symbol != null)
+                    return (Symbol) thread.setValues(symbol, Keyword.INHERITED);
+                usedPackages = usedPackages.cdr();
             }
         }
         // Not found.
@@ -756,21 +737,16 @@
         list.addAll(internalSymbols.getSymbols());
         list.addAll(externalSymbols.getSymbols());
         if (useList instanceof Cons) {
-            try {
-                LispObject usedPackages = useList;
-                while (usedPackages != NIL) {
-                    Package pkg = (Package) usedPackages.car();
-                    List<Symbol> symbols = pkg.externalSymbols.getSymbols();
-                    for (int i = 0; i < symbols.size(); i++) {
-                        Symbol symbol = (Symbol) symbols.get(i);
-                        if (shadowingSymbols == null || shadowingSymbols.get(symbol.getName()) == null)
-                            list.add(symbol);
-                    }
-                    usedPackages = usedPackages.cdr();
+            LispObject usedPackages = useList;
+            while (usedPackages != NIL) {
+                Package pkg = (Package) usedPackages.car();
+                List<Symbol> symbols = pkg.externalSymbols.getSymbols();
+                for (int i = 0; i < symbols.size(); i++) {
+                    Symbol symbol = (Symbol) symbols.get(i);
+                    if (shadowingSymbols == null || shadowingSymbols.get(symbol.getName()) == null)
+                        list.add(symbol);
                 }
-            }
-            catch (Throwable t) {
-                Debug.trace(t);
+                usedPackages = usedPackages.cdr();
             }
         }
         return list;
@@ -798,24 +774,19 @@
     {
         LispObject list = NIL;
         if (useList instanceof Cons) {
-            try {
-                LispObject usedPackages = useList;
-                while (usedPackages != NIL) {
-                    Package pkg = (Package) usedPackages.car();
-                    List externals = pkg.getExternalSymbols();
-                    for (int i = externals.size(); i-- > 0;) {
-                        Symbol symbol = (Symbol) externals.get(i);
-                        if (shadowingSymbols != null && shadowingSymbols.get(symbol.getName()) != null)
-                            continue;
-                        if (externalSymbols.get(symbol.name) == symbol)
-                            continue;
-                        list = new Cons(symbol, list);
-                    }
-                    usedPackages = usedPackages.cdr();
+            LispObject usedPackages = useList;
+            while (usedPackages != NIL) {
+                Package pkg = (Package) usedPackages.car();
+                List externals = pkg.getExternalSymbols();
+                for (int i = externals.size(); i-- > 0;) {
+                    Symbol symbol = (Symbol) externals.get(i);
+                    if (shadowingSymbols != null && shadowingSymbols.get(symbol.getName()) != null)
+                        continue;
+                    if (externalSymbols.get(symbol.name) == symbol)
+                        continue;
+                    list = new Cons(symbol, list);
                 }
-            }
-            catch (Throwable t) {
-                Debug.trace(t);
+                usedPackages = usedPackages.cdr();
             }
         }
         return list;

Modified: trunk/abcl/src/org/armedbear/lisp/Pathname.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/Pathname.java	(original)
+++ trunk/abcl/src/org/armedbear/lisp/Pathname.java	Fri Dec 18 16:50:54 2009
@@ -497,11 +497,7 @@
         boolean printEscape = (Symbol.PRINT_ESCAPE.symbolValue(thread) != NIL);
         boolean useNamestring;
         String s = null;
-        try {
-            s = getNamestring();
-        }
-        // ### FIXME exception
-        catch (Throwable t) {}
+        s = getNamestring();
         if (s != null) {
             useNamestring = true;
             if (printReadably) {
@@ -1388,12 +1384,7 @@
     };
 
     static {
-        try {
-            LispObject obj = Symbol.DEFAULT_PATHNAME_DEFAULTS.getSymbolValue();
-            Symbol.DEFAULT_PATHNAME_DEFAULTS.setSymbolValue(coerceToPathname(obj));
-        }
-        catch (Throwable t) {
-            Debug.trace(t);
-        }
+        LispObject obj = Symbol.DEFAULT_PATHNAME_DEFAULTS.getSymbolValue();
+        Symbol.DEFAULT_PATHNAME_DEFAULTS.setSymbolValue(coerceToPathname(obj));
     }
 }

Modified: trunk/abcl/src/org/armedbear/lisp/PrintNotReadable.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/PrintNotReadable.java	(original)
+++ trunk/abcl/src/org/armedbear/lisp/PrintNotReadable.java	Fri Dec 18 16:50:54 2009
@@ -83,12 +83,7 @@
     {
         FastStringBuffer sb = new FastStringBuffer();
         LispObject object = UNBOUND_VALUE;
-        try {
-            object = getInstanceSlotValue(Symbol.OBJECT);
-        }
-        catch (Throwable t) {
-            Debug.trace(t);
-        }
+        object = getInstanceSlotValue(Symbol.OBJECT);
         if (object != UNBOUND_VALUE) {
             final LispThread thread = LispThread.currentThread();
             final SpecialBindingsMark mark = thread.markSpecialBindings();
@@ -97,9 +92,6 @@
             try {
                 sb.append(object.writeToString());
             }
-            catch (Throwable t) {
-                sb.append("Object");
-            }
             finally {
                 thread.resetSpecialBindings(mark);
             }

Modified: trunk/abcl/src/org/armedbear/lisp/RandomState.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/RandomState.java	(original)
+++ trunk/abcl/src/org/armedbear/lisp/RandomState.java	Fri Dec 18 16:50:54 2009
@@ -64,9 +64,9 @@
             ObjectInputStream in = new ObjectInputStream(fileIn);
             random = (Random) in.readObject();
             in.close();
-            file.delete();
+            file.delete(); // FIXME: file leak on exception
         }
-        catch (Throwable t) {
+        catch (Throwable t) { // ANY exception gets converted to a lisp error
             error(new LispError("Unable to copy random state."));
         }
     }

Modified: trunk/abcl/src/org/armedbear/lisp/Return.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/Return.java	(original)
+++ trunk/abcl/src/org/armedbear/lisp/Return.java	Fri Dec 18 16:50:54 2009
@@ -71,15 +71,9 @@
     @Override
     public LispObject getCondition()
     {
-        try {
-            FastStringBuffer sb = new FastStringBuffer("No block named ");
-            sb.append(tag.writeToString());
-            sb.append(" is currently visible.");
-            return new ControlError(sb.toString());
-        }
-        catch (Throwable t) {
-            Debug.trace(t);
-            return new Condition();
-        }
+        FastStringBuffer sb = new FastStringBuffer("No block named ");
+        sb.append(tag.writeToString());
+        sb.append(" is currently visible.");
+        return new ControlError(sb.toString());
     }
 }

Modified: trunk/abcl/src/org/armedbear/lisp/RuntimeClass.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/RuntimeClass.java	(original)
+++ trunk/abcl/src/org/armedbear/lisp/RuntimeClass.java	Fri Dec 18 16:50:54 2009
@@ -122,9 +122,6 @@
                 return error(new LispError("class could not be linked: " +
                                             e.getMessage()));
             }
-            catch (Throwable t) {
-                Debug.trace(t);
-            }
             return error(
                 new LispError("unable to load ".concat(cn)));
         }

Modified: trunk/abcl/src/org/armedbear/lisp/ShellCommand.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/ShellCommand.java	(original)
+++ trunk/abcl/src/org/armedbear/lisp/ShellCommand.java	Fri Dec 18 16:50:54 2009
@@ -204,12 +204,7 @@
                 String s = read();
                 if (s == null)
                     return;
-                try {
-                    processOutput(s);
-                }
-                catch (Throwable t) {
-                    Debug.trace(t);
-                }
+                processOutput(s);
             }
         }
 
@@ -234,9 +229,6 @@
             catch (InterruptedException e) {
                 return null;
             }
-            catch (Throwable t) {
-                return null;
-            }
             return sb.toString();
         }
     }

Modified: trunk/abcl/src/org/armedbear/lisp/SimpleTypeError.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/SimpleTypeError.java	(original)
+++ trunk/abcl/src/org/armedbear/lisp/SimpleTypeError.java	Fri Dec 18 16:50:54 2009
@@ -72,21 +72,17 @@
     @Override
     public String getMessage()
     {
-        try {
-            LispObject formatControl = getFormatControl();
-            if (formatControl != NIL) {
-                LispObject formatArguments = getFormatArguments();
-                // (apply 'format (append '(nil format-control) format-arguments))
-                LispObject result =
-                    Primitives.APPLY.execute(Symbol.FORMAT,
-                                             Primitives.APPEND.execute(list(NIL,
-                                                                             formatControl),
-                                                                       formatArguments));
-                return result.getStringValue();
-            }
-            return super.getMessage();
+        LispObject formatControl = getFormatControl();
+        if (formatControl != NIL) {
+            LispObject formatArguments = getFormatArguments();
+            // (apply 'format (append '(nil format-control) format-arguments))
+            LispObject result =
+                Primitives.APPLY.execute(Symbol.FORMAT,
+                                         Primitives.APPEND.execute(list(NIL,
+                                                                         formatControl),
+                                                                   formatArguments));
+            return result.getStringValue();
         }
-        catch (Throwable t) {}
-        return null;
+        return super.getMessage();
     }
 }

Modified: trunk/abcl/src/org/armedbear/lisp/Site.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/Site.java	(original)
+++ trunk/abcl/src/org/armedbear/lisp/Site.java	Fri Dec 18 16:50:54 2009
@@ -83,13 +83,8 @@
         exportSpecial("*LISP-HOME*", PACKAGE_EXT, NIL);
 
     static {
-        try {
-            String s = Site.getLispHome();
-            if (s != null)
-                _LISP_HOME_.setSymbolValue(new Pathname(s));
-        }
-        catch (Throwable t) {
-            Debug.trace(t);
-        }
+        String s = Site.getLispHome();
+        if (s != null)
+            _LISP_HOME_.setSymbolValue(new Pathname(s));
     }
 }

Modified: trunk/abcl/src/org/armedbear/lisp/SiteName.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/SiteName.java	(original)
+++ trunk/abcl/src/org/armedbear/lisp/SiteName.java	Fri Dec 18 16:50:54 2009
@@ -36,18 +36,23 @@
 import static org.armedbear.lisp.Lisp.*;
 
 import java.net.InetAddress;
+import java.net.UnknownHostException;
 
 public final class SiteName
 {
     private static LispObject getHostName()
     {
         String hostName = null;
+        InetAddress addr;
         try {
-            InetAddress addr = InetAddress.getLocalHost();
-            if (addr != null)
-                hostName = addr.getHostName();
+            addr = InetAddress.getLocalHost();
         }
-        catch (Throwable t) {}
+        catch (UnknownHostException e) {
+            addr = null;
+        }
+        if (addr != null)
+            hostName = addr.getHostName();
+
         return hostName != null ? new SimpleString(hostName) : NIL;
     }
 

Modified: trunk/abcl/src/org/armedbear/lisp/SlimeInputStream.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/SlimeInputStream.java	(original)
+++ trunk/abcl/src/org/armedbear/lisp/SlimeInputStream.java	Fri Dec 18 16:50:54 2009
@@ -96,13 +96,8 @@
     protected int _readChar()
     {
         if (offset >= length) {
-            try {
-                ostream.finishOutput();
-                s = LispThread.currentThread().execute(f).getStringValue();
-            }
-            catch (Throwable t) {
-                return -1;
-            }
+            ostream.finishOutput();
+            s = LispThread.currentThread().execute(f).getStringValue();
             if (s.length() == 0)
                 return -1;
             offset = 0;

Modified: trunk/abcl/src/org/armedbear/lisp/SlotClass.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/SlotClass.java	(original)
+++ trunk/abcl/src/org/armedbear/lisp/SlotClass.java	Fri Dec 18 16:50:54 2009
@@ -123,43 +123,39 @@
     {
         if (isFinalized())
             return;
-        try {
-            Debug.assertTrue(slotDefinitions == NIL);
-            LispObject cpl = getCPL();
-            Debug.assertTrue(cpl != null);
-            Debug.assertTrue(cpl.listp());
-            cpl = cpl.reverse();
-            while (cpl != NIL) {
-                LispObject car = cpl.car();
-                if (car instanceof StandardClass) {
-                    StandardClass cls = (StandardClass) car;
-                    LispObject defs = cls.getDirectSlotDefinitions();
-                    Debug.assertTrue(defs != null);
-                    Debug.assertTrue(defs.listp());
-                    while (defs != NIL) {
-                        slotDefinitions = slotDefinitions.push(defs.car());
-                        defs = defs.cdr();
-                    }
+
+        Debug.assertTrue(slotDefinitions == NIL);
+        LispObject cpl = getCPL();
+        Debug.assertTrue(cpl != null);
+        Debug.assertTrue(cpl.listp());
+        cpl = cpl.reverse();
+        while (cpl != NIL) {
+            LispObject car = cpl.car();
+            if (car instanceof StandardClass) {
+                StandardClass cls = (StandardClass) car;
+                LispObject defs = cls.getDirectSlotDefinitions();
+                Debug.assertTrue(defs != null);
+                Debug.assertTrue(defs.listp());
+                while (defs != NIL) {
+                    slotDefinitions = slotDefinitions.push(defs.car());
+                    defs = defs.cdr();
                 }
-                cpl = cpl.cdr();
             }
-            slotDefinitions = slotDefinitions.nreverse();
-            LispObject[] instanceSlotNames = new LispObject[slotDefinitions.length()];
-            int i = 0;
-            LispObject tail = slotDefinitions;
-            while (tail != NIL) {
-                SlotDefinition slotDefinition = (SlotDefinition) tail.car();
-                slotDefinition.setLocation(i);
-                instanceSlotNames[i++] = slotDefinition.getName();
-                tail = tail.cdr();
-            }
-            setClassLayout(new Layout(this, instanceSlotNames, NIL));
-            setDefaultInitargs(computeDefaultInitargs());
-            setFinalized(true);
-        }
-        catch (Throwable t) {
-            Debug.trace(t);
+            cpl = cpl.cdr();
         }
+        slotDefinitions = slotDefinitions.nreverse();
+        LispObject[] instanceSlotNames = new LispObject[slotDefinitions.length()];
+        int i = 0;
+        LispObject tail = slotDefinitions;
+        while (tail != NIL) {
+            SlotDefinition slotDefinition = (SlotDefinition) tail.car();
+            slotDefinition.setLocation(i);
+            instanceSlotNames[i++] = slotDefinition.getName();
+            tail = tail.cdr();
+        }
+        setClassLayout(new Layout(this, instanceSlotNames, NIL));
+        setDefaultInitargs(computeDefaultInitargs());
+        setFinalized(true);
     }
 
     // ### class-direct-slots

Modified: trunk/abcl/src/org/armedbear/lisp/SlotDefinition.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/SlotDefinition.java	(original)
+++ trunk/abcl/src/org/armedbear/lisp/SlotDefinition.java	Fri Dec 18 16:50:54 2009
@@ -47,41 +47,27 @@
   public SlotDefinition(LispObject name, LispObject readers)
   {
     this();
-    try
-      {
-        Debug.assertTrue(name instanceof Symbol);
-        slots[SlotDefinitionClass.SLOT_INDEX_NAME] = name;
-        slots[SlotDefinitionClass.SLOT_INDEX_INITFUNCTION] = NIL;
-        slots[SlotDefinitionClass.SLOT_INDEX_INITARGS] =
-          new Cons(PACKAGE_KEYWORD.intern(((Symbol)name).getName()));
-        slots[SlotDefinitionClass.SLOT_INDEX_READERS] = readers;
-        slots[SlotDefinitionClass.SLOT_INDEX_ALLOCATION] = Keyword.INSTANCE;
-      }
-    catch (Throwable t)
-      {
-        Debug.trace(t);
-      }
+    Debug.assertTrue(name instanceof Symbol);
+    slots[SlotDefinitionClass.SLOT_INDEX_NAME] = name;
+    slots[SlotDefinitionClass.SLOT_INDEX_INITFUNCTION] = NIL;
+    slots[SlotDefinitionClass.SLOT_INDEX_INITARGS] =
+      new Cons(PACKAGE_KEYWORD.intern(((Symbol)name).getName()));
+    slots[SlotDefinitionClass.SLOT_INDEX_READERS] = readers;
+    slots[SlotDefinitionClass.SLOT_INDEX_ALLOCATION] = Keyword.INSTANCE;
   }
 
   public SlotDefinition(LispObject name, LispObject readers,
                         LispObject initForm)
   {
     this();
-    try
-      {
-        Debug.assertTrue(name instanceof Symbol);
-        slots[SlotDefinitionClass.SLOT_INDEX_NAME] = name;
-        slots[SlotDefinitionClass.SLOT_INDEX_INITFUNCTION] = NIL;
-        slots[SlotDefinitionClass.SLOT_INDEX_INITFORM] = initForm;
-        slots[SlotDefinitionClass.SLOT_INDEX_INITARGS] =
-          new Cons(PACKAGE_KEYWORD.intern(((Symbol)name).getName()));
-        slots[SlotDefinitionClass.SLOT_INDEX_READERS] = readers;
-        slots[SlotDefinitionClass.SLOT_INDEX_ALLOCATION] = Keyword.INSTANCE;
-      }
-    catch (Throwable t)
-      {
-        Debug.trace(t);
-      }
+    Debug.assertTrue(name instanceof Symbol);
+    slots[SlotDefinitionClass.SLOT_INDEX_NAME] = name;
+    slots[SlotDefinitionClass.SLOT_INDEX_INITFUNCTION] = NIL;
+    slots[SlotDefinitionClass.SLOT_INDEX_INITFORM] = initForm;
+    slots[SlotDefinitionClass.SLOT_INDEX_INITARGS] =
+      new Cons(PACKAGE_KEYWORD.intern(((Symbol)name).getName()));
+    slots[SlotDefinitionClass.SLOT_INDEX_READERS] = readers;
+    slots[SlotDefinitionClass.SLOT_INDEX_ALLOCATION] = Keyword.INSTANCE;
   }
   
   public static SlotDefinition checkSlotDefination(LispObject obj) {

Modified: trunk/abcl/src/org/armedbear/lisp/Symbol.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/Symbol.java	(original)
+++ trunk/abcl/src/org/armedbear/lisp/Symbol.java	Fri Dec 18 16:50:54 2009
@@ -247,39 +247,23 @@
 
   public final String getName()
   {
-    try
-      {
-        return name.getStringValue();
-      }
-    catch (Throwable t)
-      {
-        Debug.trace(t);
-        return null;
-      }
+    return name.getStringValue();
   }
 
   public final String getQualifiedName()
   {
-    try
-      {
-        final String n = name.getStringValue();
-        if (pkg == NIL)
-          return("#:".concat(n));
-        if (pkg == PACKAGE_KEYWORD)
-          return ":".concat(n);
-        FastStringBuffer sb = new FastStringBuffer(((Package)pkg).getName());
-        if (((Package)pkg).findExternalSymbol(name) != null)
-          sb.append(':');
-        else
-          sb.append("::");
-        sb.append(n);
-        return sb.toString();
-      }
-    catch (Throwable t)
-      {
-        Debug.trace(t);
-        return null;
-      }
+    final String n = name.getStringValue();
+    if (pkg == NIL)
+      return("#:".concat(n));
+    if (pkg == PACKAGE_KEYWORD)
+      return ":".concat(n);
+    FastStringBuffer sb = new FastStringBuffer(((Package)pkg).getName());
+    if (((Package)pkg).findExternalSymbol(name) != null)
+      sb.append(':');
+    else
+      sb.append("::");
+    sb.append(n);
+    return sb.toString();
   }
 
   /** Gets the value associated with the symbol

Modified: trunk/abcl/src/org/armedbear/lisp/SymbolHashTable.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/SymbolHashTable.java	(original)
+++ trunk/abcl/src/org/armedbear/lisp/SymbolHashTable.java	Fri Dec 18 16:50:54 2009
@@ -65,13 +65,8 @@
     {
         HashEntry e = buckets[key.sxhash() & mask];
         while (e != null) {
-            try {
-                if (key.equal(e.symbol.name))
-                    return e.symbol; // Return the symbol.
-            }
-            catch (Throwable t) {
-                Debug.trace(t); // Shouldn't happen.
-            }
+            if (key.equal(e.symbol.name))
+                return e.symbol; // Return the symbol.
             e = e.next;
         }
         return null;
@@ -81,13 +76,8 @@
     {
         HashEntry e = buckets[hash & mask];
         while (e != null) {
-            try {
-                if (key.equal(e.symbol.name))
-                    return e.symbol; // Return the symbol.
-            }
-            catch (Throwable t) {
-                Debug.trace(t); // Shouldn't happen.
-            }
+            if (key.equal(e.symbol.name))
+                return e.symbol; // Return the symbol.
             e = e.next;
         }
         return null;
@@ -98,19 +88,14 @@
         int index = key.sxhash() & mask;
         HashEntry e = buckets[index];
         while (e != null) {
-            try {
-                if (key.equal(e.symbol.name)) {
-                    if (e.symbol != symbol) {
-                        Debug.trace("replacing existing key for " + key.getStringValue() +
-                                    " in package " + e.symbol.getPackage().writeToString());
-                        Thread.dumpStack();
-                        e.symbol = symbol;
-                    }
-                    return;
+            if (key.equal(e.symbol.name)) {
+                if (e.symbol != symbol) {
+                    Debug.trace("replacing existing key for " + key.getStringValue() +
+                                " in package " + e.symbol.getPackage().writeToString());
+                    Thread.dumpStack();
+                    e.symbol = symbol;
                 }
-            }
-            catch (Throwable t) {
-                Debug.trace(t); // FIXME
+                return;
             }
             e = e.next;
         }
@@ -130,18 +115,13 @@
         int index = symbol.sxhash() & mask;
         HashEntry e = buckets[index];
         while (e != null) {
-            try {
-                if (symbol.name.equal(e.symbol.name)) {
-                    if (e.symbol != symbol) {
-                        Debug.trace("replacing existing key for " + symbol.getName());
-                        Thread.dumpStack();
-                        e.symbol = symbol; // Replace existing key.
-                    }
-                    return;
+            if (symbol.name.equal(e.symbol.name)) {
+                if (e.symbol != symbol) {
+                    Debug.trace("replacing existing key for " + symbol.getName());
+                    Thread.dumpStack();
+                    e.symbol = symbol; // Replace existing key.
                 }
-            }
-            catch (Throwable t) {
-                Debug.trace(t); // FIXME
+                return;
             }
             e = e.next;
         }
@@ -164,18 +144,13 @@
         HashEntry e = buckets[index];
         HashEntry last = null;
         while (e != null) {
-            try {
-                if (key.equal(e.symbol.name)) {
-                    if (last == null)
-                        buckets[index] = e.next;
-                    else
-                        last.next = e.next;
-                    --count;
-                    return e.symbol; // The key is the value!
-                }
-            }
-            catch (Throwable t) {
-                Debug.trace(t); // FIXME
+            if (key.equal(e.symbol.name)) {
+                if (last == null)
+                    buckets[index] = e.next;
+                else
+                    last.next = e.next;
+                --count;
+                return e.symbol; // The key is the value!
             }
             last = e;
             e = e.next;

Modified: trunk/abcl/src/org/armedbear/lisp/Throw.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/Throw.java	(original)
+++ trunk/abcl/src/org/armedbear/lisp/Throw.java	Fri Dec 18 16:50:54 2009
@@ -56,13 +56,7 @@
     @Override
     public LispObject getCondition()
     {
-        try {
-            return new ControlError("Attempt to throw to the nonexistent tag " +
-                                    tag.writeToString() + ".");
-        }
-        catch (Throwable t) {
-            Debug.trace(t);
-            return new Condition();
-        }
+        return new ControlError("Attempt to throw to the nonexistent tag " +
+                                tag.writeToString() + ".");
     }
 }

Modified: trunk/abcl/src/org/armedbear/lisp/TypeError.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/TypeError.java	(original)
+++ trunk/abcl/src/org/armedbear/lisp/TypeError.java	Fri Dec 18 16:50:54 2009
@@ -129,48 +129,37 @@
     @Override
     public String getMessage()
     {
-        // FIXME
+        final LispThread thread = LispThread.currentThread();
+        final SpecialBindingsMark mark = thread.markSpecialBindings();
+        thread.bindSpecial(Symbol.PRINT_ESCAPE, T);
         try {
-            final LispThread thread = LispThread.currentThread();
-            final SpecialBindingsMark mark = thread.markSpecialBindings();
-            thread.bindSpecial(Symbol.PRINT_ESCAPE, T);
-            try {
-                String s = super.getMessage();
-                if (s != null)
-                    return s;
-                final LispObject datum = getDatum();
-                final LispObject expectedType = getExpectedType();
-                FastStringBuffer sb = new FastStringBuffer();
-                String name = datum != null ? datum.writeToString() : null;
-                String type = null;
-                if (expectedType != null)
-                    type = expectedType.writeToString();
-                if (type != null) {
-                    if (name != null) {
-                        sb.append("The value ");
-                        sb.append(name);
-                    } else
-                        sb.append("Value");
-                    sb.append(" is not of type ");
-                    sb.append(type);
-                } else if (name != null) {
-                    sb.append("Wrong type: ");
+            String s = super.getMessage();
+            if (s != null)
+                return s;
+            final LispObject datum = getDatum();
+            final LispObject expectedType = getExpectedType();
+            FastStringBuffer sb = new FastStringBuffer();
+            String name = datum != null ? datum.writeToString() : null;
+            String type = null;
+            if (expectedType != null)
+                type = expectedType.writeToString();
+            if (type != null) {
+                if (name != null) {
+                    sb.append("The value ");
                     sb.append(name);
-                }
-                sb.append('.');
-                return sb.toString();
-            }
-            catch (Throwable t) {
-                // FIXME
-                Debug.trace(t);
-                return toString();
-            }
-            finally {
-                thread.resetSpecialBindings(mark);
+                } else
+                    sb.append("Value");
+                sb.append(" is not of type ");
+                sb.append(type);
+            } else if (name != null) {
+                sb.append("Wrong type: ");
+                sb.append(name);
             }
+            sb.append('.');
+            return sb.toString();
         }
-        catch (Throwable t) {
-            return toString();
+        finally {
+            thread.resetSpecialBindings(mark);
         }
     }
 

Modified: trunk/abcl/src/org/armedbear/lisp/UnboundVariable.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/UnboundVariable.java	(original)
+++ trunk/abcl/src/org/armedbear/lisp/UnboundVariable.java	Fri Dec 18 16:50:54 2009
@@ -54,12 +54,9 @@
     final SpecialBindingsMark mark = thread.markSpecialBindings();
     thread.bindSpecial(Symbol.PRINT_ESCAPE, T);
     StringBuffer sb = new StringBuffer("The variable ");
-    // FIXME
-    try
-      {
+    try {
         sb.append(getCellName().writeToString());
-      }
-    catch (Throwable t) {}
+    }
     finally {
         thread.resetSpecialBindings(mark);
     }

Modified: trunk/abcl/src/org/armedbear/lisp/WrongNumberOfArgumentsException.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/WrongNumberOfArgumentsException.java	(original)
+++ trunk/abcl/src/org/armedbear/lisp/WrongNumberOfArgumentsException.java	Fri Dec 18 16:50:54 2009
@@ -58,12 +58,7 @@
         LispObject lambdaName = operator.getLambdaName();
         if (lambdaName != null && lambdaName != NIL) {
             sb.append(" for ");
-            try {
-                sb.append(operator.getLambdaName().writeToString());
-            }
-            catch (Throwable t) {
-                Debug.trace(t);
-            }
+            sb.append(operator.getLambdaName().writeToString());
         }
         sb.append('.');
         return sb.toString();




More information about the armedbear-cvs mailing list