You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by to...@apache.org on 2005/02/14 10:10:04 UTC
cvs commit: ws-axis/java/src/org/apache/axis/client AdminClient.java
toshi 2005/02/14 01:10:04
Modified: java/src/org/apache/axis/client AdminClient.java
Log:
To support multi-language.
Revision Changes Path
1.86 +33 -1 ws-axis/java/src/org/apache/axis/client/AdminClient.java
Index: AdminClient.java
===================================================================
RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/client/AdminClient.java,v
retrieving revision 1.85
retrieving revision 1.86
diff -u -r1.85 -r1.86
--- AdminClient.java 23 Nov 2004 00:39:21 -0000 1.85
+++ AdminClient.java 14 Feb 2005 09:10:04 -0000 1.86
@@ -24,6 +24,7 @@
import org.apache.axis.utils.Messages;
import org.apache.axis.utils.Options;
import org.apache.commons.logging.Log;
+import org.apache.commons.lang.StringEscapeUtils;
import javax.xml.rpc.ServiceException;
import java.io.ByteArrayInputStream;
@@ -449,6 +450,37 @@
}
/**
+ * Unescape the specified String.
+ * @param message - to unescape String
+ * @return unescaped message
+ */
+ public String unescape(String message) {
+ StringBuffer buf = new StringBuffer();
+
+ int length = message.length();
+ char character;
+ for (int i = 0; i < length; i++) {
+ character = message.charAt( i );
+ if (character == '&') {
+ if (i+7 <= length)
+ if (message.charAt(i+1)=='#' && message.charAt(i+2)=='x' &&
+ message.charAt(i+7)==';') {
+ buf.append("\\u");
+ buf.append(message.charAt(i+3));
+ buf.append(message.charAt(i+4));
+ buf.append(message.charAt(i+5));
+ buf.append(message.charAt(i+6));
+ i+=7;
+ }
+ } else {
+ buf.append(character);
+ }
+ }
+
+ return StringEscapeUtils.unescapeJava(buf.toString());
+ }
+
+ /**
* Creates in instance of <code>AdminClient</code> and
* invokes <code>process(args)</code>.
* <p>Diagnostic output goes to <code>log.info</code>.</p>
@@ -461,7 +493,7 @@
String result = admin.process(args);
if (result != null) {
- System.out.println(result);
+ System.out.println( admin.unescape(result) );
} else {
System.exit(1);
}
Re: cvs commit: ws-axis/java/src/org/apache/axis/client AdminClient.java
Posted by Toshiyuki Kimura <to...@apache.org>.
dims, tom, glen and Ias,
My patch for 'AdminClinet' has a dependency to the encoding
issue. However, it seems that nobody can explain the meaning
of the existing code right now.
The following steps are acceptable to all of you ?
1. Cut-out 1.2 RC3 w/ the current codes
2. File an encoding bug (if there's no standard to follow)
3. (if it's a bug) Remove encoding as '' on 'UTF8Encoder'
4. (if it's a bug) Remove decoding on 'AdminClinet'
Thanks,
Toshi <to...@apache.org>
On Mon, 14 Feb 2005, Toshiyuki Kimura wrote:
> Hi Ias,
>
> Thank you very much for the rapid response !
>
>> I'm afraid not :-) Actually Jongjin raised the issue and I
>> answered it based on the existing code.
>
> It's wondering ... :)
>
> I can see what you want to point out in the thread though,
> I think that the existing code has a potential problem if
> the code is inadequately supported by any global standard.
> Do you know anything about this encoding (escaping) ?
>
> Thanks,
> Toshi <to...@apache.org>
>
> On Mon, 14 Feb 2005, Changshin Lee wrote:
>
>>> dims, and Ias,
>>>
>>> Hmm, you don't know the reason ...
>>>
>>> # changed from ws-axis-cvs to axis-dev
>>>
>>> In addition, the commit log doesn't tell me the contributor and
>>> the referred spec. It just says as follows;
>>>
>>> .........*.........*.........*.........*.........*.........*.........*
>>> Spent a few days with Purify and Quantify:
>>>
>>> Performance Related:
>>> - Ensure that serialization stuff is called only once and avoid
>>> String<->byte[] conversions.
>>> - File backed Byte Array for large messages
>>> - cleanup encoder to avoid byte<->string conversions.
>>> - use intern's in NSStack/Mapping to reduce new object creation
>>> and speed up compares.
>>>
>>> Others:
>>> - file extensions for temp files clean up
>>> - clean up encoding stuff (check message, then context, then the
>>> axis engine for which encoding to use)
>>> .........*.........*.........*.........*.........*.........*.........*
>>>
>>> However, I guess it might be from Ias ... Right ?
>>> <http://marc.theaimsgroup.com/?t=110423520200001&r=1&w=2>
>>
>> I'm afraid not :-) Actually Jongjin raised the issue and I answered it
>> based on the existing code.
>>
>> Cheers,
>>
>> Ias
>>>
>>> Thanks,
>>> Toshi
>>>
>>> On Mon, 14 Feb 2005, Davanum Srinivas wrote:
>>>
>>>> Please check the commit history...it was a patch from someone...
>>>>
>>>> -- dims
>>>>
>>>> On Mon, 14 Feb 2005 04:07:35 -0800 (PST), Toshiyuki Kimura
>>>> <to...@apache.org> wrote:
>>>>> dims,
>>>>>
>>>>> Thanks for the review and comments. :-)
>>>>>
>>>>> Yes, I can use a FilterOutputStream. Can I ask a question
>>>>> ahead of the modification ?
>>>>>
>>>>> You added "" style of encoding to UTF8Encoder.java
>>>>> looks like;
>>>>>
>>>>> writer.write("&#x");
>>>>> writer.write(Integer.toHexString(character).toUpperCase());
>>>>> writer.write(";");
>>>>>
>>>>> What kind of specification are you refering to do so ?
>>>>> Is it for a spec for Web Services, not for HTML(s) ?
>>>>>
>>>>> Thanks,
>>>>> Toshi <to...@apache.org>
>>>>>
>>>> --
>>>> Davanum Srinivas - http://webservices.apache.org/~dims/
>>>>
>>>
>>
>
Re: cvs commit: ws-axis/java/src/org/apache/axis/client AdminClient.java
Posted by Toshiyuki Kimura <to...@apache.org>.
Hi Ias,
Thank you very much for the rapid response !
> I'm afraid not :-) Actually Jongjin raised the issue and I
> answered it based on the existing code.
It's wondering ... :)
I can see what you want to point out in the thread though,
I think that the existing code has a potential problem if
the code is inadequately supported by any global standard.
Do you know anything about this encoding (escaping) ?
Thanks,
Toshi <to...@apache.org>
On Mon, 14 Feb 2005, Changshin Lee wrote:
>> dims, and Ias,
>>
>> Hmm, you don't know the reason ...
>>
>> # changed from ws-axis-cvs to axis-dev
>>
>> In addition, the commit log doesn't tell me the contributor and
>> the referred spec. It just says as follows;
>>
>> .........*.........*.........*.........*.........*.........*.........*
>> Spent a few days with Purify and Quantify:
>>
>> Performance Related:
>> - Ensure that serialization stuff is called only once and avoid
>> String<->byte[] conversions.
>> - File backed Byte Array for large messages
>> - cleanup encoder to avoid byte<->string conversions.
>> - use intern's in NSStack/Mapping to reduce new object creation
>> and speed up compares.
>>
>> Others:
>> - file extensions for temp files clean up
>> - clean up encoding stuff (check message, then context, then the
>> axis engine for which encoding to use)
>> .........*.........*.........*.........*.........*.........*.........*
>>
>> However, I guess it might be from Ias ... Right ?
>> <http://marc.theaimsgroup.com/?t=110423520200001&r=1&w=2>
>
> I'm afraid not :-) Actually Jongjin raised the issue and I answered it
> based on the existing code.
>
> Cheers,
>
> Ias
>>
>> Thanks,
>> Toshi
>>
>> On Mon, 14 Feb 2005, Davanum Srinivas wrote:
>>
>>> Please check the commit history...it was a patch from someone...
>>>
>>> -- dims
>>>
>>> On Mon, 14 Feb 2005 04:07:35 -0800 (PST), Toshiyuki Kimura
>>> <to...@apache.org> wrote:
>>>> dims,
>>>>
>>>> Thanks for the review and comments. :-)
>>>>
>>>> Yes, I can use a FilterOutputStream. Can I ask a question
>>>> ahead of the modification ?
>>>>
>>>> You added "" style of encoding to UTF8Encoder.java
>>>> looks like;
>>>>
>>>> writer.write("&#x");
>>>> writer.write(Integer.toHexString(character).toUpperCase());
>>>> writer.write(";");
>>>>
>>>> What kind of specification are you refering to do so ?
>>>> Is it for a spec for Web Services, not for HTML(s) ?
>>>>
>>>> Thanks,
>>>> Toshi <to...@apache.org>
>>>>
>>> --
>>> Davanum Srinivas - http://webservices.apache.org/~dims/
>>>
>>
>
Re: cvs commit: ws-axis/java/src/org/apache/axis/client AdminClient.java
Posted by Changshin Lee <ia...@gmail.com>.
> dims, and Ias,
>
> Hmm, you don't know the reason ...
>
> # changed from ws-axis-cvs to axis-dev
>
> In addition, the commit log doesn't tell me the contributor and
> the referred spec. It just says as follows;
>
> .........*.........*.........*.........*.........*.........*.........*
> Spent a few days with Purify and Quantify:
>
> Performance Related:
> - Ensure that serialization stuff is called only once and avoid
> String<->byte[] conversions.
> - File backed Byte Array for large messages
> - cleanup encoder to avoid byte<->string conversions.
> - use intern's in NSStack/Mapping to reduce new object creation
> and speed up compares.
>
> Others:
> - file extensions for temp files clean up
> - clean up encoding stuff (check message, then context, then the
> axis engine for which encoding to use)
> .........*.........*.........*.........*.........*.........*.........*
>
> However, I guess it might be from Ias ... Right ?
> <http://marc.theaimsgroup.com/?t=110423520200001&r=1&w=2>
I'm afraid not :-) Actually Jongjin raised the issue and I answered it
based on the existing code.
Cheers,
Ias
>
> Thanks,
> Toshi
>
> On Mon, 14 Feb 2005, Davanum Srinivas wrote:
>
> > Please check the commit history...it was a patch from someone...
> >
> > -- dims
> >
> > On Mon, 14 Feb 2005 04:07:35 -0800 (PST), Toshiyuki Kimura
> > <to...@apache.org> wrote:
> >> dims,
> >>
> >> Thanks for the review and comments. :-)
> >>
> >> Yes, I can use a FilterOutputStream. Can I ask a question
> >> ahead of the modification ?
> >>
> >> You added "" style of encoding to UTF8Encoder.java
> >> looks like;
> >>
> >> writer.write("&#x");
> >> writer.write(Integer.toHexString(character).toUpperCase());
> >> writer.write(";");
> >>
> >> What kind of specification are you refering to do so ?
> >> Is it for a spec for Web Services, not for HTML(s) ?
> >>
> >> Thanks,
> >> Toshi <to...@apache.org>
> >>
> > --
> > Davanum Srinivas - http://webservices.apache.org/~dims/
> >
>
Re: cvs commit: ws-axis/java/src/org/apache/axis/client AdminClient.java
Posted by Toshiyuki Kimura <to...@apache.org>.
dims, and Ias,
Hmm, you don't know the reason ...
# changed from ws-axis-cvs to axis-dev
In addition, the commit log doesn't tell me the contributor and
the referred spec. It just says as follows;
.........*.........*.........*.........*.........*.........*.........*
Spent a few days with Purify and Quantify:
Performance Related:
- Ensure that serialization stuff is called only once and avoid
String<->byte[] conversions.
- File backed Byte Array for large messages
- cleanup encoder to avoid byte<->string conversions.
- use intern's in NSStack/Mapping to reduce new object creation
and speed up compares.
Others:
- file extensions for temp files clean up
- clean up encoding stuff (check message, then context, then the
axis engine for which encoding to use)
.........*.........*.........*.........*.........*.........*.........*
However, I guess it might be from Ias ... Right ?
<http://marc.theaimsgroup.com/?t=110423520200001&r=1&w=2>
Thanks,
Toshi
On Mon, 14 Feb 2005, Davanum Srinivas wrote:
> Please check the commit history...it was a patch from someone...
>
> -- dims
>
> On Mon, 14 Feb 2005 04:07:35 -0800 (PST), Toshiyuki Kimura
> <to...@apache.org> wrote:
>> dims,
>>
>> Thanks for the review and comments. :-)
>>
>> Yes, I can use a FilterOutputStream. Can I ask a question
>> ahead of the modification ?
>>
>> You added "" style of encoding to UTF8Encoder.java
>> looks like;
>>
>> writer.write("&#x");
>> writer.write(Integer.toHexString(character).toUpperCase());
>> writer.write(";");
>>
>> What kind of specification are you refering to do so ?
>> Is it for a spec for Web Services, not for HTML(s) ?
>>
>> Thanks,
>> Toshi <to...@apache.org>
>>
> --
> Davanum Srinivas - http://webservices.apache.org/~dims/
>
Re: cvs commit: ws-axis/java/src/org/apache/axis/client AdminClient.java
Posted by Davanum Srinivas <da...@gmail.com>.
Please check the commit history...it was a patch from someone...
-- dims
On Mon, 14 Feb 2005 04:07:35 -0800 (PST), Toshiyuki Kimura
<to...@apache.org> wrote:
> dims,
>
> Thanks for the review and comments. :-)
>
> Yes, I can use a FilterOutputStream. Can I ask a question
> ahead of the modification ?
>
> You added "" style of encoding to UTF8Encoder.java
> looks like;
>
> writer.write("&#x");
> writer.write(Integer.toHexString(character).toUpperCase());
> writer.write(";");
>
> What kind of specification are you refering to do so ?
> Is it for a spec for Web Services, not for HTML(s) ?
>
> Thanks,
> Toshi <to...@apache.org>
>
--
Davanum Srinivas - http://webservices.apache.org/~dims/
Re: cvs commit: ws-axis/java/src/org/apache/axis/client AdminClient.java
Posted by Davanum Srinivas <da...@gmail.com>.
Please check the commit history...it was a patch from someone...
-- dims
On Mon, 14 Feb 2005 04:07:35 -0800 (PST), Toshiyuki Kimura
<to...@apache.org> wrote:
> dims,
>
> Thanks for the review and comments. :-)
>
> Yes, I can use a FilterOutputStream. Can I ask a question
> ahead of the modification ?
>
> You added "" style of encoding to UTF8Encoder.java
> looks like;
>
> writer.write("&#x");
> writer.write(Integer.toHexString(character).toUpperCase());
> writer.write(";");
>
> What kind of specification are you refering to do so ?
> Is it for a spec for Web Services, not for HTML(s) ?
>
> Thanks,
> Toshi <to...@apache.org>
>
--
Davanum Srinivas - http://webservices.apache.org/~dims/
Re: cvs commit: ws-axis/java/src/org/apache/axis/client AdminClient.java
Posted by Toshiyuki Kimura <to...@apache.org>.
dims,
Thanks for the review and comments. :-)
Yes, I can use a FilterOutputStream. Can I ask a question
ahead of the modification ?
You added "" style of encoding to UTF8Encoder.java
looks like;
writer.write("&#x");
writer.write(Integer.toHexString(character).toUpperCase());
writer.write(";");
What kind of specification are you refering to do so ?
Is it for a spec for Web Services, not for HTML(s) ?
Thanks,
Toshi <to...@apache.org>
Re: cvs commit: ws-axis/java/src/org/apache/axis/client AdminClient.java
Posted by Toshiyuki Kimura <to...@apache.org>.
dims,
Thanks for the review and comments. :-)
Yes, I can use a FilterOutputStream. Can I ask a question
ahead of the modification ?
You added "" style of encoding to UTF8Encoder.java
looks like;
writer.write("&#x");
writer.write(Integer.toHexString(character).toUpperCase());
writer.write(";");
What kind of specification are you refering to do so ?
Is it for a spec for Web Services, not for HTML(s) ?
Thanks,
Toshi <to...@apache.org>
Re: cvs commit: ws-axis/java/src/org/apache/axis/client AdminClient.java
Posted by Davanum Srinivas <da...@gmail.com>.
Hehe...looks like a hack :) Can u try using a FilterOutputStream? that
at least avoids exposing the ugliness too much :) :)
-- dims
On Mon, 14 Feb 2005 01:10:08 -0800 (PST), toshi@apache.org
<to...@apache.org> wrote:
> toshi 2005/02/14 01:10:04
>
> Modified: java/src/org/apache/axis/client AdminClient.java
> Log:
> To support multi-language.
>
> Revision Changes Path
> 1.86 +33 -1 ws-axis/java/src/org/apache/axis/client/AdminClient.java
>
> Index: AdminClient.java
> ===================================================================
> RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/client/AdminClient.java,v
> retrieving revision 1.85
> retrieving revision 1.86
> diff -u -r1.85 -r1.86
> --- AdminClient.java 23 Nov 2004 00:39:21 -0000 1.85
> +++ AdminClient.java 14 Feb 2005 09:10:04 -0000 1.86
> @@ -24,6 +24,7 @@
> import org.apache.axis.utils.Messages;
> import org.apache.axis.utils.Options;
> import org.apache.commons.logging.Log;
> +import org.apache.commons.lang.StringEscapeUtils;
>
> import javax.xml.rpc.ServiceException;
> import java.io.ByteArrayInputStream;
> @@ -449,6 +450,37 @@
> }
>
> /**
> + * Unescape the specified String.
> + * @param message - to unescape String
> + * @return unescaped message
> + */
> + public String unescape(String message) {
> + StringBuffer buf = new StringBuffer();
> +
> + int length = message.length();
> + char character;
> + for (int i = 0; i < length; i++) {
> + character = message.charAt( i );
> + if (character == '&') {
> + if (i+7 <= length)
> + if (message.charAt(i+1)=='#' && message.charAt(i+2)=='x' &&
> + message.charAt(i+7)==';') {
> + buf.append("\\u");
> + buf.append(message.charAt(i+3));
> + buf.append(message.charAt(i+4));
> + buf.append(message.charAt(i+5));
> + buf.append(message.charAt(i+6));
> + i+=7;
> + }
> + } else {
> + buf.append(character);
> + }
> + }
> +
> + return StringEscapeUtils.unescapeJava(buf.toString());
> + }
> +
> + /**
> * Creates in instance of <code>AdminClient</code> and
> * invokes <code>process(args)</code>.
> * <p>Diagnostic output goes to <code>log.info</code>.</p>
> @@ -461,7 +493,7 @@
>
> String result = admin.process(args);
> if (result != null) {
> - System.out.println(result);
> + System.out.println( admin.unescape(result) );
> } else {
> System.exit(1);
> }
>
>
--
Davanum Srinivas - http://webservices.apache.org/~dims/
Re: cvs commit: ws-axis/java/src/org/apache/axis/client AdminClient.java
Posted by Davanum Srinivas <da...@gmail.com>.
Hehe...looks like a hack :) Can u try using a FilterOutputStream? that
at least avoids exposing the ugliness too much :) :)
-- dims
On Mon, 14 Feb 2005 01:10:08 -0800 (PST), toshi@apache.org
<to...@apache.org> wrote:
> toshi 2005/02/14 01:10:04
>
> Modified: java/src/org/apache/axis/client AdminClient.java
> Log:
> To support multi-language.
>
> Revision Changes Path
> 1.86 +33 -1 ws-axis/java/src/org/apache/axis/client/AdminClient.java
>
> Index: AdminClient.java
> ===================================================================
> RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/client/AdminClient.java,v
> retrieving revision 1.85
> retrieving revision 1.86
> diff -u -r1.85 -r1.86
> --- AdminClient.java 23 Nov 2004 00:39:21 -0000 1.85
> +++ AdminClient.java 14 Feb 2005 09:10:04 -0000 1.86
> @@ -24,6 +24,7 @@
> import org.apache.axis.utils.Messages;
> import org.apache.axis.utils.Options;
> import org.apache.commons.logging.Log;
> +import org.apache.commons.lang.StringEscapeUtils;
>
> import javax.xml.rpc.ServiceException;
> import java.io.ByteArrayInputStream;
> @@ -449,6 +450,37 @@
> }
>
> /**
> + * Unescape the specified String.
> + * @param message - to unescape String
> + * @return unescaped message
> + */
> + public String unescape(String message) {
> + StringBuffer buf = new StringBuffer();
> +
> + int length = message.length();
> + char character;
> + for (int i = 0; i < length; i++) {
> + character = message.charAt( i );
> + if (character == '&') {
> + if (i+7 <= length)
> + if (message.charAt(i+1)=='#' && message.charAt(i+2)=='x' &&
> + message.charAt(i+7)==';') {
> + buf.append("\\u");
> + buf.append(message.charAt(i+3));
> + buf.append(message.charAt(i+4));
> + buf.append(message.charAt(i+5));
> + buf.append(message.charAt(i+6));
> + i+=7;
> + }
> + } else {
> + buf.append(character);
> + }
> + }
> +
> + return StringEscapeUtils.unescapeJava(buf.toString());
> + }
> +
> + /**
> * Creates in instance of <code>AdminClient</code> and
> * invokes <code>process(args)</code>.
> * <p>Diagnostic output goes to <code>log.info</code>.</p>
> @@ -461,7 +493,7 @@
>
> String result = admin.process(args);
> if (result != null) {
> - System.out.println(result);
> + System.out.println( admin.unescape(result) );
> } else {
> System.exit(1);
> }
>
>
--
Davanum Srinivas - http://webservices.apache.org/~dims/