commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Emmanuel Bourg (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (BCEL-100) ClassParser throws unintelligible Exception
Date Thu, 24 Apr 2014 08:51:15 GMT

     [ https://issues.apache.org/jira/browse/BCEL-100?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Emmanuel Bourg updated BCEL-100:
--------------------------------

             Priority: Blocker
          Environment:     (was: Operating System: other
Platform: Other)
    Affects Version/s:     (was: unspecified)
        Fix Version/s: 6.0
             Priority:   (was: P2)
             Severity:   (was: normal)

> ClassParser throws unintelligible Exception
> -------------------------------------------
>
>                 Key: BCEL-100
>                 URL: https://issues.apache.org/jira/browse/BCEL-100
>             Project: Commons BCEL
>          Issue Type: Bug
>          Components: Main
>            Reporter: Ian Darwin
>            Assignee: Apache Commons Developers
>            Priority: Blocker
>             Fix For: 6.0
>
>
> o.a.b.classfile.ClassParser throws two exceptions. One has the file_name
> variable included but the one that only comes up when you have a corrupted class
> file does not. When you have thousands and thousands of classes (counting all
> the classes in dependent jars) in a large project, this can make it very
> difficult to find the problem! 
> One could in theory argue that the application using BCEL should report this,
> but the canonical example of a file-related problem is FileNotFoundException
> which does include the filename, for the same reason as I suggest the exception
> thrown by ClassParser does. E.g., create new FileReader("/nosuchfile") and you get:
> Exception in thread "main" java.io.FileNotFoundException: /nosuchfile (No such
> file or directory)
> A simple SVN patch against r516101  follows (bigger than it needs to be due to
> Eclipse's auto-remove-excess-whitespace mode):
> Index:
> /home/ian/workspace/bcel/src/main/java/org/apache/bcel/classfile/ClassParser.java
> ===================================================================
> ---
> /home/ian/workspace/bcel/src/main/java/org/apache/bcel/classfile/ClassParser.java
> (revision 516101)
> +++
> /home/ian/workspace/bcel/src/main/java/org/apache/bcel/classfile/ClassParser.java
> (working copy)
> @@ -38,7 +38,7 @@
>   * further details about the structure of a bytecode file.
>   *
>   * @version $Id$
> - * @author <A HREF="mailto:m.dahm@gmx.de">M. Dahm</A> 
> + * @author <A HREF="mailto:m.dahm@gmx.de">M. Dahm</A>
>   */
>  public final class ClassParser {
>  
> @@ -206,7 +206,8 @@
>          }
>          if (((access_flags & Constants.ACC_ABSTRACT) != 0)
>                  && ((access_flags & Constants.ACC_FINAL) != 0)) {
> -            throw new ClassFormatException("Class can't be both final and
> abstract");
> +            throw new ClassFormatException(
> +            	"Class " + file_name + " can't be both final and abstract");
>          }
>          class_name_index = file.readUnsignedShort();
>          superclass_name_index = file.readUnsignedShort();



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Mime
View raw message