You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Alicia Sánchez-Mora <al...@gmail.com> on 2007/02/14 11:43:59 UTC

Inicialization of an UnsignedByte variable

  Hi,

I want to assign a value to a variable of type UnsignedByte. In
the  function it looks like this:

public String function (){

  final UnsignedByte ptr =new UnsignedByte() ;
  final Base64 blob = new Base64 (ptr, 10, "id","type","options"*);
  ...
}

I want the "ptr" variable to have a value other than empty. The constructor
of UnsignedByte is defined as public UnsignedByte(java.lang.String sValue)
When I initialized ptr with  final

UnsignedByte ptr = new UnsignedByte("abc");

the result was  that tomcat got hung up and throws a NumberFormatException.
This is because a string can not be converted to a long. So what is the
appropriate way…

Thanks in advance,

Alicia

Re: Inicialization of an UnsignedByte variable

Posted by David Delbecq <de...@oma.be>.
En l'instant précis du 02/15/07 13:23, Alicia Sánchez-Mora s'exprimait
en ces termes:
>
>
> What happens here is that you cannot convert a string to long and this
> cause tomcat to throw a NumberFormatException. 
No, tomcat does not throw a NumberFormatException, The library does it
and you do not catch it in your code.
> This is why I created a
> custom UnsignedByte class as I already wrote. So my question is still
> why in
> the server side (tomcat is running) the blob length is cero?
Probably because "this is a test" could not be converted to anything
meaningfull and finished as '0' ?

You have a service that seems to expects an 'Unsigned Byte', you are
putting great efforts to provide it with a random non numeric String
instead of an number in correct range, and then you are wondering why it
does not work?!? This is a nonsense.

>
>
>
> On 2/15/07, David Delbecq <de...@oma.be> wrote:
>>
>> En l'instant précis du 02/15/07 13:10, Alicia Sánchez-Mora s'exprimait
>> en ces termes:
>> > Hello again,
>>
>> > final UnsignedByte ptr = new  UnsignedByte("this is a test") ;
>>
>> "this is a test" <-- How do you expect any implementation of anything to
>> convert this string to a number????
>>
>>
>> ---------------------------------------------------------------------
>> To start a new topic, e-mail: users@tomcat.apache.org
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
>


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Inicialization of an UnsignedByte variable

Posted by Alicia Sánchez-Mora <al...@gmail.com>.
This is the contrctor:
*UnsignedByte*<http://ws.apache.org/axis/java/apiDocs/org/apache/axis/types/UnsignedByte.html#UnsignedByte(java.lang.String)>
(java.lang.String sValue)

of course, if you do some research on this and I found that internally when
you pass  a string as parameter to the constructor, the class will try to
set this value to a value of type long. The following UnsignedByte class
snippet shows this issue:
public UnsignedByte <javascript:searchRef('UnsignedByte')>(String
javascript:searchRef('String')> sValue
javascript:searchRef('sValue')>) throws NumberFormatException
javascript:searchRef('NumberFormatException')> { setValue
javascript:searchRef('setValue')>(Long
javascript:searchRef('Long')>.parseLong
javascript:searchRef('parseLong')>(sValue
javascript:searchRef('sValue')>)); }

What happens here is that you cannot convert a string to long and this
cause tomcat to throw a NumberFormatException. This is why I created a
custom UnsignedByte class as I already wrote. So my question is still why in
the server side (tomcat is running) the blob length is cero?



On 2/15/07, David Delbecq <de...@oma.be> wrote:
>
> En l'instant précis du 02/15/07 13:10, Alicia Sánchez-Mora s'exprimait
> en ces termes:
> > Hello again,
>
> > final UnsignedByte ptr = new  UnsignedByte("this is a test") ;
>
> "this is a test" <-- How do you expect any implementation of anything to
> convert this string to a number????
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: Inicialization of an UnsignedByte variable

Posted by David Delbecq <de...@oma.be>.
En l'instant précis du 02/15/07 13:10, Alicia Sánchez-Mora s'exprimait
en ces termes:
> Hello again,

> final UnsignedByte ptr = new  UnsignedByte("this is a test") ;

"this is a test" <-- How do you expect any implementation of anything to
convert this string to a number????


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Inicialization of an UnsignedByte variable

Posted by Alicia Sánchez-Mora <al...@gmail.com>.
 Hello again,

ok, maybe I am not in the appropiate mailing list, but maybe you have a
clue. I have exposed my problem in other mailing lists, the axis one, but I
got no answer. I tried waht you propoused but nothing works. I explain here
my problem in more detail and maybe you can help me.

I have a Java client that has to call some services implemented in C++. For
my alication I use axis/tomcat, for the C++ services gsoap is used. The
method in Java is implemented as follows:

*public* String reqAuthI1 (String src, String dst, RegOpts opts){
final int puzzle = 10;
final int signblob = 1;
final int result = 1;
*final* UnsignedByte ptr = *new*  UnsignedByte("this is a test") ;
*final* Base64  blob = *new* Base64 (ptr, 10, *"id"*, *"type"*, *"options"*
);

Sde_ServiceLocator sdeservice = *new* Sde_ServiceLocator();
sdeservice.setsdeEndpointAddress(*"http://127.0.0.1:7700"*);
Sde_cmd_executor executor = sdeservice.getsde();
String result_respAuthI1 = executor.respAuthI1(src, dst, puzzle, blob,
signblob, result);

*return* dummy_result;

}


The UnsignedByte class is within this package org.apache.axis.types. As you
can see I can pass to the constructor a String or a Long. If I pass a String
tomcat trows a NumberFromatException. So what I did was to create a custom
class UnsignedByte in yhis way

public class UnsignedByte{

private String str;
public UnsignedByte (String str){
this.str = str;
}

}


Now, the problem is that when I call the function respAuthI1,  in the server
side the blob length is cero. I do not have a clue where the problem comes
from. IAny idea?

Thanks in advance



On 2/14/07, Christopher Schultz <ch...@christopherschultz.net> wrote:
>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> David,
>
> David Delbecq wrote:
> > Well, your question should probably go to appropriate mailing list. I
> > don't know what libraries your found your UnsignedByte Object in, but
> > it's that library's mailing list which is appropriate for your question.
> >
> > Not knowing anything about your library, i'll dare to guess that "abc"
> > is not in the range of 'unsigned byte' which typically is [0,255]
>
> Yeah. If you are trying to convert 0xabc into a single unsigned byte, it
> just ain't gonna fit. That's two bytes right there, buddy.
>
> - -chris
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.6 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iD8DBQFF00gg9CaO5/Lv0PARAgAyAJkB1qA4bvAF1W5rhklltLGdrIVR/QCcCF2L
> /ulsy2Sk4lK28t4l5zcnz0o=
> =0b8S
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: Inicialization of an UnsignedByte variable

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

David,

David Delbecq wrote:
> Well, your question should probably go to appropriate mailing list. I
> don't know what libraries your found your UnsignedByte Object in, but
> it's that library's mailing list which is appropriate for your question.
> 
> Not knowing anything about your library, i'll dare to guess that "abc"
> is not in the range of 'unsigned byte' which typically is [0,255]

Yeah. If you are trying to convert 0xabc into a single unsigned byte, it
just ain't gonna fit. That's two bytes right there, buddy.

- -chris

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFF00gg9CaO5/Lv0PARAgAyAJkB1qA4bvAF1W5rhklltLGdrIVR/QCcCF2L
/ulsy2Sk4lK28t4l5zcnz0o=
=0b8S
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Inicialization of an UnsignedByte variable

Posted by David Delbecq <de...@oma.be>.
Well, your question should probably go to appropriate mailing list. I
don't know what libraries your found your UnsignedByte Object in, but
it's that l'ibrary's mailing list which is appropriate for your question.

Not knowing anything about your library, i'll dare to guess that "abc"
is not in the range of 'unsigned byte' which typically is [0,255]

En l'instant précis du 02/14/07 11:43, Alicia Sánchez-Mora s'exprimait
en ces termes:
>  Hi,
>
> I want to assign a value to a variable of type UnsignedByte. In
> the  function it looks like this:
>
> public String function (){
>
>  final UnsignedByte ptr =new UnsignedByte() ;
>  final Base64 blob = new Base64 (ptr, 10, "id","type","options"*);
>  ...
> }
>
> I want the "ptr" variable to have a value other than empty. The
> constructor
> of UnsignedByte is defined as public UnsignedByte(java.lang.String
> sValue)
> When I initialized ptr with  final
>
> UnsignedByte ptr = new UnsignedByte("abc");
>
> the result was  that tomcat got hung up and throws a
> NumberFormatException.
> This is because a string can not be converted to a long. So what is the
> appropriate way…
>
> Thanks in advance,
>
> Alicia
>


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org