Re: Capturing FormText errors [message #324937] |
Mon, 04 February 2008 12:11  |
Eclipse User |
|
|
|
Originally posted by: eclipse-news.rizzoweb.com
Two things:
a) the Eclipse Forms API is not actually part of SWT, so newsgroup
questions about it should go to eclipse.platform (which I've copied on
this response).
b) Since you've done the work of stepping through the code, please file
a bug report:
https://bugs.eclipse.org/bugs/enter_bug.cgi?product=Platform &component=User%20Assistance
Eric
Mike Higginbotham wrote:
> To get the error output I created a PrintStream from a
> ByteArrayOutputStream and called System.setError(PrintStream). This
> worked fine. Of course, if SWT wasn't swallowing the root exception I
> would not have had to do this.
>
> - Mike
>
> Mike Higginbotham wrote:
>> I have a standalone SWT app using Eclipse 3.3. I would like to capture
>> the error output that occurs when the string sent to FormText is valid
>> so that I can display it in my GUI. For example, in the call:
>>
>> ft.setText("<form><p><b>Bold<b></p></form>", true, false);
>>
>> Will display the following in the console when run from the Eclipse
>> IDE (displayed in red text so I assume standard error):
>>
>> [Fatal Error] :1:22: The element type "b" must be terminated by the
>> matching end-tag "</b>".
>>
>> Stepping through the code, a SAXParseException is caught in
>> FormTextModel.parseInputStream(InputStream is, boolean expandURLs).
>> The exception handling code calls
>> SWT.error(SWT.ERROR_INVALID_ARGUMENT, e) [where e is the
>> SAXParseException] which turns into a call to SWT.error (int code,
>> Throwable throwable, String detail) [where detail is null]. This final
>> method throws an IllegalArgumentException because of the value of code
>> [SWT.ERROR_INVALID_ARGUMENT]. Unfortunately, it does not use the
>> IllegalArgumentException constructor that allows you to pass in the
>> Throwable that caused the exception. What this all means is that the
>> error message displayed on the console, most of which is available in
>> the SAXParseException, is not available to my code.
>>
>> So, given that I cannot get the error from the exception that is
>> thrown, is there any reasonable way to get it from standard error so
>> that my program can display it?
>>
>> Thanks,
>> Mike Higginbotham
|
|
|
Re: Capturing FormText errors [message #324966 is a reply to message #324937] |
Mon, 04 February 2008 16:18  |
Eclipse User |
|
|
|
Originally posted by: higginmi.xxxx.xxx
Thanks, Eric. I have filed a report - 217757.
Eric Rizzo wrote:
> Two things:
> a) the Eclipse Forms API is not actually part of SWT, so newsgroup
> questions about it should go to eclipse.platform (which I've copied on
> this response).
>
> b) Since you've done the work of stepping through the code, please file
> a bug report:
> https://bugs.eclipse.org/bugs/enter_bug.cgi?product=Platform &component=User%20Assistance
>
>
> Eric
>
>
>
> Mike Higginbotham wrote:
>> To get the error output I created a PrintStream from a
>> ByteArrayOutputStream and called System.setError(PrintStream). This
>> worked fine. Of course, if SWT wasn't swallowing the root exception I
>> would not have had to do this.
>>
>> - Mike
>>
>> Mike Higginbotham wrote:
>>> I have a standalone SWT app using Eclipse 3.3. I would like to
>>> capture the error output that occurs when the string sent to FormText
>>> is valid so that I can display it in my GUI. For example, in the call:
>>>
>>> ft.setText("<form><p><b>Bold<b></p></form>", true, false);
>>>
>>> Will display the following in the console when run from the Eclipse
>>> IDE (displayed in red text so I assume standard error):
>>>
>>> [Fatal Error] :1:22: The element type "b" must be terminated by the
>>> matching end-tag "</b>".
>>>
>>> Stepping through the code, a SAXParseException is caught in
>>> FormTextModel.parseInputStream(InputStream is, boolean expandURLs).
>>> The exception handling code calls
>>> SWT.error(SWT.ERROR_INVALID_ARGUMENT, e) [where e is the
>>> SAXParseException] which turns into a call to SWT.error (int code,
>>> Throwable throwable, String detail) [where detail is null]. This
>>> final method throws an IllegalArgumentException because of the value
>>> of code [SWT.ERROR_INVALID_ARGUMENT]. Unfortunately, it does not use
>>> the IllegalArgumentException constructor that allows you to pass in
>>> the Throwable that caused the exception. What this all means is that
>>> the error message displayed on the console, most of which is
>>> available in the SAXParseException, is not available to my code.
>>>
>>> So, given that I cannot get the error from the exception that is
>>> thrown, is there any reasonable way to get it from standard error so
>>> that my program can display it?
>>>
>>> Thanks,
>>> Mike Higginbotham
|
|
|
Powered by
FUDForum. Page generated in 0.04973 seconds