Re: Problem with Example "Client2"
Dan Glauser <[email protected]>
| Newsgroups | gmane.comp.java.openamf.user |
|---|---|
| Organization | Roundbox Media |
| Message-ID | <1100711636.20719.2765.camel@nano> |
Hello OpenAMF'ers,
Unlike Leif I am a Java developer. I took a look at the debug log to
see where the error is and then took a look at the OpenAMF code. I
believe the problem is OpenAMF is not correctly recognizing the the
right method to call.
Take a look at this log snipit:
17:36:58,703 ERROR [STDERR] [DEBUG] JavaServiceInvoker - -check supports
org.openamf.examples.Directory
17:36:58,703 ERROR [STDERR] [DEBUG] DefaultGateway - -Java: YES
17:36:58,703 ERROR [STDERR] [DEBUG] JavaServiceInvoker - -REQUESTED
methodName: getPeople
17:36:58,703 ERROR [STDERR] [DEBUG] RankedMethod - -comparing to
methodName: getPeople
17:36:58,703 ERROR [STDERR] [DEBUG] RankedMethod - -NAME_MATCHES
17:36:58,703 ERROR [STDERR] [DEBUG] RankedMethod - -NAME_CASE_MATCHES
17:36:58,703 ERROR [STDERR] [DEBUG] RankedMethod - -RANK: 60.0
17:36:58,703 ERROR [STDERR] [DEBUG] RankedMethod - -comparing to
methodName: getPeople
17:36:58,703 ERROR [STDERR] [DEBUG] RankedMethod - -NAME_MATCHES
17:36:58,703 ERROR [STDERR] [DEBUG] RankedMethod - -NAME_CASE_MATCHES
17:36:58,703 ERROR [STDERR] [DEBUG] RankedMethod - -RANK: 60.0
17:36:58,703 ERROR [STDERR] [DEBUG] RankedMethod - -comparing to
methodName: getPeople
17:36:58,703 ERROR [STDERR] [DEBUG] RankedMethod - -NAME_MATCHES
17:36:58,703 ERROR [STDERR] [DEBUG] RankedMethod - -NAME_CASE_MATCHES
17:36:58,703 ERROR [STDERR] [DEBUG] RankedMethod - -PARAM_COUNT_MATCHES
17:36:58,703 ERROR [STDERR] [DEBUG] OpenAMFUtils - -expected class: int
17:36:58,703 ERROR [STDERR] [DEBUG] OpenAMFUtils - -parameter class:
java.lang.String
17:36:58,703 ERROR [STDERR] [DEBUG] OpenAMFUtils - -Decoding parameter:
Bob to type: int
17:36:58,703 ERROR [STDERR] [INFO] NativeDecoder - -Converting
ActionScript string object to non-string Java object: Bob
--> int
17:36:58,703 ERROR [STDERR] [DEBUG] OpenAMFUtils - -caught exception
while decoding parameter <java.lang.NumberFormatExc
eption: Error converting encoded String object to a number:
Bob>java.lang.NumberFormatException: Error converting encode
d String object to a number: Bob
at
java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
at java.lang.Integer.parseInt(Integer.java:468)
at java.lang.Integer.valueOf(Integer.java:574)
It appears that the RankedMethod class is matching the wrong method.
And I think I know the problem. The method it is supposed to match
takes an int parameter and it appears that
OpenAMFUtils.typesMatch(Class, Object) will only handle classes like
Integer, Long, Double and not primitives.
I have done a little reflection experiment where I believe that doing a
comparison of Class.getName() on the parameters will work. For an int
Class.getName() returns "int", for an Integer it returns "Integer". If
anyone thinks that this is a bad approach or knows of a better way then
I would love to hear about it.
For now to make the example work for Leif's presentation I'm going to
change the example code to take in an Integer parameter instead of an
int. Over the weekend I hope to have time to try and figure out if this
is indeed a problem with OpenAMF, and if so fix it.
I'd love to hear what anyone thinks about this, especially the
maintainers.
Regards,
--
Dan Glauser
[email protected]
On Wed, 2004-11-17 at 11:15, Leif Wells wrote:
> Greetings,
>
> In preparing for a presentation of using Flash Remoting with OpenAMF,
> I located a bug in the current build openamf-1.0RC10.
>
> No, I don't have an error log, but it is really easy to create the problem:
>
> 1) Load up the "client2" example.
> 2) Click "Add Person" to add the default "Bob Monkeyman" person.
> 3) Click "Get with Name" with the default "Bob" in the text field and
> see the information. :-)
> 4) Add the zipcode 92109 to the field and click "Get with Zip", and
> see the information.
> 5) Re-enter "Bob" and click "Get with Name".
>
> Then you see the NullPointerException error.
>
> Since I am not (yet) a Java programmer, I do not know how to fix this.
> I don't think that it is in the ActionScript. I believe the problem is
> either in the Directory.java file or is a problem with OpenAMF.
>
> As I am going to be comparing the AS 1 code to the AS 2 code, I'd love
> to figure out what is wrong here.
>
> Thanks to you all.
>
> Leif Wells
> Manager, Atlanta Macromedia User Group
> Director of Multimedia Services, Roundbox Media
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by: InterSystems CACHE
> FREE OODBMS DOWNLOAD - A multidimensional database that combines
> robust object and relational technologies, making it a perfect match
> for Java, C++,COM, XML, ODBC and JDBC. www.intersystems.com/match8
> _______________________________________________
> Openamf-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/openamf-user