Servoy 6 warning for jasperPluginException

Hi,

I get a warning : “The property message is undefined in jasperPluginException”

in my method:

try {
	plugins.jasperPluginRMI.runReport(vServerName,reportFileName,outputFile,outputFormat,reportParam);
	return true;
}
catch(jasperPluginException){
	var msg = jasperPluginException.message;
	application.output(msg);
	return false;
}

How can I fix that?

Thomas,

this is post #xx of the type: I get this warning, how can I fix this? It’s always the same, the type of a variable is unknown, so its properties are also unknown.

In your catch there is a jasperPluginException variable, that you one line further down ask for a property called message. The compiler does not know what TYPE jasperPluginException is. So declare the type and all is fine.

patrick:
this is post #xx of the type: I get this warning, how can I fix this? It’s always the same, the type of a variable is unknown, so its properties are also unknown.

Hi Patrick,

you are right! But I have read about the declarations in the Servoy Wiki and “Annotating JavaScript for the Closure Compiler”

on the Google Code site and have still problems to find the right declarations… I’m sorry.

Do you perhaps can give me some tips where I can find more infos about that? For example, the declaration @type {java.io.InputStream} is not an option in the valuelist for the @type declaration and I of course would like to learn how I can set the right declarations by myself without any help from the forum.

In general, what you need to do is figure out what kind of object you are dealing with and declare your variable with that type.

The example with the BufferedInputStream was a bit tricky, because that is plain Java. Expected was an InputStream and although your special InputStream was a subclass of InputStream it was not recognized as such. Not sure why, probably because we are not in Java here. What I did is 1) checked what the read() method expects and 2) declared that as type.

For this case here check http://www.servoy.com/forum/viewtopic.php?f=3&t=16736

this part:

catch(jasperPluginException){
   var msg = jasperPluginException.message;

is already fixed in the dltk plugin servoy uses, but it didn’t make it into 6.0.1
hopefully it will be in 6.0.2

what you can do is do:

catch(jasperPluginException){
   var msg = jasperPluginException['message'];