You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bcel-dev@jakarta.apache.org by en...@apache.org on 2002/04/23 22:55:55 UTC

cvs commit: jakarta-bcel/src/java/org/apache/bcel/verifier/statics StringRepresentation.java

enver       02/04/23 13:55:55

  Modified:    src/java/org/apache/bcel/verifier/statics
                        StringRepresentation.java
  Log:
  Bullet-proof text representation of objects that trigger BCEL's beloved "ClassFormatError"
  trying to object.toString() them.
  
  Revision  Changes    Path
  1.4       +6 -1      jakarta-bcel/src/java/org/apache/bcel/verifier/statics/StringRepresentation.java
  
  Index: StringRepresentation.java
  ===================================================================
  RCS file: /home/cvs/jakarta-bcel/src/java/org/apache/bcel/verifier/statics/StringRepresentation.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- StringRepresentation.java	4 Feb 2002 13:07:31 -0000	1.3
  +++ StringRepresentation.java	23 Apr 2002 20:55:54 -0000	1.4
  @@ -69,7 +69,7 @@
    * Note that this class also serves as a placeholder for more sophisticated message
    * handling in future versions of JustIce.
    * 
  - * @version $Id: StringRepresentation.java,v 1.3 2002/02/04 13:07:31 enver Exp $
  + * @version $Id: StringRepresentation.java,v 1.4 2002/04/23 20:55:54 enver Exp $
    * @author <A HREF="http://www.inf.fu-berlin.de/~ehaase"/>Enver Haase</A>
    */
   public class StringRepresentation extends org.apache.bcel.classfile.EmptyVisitor implements Visitor{
  @@ -112,6 +112,11 @@
   			String s = obj.getClass().getName();
   			s = s.substring(s.lastIndexOf(".")+1);
   			ret = "<<"+s+">>";
  +    }
  +    catch(ClassFormatError e){ /* BCEL can be harsh e.g. trying to convert the "signature" of a ReturnaddressType LocalVariable (shouldn't occur, but people do crazy things) */
  +      String s = obj.getClass().getName();
  +      s = s.substring(s.lastIndexOf(".")+1);
  +      ret = "<<"+s+">>";
   		}
   		return ret;
   	}
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>