Hello Patrick,
Thank you for the answer.

The reason, why I didn't use simple double is that the method, I want to 
call, accept Number or String as parameter:
Eg.
//method 1
void x(Number n){...}

//method 2
void x(String s){...}

.. and if I call it like

$o->x(888);

the parameter 888 has been interpreted as String and I am in the wrong 
wethod (method 2 instead of method 1) . 
That's why I tried to create real java.lang.Double

Anyway I find your work and the idea of Inline at all great!

Thank you!

Masha






"Patrick LeBoutillier" <[EMAIL PROTECTED]>
30.05.01 14:46

 
        To:     "Maria Ananieva" <[EMAIL PROTECTED]>
        cc: 
        Subject:        Re: Inline::Java subclasses of java.lang.Number don't work! 
Why?


Maria,

I'll definitely look into this. I didn't do much testing with
java.lang.Number stuff since
Inline::Java should handle it automagically. So if you have a Java method
that expects
either a 'double' or a 'java.lang.Double', you should be able to pass 
simply
the double in Perl
an Inline::Java will do the conversion.


Thanks,

Patrick

----- Original Message -----
From: "Maria Ananieva" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Wednesday, May 30, 2001 8:22 AM
Subject: Inline::Java subclasses of java.lang.Number don't work! Why?


> Hi!
>
> The code below throws exception
>
> ======================
> use strict;
> use Inline( JAVA => 'STUDY',
>             STUDY => ['java.lang.Double'],
> #           DEBUG => 1,
>               );
>
> my $pk = new java::lang::Double('8.4');         # here ok
> print $pk,"\n";                                 # here ok
> my $i = $pk->toString();                                # here exception
> happens!
>
> ======================
> output:
>
> main::java::lang::Double=HASH(0x466ac0)
>
> Exception in thread "main" java.lang.NumberFormatException:
> java.lang.Double
>         at java.lang.Throwable.fillInStackTrace(Native Method)
>         at java.lang.Throwable.<init>(Throwable.java:94)
>         at java.lang.Exception.<init>(Exception.java:42)
>         at java.lang.RuntimeException.<init>(RuntimeException.java:47)
>         at
>
java.lang.IllegalArgumentException.<init>(IllegalArgumentException.java:43)
>         at
> java.lang.NumberFormatException.<init>(NumberFormatException.java:43)
>         at java.lang.Integer.parseInt(Compiled Code)
>         at java.lang.Integer.parseInt(Compiled Code)
>         at
>
InlineJavaServer$InlineJavaProtocol.CallJavaMethod(InlineJavaServer.java:852
)
>         at
> InlineJavaServer$InlineJavaProtocol.Do(InlineJavaServer.java:695)
>         at InlineJavaServer.ProcessCommand(InlineJavaServer.java:62)
>         at InlineJavaServer.<init>(Compiled Code)
>         at InlineJavaServer.main(InlineJavaServer.java:115)
> Can't receive packet from JVM:  at
> /home/maria/perl/lib/perl5/site_perl/5.6.0/Inline/Java/Protocol.pm line
> 251
>  at a.pl line 9
> ======================
> Why?
> Bug?
> Thank you
>
> Masha
> _____________________________________________
> Maria Ananieva                               Software-Entwicklung
> uni-X Software AG
> Mindener Strasse 127                     49084 Osnabrueck
> Tel. +49-541- 71008-433                Fax +49-541-71008-99
> http://www.uni-X.com  [EMAIL PROTECTED]
>


Reply via email to