United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6735320 StringIndexOutOfBoundsException for empty @serialField tag
JDK-6735320 : StringIndexOutOfBoundsException for empty @serialField tag

Details
Type:
Bug
Submit Date:
2008-08-08
Status:
Closed
Updated Date:
2012-02-24
Project Name:
JDK
Resolved Date:
2012-02-24
Component:
tools
OS:
linux
Sub-Component:
javadoc(tool)
CPU:
x86
Priority:
P3
Resolution:
Fixed
Affected Versions:
6
Fixed Versions:

Related Reports
Backport:

Sub Tasks

Description
FULL PRODUCT VERSION :
java version "1.6.0_03"
Java(TM) SE Runtime Environment (build 1.6.0_03-b05)
Java HotSpot(TM) Server VM (build 1.6.0_03-b05, mixed mode)


ADDITIONAL OS VERSION INFORMATION :
OS independent

A DESCRIPTION OF THE PROBLEM :
In case I use empty @serialField tag in a field comment the javadoc tool always throws java.lang.StringIndexOutOfBoundsException.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
generate javadoc for the test case


ERROR MESSAGES/STACK TRACES THAT OCCUR :
java.lang.StringIndexOutOfBoundsException: String index out of range: 0
        at java.lang.String.codePointAt(String.java:716)
        at com.sun.tools.javadoc.SerialFieldTagImpl.parseSerialFieldString(SerialFieldTagImpl.java:80)
        at com.sun.tools.javadoc.SerialFieldTagImpl.<init>(SerialFieldTagImpl.java:49)
        at com.sun.tools.javadoc.Comment$1CommentStringParser.parseCommentComponent(Comment.java:142)
        at com.sun.tools.javadoc.Comment$1CommentStringParser.parseCommentStateMachine(Comment.java:116)
        at com.sun.tools.javadoc.Comment.<init>(Comment.java:167)
        at com.sun.tools.javadoc.DocImpl.comment(DocImpl.java:82)
        at com.sun.tools.javadoc.FieldDocImpl.serialFieldTags(FieldDocImpl.java:228)
        at com.sun.tools.javadoc.SerializedForm.mapSerialFieldTagImplsToFieldDocImpls(SerializedForm.java:215)
        at com.sun.tools.javadoc.SerializedForm.<init>(SerializedForm.java:107)
        at com.sun.tools.javadoc.ClassDocImpl.serializationMethods(ClassDocImpl.java:1174)
        at com.sun.tools.doclets.internal.toolkit.builders.SerializedFormBuilder.buildMethodHeader(SerializedFormBuilder.java:300)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at com.sun.tools.doclets.internal.toolkit.builders.SerializedFormBuilder.invokeMethod(SerializedFormBuilder.java:131)
        at com.sun.tools.doclets.internal.toolkit.builders.AbstractBuilder.build(AbstractBuilder.java:90)
        at com.sun.tools.doclets.internal.toolkit.builders.SerializedFormBuilder.buildClassSerializedForm(SerializedFormBuilder.java:185)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at com.sun.tools.doclets.internal.toolkit.builders.SerializedFormBuilder.invokeMethod(SerializedFormBuilder.java:131)
        at com.sun.tools.doclets.internal.toolkit.builders.AbstractBuilder.build(AbstractBuilder.java:90)
        at com.sun.tools.doclets.internal.toolkit.builders.SerializedFormBuilder.buildPackageSerializedForm(SerializedFormBuilder.java:167)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at com.sun.tools.doclets.internal.toolkit.builders.SerializedFormBuilder.invokeMethod(SerializedFormBuilder.java:131)
        at com.sun.tools.doclets.internal.toolkit.builders.AbstractBuilder.build(AbstractBuilder.java:90)
        at com.sun.tools.doclets.internal.toolkit.builders.SerializedFormBuilder.buildSerializedFormSummaries(SerializedFormBuilder.java:148)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at com.sun.tools.doclets.internal.toolkit.builders.SerializedFormBuilder.invokeMethod(SerializedFormBuilder.java:131)
        at com.sun.tools.doclets.internal.toolkit.builders.AbstractBuilder.build(AbstractBuilder.java:90)
        at com.sun.tools.doclets.internal.toolkit.builders.SerializedFormBuilder.buildSerializedForm(SerializedFormBuilder.java:116)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at com.sun.tools.doclets.internal.toolkit.builders.SerializedFormBuilder.invokeMethod(SerializedFormBuilder.java:131)
        at com.sun.tools.doclets.internal.toolkit.builders.AbstractBuilder.build(AbstractBuilder.java:90)
        at com.sun.tools.doclets.internal.toolkit.builders.SerializedFormBuilder.build(SerializedFormBuilder.java:101)
        at com.sun.tools.doclets.internal.toolkit.AbstractDoclet.generateOtherFiles(AbstractDoclet.java:137)
        at com.sun.tools.doclets.formats.html.HtmlDoclet.generateOtherFiles(HtmlDoclet.java:66)
        at com.sun.tools.doclets.internal.toolkit.AbstractDoclet.startGeneration(AbstractDoclet.java:122)
        at com.sun.tools.doclets.internal.toolkit.AbstractDoclet.start(AbstractDoclet.java:64)
        at com.sun.tools.doclets.formats.html.HtmlDoclet.start(HtmlDoclet.java:42)
        at com.sun.tools.doclets.standard.Standard.start(Standard.java:23)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at com.sun.tools.javadoc.DocletInvoker.invoke(DocletInvoker.java:215)
        at com.sun.tools.javadoc.DocletInvoker.start(DocletInvoker.java:91)
        at com.sun.tools.javadoc.Start.parseAndExecute(Start.java:340)
        at com.sun.tools.javadoc.Start.begin(Start.java:128)
        at com.sun.tools.javadoc.Main.execute(Main.java:41)
        at com.sun.tools.javadoc.Main.main(Main.java:31)


REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
package javadoc;

import java.io.ObjectStreamField;
import java.io.Serializable;

public class SerialFieldTest implements Serializable {
    private int i;
    /**
     * @serialField
     */
    private static final ObjectStreamField[] serialPersistentFields = {
        new ObjectStreamField("i", int.class),
    };
}

---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
Fill the tag values.

                                    

Comments
EVALUATION

All the other tags when given a null value continue with a warning, this one
also should, and not throw exceptions.
                                     
2011-06-28



Hardware and Software, Engineered to Work Together