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 232316 - IllegalStateException: Fold has been already finished.
Summary: IllegalStateException: Fold has been already finished.
Status: RESOLVED FIXED
Alias: None
Product: projects
Classification: Unclassified
Component: Maven (show other bugs)
Version: 7.4
Hardware: All All
: P3 normal (vote)
Assignee: Milos Kleint
URL:
Keywords: API_REVIEW_FAST
: 232997 234378 (view as bug list)
Depends on:
Blocks:
 
Reported: 2013-07-05 22:44 UTC by janario
Modified: 2013-08-20 06:42 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 201872


Attachments
stacktrace (1.54 KB, text/plain)
2013-07-05 22:44 UTC, janario
Details
Proposed Patch (8.97 KB, patch)
2013-07-17 08:30 UTC, Jaroslav Havlin
Details | Diff
stacktrace (1.54 KB, text/plain)
2013-07-18 20:15 UTC, locked
Details
Proposed Patch v2 (8.71 KB, patch)
2013-07-23 08:58 UTC, Jaroslav Havlin
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description janario 2013-07-05 22:44:50 UTC
Build: NetBeans IDE Dev (Build 20130705-2a0d2b28cb6d)
VM: Java HotSpot(TM) 64-Bit Server VM, 23.21-b01, Java(TM) SE Runtime Environment, 1.7.0_21-b11
OS: Linux

User Comments:
janario: Running java aplication

GUEST: pom.xml webservice client




Stacktrace: 
java.lang.IllegalStateException: Fold has been already finished.
   at org.netbeans.core.output2.NbIO$IOFoldingImpl$NbIoFoldHandleDefinition.finish(NbIO.java:594)
   at org.openide.windows.FoldHandle.finish(FoldHandle.java:69)
   at org.netbeans.modules.maven.execute.cmd.ExecutionEventObject$Tree.finishFold(ExecutionEventObject.java:223)
   at org.netbeans.modules.maven.execute.CommandLineOutputHandler.processExecEvent(CommandLineOutputHandler.java:437)
   at org.netbeans.modules.maven.execute.CommandLineOutputHandler.trimTree(CommandLineOutputHandler.java:525)
   at org.netbeans.modules.maven.execute.CommandLineOutputHandler.completeTreeAtEnd(CommandLineOutputHandler.java:398)
Comment 1 janario 2013-07-05 22:44:51 UTC
Created attachment 136755 [details]
stacktrace
Comment 2 Jaroslav Havlin 2013-07-17 08:30:07 UTC
Created attachment 137295 [details]
Proposed Patch

Patch for API change that adds some convenience methods to class FoldHandle.
Comment 3 Jaroslav Havlin 2013-07-17 08:36:03 UTC
The bug comes from Maven Project Support, but the FoldHandle could be more helpful if it's too complex or undesirable to manage state and structure of folds on the client side of the API.

Milos, can you please check the attached patch? Would the new methods be useful for you? Thank you. (Suggestions for better method names are welcome.)
Comment 4 Milos Kleint 2013-07-17 09:07:39 UTC
patch looks ok to me
Comment 5 Jaroslav Havlin 2013-07-17 09:16:41 UTC
Please review the following API changes in class FoldHandle:

New methods:
------------
isFinished()
getLastNestedFold()
getCurrentNestedFold()
silentFinish()
silentStartFold(boolean)

Thank you.
Comment 6 locked 2013-07-18 20:15:41 UTC
Created attachment 137400 [details]
stacktrace

tried to run a maven program
Comment 7 Jaroslav Havlin 2013-07-19 06:21:43 UTC
*** Bug 232997 has been marked as a duplicate of this bug. ***
Comment 8 Ralph Ruijs 2013-07-23 07:59:17 UTC
(In reply to comment #5)
> Please review the following API changes in class FoldHandle:
> New methods:
> ------------
> isFinished()
> getLastNestedFold()
> getCurrentNestedFold()
> silentFinish()
> silentStartFold(boolean)
> Thank you.


R01: Are the silent methods really necessary? Are the added methods isFinished() and getCurrentNestedFold() not sufficient for the api-client to safely call finish() or startFold()?
R02: I do not think we want to catch(Exception)
Comment 9 Jaroslav Havlin 2013-07-23 08:58:07 UTC
Created attachment 137606 [details]
Proposed Patch v2

> R01: [...] Are the added methods isFinished() and getCurrentNestedFold() not 
> sufficient for the api-client to  safely call finish() or startFold()?
Yes, the two methods are sufficient, other methods are just for API client convenience. If they are not implemented here, they'll be implemented in module maven (and maybe some others, e.g. ant).

So I preferred richer API over duplication of code.
If you think minimalistic API is better, I'll remove the extra methods.

> R02: I do not think we want to catch(Exception)
Indeed. Thank you. All possible problems are handled, so the try-catch is not needed.
Comment 10 Ralph Ruijs 2013-07-23 09:15:18 UTC
(In reply to comment #9)
> R01: [...] So I preferred richer API over duplication of code.
> If you think minimalistic API is better, I'll remove the extra methods.

I agree, the patch v2 looks ok to me.
Comment 11 Jaroslav Havlin 2013-07-24 14:20:22 UTC
Thank you, Ralph.

It there are no other objections, I'll integrate the patch tomorrow. Thanks.
Comment 12 Jaroslav Havlin 2013-07-26 04:54:48 UTC
Integrated as http://hg.netbeans.org/core-main/rev/28fa0b528e68
Thank you for reviewing.
Comment 13 Jaroslav Havlin 2013-07-26 05:00:23 UTC
I'm changing subject of the issue to the original one and reassigning it to Projects/Maven. Milos, please check it. Thanks.
Comment 14 Milos Kleint 2013-07-26 08:46:30 UTC
I guess this should be sufficient
http://hg.netbeans.org/core-main/rev/38d2a6e17aff
Comment 15 Quality Engineering 2013-07-27 02:20:25 UTC
Integrated into 'main-silver', will be available in build *201307262300* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/28fa0b528e68
User: Jaroslav Havlin <jhavlin@netbeans.org>
Log: #232316: Output Window: Make FoldHandle API more user-friendly
Comment 16 Milos Kleint 2013-08-20 06:42:55 UTC
*** Bug 234378 has been marked as a duplicate of this bug. ***