river-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bob Scheifler (JIRA)" <j...@apache.org>
Subject [jira] Created: (RIVER-151) ClassDep should have a method to determine if problems occurred
Date Mon, 30 Jul 2007 16:51:52 GMT
ClassDep should have a method to determine if problems occurred
---------------------------------------------------------------

                 Key: RIVER-151
                 URL: https://issues.apache.org/jira/browse/RIVER-151
             Project: River
          Issue Type: New Feature
          Components: com_sun_jini_tool
    Affects Versions: jtsk_2.1
            Reporter: Bob Scheifler
            Priority: Minor


Bugtraq ID [6353693|http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6353693]

When using ClassDep there are various conditions that result in a diagnostic message being
printed that indicates some problem. But there is no API to find out programatically if any
such problems occurred.

SuggestedFix

--- C:\Documents and Settings\marbro\Local Settings\Temp\t3596t46.tmp   Sun Nov 20 11:27:33
2005 UTC
+++ D:\workspace\party\jini\src\com\sun\jini\tool\ClassDep.java Sat Nov 19 17:15:14 2005 UTC
@@ -15,6 +15,10 @@
  * limitations under the License.
  *
  */
+
+/*
+ * NOTE: this file has been modified by the Cheiron Project.
+ */
 package com.sun.jini.tool;

 import sun.tools.java.BinaryClass;
@@ -507,6 +511,12 @@
     private final ArrayList results = new ArrayList();

     /**
+     * Indicates whether a failure has been encountered during deep dependency
+     * checking.
+     */
+    private boolean failed;
+
+    /**
      * No argument constructor. The user must fill in the
      * appropriate fields prior to asking for the processing
      * of dependencies.
@@ -855,12 +865,15 @@
            cdef = (BinaryClass)env.getClassDefinition(id);
            cdef.loadNested(env);
        } catch (ClassNotFound e) {
+           failed = true;
            print("classdep.notfound", id);
            return;
        } catch (IllegalArgumentException e) {
+           failed = true;
            print("classdep.illegal", id, e.getMessage());
            return;
        } catch (Exception e) {
+           failed = true;
            print("classdep.failed", id);
            e.printStackTrace();
            return;
@@ -921,8 +934,15 @@
      * Method that takes the user provided switches that
      * logically define the domain in which to look for
      * dependencies.
+     * <p>
+     * Whether a failure has occurred during computing the dependent classes
+     * can be found out with a call to {@link #hasFailed()}.
+     *
+     * @return array containing the dependent classes found in the format as
+     * specified by the options passed in
      */
     public String[] compute() {
+       failed = false;
        /* sort ins and outs, longest first */
        Comparator c = new Compare();
        Collections.sort(inside, c);
@@ -1115,6 +1135,17 @@
     }

     /**
+     * Indicates whether computing the dependent classes as result of the last
+     * call to {@link #compute()} resulted in one or more failures.
+     *
+     * @return <code>true</code> in case a failure has happened, such as a
+     * class not being found, <code>false</code> otherwise
+     */
+    public boolean hasFailed() {
+       return failed;
+    }
+
+    /**
      * Convenience method for initializing an instance with specific
      * command line arguments. See the description of this class
      * for a list and description of the acceptable arguments.

Entry 1 bob.scheifler [2005-11-21 16:25]



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message