Type casting problem with Java Class (bean)

[nobr]I have a simple Java class that I registered with the asp server as a COM used to process credit cards. There is a STRING variable in the class called Amount which, as the name indicates, will contain the dollar value of the transaction.

The problem is that no matter how I try to coerce a value like 45.99 into a string, I receive a Type mismatch error:

Error Type:

Sun ONE ASP VBScript runtime (0x800A000D)

Type mismatch

If I set the value using something like "45.99.56" or "three" (i.e. an obvious string), it works fine in terms of setting the variable.

Here are the code snippets:

<%@LANGUAGE="VBSCRIPT" %>

<%

Dim Authctl

Dim myamount

Dim mytype

Dim objprop

myamount = CStr("55.34")

mytype = TypeName(myamount)

Response.Write"myamount = " & myamount &"<br />mytype = " & mytype &"<br />"

Set Authctl = Server.CreateObject("MyBean.Processor")

With Authctl

.ResetValues

.SrvrIPName ="127.0.0.1"

.CardType ="V"

.TranType ="AU"

.Amount ="45.99.65"

Response.Write .SrvrIPName &"<br />" & .CardType &"<br />" & .TranType &"<br />" & .Amount &"<br />

End With

Set Authctl = Nothing

Response.End

%>

The above produces the following on output:

myamount = 55.34

mytype = String

127.0.0.1

V

AU

45.99.65

Now if I change the above code to substitue the variable myamount for the "45.99.65" :

<%@LANGUAGE="VBSCRIPT" %>

<%

Dim Authctl

Dim myamount

Dim mytype

Dim objprop

myamount = CStr("55.34")

mytype = TypeName(myamount)

Response.Write"myamount = " & myamount &"<br />mytype = " & mytype &"<br />"

Set Authctl = Server.CreateObject("MyBean.Processor")

With Authctl

.ResetValues

.SrvrIPName ="127.0.0.1"

.CardType ="V"

.TranType ="AU"

.Amount = myamount

Response.Write .SrvrIPName &"<br />" & .CardType &"<br />" & .TranType &"<br />" & .Amount &"<br />

End With

Set Authctl = Nothing

Response.End

%>

I get the Type mismatch error.

I looked for any known bugs about type coercion and java but came up empty-handed so far. The odd thing is that if I restart the casp server, the error does not happen until I call the page a couple times; after that, it bails with the Type mismatch error. I have tried to include a Session.Abandon command in the script so as to create a new session each time I invoke the page, but that does nothing.

It's as if after a few calls to the page, the CStr function fails to work when it calls the Java Class and passes the double instead.[/nobr]

[3618 byte] By [Svenw] at [2007-11-26 8:01:56]
# 1

Where can I file a bug report? I am assuming this is a bug in the asp as there is no real rocket science going on here.

My java class basically declares my variables in the standard way:

public String ZIPcode;

now when I try to assign a value to that property in my asp code:

myObject.ZIPCode = "55555"

or alternatively

myZip = CStr("55555")

myObject.ZIPCode = myzip

I end up with Type mismatch errors. If I assign it something that is more "obviously" a string:

myObject.ZIPCode = "55555-0000"

It works perfectly fine. So why is the java parser(?) completely ignoring the casting done by the asp server or why is the asp server failing to send the correct datatype to the java class?

Bottom line is that it is completely unusable in its current form and I would like to file a bug report.

Svenw at 2007-7-6 20:33:57 > top of Java-index,Web & Directory Servers,Web Servers...