Catching (and explaining to end user) BIRT exceptions [message #482987] |
Fri, 28 August 2009 21:54 |
Eclipse User |
|
|
|
Originally posted by: l.arzeni.gmail.com
Hi to all,
environment: Eclipse 3.4, BIRT 2.5
I'm developing a standalone application for rendering report.
All works fine, problem arise when I need to explain problems to end user.
For example, if I use a wrong password for the oda connection, I can catch
the error, but this is not much meaningful.
Code example:
try {
IReportRunnable l_reportRunnable = m_engine.openReportDesign(i_reportPath);
}
catch (EngineException l_exception) {
l_exception.printStackTrace();
}
Exception printed is:
--- stdout begin ---
org.eclipse.birt.report.engine.api.EngineException: Error happened while
running the report at
org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.doR un(RunAndRenderTask.java:196)
....omissis...
Caused by: java.lang.NoClassDefFoundError: org/w3c/tidy/Tidy
at
org.eclipse.birt.report.engine.parser.HTMLTextParser.<init>(HTMLTextParser.java:55)
....omissis...
--- stdout end ---
But the real error is explained in the BIRT log:
--- log begin ---
Aug 28, 2009 9:04:57 PM
org.eclipse.birt.data.engine.odaconsumer.ConnectionManager openConnection
SEVERE: Cannot open connection.
org.eclipse.birt.report.data.oda.jdbc.JDBCException: There is an error in
get connection, FATAL: password authentication failed for user "timesheet".
at
org.eclipse.birt.report.data.oda.jdbc.JDBCDriverManager.doCo nnect(JDBCDriverManager.java:229)
....omissis...
Aug 28, 2009 9:04:57 PM
org.eclipse.birt.report.engine.api.impl.RunAndRenderTask doRun
SEVERE: Error happened while running the report.
java.lang.NoClassDefFoundError: org/w3c/tidy/Tidy
at
org.eclipse.birt.report.engine.parser.HTMLTextParser.<init>(HTMLTextParser.java:55)
--- log end ---
So, (apart from the java.lang.NoClassDefFoundError: org/w3c/tidy/Tidy that I
don't understand), the real problem is known to BIRT: password
authentication failed, but from the code I can only report to the user that
there is an error while running the report (which is much less
explicative).
So question is: Is there any way to hook these problems at their origin? Is
there any way to hook BIRT error handler?
Thanks, Luca
|
|
|
Re: Catching (and explaining to end user) BIRT exceptions [message #483279 is a reply to message #482987] |
Mon, 31 August 2009 20:36 |
|
Luca,
catch on all Exception intsances instead of just EngineException.
Also you can also check the errors:
if ( !task.getErrors( ).isEmpty( ) )
{
for ( Object e : task.getErrors( ) )
{
( (Exception) e ).printStackTrace( );
}
}
Jason
Luca Arzeni wrote:
> Hi to all,
>
> environment: Eclipse 3.4, BIRT 2.5
>
> I'm developing a standalone application for rendering report.
> All works fine, problem arise when I need to explain problems to end user.
> For example, if I use a wrong password for the oda connection, I can catch
> the error, but this is not much meaningful.
>
> Code example:
>
> try {
> IReportRunnable l_reportRunnable = m_engine.openReportDesign(i_reportPath);
> }
> catch (EngineException l_exception) {
> l_exception.printStackTrace();
> }
>
> Exception printed is:
>
> --- stdout begin ---
>
> org.eclipse.birt.report.engine.api.EngineException: Error happened while
> running the report at
> org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.doR un(RunAndRenderTask.java:196)
> ...omissis...
>
> Caused by: java.lang.NoClassDefFoundError: org/w3c/tidy/Tidy
> at
> org.eclipse.birt.report.engine.parser.HTMLTextParser.<init>(HTMLTextParser.java:55)
> ...omissis...
>
> --- stdout end ---
>
> But the real error is explained in the BIRT log:
>
> --- log begin ---
>
> Aug 28, 2009 9:04:57 PM
> org.eclipse.birt.data.engine.odaconsumer.ConnectionManager openConnection
> SEVERE: Cannot open connection.
> org.eclipse.birt.report.data.oda.jdbc.JDBCException: There is an error in
> get connection, FATAL: password authentication failed for user "timesheet".
> at
> org.eclipse.birt.report.data.oda.jdbc.JDBCDriverManager.doCo nnect(JDBCDriverManager.java:229)
> ...omissis...
>
> Aug 28, 2009 9:04:57 PM
> org.eclipse.birt.report.engine.api.impl.RunAndRenderTask doRun
> SEVERE: Error happened while running the report.
> java.lang.NoClassDefFoundError: org/w3c/tidy/Tidy
> at
> org.eclipse.birt.report.engine.parser.HTMLTextParser.<init>(HTMLTextParser.java:55)
>
> --- log end ---
>
> So, (apart from the java.lang.NoClassDefFoundError: org/w3c/tidy/Tidy that I
> don't understand), the real problem is known to BIRT: password
> authentication failed, but from the code I can only report to the user that
> there is an error while running the report (which is much less
> explicative).
>
> So question is: Is there any way to hook these problems at their origin? Is
> there any way to hook BIRT error handler?
>
> Thanks, Luca
|
|
|
Re: Catching (and explaining to end user) BIRT exceptions [message #483342 is a reply to message #483279] |
Tue, 01 September 2009 08:41 |
Eclipse User |
|
|
|
Originally posted by: l.arzeni.gmail.com
Thanks Jason, it did it!!!
Jason Weathersby wrote:
> Luca,
>
> catch on all Exception intsances instead of just EngineException.
>
> Also you can also check the errors:
>
> if ( !task.getErrors( ).isEmpty( ) )
>
> {
>
> for ( Object e : task.getErrors( ) )
>
> {
>
> ( (Exception) e ).printStackTrace( );
>
> }
>
> }
>
> Jason
>
> Luca Arzeni wrote:
>> Hi to all,
>>
>> environment: Eclipse 3.4, BIRT 2.5
>>
>> I'm developing a standalone application for rendering report.
>> All works fine, problem arise when I need to explain problems to end
>> user. For example, if I use a wrong password for the oda connection, I
>> can catch the error, but this is not much meaningful.
>>
>> Code example:
>>
>> try {
>> IReportRunnable l_reportRunnable =
>> m_engine.openReportDesign(i_reportPath);
>> }
>> catch (EngineException l_exception) {
>> l_exception.printStackTrace();
>> }
>>
>> Exception printed is:
>>
>> --- stdout begin ---
>>
>> org.eclipse.birt.report.engine.api.EngineException: Error happened while
>> running the report at
>>
org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.doR un(RunAndRenderTask.java:196)
>> ...omissis...
>>
>> Caused by: java.lang.NoClassDefFoundError: org/w3c/tidy/Tidy
>> at
>>
org.eclipse.birt.report.engine.parser.HTMLTextParser.<init>(HTMLTextParser.java:55)
>> ...omissis...
>>
>> --- stdout end ---
>>
>> But the real error is explained in the BIRT log:
>>
>> --- log begin ---
>>
>> Aug 28, 2009 9:04:57 PM
>> org.eclipse.birt.data.engine.odaconsumer.ConnectionManager openConnection
>> SEVERE: Cannot open connection.
>> org.eclipse.birt.report.data.oda.jdbc.JDBCException: There is an error in
>> get connection, FATAL: password authentication failed for user
>> "timesheet".
>> at
>>
org.eclipse.birt.report.data.oda.jdbc.JDBCDriverManager.doCo nnect(JDBCDriverManager.java:229)
>> ...omissis...
>>
>> Aug 28, 2009 9:04:57 PM
>> org.eclipse.birt.report.engine.api.impl.RunAndRenderTask doRun
>> SEVERE: Error happened while running the report.
>> java.lang.NoClassDefFoundError: org/w3c/tidy/Tidy
>> at
>>
org.eclipse.birt.report.engine.parser.HTMLTextParser.<init>(HTMLTextParser.java:55)
>>
>> --- log end ---
>>
>> So, (apart from the java.lang.NoClassDefFoundError: org/w3c/tidy/Tidy
>> that I don't understand), the real problem is known to BIRT: password
>> authentication failed, but from the code I can only report to the user
>> that there is an error while running the report (which is much less
>> explicative).
>>
>> So question is: Is there any way to hook these problems at their origin?
>> Is there any way to hook BIRT error handler?
>>
>> Thanks, Luca
|
|
|
Powered by
FUDForum. Page generated in 0.03286 seconds