Skip to main content



      Home
Home » Archived » BIRT » Java event handler and the List Box Parameter
Java event handler and the List Box Parameter [message #245712] Sat, 30 June 2007 20:19 Go to next message
Eclipse UserFriend
I have done the following:

- created a JDBC datasource and added a Java event handler class
- created a dataset using this datasource
After that, I tried to add a parameter with the Display Type "List Box"
and a static list of values. When I clicked on the "Import values"
button, a NullPointerException was thrown.

The problem is the method ScriptExecutor#getInstance(
DesignElementHandle element, ExecutionContext context )
because, in this case, context= null.
I suppose that this is a bug in BIRT.
The method is the same in BIRT 2.1.2 and BIRT 2.2RC4.

I have modified the method in the following way:

protected static Object getInstance( String className,
ExecutionContext context )
{
if ( className == null )
return null;

Object o = null;
Class c = null;
// try to load the 'className' class using the current classloader
try {
c = Class.forName(className);
} catch (ClassNotFoundException e) {
// ignore
}

try
{
if (c == null) {
ClassLoader classLoader =
Thread.currentThread().getContextClassLoader();
if (context != null) {
classLoader = context.getApplicationClassLoader();
}
c = classLoader.loadClass(className);
}
o = c.newInstance( );
}
.....

There is yet another problem in the "Import Values" dialog.
DataSourceScriptExecutor doesn't recognize the 'params' variable.
I am using the following workaround :

var params;
if (params == undefined) {
paramValue = ...;
} else {
paramValue = params["parameter"];
}

but, this isn't probably the best solution.

Snjeza
Re: Java event handler and the List Box Parameter [message #245848 is a reply to message #245712] Mon, 02 July 2007 05:38 Go to previous messageGo to next message
Eclipse UserFriend
Hi Snjeza
Thanks for your question, this is a real issue in BIRT, you can see
bug#190500 in Bugzilla may be it is as same as the issue you met.
Currently, we can not get the event handler in design time, so when you
click the import value, the designer get no value list, and the NPE throws
out. And this issue is underreviewing in 2.2.1, we will find a solution to
solve this and we will also consult your suggestion. If you feel that it's
not a duplicate issue with 190500, welcome to post that.

Best Regards~
Re: Java event handler and the List Box Parameter [message #245876 is a reply to message #245848] Mon, 02 July 2007 07:52 Go to previous messageGo to next message
Eclipse UserFriend
Hi Tianli,

This is not the same issue.
I had a problem similar to the problem described in bug #190500, but I
resolved it using buddy classloading (org.mozilla.rhino has policy
registered. The viewer plugin depends on org.mozilla.rhino in my RCP
application).
You have exactly described my issue, but it isn't described in bug #190500.

Regards,
Snjeza

Tianli wrote:
> Hi Snjeza
> Thanks for your question, this is a real issue in BIRT, you can see
> bug#190500 in Bugzilla may be it is as same as the issue you met.
> Currently, we can not get the event handler in design time, so when you
> click the import value, the designer get no value list, and the NPE
> throws out. And this issue is underreviewing in 2.2.1, we will find a
> solution to solve this and we will also consult your suggestion. If you
> feel that it's not a duplicate issue with 190500, welcome to post that.
>
> Best Regards~
Re: Java event handler and the List Box Parameter [message #246025 is a reply to message #245876] Mon, 02 July 2007 22:03 Go to previous messageGo to next message
Eclipse UserFriend
Hi,Snjeza

I got your point, after investigating, they are the same issue. The bug
didn't cover your steps to reproduce the issue, but they caused by the
same problem that we can not get the event handler at the design time, if
you import the values, we should populate all the values, but at that time
we can't. So we will pay attention to the issue and find a solution, do
you have any other idea?

Regards:)
Re: Java event handler and the List Box Parameter [message #246051 is a reply to message #246025] Tue, 03 July 2007 00:31 Go to previous message
Eclipse UserFriend
Hello Tianli,

I have integrated the BIRT viewer and BIRT Report Designer perspective
in a RCP application which uses Hibernate datasource, JDBC datasource
with event handlers and scripted datasources. BIRT is used in the design
and runtime mode.

There were three issues in the design time that I solved in different
ways. They are the following:

1) NPE is thrown in the method ScriptExecutor#getInstance(
DesignElementHandle element, ExecutionContext context )when trying to
create the List Box parameter and import static values from the JDBC
datasource which uses the event handler. This issue and my solution have
been described in my first post.

2) when using Preview Results in a scripted datasource, BIRT throws an
exception. That problem is also described in bug #190500. The method
ScriptExecutor#getInstance( DesignElementHandle element,
ExecutionContext context ) isn't called in this case.
The problem is that my classes aren't visible in the org.mozilla.rhino
and in org.eclipse.birt.report.engine plugins. They are visible in
runtime. My solution for this issue is using buddy classloading.

3) DataSourceScriptExecutor doesn't recognize the 'params' variable in
the Import Values dialog when creating the List Box parameter.
I have described my workaround in my first post.

Regards,
Snjeza

Tianli wrote:
> Hi,Snjeza
>
> I got your point, after investigating, they are the same issue. The bug
> didn't cover your steps to reproduce the issue, but they caused by the
> same problem that we can not get the event handler at the design time,
> if you import the values, we should populate all the values, but at that
> time we can't. So we will pay attention to the issue and find a
> solution, do you have any other idea?
> Regards:)
>
Previous Topic:Help: BIRT dynamic formatting
Next Topic:[2.2.0 Scripting] Setting Parameters
Goto Forum:
  


Current Time: Sat Jun 21 12:32:41 EDT 2025

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

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

Back to the top