svn commit: r386056 [27/28] - in /jakarta/bcel/trunk: examples/ examples/Mini/ src/java/org/apache/bcel/ src/java/org/apache/bcel/classfile/ src/java/org/apache/bcel/generic/ src/java/org/apache/bcel/util/ src/java/org/apache/bcel/verifier/ src/java/or...

[email protected]
Newsgroups gmane.comp.jakarta.bcel.devel
Message-ID <[email protected]>
Modified: jakarta/bcel/trunk/src/java/org/apache/bcel/verifier/GraphicalVerifier.java
URL: http://svn.apache.org/viewcvs/jakarta/bcel/trunk/src/java/org/apache/bcel/verifier/GraphicalVerifier.java?rev=386056&r1=386055&r2=386056&view=diff
==============================================================================
--- jakarta/bcel/trunk/src/java/org/apache/bcel/verifier/GraphicalVerifier.java (original)
+++ jakarta/bcel/trunk/src/java/org/apache/bcel/verifier/GraphicalVerifier.java Wed Mar 15 03:31:56 2006
@@ -13,16 +13,14 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License. 
  *
- */ 
+ */
 package org.apache.bcel.verifier;
 
-
 import java.awt.Dimension;
 import java.awt.Toolkit;
 import javax.swing.UIManager;
 import org.apache.bcel.generic.Type;
 
-
 /**
  * A graphical user interface application demonstrating JustIce.
  *
@@ -30,43 +28,45 @@
  * @author Enver Haase
  */
 public class GraphicalVerifier {
-  boolean packFrame = false;
 
-  /** Constructor. */
-  public GraphicalVerifier() {
-    VerifierAppFrame frame = new VerifierAppFrame();
-    //Frames überprüfen, die voreingestellte Größe haben
-    //Frames packen, die nutzbare bevorzugte Größeninformationen enthalten, z.B. aus ihrem Layout
-    if (packFrame) {
-      frame.pack();
-    }
-    else {
-      frame.validate();
-    }
-    //Das Fenster zentrieren
-    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
-    Dimension frameSize = frame.getSize();
-    if (frameSize.height > screenSize.height) {
-      frameSize.height = screenSize.height;
-    }
-    if (frameSize.width > screenSize.width) {
-      frameSize.width = screenSize.width;
-    }
-    frame.setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2);
-    frame.setVisible(true);
+    boolean packFrame = false;
+
 
-    frame.classNamesJList.setModel(new VerifierFactoryListModel());
-    VerifierFactory.getVerifier(Type.OBJECT.getClassName()); // Fill list with java.lang.Object
-    frame.classNamesJList.setSelectedIndex(0); // default, will verify java.lang.Object
-  }
-  /** Main method. */
-  public static void main(String[] args) {
-    try {
-      UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
+    /** Constructor. */
+    public GraphicalVerifier() {
+        VerifierAppFrame frame = new VerifierAppFrame();
+        //Frames überprüfen, die voreingestellte Größe haben
+        //Frames packen, die nutzbare bevorzugte Größeninformationen enthalten, z.B. aus ihrem Layout
+        if (packFrame) {
+            frame.pack();
+        } else {
+            frame.validate();
+        }
+        //Das Fenster zentrieren
+        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
+        Dimension frameSize = frame.getSize();
+        if (frameSize.height > screenSize.height) {
+            frameSize.height = screenSize.height;
+        }
+        if (frameSize.width > screenSize.width) {
+            frameSize.width = screenSize.width;
+        }
+        frame.setLocation((screenSize.width - frameSize.width) / 2,
+                (screenSize.height - frameSize.height) / 2);
+        frame.setVisible(true);
+        frame.classNamesJList.setModel(new VerifierFactoryListModel());
+        VerifierFactory.getVerifier(Type.OBJECT.getClassName()); // Fill list with java.lang.Object
+        frame.classNamesJList.setSelectedIndex(0); // default, will verify java.lang.Object
     }
-    catch(Exception e) {
-      e.printStackTrace();
+
+
+    /** Main method. */
+    public static void main( String[] args ) {
+        try {
+            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        new GraphicalVerifier();
     }
-    new GraphicalVerifier();
-  }
 }

Modified: jakarta/bcel/trunk/src/java/org/apache/bcel/verifier/NativeVerifier.java
URL: http://svn.apache.org/viewcvs/jakarta/bcel/trunk/src/java/org/apache/bcel/verifier/NativeVerifier.java?rev=386056&r1=386055&r2=386056&view=diff
==============================================================================
--- jakarta/bcel/trunk/src/java/org/apache/bcel/verifier/NativeVerifier.java (original)
+++ jakarta/bcel/trunk/src/java/org/apache/bcel/verifier/NativeVerifier.java Wed Mar 15 03:31:56 2006
@@ -13,10 +13,9 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License. 
  *
- */ 
+ */
 package org.apache.bcel.verifier;
 
-
 /**
  * The NativeVerifier class implements a main(String[] args) method that's
  * roughly compatible to the one in the Verifier class, but that uses the
@@ -27,53 +26,49 @@
  * @version $Id$
  * @author Enver Haase
  */
-public abstract class NativeVerifier{
-
-	/**
-	 * This class must not be instantiated.
-	 */
-	private NativeVerifier(){
-	}
-	
-	/**
-	 * Works only on the first argument.
-	 */
-	public static void main(String [] args){
-		if (args.length != 1){
-			System.out.println("Verifier front-end: need exactly one argument.");
-			System.exit(1);
-		}
-
-		int dotclasspos = args[0].lastIndexOf(".class");
-		if (dotclasspos != -1) args[0] = args[0].substring(0,dotclasspos);
-		args[0] = args[0].replace('/','.');
-		//System.out.println(args[0]);
-
-		
-		try{
-			Class.forName(args[0]);
-		}
-		catch(ExceptionInInitializerError eiie){ //subclass of LinkageError!
-			System.out.println("NativeVerifier: ExceptionInInitializerError encountered on '"+args[0]+"'.");
-			System.out.println(eiie);
-			System.exit(1);		
-		}
-		catch(LinkageError le){
-			System.out.println("NativeVerifier: LinkageError encountered on '"+args[0]+"'.");
-			System.out.println(le);
-			System.exit(1);
-		}
-		catch(ClassNotFoundException cnfe){
-			System.out.println("NativeVerifier: FILE NOT FOUND: '"+args[0]+"'.");
-			System.exit(1);
-		}
-		catch(Throwable t){
-			System.out.println("NativeVerifier: Unspecified verification error on'"+args[0]+"'.");
-			System.exit(1);
-		}
-		
-		System.out.println("NativeVerifier: Class file '"+args[0]+"' seems to be okay.");
-		System.exit(0);
+public abstract class NativeVerifier {
 
-	}
+    /**
+     * This class must not be instantiated.
+     */
+    private NativeVerifier() {
+    }
+
+
+    /**
+     * Works only on the first argument.
+     */
+    public static void main( String[] args ) {
+        if (args.length != 1) {
+            System.out.println("Verifier front-end: need exactly one argument.");
+            System.exit(1);
+        }
+        int dotclasspos = args[0].lastIndexOf(".class");
+        if (dotclasspos != -1) {
+            args[0] = args[0].substring(0, dotclasspos);
+        }
+        args[0] = args[0].replace('/', '.');
+        //System.out.println(args[0]);
+        try {
+            Class.forName(args[0]);
+        } catch (ExceptionInInitializerError eiie) { //subclass of LinkageError!
+            System.out.println("NativeVerifier: ExceptionInInitializerError encountered on '"
+                    + args[0] + "'.");
+            System.out.println(eiie);
+            System.exit(1);
+        } catch (LinkageError le) {
+            System.out.println("NativeVerifier: LinkageError encountered on '" + args[0] + "'.");
+            System.out.println(le);
+            System.exit(1);
+        } catch (ClassNotFoundException cnfe) {
+            System.out.println("NativeVerifier: FILE NOT FOUND: '" + args[0] + "'.");
+            System.exit(1);
+        } catch (Throwable t) {
+            System.out.println("NativeVerifier: Unspecified verification error on'" + args[0]
+                    + "'.");
+            System.exit(1);
+        }
+        System.out.println("NativeVerifier: Class file '" + args[0] + "' seems to be okay.");
+        System.exit(0);
+    }
 }

Modified: jakarta/bcel/trunk/src/java/org/apache/bcel/verifier/PassVerifier.java
URL: http://svn.apache.org/viewcvs/jakarta/bcel/trunk/src/java/org/apache/bcel/verifier/PassVerifier.java?rev=386056&r1=386055&r2=386056&view=diff
==============================================================================
--- jakarta/bcel/trunk/src/java/org/apache/bcel/verifier/PassVerifier.java (original)
+++ jakarta/bcel/trunk/src/java/org/apache/bcel/verifier/PassVerifier.java Wed Mar 15 03:31:56 2006
@@ -13,10 +13,9 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License. 
  *
- */ 
+ */
 package org.apache.bcel.verifier;
 
-
 import java.util.ArrayList;
 import java.util.List;
 
@@ -46,59 +45,61 @@
  * @see org.apache.bcel.verifier.Verifier
  * @see #verify()
  */
-public abstract class PassVerifier{
+public abstract class PassVerifier {
 
-	/** The (warning) messages. */
-	private List messages = new ArrayList(); //Type of elements: String
-	
-	/** The VerificationResult cache. */
-	private VerificationResult verificationResult = null;
-
-	/**
-	 * This method runs a verification pass conforming to the
-	 * Java Virtual Machine Specification, 2nd edition, on a
-	 * class file.
-	 * PassVerifier instances perform caching;
-	 * i.e. if the verify() method once determined a VerificationResult,
-	 * then this result may be returned after every invocation of this
-	 * method instead of running the verification pass anew; likewise with
-	 * the result of getMessages().
-	 *
-	 * @see #getMessages()
-	 * @see #addMessage(String)
-	 */
-	public VerificationResult verify(){
-		if (verificationResult == null){
-			verificationResult = do_verify();
-		}
-		return verificationResult;
-	}
-
-	/** Does the real verification work, uncached. */
-	public abstract VerificationResult do_verify();
-
-	/**
-	 * This method adds a (warning) message to the message pool of this
-	 * PassVerifier. This method is normally only internally used by
-	 * BCEL's class file verifier "JustIce" and should not be used from
-	 * the outside. 
-	 *
-	 * @see #getMessages()
-	 */
-	public void addMessage(String message){
-		messages.add(message);
-	}
-
-	/**
-	 * Returns the (warning) messages that this PassVerifier accumulated
-	 * during its do_verify()ing work.
-	 *
-	 * @see #addMessage(String)
-	 * @see #do_verify()
-	 */
-	public String[] getMessages(){
-		verify(); // create messages if not already done (cached!)
-		
-		return (String[]) messages.toArray(new String[messages.size()]);
-	}
+    /** The (warning) messages. */
+    private List messages = new ArrayList(); //Type of elements: String
+    /** The VerificationResult cache. */
+    private VerificationResult verificationResult = null;
+
+
+    /**
+     * This method runs a verification pass conforming to the
+     * Java Virtual Machine Specification, 2nd edition, on a
+     * class file.
+     * PassVerifier instances perform caching;
+     * i.e. if the verify() method once determined a VerificationResult,
+     * then this result may be returned after every invocation of this
+     * method instead of running the verification pass anew; likewise with
+     * the result of getMessages().
+     *
+     * @see #getMessages()
+     * @see #addMessage(String)
+     */
+    public VerificationResult verify() {
+        if (verificationResult == null) {
+            verificationResult = do_verify();
+        }
+        return verificationResult;
+    }
+
+
+    /** Does the real verification work, uncached. */
+    public abstract VerificationResult do_verify();
+
+
+    /**
+     * This method adds a (warning) message to the message pool of this
+     * PassVerifier. This method is normally only internally used by
+     * BCEL's class file verifier "JustIce" and should not be used from
+     * the outside. 
+     *
+     * @see #getMessages()
+     */
+    public void addMessage( String message ) {
+        messages.add(message);
+    }
+
+
+    /**
+     * Returns the (warning) messages that this PassVerifier accumulated
+     * during its do_verify()ing work.
+     *
+     * @see #addMessage(String)
+     * @see #do_verify()
+     */
+    public String[] getMessages() {
+        verify(); // create messages if not already done (cached!)
+        return (String[]) messages.toArray(new String[messages.size()]);
+    }
 }

Modified: jakarta/bcel/trunk/src/java/org/apache/bcel/verifier/TransitiveHull.java
URL: http://svn.apache.org/viewcvs/jakarta/bcel/trunk/src/java/org/apache/bcel/verifier/TransitiveHull.java?rev=386056&r1=386055&r2=386056&view=diff
==============================================================================
--- jakarta/bcel/trunk/src/java/org/apache/bcel/verifier/TransitiveHull.java (original)
+++ jakarta/bcel/trunk/src/java/org/apache/bcel/verifier/TransitiveHull.java Wed Mar 15 03:31:56 2006
@@ -13,10 +13,9 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License. 
  *
- */ 
+ */
 package org.apache.bcel.verifier;
 
-
 import org.apache.bcel.Repository;
 import org.apache.bcel.classfile.JavaClass;
 
@@ -29,76 +28,77 @@
  * @version $Id$
  * @author Enver Haase
  */
-public class TransitiveHull implements VerifierFactoryObserver{
+public class TransitiveHull implements VerifierFactoryObserver {
+
+    /** Used for indentation. */
+    private int indent = 0;
 
-	/** Used for indentation. */
-	private int indent = 0;
 
-	/** Not publicly instantiable. */
-	private TransitiveHull(){
-	}
-	
-	/* Implementing VerifierFactoryObserver. */
-	public void update(String classname) {
-
-		System.gc(); // avoid swapping if possible.
-
-		for (int i=0; i<indent; i++){
-			System.out.print(" ");
-		}
-		System.out.println(classname);
-		indent += 1;
-
-		Verifier v = VerifierFactory.getVerifier(classname);
-	
-		VerificationResult vr;
-		vr = v.doPass1();
-		if (vr != VerificationResult.VR_OK) //System.exit(1);
-			System.out.println("Pass 1:\n"+vr);
-
-		vr = v.doPass2();
-      if (vr != VerificationResult.VR_OK) //System.exit(1);
-			System.out.println("Pass 2:\n"+vr);
-
-		if (vr == VerificationResult.VR_OK){
-			try {
-				JavaClass jc = Repository.lookupClass(v.getClassName());
-				for (int i=0; i<jc.getMethods().length; i++){
-					vr = v.doPass3a(i);
-					if (vr != VerificationResult.VR_OK) //System.exit(1);
-						System.out.println(v.getClassName()+", Pass 3a, method "+i+" ['"+jc.getMethods()[i]+"']:\n"+vr);
-	
-					vr = v.doPass3b(i);
-					if (vr != VerificationResult.VR_OK) //System.exit(1);
-						System.out.println(v.getClassName()+", Pass 3b, method "+i+" ['"+jc.getMethods()[i]+"']:\n"+vr);
-				}
-			} catch (ClassNotFoundException e) {
-				System.err.println("Could not find class " + v.getClassName() + " in Repository");
-			}
-		}
-
-		indent -= 1;
-	}
-
-	/**
-	 * This method implements a demonstration program
-	 * of how to use the VerifierFactoryObserver. It transitively verifies
-	 * all class files encountered; this may take up a lot of time and,
-	 * more notably, memory.
-	 */
-	public static void main(String[] args){
-		if (args.length != 1){
-			System.out.println("Need exactly one argument: The root class to verify.");
-			System.exit(1);
-		}
-
-		int dotclasspos = args[0].lastIndexOf(".class");
-		if (dotclasspos != -1) args[0] = args[0].substring(0,dotclasspos);
-		args[0] = args[0].replace('/', '.');
-	
-		TransitiveHull th = new TransitiveHull();
-		VerifierFactory.attach(th);
-		VerifierFactory.getVerifier(args[0]); // the observer is called back and does the actual trick.
-		VerifierFactory.detach(th);
-	}
+    /** Not publicly instantiable. */
+    private TransitiveHull() {
+    }
+
+
+    /* Implementing VerifierFactoryObserver. */
+    public void update( String classname ) {
+        System.gc(); // avoid swapping if possible.
+        for (int i = 0; i < indent; i++) {
+            System.out.print(" ");
+        }
+        System.out.println(classname);
+        indent += 1;
+        Verifier v = VerifierFactory.getVerifier(classname);
+        VerificationResult vr;
+        vr = v.doPass1();
+        if (vr != VerificationResult.VR_OK) {
+            System.out.println("Pass 1:\n" + vr);
+        }
+        vr = v.doPass2();
+        if (vr != VerificationResult.VR_OK) {
+            System.out.println("Pass 2:\n" + vr);
+        }
+        if (vr == VerificationResult.VR_OK) {
+            try {
+                JavaClass jc = Repository.lookupClass(v.getClassName());
+                for (int i = 0; i < jc.getMethods().length; i++) {
+                    vr = v.doPass3a(i);
+                    if (vr != VerificationResult.VR_OK) {
+                        System.out.println(v.getClassName() + ", Pass 3a, method " + i + " ['"
+                                + jc.getMethods()[i] + "']:\n" + vr);
+                    }
+                    vr = v.doPass3b(i);
+                    if (vr != VerificationResult.VR_OK) {
+                        System.out.println(v.getClassName() + ", Pass 3b, method " + i + " ['"
+                                + jc.getMethods()[i] + "']:\n" + vr);
+                    }
+                }
+            } catch (ClassNotFoundException e) {
+                System.err.println("Could not find class " + v.getClassName() + " in Repository");
+            }
+        }
+        indent -= 1;
+    }
+
+
+    /**
+     * This method implements a demonstration program
+     * of how to use the VerifierFactoryObserver. It transitively verifies
+     * all class files encountered; this may take up a lot of time and,
+     * more notably, memory.
+     */
+    public static void main( String[] args ) {
+        if (args.length != 1) {
+            System.out.println("Need exactly one argument: The root class to verify.");
+            System.exit(1);
+        }
+        int dotclasspos = args[0].lastIndexOf(".class");
+        if (dotclasspos != -1) {
+            args[0] = args[0].substring(0, dotclasspos);
+        }
+        args[0] = args[0].replace('/', '.');
+        TransitiveHull th = new TransitiveHull();
+        VerifierFactory.attach(th);
+        VerifierFactory.getVerifier(args[0]); // the observer is called back and does the actual trick.
+        VerifierFactory.detach(th);
+    }
 }

Modified: jakarta/bcel/trunk/src/java/org/apache/bcel/verifier/VerificationResult.java
URL: http://svn.apache.org/viewcvs/jakarta/bcel/trunk/src/java/org/apache/bcel/verifier/VerificationResult.java?rev=386056&r1=386055&r2=386056&view=diff
==============================================================================
--- jakarta/bcel/trunk/src/java/org/apache/bcel/verifier/VerificationResult.java (original)
+++ jakarta/bcel/trunk/src/java/org/apache/bcel/verifier/VerificationResult.java Wed Mar 15 03:31:56 2006
@@ -13,10 +13,9 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License. 
  *
- */ 
+ */
 package org.apache.bcel.verifier;
 
-
 /**
  * A VerificationResult is what a PassVerifier returns
  * after verifying.
@@ -25,78 +24,92 @@
  * @author Enver Haase
  *
  */
-public class VerificationResult{
+public class VerificationResult {
+
+    /**
+     * Constant to indicate verification has not been tried yet.
+     * This happens if some earlier verification pass did not return VERIFIED_OK.
+     */
+    public static final int VERIFIED_NOTYET = 0;
+    /** Constant to indicate verification was passed. */
+    public static final int VERIFIED_OK = 1;
+    /** Constant to indicate verfication failed. */
+    public static final int VERIFIED_REJECTED = 2;
+    /**
+     * This string is the canonical message for verifications that have not been tried yet.
+     * This happens if some earlier verification pass did not return VERIFIED_OK.
+     */
+    private static final String VERIFIED_NOTYET_MSG = "Not yet verified.";
+    /** This string is the canonical message for passed verification passes. */
+    private static final String VERIFIED_OK_MSG = "Passed verification.";
+    /**
+     * Canonical VerificationResult for not-yet-tried verifications.
+     * This happens if some earlier verification pass did not return VERIFIED_OK.
+     */
+    public static final VerificationResult VR_NOTYET = new VerificationResult(VERIFIED_NOTYET,
+            VERIFIED_NOTYET_MSG);
+    /** Canonical VerificationResult for passed verifications. */
+    public static final VerificationResult VR_OK = new VerificationResult(VERIFIED_OK,
+            VERIFIED_OK_MSG);
+    /** The numeric status. */
+    private int numeric;
+    /** The detailed message. */
+    private String detailMessage;
+
+
+    /** The usual constructor. */
+    public VerificationResult(int status, String message) {
+        numeric = status;
+        detailMessage = message;
+    }
+
+
+    /** Returns one one the VERIFIED_OK, VERIFIED_NOTYET, VERIFIED_REJECTED constants. */
+    public int getStatus() {
+        return numeric;
+    }
 
-	/**
-	 * Constant to indicate verification has not been tried yet.
-	 * This happens if some earlier verification pass did not return VERIFIED_OK.
-	 */
-	public static final int VERIFIED_NOTYET = 0;
-	/** Constant to indicate verification was passed. */
-	public static final int VERIFIED_OK = 1;
-	/** Constant to indicate verfication failed. */
-	public static final int VERIFIED_REJECTED = 2;
-
-	/**
-	 * This string is the canonical message for verifications that have not been tried yet.
-	 * This happens if some earlier verification pass did not return VERIFIED_OK.
-	 */
-	private static final String VERIFIED_NOTYET_MSG = "Not yet verified.";
-	/** This string is the canonical message for passed verification passes. */
-	private static final String VERIFIED_OK_MSG = "Passed verification.";
-
-	/**
-	 * Canonical VerificationResult for not-yet-tried verifications.
-	 * This happens if some earlier verification pass did not return VERIFIED_OK.
-	 */
-	public static final VerificationResult VR_NOTYET = new VerificationResult(VERIFIED_NOTYET, VERIFIED_NOTYET_MSG);
-	/** Canonical VerificationResult for passed verifications. */
-	public static final VerificationResult VR_OK = new VerificationResult(VERIFIED_OK, VERIFIED_OK_MSG);
-
-	/** The numeric status. */
-	private int numeric;
-
-	/** The detailed message. */
-	private String detailMessage;
-
-	/** The usual constructor. */
-	public VerificationResult(int status, String message){
-		numeric = status;
-		detailMessage = message;
-	}
-
-	/** Returns one one the VERIFIED_OK, VERIFIED_NOTYET, VERIFIED_REJECTED constants. */
-	public int getStatus(){
-		return numeric;
-	}
-
-	/** Returns a detailed message. */
-	public String getMessage(){
-		return detailMessage;
-	}
-
-	/** @return a hash code value for the object.
-     */
-	public int hashCode() { return numeric ^ detailMessage.hashCode(); }
-
-	/**
-	 * Returns if two VerificationResult instances are equal.
-	 */ 
-	public boolean equals(Object o){
-		if (! (o instanceof VerificationResult)) return false;
-		VerificationResult other = (VerificationResult) o;
-		return ((other.numeric == this.numeric) && (other.detailMessage.equals(this.detailMessage)));
-	}
-	
-	/**
-	 * Returns a String representation of the VerificationResult.
-	 */
-	public String toString(){
-		String ret="";
-		if (numeric == VERIFIED_NOTYET)   ret = "VERIFIED_NOTYET";
-		if (numeric == VERIFIED_OK)       ret = "VERIFIED_OK";
-		if (numeric == VERIFIED_REJECTED) ret = "VERIFIED_REJECTED";
-		ret+="\n"+detailMessage+"\n";
-		return ret;
-	}
+
+    /** Returns a detailed message. */
+    public String getMessage() {
+        return detailMessage;
+    }
+
+
+    /** @return a hash code value for the object.
+     */
+    public int hashCode() {
+        return numeric ^ detailMessage.hashCode();
+    }
+
+
+    /**
+     * Returns if two VerificationResult instances are equal.
+     */
+    public boolean equals( Object o ) {
+        if (!(o instanceof VerificationResult)) {
+            return false;
+        }
+        VerificationResult other = (VerificationResult) o;
+        return ((other.numeric == this.numeric) && (other.detailMessage.equals(this.detailMessage)));
+    }
+
+
+    /**
+     * Returns a String representation of the VerificationResult.
+     */
+    public String toString() {
+        String ret = "";
+        if (numeric == VERIFIED_NOTYET) {
+            ret = "VERIFIED_NOTYET";
+        }
+        if (numeric == VERIFIED_OK) {
+            ret = "VERIFIED_OK";
+        }
+        if (numeric == VERIFIED_REJECTED) {
+            ret = "VERIFIED_REJECTED";
+        }
+        ret += "\n" + detailMessage + "\n";
+        return ret;
+    }
 }

Modified: jakarta/bcel/trunk/src/java/org/apache/bcel/verifier/Verifier.java
URL: http://svn.apache.org/viewcvs/jakarta/bcel/trunk/src/java/org/apache/bcel/verifier/Verifier.java?rev=386056&r1=386055&r2=386056&view=diff
==============================================================================
--- jakarta/bcel/trunk/src/java/org/apache/bcel/verifier/Verifier.java (original)
+++ jakarta/bcel/trunk/src/java/org/apache/bcel/verifier/Verifier.java Wed Mar 15 03:31:56 2006
@@ -13,10 +13,9 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License. 
  *
- */ 
+ */
 package org.apache.bcel.verifier;
 
-
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Iterator;
@@ -43,212 +42,207 @@
  * @see org.apache.bcel.verifier.VerifierFactory
  * @see org.apache.bcel.verifier.PassVerifier
  */
-public class Verifier{
-	/**
-	 * The name of the class this verifier operates on.
-	 */
-	private final String classname;
-
-	/** A Pass1Verifier for this Verifier instance. */
-	private Pass1Verifier p1v;
-	/** A Pass2Verifier for this Verifier instance. */
-	private Pass2Verifier p2v;
-	/** The Pass3aVerifiers for this Verifier instance. Key: Interned string specifying the method number. */
-	private Map p3avs = new HashMap();
-	/** The Pass3bVerifiers for this Verifier instance. Key: Interned string specifying the method number. */
-	private Map p3bvs = new HashMap();
-
-	/** Returns the VerificationResult for the given pass. */
-	public VerificationResult doPass1(){
-		if (p1v == null){
-			p1v = new Pass1Verifier(this);
-		}
-		return p1v.verify();
-	}
-
-	/** Returns the VerificationResult for the given pass. */
-	public VerificationResult doPass2(){
-		if (p2v == null){
-			p2v = new Pass2Verifier(this);
-		}
-		return p2v.verify();
-	}
-
-	/** Returns the VerificationResult for the given pass. */
-	public VerificationResult doPass3a(int method_no){
-		String key = Integer.toString(method_no);
-		Pass3aVerifier p3av;
-		p3av = (Pass3aVerifier) (p3avs.get(key));
-		if (p3avs.get(key) == null){
-			p3av = new Pass3aVerifier(this, method_no);
-			p3avs.put(key, p3av);
-		}
-		return p3av.verify();
-	}
-
-	/** Returns the VerificationResult for the given pass. */
-	public VerificationResult doPass3b(int method_no){
-		String key = Integer.toString(method_no);
-		Pass3bVerifier p3bv;
-		p3bv = (Pass3bVerifier) (p3bvs.get(key));
-		if (p3bvs.get(key) == null){
-			p3bv = new Pass3bVerifier(this, method_no);
-			p3bvs.put(key, p3bv);
-		}
-		return p3bv.verify();
-	}
-
-
-	/**
-	 * Instantiation is done by the VerifierFactory.
-	 *
-	 * @see VerifierFactory
-	 */
-	Verifier(String fully_qualified_classname){
-		classname = fully_qualified_classname;
-		flush();
-	}
-
-	/**
-	 * Returns the name of the class this verifier operates on.
-	 * This is particularly interesting when this verifier was created
-	 * recursively by another Verifier and you got a reference to this
-	 * Verifier by the getVerifiers() method of the VerifierFactory.
-	 * @see VerifierFactory
-	 */
-	public final String getClassName(){
-		return classname;
-	}
-
-	/**
-	 * Forget everything known about the class file; that means, really
-	 * start a new verification of a possibly different class file from
-	 * BCEL's repository.
-	 *
-	 */
-	public void flush(){
-		p1v = null;
-		p2v = null;
-		p3avs.clear();
-		p3bvs.clear();
-	}
-
-	/**
-	 * This returns all the (warning) messages collected during verification.
-	 * A prefix shows from which verifying pass a message originates.
-	 */
-	public String[] getMessages() throws ClassNotFoundException {
-		ArrayList messages = new ArrayList();
-
-		if (p1v != null){
-			String[] p1m = p1v.getMessages();
-			for (int i=0; i<p1m.length; i++){
-				messages.add("Pass 1: "+p1m[i]);
-			}
-		}
-		if (p2v != null){
-			String[] p2m = p2v.getMessages();
-			for (int i=0; i<p2m.length; i++){
-				messages.add("Pass 2: "+p2m[i]);
-			}
-		}
-		Iterator p3as = p3avs.values().iterator();
-		while (p3as.hasNext()){
-			Pass3aVerifier pv = (Pass3aVerifier) p3as.next();
-			String[] p3am = pv.getMessages();
-			int meth = pv.getMethodNo();
-			for (int i=0; i<p3am.length; i++){
-				messages.add("Pass 3a, method "+meth+
-					     " ('"+
-					     org.apache.bcel.Repository
-					     .lookupClass(classname)
-					     .getMethods()[meth] +
-					     "'): "+p3am[i]);
-			}
-		}
-		Iterator p3bs = p3bvs.values().iterator();
-		while (p3bs.hasNext()){
-			Pass3bVerifier pv = (Pass3bVerifier) p3bs.next();
-			String[] p3bm = pv.getMessages();
-			int meth = pv.getMethodNo();
-			for (int i=0; i<p3bm.length; i++){
-				messages.add("Pass 3b, method "+meth+
-					     " ('"+
-					     org.apache.bcel.Repository.
-					     lookupClass(classname).
-					     getMethods()[meth] +
-					     "'): "+p3bm[i]);
-			}
-		}
-
-		String[] ret = new String[messages.size()];
-		for (int i=0; i< messages.size(); i++){
-			ret[i] = (String) messages.get(i);
-		}
-
-		return ret;
-	}
-
-	/**
-	 * Verifies class files.
-	 * This is a simple demonstration of how the API of BCEL's
-	 * class file verifier "JustIce" may be used.
-	 * You should supply command-line arguments which are
-	 * fully qualified namea of the classes to verify. These class files
-	 * must be somewhere in your CLASSPATH (refer to Sun's
-	 * documentation for questions about this) or you must have put the classes
-	 * into the BCEL Repository yourself (via 'addClass(JavaClass)').
-	 */
-	public static void main(String [] args){
-		System.out.println("JustIce by Enver Haase, (C) 2001-2002.\n<http://bcel.sourceforge.net>\n<http://jakarta.apache.org/bcel>\n");
-	  for(int k=0; k < args.length; k++) {
-		try {
-			if (args[k].endsWith(".class")){
-				int dotclasspos = args[k].lastIndexOf(".class");
-				if (dotclasspos != -1) args[k] = args[k].substring(0,dotclasspos);
-			}
-
-			args[k] = args[k].replace('/', '.');
-
-			System.out.println("Now verifying: "+args[k]+"\n");
-
-			Verifier v = VerifierFactory.getVerifier(args[k]);
-			VerificationResult vr;
-
-			vr = v.doPass1();
-			System.out.println("Pass 1:\n"+vr);
-
-			vr = v.doPass2();
-			System.out.println("Pass 2:\n"+vr);
-
-			if (vr == VerificationResult.VR_OK){
-				JavaClass jc = org.apache.bcel.Repository
-				    .lookupClass(args[k]);
-				for (int i=0; i<jc.getMethods().length; i++){
-					vr = v.doPass3a(i);
-					System.out.println("Pass 3a, method number "+i+" ['"+jc.getMethods()[i]+"']:\n"+vr);
-
-					vr = v.doPass3b(i);
-					System.out.println("Pass 3b, method number "+i+" ['"+jc.getMethods()[i]+"']:\n"+vr);
-				}
-			}
-
-			System.out.println("Warnings:");
-			String[] warnings = v.getMessages();
-			if (warnings.length == 0) System.out.println("<none>");
-			for (int j=0; j<warnings.length; j++){
-				System.out.println(warnings[j]);
-			}
-
-			System.out.println("\n");
-
-			// avoid swapping.
-	  		v.flush();
-	  		org.apache.bcel.Repository.clearCache();
-			System.gc();
-		} catch (ClassNotFoundException e) {
-			e.printStackTrace();
-		}
-	  }
-	}
+public class Verifier {
+
+    /**
+     * The name of the class this verifier operates on.
+     */
+    private final String classname;
+    /** A Pass1Verifier for this Verifier instance. */
+    private Pass1Verifier p1v;
+    /** A Pass2Verifier for this Verifier instance. */
+    private Pass2Verifier p2v;
+    /** The Pass3aVerifiers for this Verifier instance. Key: Interned string specifying the method number. */
+    private Map p3avs = new HashMap();
+    /** The Pass3bVerifiers for this Verifier instance. Key: Interned string specifying the method number. */
+    private Map p3bvs = new HashMap();
+
+
+    /** Returns the VerificationResult for the given pass. */
+    public VerificationResult doPass1() {
+        if (p1v == null) {
+            p1v = new Pass1Verifier(this);
+        }
+        return p1v.verify();
+    }
+
+
+    /** Returns the VerificationResult for the given pass. */
+    public VerificationResult doPass2() {
+        if (p2v == null) {
+            p2v = new Pass2Verifier(this);
+        }
+        return p2v.verify();
+    }
+
+
+    /** Returns the VerificationResult for the given pass. */
+    public VerificationResult doPass3a( int method_no ) {
+        String key = Integer.toString(method_no);
+        Pass3aVerifier p3av;
+        p3av = (Pass3aVerifier) (p3avs.get(key));
+        if (p3avs.get(key) == null) {
+            p3av = new Pass3aVerifier(this, method_no);
+            p3avs.put(key, p3av);
+        }
+        return p3av.verify();
+    }
+
+
+    /** Returns the VerificationResult for the given pass. */
+    public VerificationResult doPass3b( int method_no ) {
+        String key = Integer.toString(method_no);
+        Pass3bVerifier p3bv;
+        p3bv = (Pass3bVerifier) (p3bvs.get(key));
+        if (p3bvs.get(key) == null) {
+            p3bv = new Pass3bVerifier(this, method_no);
+            p3bvs.put(key, p3bv);
+        }
+        return p3bv.verify();
+    }
+
+
+    /**
+     * Instantiation is done by the VerifierFactory.
+     *
+     * @see VerifierFactory
+     */
+    Verifier(String fully_qualified_classname) {
+        classname = fully_qualified_classname;
+        flush();
+    }
+
+
+    /**
+     * Returns the name of the class this verifier operates on.
+     * This is particularly interesting when this verifier was created
+     * recursively by another Verifier and you got a reference to this
+     * Verifier by the getVerifiers() method of the VerifierFactory.
+     * @see VerifierFactory
+     */
+    public final String getClassName() {
+        return classname;
+    }
+
+
+    /**
+     * Forget everything known about the class file; that means, really
+     * start a new verification of a possibly different class file from
+     * BCEL's repository.
+     *
+     */
+    public void flush() {
+        p1v = null;
+        p2v = null;
+        p3avs.clear();
+        p3bvs.clear();
+    }
+
+
+    /**
+     * This returns all the (warning) messages collected during verification.
+     * A prefix shows from which verifying pass a message originates.
+     */
+    public String[] getMessages() throws ClassNotFoundException {
+        ArrayList messages = new ArrayList();
+        if (p1v != null) {
+            String[] p1m = p1v.getMessages();
+            for (int i = 0; i < p1m.length; i++) {
+                messages.add("Pass 1: " + p1m[i]);
+            }
+        }
+        if (p2v != null) {
+            String[] p2m = p2v.getMessages();
+            for (int i = 0; i < p2m.length; i++) {
+                messages.add("Pass 2: " + p2m[i]);
+            }
+        }
+        Iterator p3as = p3avs.values().iterator();
+        while (p3as.hasNext()) {
+            Pass3aVerifier pv = (Pass3aVerifier) p3as.next();
+            String[] p3am = pv.getMessages();
+            int meth = pv.getMethodNo();
+            for (int i = 0; i < p3am.length; i++) {
+                messages.add("Pass 3a, method " + meth + " ('"
+                        + org.apache.bcel.Repository.lookupClass(classname).getMethods()[meth]
+                        + "'): " + p3am[i]);
+            }
+        }
+        Iterator p3bs = p3bvs.values().iterator();
+        while (p3bs.hasNext()) {
+            Pass3bVerifier pv = (Pass3bVerifier) p3bs.next();
+            String[] p3bm = pv.getMessages();
+            int meth = pv.getMethodNo();
+            for (int i = 0; i < p3bm.length; i++) {
+                messages.add("Pass 3b, method " + meth + " ('"
+                        + org.apache.bcel.Repository.lookupClass(classname).getMethods()[meth]
+                        + "'): " + p3bm[i]);
+            }
+        }
+        String[] ret = new String[messages.size()];
+        for (int i = 0; i < messages.size(); i++) {
+            ret[i] = (String) messages.get(i);
+        }
+        return ret;
+    }
+
+
+    /**
+     * Verifies class files.
+     * This is a simple demonstration of how the API of BCEL's
+     * class file verifier "JustIce" may be used.
+     * You should supply command-line arguments which are
+     * fully qualified namea of the classes to verify. These class files
+     * must be somewhere in your CLASSPATH (refer to Sun's
+     * documentation for questions about this) or you must have put the classes
+     * into the BCEL Repository yourself (via 'addClass(JavaClass)').
+     */
+    public static void main( String[] args ) {
+        System.out
+                .println("JustIce by Enver Haase, (C) 2001-2002.\n<http://bcel.sourceforge.net>\n<http://jakarta.apache.org/bcel>\n");
+        for (int k = 0; k < args.length; k++) {
+            try {
+                if (args[k].endsWith(".class")) {
+                    int dotclasspos = args[k].lastIndexOf(".class");
+                    if (dotclasspos != -1) {
+                        args[k] = args[k].substring(0, dotclasspos);
+                    }
+                }
+                args[k] = args[k].replace('/', '.');
+                System.out.println("Now verifying: " + args[k] + "\n");
+                Verifier v = VerifierFactory.getVerifier(args[k]);
+                VerificationResult vr;
+                vr = v.doPass1();
+                System.out.println("Pass 1:\n" + vr);
+                vr = v.doPass2();
+                System.out.println("Pass 2:\n" + vr);
+                if (vr == VerificationResult.VR_OK) {
+                    JavaClass jc = org.apache.bcel.Repository.lookupClass(args[k]);
+                    for (int i = 0; i < jc.getMethods().length; i++) {
+                        vr = v.doPass3a(i);
+                        System.out.println("Pass 3a, method number " + i + " ['"
+                                + jc.getMethods()[i] + "']:\n" + vr);
+                        vr = v.doPass3b(i);
+                        System.out.println("Pass 3b, method number " + i + " ['"
+                                + jc.getMethods()[i] + "']:\n" + vr);
+                    }
+                }
+                System.out.println("Warnings:");
+                String[] warnings = v.getMessages();
+                if (warnings.length == 0) {
+                    System.out.println("<none>");
+                }
+                for (int j = 0; j < warnings.length; j++) {
+                    System.out.println(warnings[j]);
+                }
+                System.out.println("\n");
+                // avoid swapping.
+                v.flush();
+                org.apache.bcel.Repository.clearCache();
+                System.gc();
+            } catch (ClassNotFoundException e) {
+                e.printStackTrace();
+            }
+        }
+    }
 }

Modified: jakarta/bcel/trunk/src/java/org/apache/bcel/verifier/VerifierAppFrame.java
URL: http://svn.apache.org/viewcvs/jakarta/bcel/trunk/src/java/org/apache/bcel/verifier/VerifierAppFrame.java?rev=386056&r1=386055&r2=386056&view=diff
==============================================================================
--- jakarta/bcel/trunk/src/java/org/apache/bcel/verifier/VerifierAppFrame.java (original)
+++ jakarta/bcel/trunk/src/java/org/apache/bcel/verifier/VerifierAppFrame.java Wed Mar 15 03:31:56 2006
@@ -13,10 +13,9 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License. 
  *
- */ 
+ */
 package org.apache.bcel.verifier;
 
-
 import java.awt.AWTEvent;
 import java.awt.CardLayout;
 import java.awt.Color;
@@ -49,341 +48,349 @@
  * @see GraphicalVerifier
  */
 public class VerifierAppFrame extends JFrame {
-  JPanel contentPane;
-  JSplitPane jSplitPane1 = new JSplitPane();
-  JPanel jPanel1 = new JPanel();
-  JPanel jPanel2 = new JPanel();
-  JSplitPane jSplitPane2 = new JSplitPane();
-  JPanel jPanel3 = new JPanel();
-  JList classNamesJList = new JList();
-  GridLayout gridLayout1 = new GridLayout();
-  JPanel messagesPanel = new JPanel();
-  GridLayout gridLayout2 = new GridLayout();
-  JMenuBar jMenuBar1 = new JMenuBar();
-  JMenu jMenu1 = new JMenu();
-  JScrollPane jScrollPane1 = new JScrollPane();
-  JScrollPane messagesScrollPane = new JScrollPane();
-  JScrollPane jScrollPane3 = new JScrollPane();
-  GridLayout gridLayout4 = new GridLayout();
-  JScrollPane jScrollPane4 = new JScrollPane();
-  CardLayout cardLayout1 = new CardLayout();
-
-  private String JUSTICE_VERSION = "JustIce by Enver Haase";
-  private String current_class;
-  GridLayout gridLayout3 = new GridLayout();
-  JTextPane pass1TextPane = new JTextPane();
-  JTextPane pass2TextPane = new JTextPane();
-  JTextPane messagesTextPane = new JTextPane();
-  JMenuItem newFileMenuItem = new JMenuItem();
-  JSplitPane jSplitPane3 = new JSplitPane();
-  JSplitPane jSplitPane4 = new JSplitPane();
-  JScrollPane jScrollPane2 = new JScrollPane();
-  JScrollPane jScrollPane5 = new JScrollPane();
-  JScrollPane jScrollPane6 = new JScrollPane();
-  JScrollPane jScrollPane7 = new JScrollPane();
-  JList pass3aJList = new JList();
-  JList pass3bJList = new JList();
-  JTextPane pass3aTextPane = new JTextPane();
-  JTextPane pass3bTextPane = new JTextPane();
-  JMenu jMenu2 = new JMenu();
-  JMenuItem whatisMenuItem = new JMenuItem();
-  JMenuItem aboutMenuItem = new JMenuItem();
-
-  /** Constructor. */
-  public VerifierAppFrame() {
-    enableEvents(AWTEvent.WINDOW_EVENT_MASK);
-    try {
-      jbInit();
-    }
-    catch(Exception e) {
-      e.printStackTrace();
-    }
-  }
-  /** Initizalization of the components. */
-  private void jbInit() throws Exception  {
-    //setIconImage(Toolkit.getDefaultToolkit().createImage(Frame1.class.getResource("[Ihr Symbol]")));
-    contentPane = (JPanel) this.getContentPane();
-    contentPane.setLayout(cardLayout1);
-    this.setJMenuBar(jMenuBar1);
-    this.setSize(new Dimension(708, 451));
-    this.setTitle("JustIce");
-    jPanel1.setMinimumSize(new Dimension(100, 100));
-    jPanel1.setPreferredSize(new Dimension(100, 100));
-    jPanel1.setLayout(gridLayout1);
-    jSplitPane2.setOrientation(JSplitPane.VERTICAL_SPLIT);
-    jPanel2.setLayout(gridLayout2);
-    jPanel3.setMinimumSize(new Dimension(200, 100));
-    jPanel3.setPreferredSize(new Dimension(400, 400));
-    jPanel3.setLayout(gridLayout4);
-    messagesPanel.setMinimumSize(new Dimension(100, 100));
-    messagesPanel.setLayout(gridLayout3);
-    jPanel2.setMinimumSize(new Dimension(200, 100));
-    jMenu1.setText("File");
-
-    jScrollPane1.getViewport().setBackground(Color.red);
-    messagesScrollPane.getViewport().setBackground(Color.red);
-    messagesScrollPane.setPreferredSize(new Dimension(10, 10));
-    classNamesJList.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
-      public void valueChanged(ListSelectionEvent e) {
-        classNamesJList_valueChanged(e);
-      }
-    });
-    classNamesJList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
-    jScrollPane3.setBorder(BorderFactory.createLineBorder(Color.black));
-    jScrollPane3.setPreferredSize(new Dimension(100, 100));
-    gridLayout4.setRows(4);
-    gridLayout4.setColumns(1);
-    gridLayout4.setHgap(1);
-    jScrollPane4.setBorder(BorderFactory.createLineBorder(Color.black));
-    jScrollPane4.setPreferredSize(new Dimension(100, 100));
-    pass1TextPane.setBorder(BorderFactory.createRaisedBevelBorder());
-    pass1TextPane.setToolTipText("");
-    pass1TextPane.setEditable(false);
-    pass2TextPane.setBorder(BorderFactory.createRaisedBevelBorder());
-    pass2TextPane.setEditable(false);
-    messagesTextPane.setBorder(BorderFactory.createRaisedBevelBorder());
-    messagesTextPane.setEditable(false);
-    newFileMenuItem.setText("New...");
-    newFileMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(78, java.awt.event.KeyEvent.CTRL_MASK, true));
-    newFileMenuItem.addActionListener(new java.awt.event.ActionListener() {
-      public void actionPerformed(ActionEvent e) {
-        newFileMenuItem_actionPerformed(e);
-      }
-    });
-    pass3aTextPane.setEditable(false);
-    pass3bTextPane.setEditable(false);
-    pass3aJList.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
-      public void valueChanged(ListSelectionEvent e) {
-        pass3aJList_valueChanged(e);
-      }
-    });
-    pass3bJList.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
-      public void valueChanged(ListSelectionEvent e) {
-        pass3bJList_valueChanged(e);
-      }
-    });
-    jMenu2.setText("Help");
-    whatisMenuItem.setText("What is...");
-    whatisMenuItem.addActionListener(new java.awt.event.ActionListener() {
-      public void actionPerformed(ActionEvent e) {
-        whatisMenuItem_actionPerformed(e);
-      }
-    });
-    aboutMenuItem.setText("About");
-    aboutMenuItem.addActionListener(new java.awt.event.ActionListener() {
-      public void actionPerformed(ActionEvent e) {
-        aboutMenuItem_actionPerformed(e);
-      }
-    });
-    jSplitPane2.add(messagesPanel, JSplitPane.BOTTOM);
-    messagesPanel.add(messagesScrollPane, null);
-    messagesScrollPane.getViewport().add(messagesTextPane, null);
-    jSplitPane2.add(jPanel3, JSplitPane.TOP);
-    jPanel3.add(jScrollPane3, null);
-    jScrollPane3.getViewport().add(pass1TextPane, null);
-    jPanel3.add(jScrollPane4, null);
-    jPanel3.add(jSplitPane3, null);
-    jSplitPane3.add(jScrollPane2, JSplitPane.LEFT);
-    jScrollPane2.getViewport().add(pass3aJList, null);
-    jSplitPane3.add(jScrollPane5, JSplitPane.RIGHT);
-    jScrollPane5.getViewport().add(pass3aTextPane, null);
-    jPanel3.add(jSplitPane4, null);
-    jSplitPane4.add(jScrollPane6, JSplitPane.LEFT);
-    jScrollPane6.getViewport().add(pass3bJList, null);
-    jSplitPane4.add(jScrollPane7, JSplitPane.RIGHT);
-    jScrollPane7.getViewport().add(pass3bTextPane, null);
-    jScrollPane4.getViewport().add(pass2TextPane, null);
-    jSplitPane1.add(jPanel2, JSplitPane.TOP);
-    jPanel2.add(jScrollPane1, null);
-    jSplitPane1.add(jPanel1, JSplitPane.BOTTOM);
-    jPanel1.add(jSplitPane2, null);
-    jScrollPane1.getViewport().add(classNamesJList, null);
-    jMenuBar1.add(jMenu1);
-    jMenuBar1.add(jMenu2);
-    contentPane.add(jSplitPane1, "jSplitPane1");
-    jMenu1.add(newFileMenuItem);
-    jMenu2.add(whatisMenuItem);
-    jMenu2.add(aboutMenuItem);
-    jSplitPane2.setDividerLocation(300);
-    jSplitPane3.setDividerLocation(150);
-    jSplitPane4.setDividerLocation(150);
-  }
-
-  /** Overridden to stop the application on a closing window. */
-  protected void processWindowEvent(WindowEvent e) {
-    super.processWindowEvent(e);
-    if (e.getID() == WindowEvent.WINDOW_CLOSING) {
-      System.exit(0);
-    }
-  }
 
-  synchronized void classNamesJList_valueChanged(ListSelectionEvent e) {
-    if (e.getValueIsAdjusting()) return;
-    current_class = classNamesJList.getSelectedValue().toString();
-    try {
-      verify();
-    } catch (ClassNotFoundException ex) {
-      // FIXME: report the error using the GUI
-      ex.printStackTrace();
+    JPanel contentPane;
+    JSplitPane jSplitPane1 = new JSplitPane();
+    JPanel jPanel1 = new JPanel();
+    JPanel jPanel2 = new JPanel();
+    JSplitPane jSplitPane2 = new JSplitPane();
+    JPanel jPanel3 = new JPanel();
+    JList classNamesJList = new JList();
+    GridLayout gridLayout1 = new GridLayout();
+    JPanel messagesPanel = new JPanel();
+    GridLayout gridLayout2 = new GridLayout();
+    JMenuBar jMenuBar1 = new JMenuBar();
+    JMenu jMenu1 = new JMenu();
+    JScrollPane jScrollPane1 = new JScrollPane();
+    JScrollPane messagesScrollPane = new JScrollPane();
+    JScrollPane jScrollPane3 = new JScrollPane();
+    GridLayout gridLayout4 = new GridLayout();
+    JScrollPane jScrollPane4 = new JScrollPane();
+    CardLayout cardLayout1 = new CardLayout();
+    private String JUSTICE_VERSION = "JustIce by Enver Haase";
+    private String current_class;
+    GridLayout gridLayout3 = new GridLayout();
+    JTextPane pass1TextPane = new JTextPane();
+    JTextPane pass2TextPane = new JTextPane();
+    JTextPane messagesTextPane = new JTextPane();
+    JMenuItem newFileMenuItem = new JMenuItem();
+    JSplitPane jSplitPane3 = new JSplitPane();
+    JSplitPane jSplitPane4 = new JSplitPane();
+    JScrollPane jScrollPane2 = new JScrollPane();
+    JScrollPane jScrollPane5 = new JScrollPane();
+    JScrollPane jScrollPane6 = new JScrollPane();
+    JScrollPane jScrollPane7 = new JScrollPane();
+    JList pass3aJList = new JList();
+    JList pass3bJList = new JList();
+    JTextPane pass3aTextPane = new JTextPane();
+    JTextPane pass3bTextPane = new JTextPane();
+    JMenu jMenu2 = new JMenu();
+    JMenuItem whatisMenuItem = new JMenuItem();
+    JMenuItem aboutMenuItem = new JMenuItem();
+
+
+    /** Constructor. */
+    public VerifierAppFrame() {
+        enableEvents(AWTEvent.WINDOW_EVENT_MASK);
+        try {
+            jbInit();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
     }
-    classNamesJList.setSelectedValue(current_class, true);
-  }
 
-  private void verify() throws ClassNotFoundException {
-    setTitle("PLEASE WAIT");
 
-    Verifier v = VerifierFactory.getVerifier(current_class);
-    v.flush(); // Don't cache the verification result for this class.
+    /** Initizalization of the components. */
+    private void jbInit() throws Exception {
+        //setIconImage(Toolkit.getDefaultToolkit().createImage(Frame1.class.getResource("[Ihr Symbol]")));
+        contentPane = (JPanel) this.getContentPane();
+        contentPane.setLayout(cardLayout1);
+        this.setJMenuBar(jMenuBar1);
+        this.setSize(new Dimension(708, 451));
+        this.setTitle("JustIce");
+        jPanel1.setMinimumSize(new Dimension(100, 100));
+        jPanel1.setPreferredSize(new Dimension(100, 100));
+        jPanel1.setLayout(gridLayout1);
+        jSplitPane2.setOrientation(JSplitPane.VERTICAL_SPLIT);
+        jPanel2.setLayout(gridLayout2);
+        jPanel3.setMinimumSize(new Dimension(200, 100));
+        jPanel3.setPreferredSize(new Dimension(400, 400));
+        jPanel3.setLayout(gridLayout4);
+        messagesPanel.setMinimumSize(new Dimension(100, 100));
+        messagesPanel.setLayout(gridLayout3);
+        jPanel2.setMinimumSize(new Dimension(200, 100));
+        jMenu1.setText("File");
+        jScrollPane1.getViewport().setBackground(Color.red);
+        messagesScrollPane.getViewport().setBackground(Color.red);
+        messagesScrollPane.setPreferredSize(new Dimension(10, 10));
+        classNamesJList.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
+
+            public void valueChanged( ListSelectionEvent e ) {
+                classNamesJList_valueChanged(e);
+            }
+        });
+        classNamesJList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+        jScrollPane3.setBorder(BorderFactory.createLineBorder(Color.black));
+        jScrollPane3.setPreferredSize(new Dimension(100, 100));
+        gridLayout4.setRows(4);
+        gridLayout4.setColumns(1);
+        gridLayout4.setHgap(1);
+        jScrollPane4.setBorder(BorderFactory.createLineBorder(Color.black));
+        jScrollPane4.setPreferredSize(new Dimension(100, 100));
+        pass1TextPane.setBorder(BorderFactory.createRaisedBevelBorder());
+        pass1TextPane.setToolTipText("");
+        pass1TextPane.setEditable(false);
+        pass2TextPane.setBorder(BorderFactory.createRaisedBevelBorder());
+        pass2TextPane.setEditable(false);
+        messagesTextPane.setBorder(BorderFactory.createRaisedBevelBorder());
+        messagesTextPane.setEditable(false);
+        newFileMenuItem.setText("New...");
+        newFileMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(78,
+                java.awt.event.KeyEvent.CTRL_MASK, true));
+        newFileMenuItem.addActionListener(new java.awt.event.ActionListener() {
+
+            public void actionPerformed( ActionEvent e ) {
+                newFileMenuItem_actionPerformed(e);
+            }
+        });
+        pass3aTextPane.setEditable(false);
+        pass3bTextPane.setEditable(false);
+        pass3aJList.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
+
+            public void valueChanged( ListSelectionEvent e ) {
+                pass3aJList_valueChanged(e);
+            }
+        });
+        pass3bJList.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
+
+            public void valueChanged( ListSelectionEvent e ) {
+                pass3bJList_valueChanged(e);
+            }
+        });
+        jMenu2.setText("Help");
+        whatisMenuItem.setText("What is...");
+        whatisMenuItem.addActionListener(new java.awt.event.ActionListener() {
+
+            public void actionPerformed( ActionEvent e ) {
+                whatisMenuItem_actionPerformed(e);
+            }
+        });
+        aboutMenuItem.setText("About");
+        aboutMenuItem.addActionListener(new java.awt.event.ActionListener() {
+
+            public void actionPerformed( ActionEvent e ) {
+                aboutMenuItem_actionPerformed(e);
+            }
+        });
+        jSplitPane2.add(messagesPanel, JSplitPane.BOTTOM);
+        messagesPanel.add(messagesScrollPane, null);
+        messagesScrollPane.getViewport().add(messagesTextPane, null);
+        jSplitPane2.add(jPanel3, JSplitPane.TOP);
+        jPanel3.add(jScrollPane3, null);
+        jScrollPane3.getViewport().add(pass1TextPane, null);
+        jPanel3.add(jScrollPane4, null);
+        jPanel3.add(jSplitPane3, null);
+        jSplitPane3.add(jScrollPane2, JSplitPane.LEFT);
+        jScrollPane2.getViewport().add(pass3aJList, null);
+        jSplitPane3.add(jScrollPane5, JSplitPane.RIGHT);
+        jScrollPane5.getViewport().add(pass3aTextPane, null);
+        jPanel3.add(jSplitPane4, null);
+        jSplitPane4.add(jScrollPane6, JSplitPane.LEFT);
+        jScrollPane6.getViewport().add(pass3bJList, null);
+        jSplitPane4.add(jScrollPane7, JSplitPane.RIGHT);
+        jScrollPane7.getViewport().add(pass3bTextPane, null);
+        jScrollPane4.getViewport().add(pass2TextPane, null);
+        jSplitPane1.add(jPanel2, JSplitPane.TOP);
+        jPanel2.add(jScrollPane1, null);
+        jSplitPane1.add(jPanel1, JSplitPane.BOTTOM);
+        jPanel1.add(jSplitPane2, null);
+        jScrollPane1.getViewport().add(classNamesJList, null);
+        jMenuBar1.add(jMenu1);
+        jMenuBar1.add(jMenu2);
+        contentPane.add(jSplitPane1, "jSplitPane1");
+        jMenu1.add(newFileMenuItem);
+        jMenu2.add(whatisMenuItem);
+        jMenu2.add(aboutMenuItem);
+        jSplitPane2.setDividerLocation(300);
+        jSplitPane3.setDividerLocation(150);
+        jSplitPane4.setDividerLocation(150);
+    }
 
-    VerificationResult vr;
-
-    vr =  v.doPass1();
-    if (vr.getStatus() == VerificationResult.VERIFIED_REJECTED){
-      pass1TextPane.setText(vr.getMessage());
-      pass1TextPane.setBackground(Color.red);
-
-      pass2TextPane.setText("");
-      pass2TextPane.setBackground(Color.yellow);
-      pass3aTextPane.setText("");
-      pass3aJList.setListData(new Object[0]);
-      pass3aTextPane.setBackground(Color.yellow);
-
-      pass3bTextPane.setText("");
-      pass3bJList.setListData(new Object[0]);
-      pass3bTextPane.setBackground(Color.yellow);
 
+    /** Overridden to stop the application on a closing window. */
+    protected void processWindowEvent( WindowEvent e ) {
+        super.processWindowEvent(e);
+        if (e.getID() == WindowEvent.WINDOW_CLOSING) {
+            System.exit(0);
+        }
     }
-    else{ // Must be VERIFIED_OK, Pass 1 does not know VERIFIED_NOTYET
-      pass1TextPane.setBackground(Color.green);
-      pass1TextPane.setText(vr.getMessage());
-
-      vr = v.doPass2();
-      if (vr.getStatus() == VerificationResult.VERIFIED_REJECTED){
-        pass2TextPane.setText(vr.getMessage());
-        pass2TextPane.setBackground(Color.red);
-
-        pass3aTextPane.setText("");
-        pass3aTextPane.setBackground(Color.yellow);
-        pass3aJList.setListData(new Object[0]);
-        pass3bTextPane.setText("");
-        pass3bTextPane.setBackground(Color.yellow);
-        pass3bJList.setListData(new Object[0]);
-      }
-      else{ // must be Verified_OK, because Pass1 was OK (cannot be Verified_NOTYET).
-          pass2TextPane.setText(vr.getMessage());
-          pass2TextPane.setBackground(Color.green);
-
-          JavaClass jc = Repository.lookupClass(current_class);
-          /*
-          boolean all3aok = true;
-          boolean all3bok = true;
-          String all3amsg = "";
-          String all3bmsg = "";
-          */
-
-          String[] methodnames = new String[jc.getMethods().length];
-          for (int i=0; i<jc.getMethods().length; i++){
-            methodnames[i] = jc.getMethods()[i].toString().replace('\n',' ').replace('\t',' ');
-          }
-          pass3aJList.setListData(methodnames);
-          pass3aJList.setSelectionInterval(0,jc.getMethods().length-1);
-          pass3bJList.setListData(methodnames);
-          pass3bJList.setSelectionInterval(0,jc.getMethods().length-1);
-      }
 
+
+    synchronized void classNamesJList_valueChanged( ListSelectionEvent e ) {
+        if (e.getValueIsAdjusting()) {
+            return;
+        }
+        current_class = classNamesJList.getSelectedValue().toString();
+        try {
+            verify();
+        } catch (ClassNotFoundException ex) {
+            // FIXME: report the error using the GUI
+            ex.printStackTrace();
+        }
+        classNamesJList.setSelectedValue(current_class, true);
     }
-    String[] msgs = v.getMessages();
-    messagesTextPane.setBackground(msgs.length == 0? Color.green : Color.yellow);
-    String allmsgs = "";
-    for (int i=0; i<msgs.length; i++){
-      msgs[i] = msgs[i].replace('\n',' ');
-      allmsgs += msgs[i] + "\n\n";
-    }
-    messagesTextPane.setText(allmsgs);
 
-    setTitle(current_class + " - " + JUSTICE_VERSION);
-  }
 
-  void newFileMenuItem_actionPerformed(ActionEvent e) {
-    String classname = JOptionPane.showInputDialog("Please enter the fully qualified name of a class or interface to verify:");
-    if ((classname == null) || (classname.equals(""))) return;
-    VerifierFactory.getVerifier(classname); // let observers do the rest.
-    classNamesJList.setSelectedValue(classname, true);
-  }
-
-  synchronized void pass3aJList_valueChanged(ListSelectionEvent e) {
-
-    if (e.getValueIsAdjusting()) return;
-    Verifier v = VerifierFactory.getVerifier(current_class);
-
-    String all3amsg = "";
-    boolean all3aok = true;
-    boolean rejected = false;
-    for (int i=0; i<pass3aJList.getModel().getSize(); i++){
-
-      if (pass3aJList.isSelectedIndex(i)){
-        VerificationResult vr = v.doPass3a(i);
-
-        if (vr.getStatus() == VerificationResult.VERIFIED_REJECTED){
-          all3aok = false;
-          rejected = true;
-        }
-        JavaClass jc = null;
-	try {
-          jc = Repository.lookupClass(v.getClassName());
-          all3amsg += "Method '"+jc.getMethods()[i]+"': "+vr.getMessage().replace('\n',' ')+"\n\n";
-        } catch (ClassNotFoundException ex) {
-          // FIXME: handle the error
-          ex.printStackTrace();
+    private void verify() throws ClassNotFoundException {
+        setTitle("PLEASE WAIT");
+        Verifier v = VerifierFactory.getVerifier(current_class);
+        v.flush(); // Don't cache the verification result for this class.
+        VerificationResult vr;
+        vr = v.doPass1();
+        if (vr.getStatus() == VerificationResult.VERIFIED_REJECTED) {
+            pass1TextPane.setText(vr.getMessage());
+            pass1TextPane.setBackground(Color.red);
+            pass2TextPane.setText("");
+            pass2TextPane.setBackground(Color.yellow);
+            pass3aTextPane.setText("");
+            pass3aJList.setListData(new Object[0]);
+            pass3aTextPane.setBackground(Color.yellow);
+            pass3bTextPane.setText("");
+            pass3bJList.setListData(new Object[0]);
+            pass3bTextPane.setBackground(Color.yellow);
+        } else { // Must be VERIFIED_OK, Pass 1 does not know VERIFIED_NOTYET
+            pass1TextPane.setBackground(Color.green);
+            pass1TextPane.setText(vr.getMessage());
+            vr = v.doPass2();
+            if (vr.getStatus() == VerificationResult.VERIFIED_REJECTED) {
+                pass2TextPane.setText(vr.getMessage());
+                pass2TextPane.setBackground(Color.red);
+                pass3aTextPane.setText("");
+                pass3aTextPane.setBackground(Color.yellow);
+                pass3aJList.setListData(new Object[0]);
+                pass3bTextPane.setText("");
+                pass3bTextPane.setBackground(Color.yellow);
+                pass3bJList.setListData(new Object[0]);
+            } else { // must be Verified_OK, because Pass1 was OK (cannot be Verified_NOTYET).
+                pass2TextPane.setText(vr.getMessage());
+                pass2TextPane.setBackground(Color.green);
+                JavaClass jc = Repository.lookupClass(current_class);
+                /*
+                 boolean all3aok = true;
+                 boolean all3bok = true;
+                 String all3amsg = "";
+                 String all3bmsg = "";
+                 */
+                String[] methodnames = new String[jc.getMethods().length];
+                for (int i = 0; i < jc.getMethods().length; i++) {
+                    methodnames[i] = jc.getMethods()[i].toString().replace('\n', ' ').replace('\t',
+                            ' ');
+                }
+                pass3aJList.setListData(methodnames);
+                pass3aJList.setSelectionInterval(0, jc.getMethods().length - 1);
+                pass3bJList.setListData(methodnames);
+                pass3bJList.setSelectionInterval(0, jc.getMethods().length - 1);
+            }
+        }
+        String[] msgs = v.getMessages();
+        messagesTextPane.setBackground(msgs.length == 0 ? Color.green : Color.yellow);
+        String allmsgs = "";
+        for (int i = 0; i < msgs.length; i++) {
+            msgs[i] = msgs[i].replace('\n', ' ');
+            allmsgs += msgs[i] + "\n\n";
         }
-      }
+        messagesTextPane.setText(allmsgs);
+        setTitle(current_class + " - " + JUSTICE_VERSION);
     }
-    pass3aTextPane.setText(all3amsg);
-    pass3aTextPane.setBackground(all3aok? Color.green : (rejected? Color.red : Color.yellow));
 
-  }
 
-  synchronized void pass3bJList_valueChanged(ListSelectionEvent e) {
-    if (e.getValueIsAdjusting()) return;
+    void newFileMenuItem_actionPerformed( ActionEvent e ) {
+        String classname = JOptionPane
+                .showInputDialog("Please enter the fully qualified name of a class or interface to verify:");
+        if ((classname == null) || (classname.equals(""))) {
+            return;
+        }
+        VerifierFactory.getVerifier(classname); // let observers do the rest.
+        classNamesJList.setSelectedValue(classname, true);
+    }
 
-    Verifier v = VerifierFactory.getVerifier(current_class);
 
-    String all3bmsg = "";
-    boolean all3bok = true;
-    boolean rejected = false;
-    for (int i=0; i<pass3bJList.getModel().getSize(); i++){
+    synchronized void pass3aJList_valueChanged( ListSelectionEvent e ) {
+        if (e.getValueIsAdjusting()) {
+            return;
+        }
+        Verifier v = VerifierFactory.getVerifier(current_class);
+        String all3amsg = "";
+        boolean all3aok = true;
+        boolean rejected = false;
+        for (int i = 0; i < pass3aJList.getModel().getSize(); i++) {
+            if (pass3aJList.isSelectedIndex(i)) {
+                VerificationResult vr = v.doPass3a(i);
+                if (vr.getStatus() == VerificationResult.VERIFIED_REJECTED) {
+                    all3aok = false;
+                    rejected = true;
+                }
+                JavaClass jc = null;
+                try {
+                    jc = Repository.lookupClass(v.getClassName());
+                    all3amsg += "Method '" + jc.getMethods()[i] + "': "
+                            + vr.getMessage().replace('\n', ' ') + "\n\n";
+                } catch (ClassNotFoundException ex) {
+                    // FIXME: handle the error
+                    ex.printStackTrace();
+                }
+            }
+        }
+        pass3aTextPane.setText(all3amsg);
+        pass3aTextPane.setBackground(all3aok ? Color.green : (rejected ? Color.red : Color.yellow));
+    }
 
-      if (pass3bJList.isSelectedIndex(i)){
-        VerificationResult vr = v.doPass3b(i);
 
-        if (vr.getStatus() == VerificationResult.VERIFIED_REJECTED){
-          all3bok = false;
-          rejected = true;
+    synchronized void pass3bJList_valueChanged( ListSelectionEvent e ) {
+        if (e.getValueIsAdjusting()) {
+            return;
         }
-        JavaClass jc = null;
-	try {
-          jc = Repository.lookupClass(v.getClassName());
-          all3bmsg += "Method '"+jc.getMethods()[i]+"': "+vr.getMessage().replace('\n',' ')+"\n\n";
-        } catch (ClassNotFoundException ex) {
-          // FIXME: handle the error
-          ex.printStackTrace();
+        Verifier v = VerifierFactory.getVerifier(current_class);
+        String all3bmsg = "";
+        boolean all3bok = true;
+        boolean rejected = false;
+        for (int i = 0; i < pass3bJList.getModel().getSize(); i++) {
+            if (pass3bJList.isSelectedIndex(i)) {
+                VerificationResult vr = v.doPass3b(i);
+                if (vr.getStatus() == VerificationResult.VERIFIED_REJECTED) {
+                    all3bok = false;
+                    rejected = true;
+                }
+                JavaClass jc = null;
+                try {
+                    jc = Repository.lookupClass(v.getClassName());
+                    all3bmsg += "Method '" + jc.getMethods()[i] + "': "
+                            + vr.getMessage().replace('\n', ' ') + "\n\n";
+                } catch (ClassNotFoundException ex) {
+                    // FIXME: handle the error
+                    ex.printStackTrace();
+                }
+            }
         }
-      }
+        pass3bTextPane.setText(all3bmsg);
+        pass3bTextPane.setBackground(all3bok ? Color.green : (rejected ? Color.red : Color.yellow));
+    }
+
+
+    void aboutMenuItem_actionPerformed( ActionEvent e ) {
+        JOptionPane
+                .showMessageDialog(
+                        this,
+                        "JustIce is a Java class file verifier.\nIt was implemented by Enver Haase in 2001, 2002.\n<http://jakarta.apache.org/bcel/index.html>",
+                        JUSTICE_VERSION, JOptionPane.INFORMATION_MESSAGE);
     }
-    pass3bTextPane.setText(all3bmsg);
-    pass3bTextPane.setBackground(all3bok? Color.green : (rejected? Color.red : Color.yellow));
 
-  }
 
-  void aboutMenuItem_actionPerformed(ActionEvent e) {
-    JOptionPane.showMessageDialog(this,
-            "JustIce is a Java class file verifier.\nIt was implemented by Enver Haase in 2001, 2002.\n<http://jakarta.apache.org/bcel/index.html>",
-             JUSTICE_VERSION, JOptionPane.INFORMATION_MESSAGE);
-  }
-
-  void whatisMenuItem_actionPerformed(ActionEvent e) {
-    JOptionPane.showMessageDialog(this,
-            "The upper four boxes to the right reflect verification passes according to The Java Virtual Machine Specification.\nThese are (in that order): Pass one, Pass two, Pass three (before data flow analysis), Pass three (data flow analysis).\nThe bottom box to the right shows (warning) messages; warnings do not cause a class to be rejected.",
-             JUSTICE_VERSION, JOptionPane.INFORMATION_MESSAGE);
-  }
+    void whatisMenuItem_actionPerformed( ActionEvent e ) {
+        JOptionPane
+                .showMessageDialog(
+                        this,
+                        "The upper four boxes to the right reflect verification passes according to The Java Virtual Machine Specification.\nThese are (in that order): Pass one, Pass two, Pass three (before data flow analysis), Pass three (data flow analysis).\nThe bottom box to the right shows (warning) messages; warnings do not cause a class to be rejected.",
+                        JUSTICE_VERSION, JOptionPane.INFORMATION_MESSAGE);
+    }
 }

Modified: jakarta/bcel/trunk/src/java/org/apache/bcel/verifier/VerifierFactory.java
URL: http://svn.apache.org/viewcvs/jakarta/bcel/trunk/src/java/org/apache/bcel/verifier/VerifierFactory.java?rev=386056&r1=386055&r2=386056&view=diff
==============================================================================
--- jakarta/bcel/trunk/src/java/org/apache/bcel/verifier/VerifierFactory.java (original)
+++ jakarta/bcel/trunk/src/java/org/apache/bcel/verifier/VerifierFactory.java Wed Mar 15 03:31:56 2006
@@ -13,10 +13,9 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License. 
  *
- */ 
+ */
 package org.apache.bcel.verifier;
 
-
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
@@ -33,74 +32,79 @@
  * @author Enver Haase
  * @see org.apache.bcel.verifier.Verifier
  */
-public class VerifierFactory{
+public class VerifierFactory {
 
-	/**
-	 * The HashMap that holds the data about the already-constructed Verifier instances.
-	 */
-	private static Map hashMap = new HashMap();
-
-	/**
-	 * The VerifierFactoryObserver instances that observe the VerifierFactory.
-	 */
-	private static List observers = new Vector();
-
-	/**
-	 * The VerifierFactory is not instantiable.
-	 */
-	private VerifierFactory(){}
-	
-	/**
-	 * Returns the (only) verifier responsible for the class with the given name.
-	 * Possibly a new Verifier object is transparently created.
-	 * @return the (only) verifier responsible for the class with the given name.
-	 */
-	public static Verifier getVerifier(String fully_qualified_classname){
-		Verifier v = (Verifier) (hashMap.get(fully_qualified_classname));
-		if (v==null){
-			v = new Verifier(fully_qualified_classname);
-			hashMap.put(fully_qualified_classname, v);
-			notify(fully_qualified_classname);
-		}
-		
-		return v;
-	}
-
-	/**
-	 * Notifies the observers of a newly generated Verifier.
-	 */
-	private static void notify(String fully_qualified_classname){
-		// notify the observers
-		Iterator i = observers.iterator();
-		while (i.hasNext()){
-			VerifierFactoryObserver vfo = (VerifierFactoryObserver) i.next();
-			vfo.update(fully_qualified_classname);
-		}
-	}
-
-	/**
-	 * Returns all Verifier instances created so far.
-	 * This is useful when a Verifier recursively lets
-	 * the VerifierFactory create other Verifier instances
-	 * and if you want to verify the transitive hull of
-	 * referenced class files.
-	 */
-	public static Verifier[] getVerifiers(){
-		Verifier[] vs = new Verifier[hashMap.values().size()];
-		return (Verifier[]) (hashMap.values().toArray(vs));	// Because vs is big enough, vs is used to store the values into and returned!
-	}
-
-	/**
-	 * Adds the VerifierFactoryObserver o to the list of observers.
-	 */
-	public static void attach(VerifierFactoryObserver o){
-		observers.add(o);
-	}
-	
-	/**
-	 * Removes the VerifierFactoryObserver o from the list of observers.
-	 */
-	public static void detach(VerifierFactoryObserver o){
-			observers.remove(o);
-	}
+    /**
+     * The HashMap that holds the data about the already-constructed Verifier instances.
+     */
+    private static Map hashMap = new HashMap();
+    /**
+     * The VerifierFactoryObserver instances that observe the VerifierFactory.
+     */
+    private static List observers = new Vector();
+
+
+    /**
+     * The VerifierFactory is not instantiable.
+     */
+    private VerifierFactory() {
+    }
+
+
+    /**
+     * Returns the (only) verifier responsible for the class with the given name.
+     * Possibly a new Verifier object is transparently created.
+     * @return the (only) verifier responsible for the class with the given name.
+     */
+    public static Verifier getVerifier( String fully_qualified_classname ) {
+        Verifier v = (Verifier) (hashMap.get(fully_qualified_classname));
+        if (v == null) {
+            v = new Verifier(fully_qualified_classname);
+            hashMap.put(fully_qualified_classname, v);
+            notify(fully_qualified_classname);
+        }
+        return v;
+    }
+
+
+    /**
+     * Notifies the observers of a newly generated Verifier.
+     */
+    private static void notify( String fully_qualified_classname ) {
+        // notify the observers
+        Iterator i = observers.iterator();
+        while (i.hasNext()) {
+            VerifierFactoryObserver vfo = (VerifierFactoryObserver) i.next();
+            vfo.update(fully_qualified_classname);
+        }
+    }
+
+
+    /**
+     * Returns all Verifier instances created so far.
+     * This is useful when a Verifier recursively lets
+     * the VerifierFactory create other Verifier instances
+     * and if you want to verify the transitive hull of
+     * referenced class files.
+     */
+    public static Verifier[] getVerifiers() {
+        Verifier[] vs = new Verifier[hashMap.values().size()];
+        return (Verifier[]) (hashMap.values().toArray(vs)); // Because vs is big enough, vs is used to store the values into and returned!
+    }
+
+
+    /**
+     * Adds the VerifierFactoryObserver o to the list of observers.
+     */
+    public static void attach( VerifierFactoryObserver o ) {
+        observers.add(o);
+    }
+
+
+    /**
+     * Removes the VerifierFactoryObserver o from the list of observers.
+     */
+    public static void detach( VerifierFactoryObserver o ) {
+        observers.remove(o);
+    }
 }

Modified: jakarta/bcel/trunk/src/java/org/apache/bcel/verifier/VerifierFactoryListModel.java
URL: http://svn.apache.org/viewcvs/jakarta/bcel/trunk/src/java/org/apache/bcel/verifier/VerifierFactoryListModel.java?rev=386056&r1=386055&r2=386056&view=diff
==============================================================================
--- jakarta/bcel/trunk/src/java/org/apache/bcel/verifier/VerifierFactoryListModel.java (original)
+++ jakarta/bcel/trunk/src/java/org/apache/bcel/verifier/VerifierFactoryListModel.java Wed Mar 15 03:31:56 2006
@@ -13,10 +13,11 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License. 
  *
- */ 
+ */
 package org.apache.bcel.verifier;
 
 import javax.swing.event.ListDataEvent;
+
 /**
  * This class implements an adapter; it implements both a Swing ListModel and
  * a VerifierFactoryObserver.
@@ -24,46 +25,51 @@
  * @version $Id$
  * @author Enver Haase
  */
-public class VerifierFactoryListModel implements org.apache.bcel.verifier.VerifierFactoryObserver, javax.swing.ListModel{
+public class VerifierFactoryListModel implements org.apache.bcel.verifier.VerifierFactoryObserver,
+        javax.swing.ListModel {
 
-  private java.util.ArrayList listeners = new java.util.ArrayList();
+    private java.util.ArrayList listeners = new java.util.ArrayList();
+    private java.util.TreeSet cache = new java.util.TreeSet();
 
-  private java.util.TreeSet cache = new java.util.TreeSet();
 
-  public VerifierFactoryListModel() {
-    VerifierFactory.attach(this);
-    update(null); // fill cache.
-  }
+    public VerifierFactoryListModel() {
+        VerifierFactory.attach(this);
+        update(null); // fill cache.
+    }
 
-  public synchronized void update(String s){
-    int size = listeners.size();
 
-    Verifier[] verifiers = VerifierFactory.getVerifiers();
-    int num_of_verifiers = verifiers.length;
-    cache.clear();
-    for (int i=0; i<num_of_verifiers; i++) {
-      cache.add(verifiers[i].getClassName());
+    public synchronized void update( String s ) {
+        int size = listeners.size();
+        Verifier[] verifiers = VerifierFactory.getVerifiers();
+        int num_of_verifiers = verifiers.length;
+        cache.clear();
+        for (int i = 0; i < num_of_verifiers; i++) {
+            cache.add(verifiers[i].getClassName());
+        }
+        for (int i = 0; i < size; i++) {
+            ListDataEvent e = new ListDataEvent(this, ListDataEvent.CONTENTS_CHANGED, 0,
+                    num_of_verifiers - 1);
+            ((javax.swing.event.ListDataListener) (listeners.get(i))).contentsChanged(e);
+        }
     }
 
-    for (int i=0; i<size; i++){
-      ListDataEvent e = new ListDataEvent(this, ListDataEvent.CONTENTS_CHANGED, 0, num_of_verifiers-1);
-      ((javax.swing.event.ListDataListener) (listeners.get(i))).contentsChanged(e);
+
+    public synchronized void addListDataListener( javax.swing.event.ListDataListener l ) {
+        listeners.add(l);
     }
-  }
 
-  public synchronized void addListDataListener(javax.swing.event.ListDataListener l){
-    listeners.add(l);
-  }
 
-  public synchronized void removeListDataListener(javax.swing.event.ListDataListener l){
-    listeners.remove(l);
-  }
+    public synchronized void removeListDataListener( javax.swing.event.ListDataListener l ) {
+        listeners.remove(l);
+    }
 
-  public synchronized int getSize(){
-    return cache.size();
-  }
 
-  public synchronized Object getElementAt(int index){
-    return (cache.toArray())[index];
-  }
+    public synchronized int getSize() {
+        return cache.size();
+    }
+
+
+    public synchronized Object getElementAt( int index ) {
+        return (cache.toArray())[index];
+    }
 }

Modified: jakarta/bcel/trunk/src/java/org/apache/bcel/verifier/VerifierFactoryObserver.java
URL: http://svn.apache.org/viewcvs/jakarta/bcel/trunk/src/java/org/apache/bcel/verifier/VerifierFactoryObserver.java?rev=386056&r1=386055&r2=386056&view=diff
==============================================================================
--- jakarta/bcel/trunk/src/java/org/apache/bcel/verifier/VerifierFactoryObserver.java (original)
+++ jakarta/bcel/trunk/src/java/org/apache/bcel/verifier/VerifierFactoryObserver.java Wed Mar 15 03:31:56 2006
@@ -13,10 +13,9 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License. 
  *
- */ 
+ */
 package org.apache.bcel.verifier;
 
-
 /**
  * VerifierFactoryObserver instances are notified when new Verifier
  * instances are created.
@@ -29,11 +28,12 @@
  * @see VerifierFactory#attach(VerifierFactoryObserver)
  * @see VerifierFactory#detach(VerifierFactoryObserver)
  */
-public interface VerifierFactoryObserver{
-	/**
-	 * VerifierFactoryObserver instances are notified invoking this method.
-	 * The String argument is the fully qualified class name of a class a
-	 * new Verifier instance created by the VerifierFactory operates on.
-	 */
-	public void update(String s);
+public interface VerifierFactoryObserver {
+
+    /**
+     * VerifierFactoryObserver instances are notified invoking this method.
+     * The String argument is the fully qualified class name of a class a
+     * new Verifier instance created by the VerifierFactory operates on.
+     */
+    public void update( String s );
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.