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 110311 - StringIndexOutOfBoundsException upon "Implement all abstract methods"
Summary: StringIndexOutOfBoundsException upon "Implement all abstract methods"
Status: RESOLVED WONTFIX
Alias: None
Product: java
Classification: Unclassified
Component: Source (show other bugs)
Version: 6.x
Hardware: PC Windows XP
: P4 blocker with 1 vote (vote)
Assignee: Rastislav Komara
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-07-19 15:40 UTC by matthies
Modified: 2009-11-02 11:04 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description matthies 2007-07-19 15:40:38 UTC
Steps to reproduce:

1. Create the following Java source file:

    public class Test
    {
        static class Foo implements Comparable<String>

        static
        {
        }
    }

2. Move caret on the incomplete definition of Foo.

3. Press Alt+Enter and then press Enter to execute "Implement all abstract methods".

-> The following exception is thrown:

java.lang.StringIndexOutOfBoundsException: String index out of range: 125
	at java.lang.String.charAt(String.java:687)
	at org.netbeans.modules.java.source.save.CasualDiff.diffClassDef(CasualDiff.java:322)
	at org.netbeans.modules.java.source.save.CasualDiff.diffTree(CasualDiff.java:2223)
	at org.netbeans.modules.java.source.save.CasualDiff.diffList(CasualDiff.java:1966)
	at org.netbeans.modules.java.source.save.CasualDiff.diffTopLevel(CasualDiff.java:135)
	at org.netbeans.modules.java.source.save.CasualDiff.diffTree(CasualDiff.java:2217)
	at org.netbeans.modules.java.source.save.CasualDiff.diff(CasualDiff.java:88)
	at org.netbeans.modules.java.source.save.Commit.commit(Commit.java:176)
	at org.netbeans.modules.java.source.save.Commit.visitCompilationUnit(Commit.java:129)
Caused: QueryException
	at org.netbeans.modules.java.source.query.Query.error(Query.java:117)
	at org.netbeans.modules.java.source.save.Commit.visitCompilationUnit(Commit.java:137)
	at org.netbeans.modules.java.source.save.Commit.visitCompilationUnit(Commit.java:51)
	at com.sun.tools.javac.tree.JCTree$JCCompilationUnit.accept(JCTree.java:476)
	at org.netbeans.modules.java.source.engine.RootTree.accept(RootTree.java:60)
	at org.netbeans.modules.java.source.query.Query.apply(Query.java:95)
	at org.netbeans.modules.java.source.save.Commit.commit(Commit.java:85)
	at org.netbeans.api.java.source.WorkingCopy.getChanges(WorkingCopy.java:207)
	at org.netbeans.api.java.source.JavaSource.runModificationTask(JavaSource.java:785)
	at org.netbeans.modules.java.hints.errors.ImplementAllAbstractMethods$FixImpl.implement
(ImplementAllAbstractMethods.java:165)
	at org.netbeans.modules.editor.hints.HintsUI$1.run(HintsUI.java:542)
	at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:539)
[catch] at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:964)

Found with build 200707171200.
Comment 1 Tomas Zezula 2007-09-06 20:14:28 UTC
Fixed a java hints issue which caused no errors and hints displayed for given file.
Checking in src/org/netbeans/modules/java/hints/infrastructure/ErrorHintsProvider.java;
/cvs/java/hints/src/org/netbeans/modules/java/hints/infrastructure/ErrorHintsProvider.java,v  <--  ErrorHintsProvider.java
new revision: 1.6; previous revision: 1.5
done

Now it's reproduceable, it's up to Pavel to decide if we will fix the Diff or we can disable the hint for such a broken
file.
Comment 2 Pavel Flaska 2007-09-12 11:44:55 UTC
Not sure, currently the exception is no longer reproducible, but the abstract methods are generated to top level class
and line with declaration is duplicated. Positions are totally broken. I think now it can be considered as P4 bug,
because it doesn't throw any exception and it does not do any mismatch in source.
Comment 3 Rastislav Komara 2009-02-03 10:57:05 UTC
Overtake.
Comment 4 David Strupl 2009-03-31 15:59:46 UTC
Resolving all issues with milestone "future" as LATER. If you feel strongly that
it should be implemented please reopen and set the target milestone to "next".
Comment 5 Quality Engineering 2009-11-02 11:04:23 UTC
NetBeans.org Migration: changing resolution from LATER to WONTFIX