This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 49121 - ClassUpdater reports exceptions when reading invalid class files
Summary: ClassUpdater reports exceptions when reading invalid class files
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Unsupported (show other bugs)
Version: 4.x
Hardware: PC Linux
: P3 blocker (vote)
Assignee: issues@java
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-09-16 02:02 UTC by _ tball
Modified: 2007-09-26 09:14 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Exception thrown when scanning the bad foo.class file. (10.89 KB, text/plain)
2004-09-16 02:04 UTC, _ tball
Details

Note You need to log in before you can comment on or make changes to this bug.
Description _ tball 2004-09-16 02:02:18 UTC
When the ClassUpdater finds a file that ends in
".class" but isn't a valid Java class file, it
logs a long, scary exception.  Exceptions are
supposed to be used for occasional occurrences,
but we cannot assume that the content of all files
whose names end in ".class" are guaranteed to be
Java files.  At most, a "invalid class file:
<filename>" message should be logged instead of
the exception.

To recreate, copy any data file to something like
"foo.class" in a project directory to create a bad
class file.  

Suggested fix:  the classfile module can define an
InvalidClassFormatException which extends
IOException, and throw that for those cases where
it detects a bad class format.  ClassUpdater can
separately catch this exception, and either log
the bad file by name, or ignore it.  This way,
real IOExceptions (bad disk, etc.) can still be
logged.  I'd be happy to make these changes.
Comment 1 _ tball 2004-09-16 02:04:43 UTC
Created attachment 17672 [details]
Exception thrown when scanning the bad foo.class file.
Comment 2 _ tball 2004-09-18 00:30:44 UTC
Added InvalidClassFileException to classfile, which is thrown for
badly formatted classes, then added catch for this exception in
ClassUpdater.  This allows true IOExceptions to still be reported.
Comment 3 Quality Engineering 2007-09-20 10:55:12 UTC
Reorganization of java component