Skip to main content



      Home
Home » Archived » BIRT » How to catch Exception
How to catch Exception [message #202761] Thu, 23 November 2006 11:45 Go to next message
Eclipse UserFriend
Originally posted by: miroslav.dekasoft.com.ua

Hi everyone!

I have my Java-class that make data

package mydata;

public class MyClass {
public static MyData[] getData() throws Exception {
// mine data
....
}
}

And I have .rptdesign with scripted datasource and scripted dataset. I
wrote next code on dataset's open event

data = Packages.mydata.MyClass.getData();

I generate report in PDF and when Exception occurs i see empty PDF page
without any message.

Tell me please how I can catch Exception on report side and show it in my
localized look?

I try to use the next construction

try {
data = Packages.mydata.MyClass.getData();
} catch (er) {
// show something
}

but it not working!

Miroslav
Re: How to catch Exception [message #203231 is a reply to message #202761] Tue, 28 November 2006 03:26 Go to previous message
Eclipse UserFriend
Originally posted by: brell.oio.de

Hi Miroslav,

you can catch your exception in the dataSets's open Event. But you can only
assign values to variables there, you can not display any messages or
produce output.
The first thing you should do is to create a global variable with the help
of reportContext-Object in beforeFactory-Method of your report. This
variable is now visible from everywhere in your report.
In onOpen-Event of your datasource you can catch your exception and assign
error-Text to this variable. Then you should add a condition to your
fetch-Method to ensure that it returns directly false if any text is
assigned to your variable (this is because a exception occured in onOpen).

In your report you can test if anything is assigned to your global variable
and display it s value (catched-Error Message) in a customized look.

I didn't try this before so it would be nice to hear if it works.



"Miroslav" <miroslav@dekasoft.com.ua> schrieb im Newsbeitrag
news:baf4ab8921fce18a78900a1784abf687$1@www.eclipse.org...
> Hi everyone!
>
> I have my Java-class that make data
>
> package mydata;
>
> public class MyClass {
> public static MyData[] getData() throws Exception {
> // mine data
> ....
> }
> }
>
> And I have .rptdesign with scripted datasource and scripted dataset. I
> wrote next code on dataset's open event
>
> data = Packages.mydata.MyClass.getData();
>
> I generate report in PDF and when Exception occurs i see empty PDF page
> without any message.
>
> Tell me please how I can catch Exception on report side and show it in my
> localized look?
>
> I try to use the next construction
>
> try {
> data = Packages.mydata.MyClass.getData();
> } catch (er) {
> // show something
> }
>
> but it not working!
>
> Miroslav
>
Previous Topic:Problems with a custom dataSetPage
Next Topic:Scripted Data Source & HTTP Servlet
Goto Forum:
  


Current Time: Sat Jun 21 20:45:22 EDT 2025

Powered by FUDForum. Page generated in 0.03305 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top