bug-classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug classpath/22771] java.text.AttributedString will throw a NPE at lin


From: gcc-bugzilla at gcc dot gnu dot org
Subject: [Bug classpath/22771] java.text.AttributedString will throw a NPE at line 276
Date: 16 Oct 2005 01:27:06 -0000

the field attribs is not initialized in the constructor for AttributedString
before it is dereferenced on line 276. As a result, a NPE will always be thrown
on line 276 if that line is executed.

I believe the quick fix is to initialize attribs to be an empty array. In other
works, 
  attribs = new AttributeRange[0];

A better solution would be to build up the collection of attributes as a list
and then convert it to an array.

This bug was found with our static analysis tool for finding bugs in Java
programs, FindBugs:
   http://findbugs.sourceforge.net/


------- Comment #1 from from-classpath at savannah dot gnu dot org  2004-08-17 
03:08 -------
I'm checking in the fix for this.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22771





reply via email to

[Prev in Thread] Current Thread [Next in Thread]