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 97727 - warning dialogue for opening large files is meaningless if opened via a hyperlink
Summary: warning dialogue for opening large files is meaningless if opened via a hyper...
Status: RESOLVED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Text (show other bugs)
Version: 5.x
Hardware: All All
: P4 blocker (vote)
Assignee: Denis Anisimov
URL:
Keywords:
: 129634 (view as bug list)
Depends on:
Blocks:
 
Reported: 2007-03-13 12:22 UTC by davehun
Modified: 2008-12-22 10:51 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Only the OK button is present though it has the same effect as clicking no (21.39 KB, application/octet-stream)
2007-03-13 12:24 UTC, davehun
Details
The correct buttons (24.73 KB, application/octet-stream)
2007-03-13 12:37 UTC, davehun
Details
log file with exception in it (53.94 KB, text/plain)
2007-08-23 09:43 UTC, davehun
Details

Note You need to log in before you can comment on or make changes to this bug.
Description davehun 2007-03-13 12:22:54 UTC
When opening a .java file whose size is greater than 1Meg a dialogue is presented to the users asking 
them if they want to continue as it may cause problems with the IDE. If the file is opened using the project 
of file browsers there are 2 buttons, labelled yes and no. If the file is opened from a hyperlink (e.g. the file 
contains a compile error) the dialogue  is shown with only an ok button. Clicking ok doesn't open the file 
(it has the same behaviour as clicking no.
To reproduce the error create a large file with one error and click on the error to open the file the 
incorrect dialogue will be shown.
Comment 1 davehun 2007-03-13 12:24:51 UTC
Created attachment 39427 [details]
Only the OK button is present though it has the same effect as clicking no
Comment 2 davehun 2007-03-13 12:37:29 UTC
Created attachment 39429 [details]
The correct buttons
Comment 3 Vitezslav Stejskal 2007-03-13 23:48:46 UTC
I think this is implemented in openide/loaders.
Comment 4 Jaroslav Tulach 2007-03-14 00:14:21 UTC
It is not that easy. The code in openide/loaders generates

class ME extends org.openide.util.UserQuestionException

and it is the responsibility of the caller to understand the exception, show 
reasonable dialog and then invoke exception.confirmed()

I would have to see the stacktrace, but I guess this has to be done somewhere 
in the hyperlinks code.
Comment 5 Vitezslav Stejskal 2007-03-14 01:49:15 UTC
I see. I'll then investigate it further. davehun, could you please reproduce the
problem and attach your messages.log (<userdir>/var/log/messages.log). Hopefully
we will see some stacktraces from there. Thanks a lot.
Comment 6 davehun 2007-08-23 09:43:36 UTC
Created attachment 47146 [details]
log file with exception in it
Comment 7 davehun 2007-08-23 10:00:29 UTC
just tried in 6m10. This has the same issue
Comment 8 Vitezslav Stejskal 2007-08-23 13:14:30 UTC
Ok, I think I tracked this down to CloneableEditorSupport. It allows a document to be opened in two ways - simple open()
and through Line.show(kind, column), which translates to CES.openAtImpl(...). In the latter case CES does not handle the
UserQuestionException that is thrown when loading a huge file. Therefore the exception is caught and handled in
org.netbeans.core.NotifyExcPanel, but because it's got a localized message attached to it the dialog shows that message
rather than an ugly stacktrace. Both dialogs look similar, but they are different. IMO CES should handle UQE in both
open() and openAtImpl() the same way.
Comment 9 Petr Nejedly 2007-09-14 12:29:51 UTC
Nontrivial to implement (multiple threads involved, danger of a deadlock), -> future.
Comment 10 Denis Anisimov 2008-03-24 09:29:28 UTC
*** Issue 129634 has been marked as a duplicate of this issue. ***
Comment 11 Denis Anisimov 2008-03-24 17:24:07 UTC
This issue doesn't relate to call CES.openAtImpl(...).
Possibly mentioned method call CES.openAtImpl(...) will lead to related 
problem but there should be separate issue with exact steps to reproduce
for such behavior.

In this issue the problem is in call of Hyperlink.outputLineAction()
at org.openide.text.CloneableEditorSupport.openDocument(CloneableEditorSupport.java:710)
at org.openide.text.DataEditorSupport.openDocument(DataEditorSupport.java:398)
--------> at org.apache.tools.ant.module.run.Hyperlink.outputLineAction(Hyperlink.java:115)
at org.netbeans.core.output2.Controller.lineClicked(Controller.java:860)
at org.netbeans.core.output2.OutputWindow.lineClicked(OutputWindow.java:277)
at org.netbeans.core.output2.OutputTab.lineClicked(OutputTab.java:163)
at org.netbeans.core.output2.OutputPane.lineClicked(OutputPane.java:72)
at org.netbeans.core.output2.ui.AbstractOutputPane.mouseReleased(AbstractOutputPane.java:600)
at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:273)
at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:272)

In this method there is a call to EditorCookie.openDocument().
And this method should be called with special contract ( the problem here that 
this contract was poorly described in Javadoc but it is fixed some time ago by me ).
If one calls this method he should care about UserQuestionExcepotion and catch it in
appropriate way. 
So THIS issue is for class org.apache.tools.ant.module.run.Hyperlink .
Comment 12 Denis Anisimov 2008-03-24 17:52:47 UTC
I don't know what is exact component for org.apache.tools.ant.module
so I just keep it as is.
Comment 13 Denis Anisimov 2008-03-24 18:00:31 UTC
changeset:   74755:5a6e96cf4592