maguro      2005/04/20 14:59:53

  Modified:    modules/core/src/java/org/openejb/corba/compiler
                        OpenORBStubGenerator.java
  Log:

  Filter errors from Sun's name server.
  
  Revision  Changes    Path
  1.11      +25 -9     
openejb/modules/core/src/java/org/openejb/corba/compiler/OpenORBStubGenerator.java
  
  Index: OpenORBStubGenerator.java
  ===================================================================
  RCS file: 
/home/projects/openejb/scm/openejb/modules/core/src/java/org/openejb/corba/compiler/OpenORBStubGenerator.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- OpenORBStubGenerator.java 17 Apr 2005 16:43:29 -0000      1.10
  +++ OpenORBStubGenerator.java 20 Apr 2005 18:59:53 -0000      1.11
  @@ -174,13 +174,7 @@
               jar.setUpdate(true);
               jar.execute();
           } catch (Exception e) {
  -            log.error("Error generating stub", e);
  -
  -            /**
  -             * Convert the msg to string so that we don't try to serialize
  -             * anything that is unserializable in a cause exception
  -             */
  -            throw new CompilerException(e.toString());
  +            logAndThrow(e);
           } finally {
               Thread.currentThread().setContextClassLoader(savedLoader);
               FileUtils.recursiveDelete(TEMPDIR);
  @@ -194,6 +188,28 @@
           for (int i = 0; i < classes.length; i++) {
               collectClasspaths(set, classes[i]);
           }
  +    }
  +
  +    private static void logAndThrow(Exception e) throws CompilerException {
  +        boolean shouldLog = true;
  +        StackTraceElement[] stackTrace = e.getStackTrace();
  +        for (int i = 0; i < stackTrace.length; i++) {
  +            StackTraceElement stackTraceElement = stackTrace[i];
  +            if 
(stackTraceElement.getClassName().equals("org.omg.CosNaming.NamingContextExtPOA")
  +                && stackTraceElement.getMethodName().equals("_invoke")) {
  +                shouldLog = false;
  +                break;
  +            }
  +        }
  +        if (shouldLog) {
  +            log.error("Unable to generate stub", e);
  +        }
  +
  +        /**
  +         * Convert the msg to string so that we don't try to serialize
  +         * anything that is unserializable in a cause exception
  +         */
  +        throw new CompilerException("Unable to generate stub: " + 
e.toString());
       }
   
       public void doStart() throws Exception {
  
  
  

Reply via email to