You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Sourav Basu <ba...@yahoo.co.in> on 2007/10/24 21:02:40 UTC

Value of String Array[] not obtained in vm file when calling a method in a Java class running against jre v1.5 update 12

Hi All,

I am facing the below mentioned issue after upgrading jdk/jre from v1.4.2 update 13 to v1.5 update 12. 
 
 The value of a String Array is not obtained in the .vm file when calling a method in a Java class running against jre v1.5 update 12. The vm file is calling the java method using SOAP service. The String Array contains values at the java class level, however, when the array is returned to the vm file, it is obtained as null. 
 
 The same method works fine when tested with jdk/jre 1.4.2 update 13. 
 
Following is a code snippet to help you better understand the problem:

Java code:

public String[] getCompanies() {
    String[] str = iceService.getCompanies();
    logger.debug("[getCompanies] getCompanies");
    return str;
}

Velocity code:

#foreach ($companyName in $soapService.getCompanies())
    <tr><td><li>$companyName</td></tr>
#end

The velocity code is displaying the value of $companyName as NULL.


 Please provide inputs on this issue as soon as possible. 
 
Thanks,
Sourav
         
                   Description   
        The below mentioned issue is being faced after upgrading jdk/jre from v1.4.2 update 13 to v1.5 update 12. The value of a String Array is not obtained in the .vm file when calling a method in a Java class running against jre v1.5 update 12. The vm file is calling the java method using SOAP service. The String Array contains values at the java class level, however, when the array is returned to the vm file, it is obtained as null. The same method works fine when tested with jdk/jre 1.4.2 update 13. Please provide inputs on this issue urgently, as it is affecting the working of my application. Thanks.

     Show »
   
   
 __________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Re: Value of String Array[] not obtained in vm file when calling a method in a Java class running against jre v1.5 update 12

Posted by Nathan Bubna <nb...@gmail.com>.
Hi Sourav,

Thanks for posting this on the user list instead of in JIRA!  Some
feedback and further questions below.

On 10/24/07, Sourav Basu <ba...@yahoo.co.in> wrote:
> Hi All,
>
> I am facing the below mentioned issue after upgrading jdk/jre from v1.4.2 update 13 to v1.5 update 12.

You're sure this is the only change?  Also, what version of Velocity
are you using?

>  The value of a String Array is not obtained in the .vm file when calling a method in a Java class running against jre v1.5 update 12. The vm file is calling the java method using SOAP service. The String Array contains values at the java class level, however, when the array is returned to the vm file, it is obtained as null.

Does the method work when you call it from normal java rather than
from a template?

>  The same method works fine when tested with jdk/jre 1.4.2 update 13.
>
> Following is a code snippet to help you better understand the problem:
>
> Java code:
>
> public String[] getCompanies() {
>     String[] str = iceService.getCompanies();
>     logger.debug("[getCompanies] getCompanies");
>     return str;
> }

just to double check, is the class that declares this method is
declared public as well?

> Velocity code:
>
> #foreach ($companyName in $soapService.getCompanies())
>     <tr><td><li>$companyName</td></tr>
> #end
>
> The velocity code is displaying the value of $companyName as NULL.

This is confusing to me, just to clarify: is the output you get:

<tr><td><li>NULL</td></tr>

or is it

<tr><td><li>$companyName</td></tr>

?  And is it repeated once or not at all?  Further, what is the output
if you do:

$soapService  ##to ensure that this value isn't null
$soapService.getCompanies()  ##to see if the whole array is null or
just the values

>
>  Please provide inputs on this issue as soon as possible.
>
> Thanks,
> Sourav
>
>                    Description
>         The below mentioned issue is being faced after upgrading jdk/jre from v1.4.2 update 13 to v1.5 update 12. The value of a String Array is not obtained in the .vm file when calling a method in a Java class running against jre v1.5 update 12. The vm file is calling the java method using SOAP service. The String Array contains values at the java class level, however, when the array is returned to the vm file, it is obtained as null. The same method works fine when tested with jdk/jre 1.4.2 update 13. Please provide inputs on this issue urgently, as it is affecting the working of my application. Thanks.
>
>      Show »
>
>
>  __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org