Yes, you're right. I've reviewing all the code again.the difference was
this:
In the first code I do this:
$i=3Dnew java("java.lang.Integer",1);
$i=3D1;
$Cliente=3D$h->get($i);
echo "Cliente:".$Cliente->toString();
see that line in red, I didn't post it in the previous mail :(
now I understand why didn't work. When I do "$i=3D1" I make the $i a long. =
So,
the only way that we can handle Integer is with the java constructor.
On 9/22/05, Abbett, Jonathan <Jon...@ch...> wrote:
>
> Very interesting.
>
> I thought in your initial e-mail you said that using new java("
> java.lang.Integer", 1) gave you the same fatal error?
>
> > Also:
> >
> > $i=3Dnew java("java.lang.Integer",1);
> > $Cliente=3D$h->get($i);
> > echo "Cliente:".$Cliente->toString();
> >
> >
> > both return :
> >
> > Fatal error: Call to a member function toString() on a non-object.
>
>
> Did something else change in your implementation as well?
>
> (make sure you send your responses to the listserver, not just me!)
>
> Best,
> Jon
>
> ________________________________________
> From: Nicolas Granelli [mailto:nic...@gm...]
> Sent: Thursday, September 22, 2005 4:02 PM
> To: Abbett, Jonathan
> Subject: Re: [Php-java-bridge-users] HashMap->get()
>
> the $h is not null, because $h->size() return the correct value.
>
> I've tried with:
>
> $i=3Dnew java("java.lang.Integer", 1);
> $Cliente=3D$h->get($i);
>
> instead of:
>
> $Cliente=3D$h->get(1);
>
> and you know what? works just fine!!!!
>
>
> The problem was that the "1" was interpretated as a java Long, not an
> Integer. I get this solution from the other thread: "Primitives Types".
>
> Thanks a lot.
> This projects is very very good :)
>
> On 9/21/05, Abbett, Jonathan <Jon...@ch...>
> wrote:
> Based on the error, it seems like $h is null. Whatever is providing you
> with the HashMap object needs to be looked at more closely... I doubt it'=
s a
> problem with the PHP-Java bridge.
> --Jon
>
>
> ________________________________________
> From: php...@li... [mailto:
> php...@li...] On Behalf Of Nicolas
> Granelli
> Sent: Tuesday, September 20, 2005 7:04 PM
> To: php-java-bridge
> Subject: [Php-java-bridge-users] HashMap->get()
>
> I can't get to work the get method of a HashMap, that I get from Java (i'=
m
> not creating from php)
>
> I try:
>
> $Cliente=3D$h->get(1); //where $h is the HashMap
>
>
> Also:
>
> $i=3Dnew java("java.lang.Integer",1);
> $Cliente=3D$h->get($i);
> echo "Cliente:".$Cliente->toString();
>
>
> both return :
>
> Fatal error: Call to a member function toString() on a non-object.
>
>
>
|