-
Bug
-
Resolution: Fixed
-
P4
-
None
-
7u55, 9
-
x86_64
-
windows_7
FULL PRODUCT VERSION :
A DESCRIPTION OF THE PROBLEM :
java.lang.NullPointerException at com.sun.org.apache.xerces.internal.impl.io.UTF8Reader.<init>(UTF8Reader.java:120)
It looks like there is a bug in ThreadLocalBufferAllocator.getBufferAllocator() that returns null when reference is gc'ed while it should never return null.
Related source code:
http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/com/sun/xml/internal/stream/util/ThreadLocalBufferAllocator.java
41public class More ...ThreadLocalBufferAllocator {
42 private static ThreadLocal tlba = new ThreadLocal();
43
44 public static BufferAllocator More ...getBufferAllocator() {
45 SoftReference bAllocatorRef = (SoftReference) tlba.get();
46 if (bAllocatorRef == null || bAllocatorRef.get() == null) {
47 bAllocatorRef = new SoftReference(new BufferAllocator());
48 tlba.set(bAllocatorRef);
49 }
50
51 return (BufferAllocator) bAllocatorRef.get();
52 }
53}
http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/com/sun/org/apache/xerces/internal/impl/io/UTF8Reader.java
116 public UTF8Reader(InputStream inputStream, int size,
117 MessageFormatter messageFormatter, Locale locale) {
118 fInputStream = inputStream;
119 BufferAllocator ba = ThreadLocalBufferAllocator.getBufferAllocator();
120 fBuffer = ba.getByteBuffer(size);
121 if (fBuffer == null) {
122 fBuffer = new byte[size];
123 }
124 fFormatter = messageFormatter;
125 fLocale = locale;
126 } // <init>(InputStream, int, MessageFormatter, Locale)
REPRODUCIBILITY :
This bug can be reproduced occasionally.
A DESCRIPTION OF THE PROBLEM :
java.lang.NullPointerException at com.sun.org.apache.xerces.internal.impl.io.UTF8Reader.<init>(UTF8Reader.java:120)
It looks like there is a bug in ThreadLocalBufferAllocator.getBufferAllocator() that returns null when reference is gc'ed while it should never return null.
Related source code:
http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/com/sun/xml/internal/stream/util/ThreadLocalBufferAllocator.java
41public class More ...ThreadLocalBufferAllocator {
42 private static ThreadLocal tlba = new ThreadLocal();
43
44 public static BufferAllocator More ...getBufferAllocator() {
45 SoftReference bAllocatorRef = (SoftReference) tlba.get();
46 if (bAllocatorRef == null || bAllocatorRef.get() == null) {
47 bAllocatorRef = new SoftReference(new BufferAllocator());
48 tlba.set(bAllocatorRef);
49 }
50
51 return (BufferAllocator) bAllocatorRef.get();
52 }
53}
http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/com/sun/org/apache/xerces/internal/impl/io/UTF8Reader.java
116 public UTF8Reader(InputStream inputStream, int size,
117 MessageFormatter messageFormatter, Locale locale) {
118 fInputStream = inputStream;
119 BufferAllocator ba = ThreadLocalBufferAllocator.getBufferAllocator();
120 fBuffer = ba.getByteBuffer(size);
121 if (fBuffer == null) {
122 fBuffer = new byte[size];
123 }
124 fFormatter = messageFormatter;
125 fLocale = locale;
126 } // <init>(InputStream, int, MessageFormatter, Locale)
REPRODUCIBILITY :
This bug can be reproduced occasionally.