You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ws.apache.org by "Masaki Nishikawa (JIRA)" <ji...@apache.org> on 2012/08/01 09:31:33 UTC

[jira] [Created] (AXIOM-438) StringIndexOutOfBoundsException occur on rare occasions is when you create a stub object

Masaki Nishikawa created AXIOM-438:
--------------------------------------

             Summary: StringIndexOutOfBoundsException occur on rare occasions is when you create a stub object
                 Key: AXIOM-438
                 URL: https://issues.apache.org/jira/browse/AXIOM-438
             Project: Axiom
          Issue Type: Bug
          Components: API
    Affects Versions: 1.2.10
         Environment: Linux
            Reporter: Masaki Nishikawa
            Priority: Trivial


(Google Translated)
There is a problem with the logic of UUIDGenerator.getInitialUUID, is rare, can occur when generating the object of the stub is StringIndexOutOfBoundsException.
The cause is because the next "1" s number, places such as "01" when over a string of numeric Integer.toHexString will decrease.
What are you handling this like why, I do not understand, what the problem be solved by simply zero-fill?
We appreciate if you fix this bug.

【The appropriate program】

public class UUIDGenerator {
	/* Omitted */
    protected static String getInitialUUID() {
        if (myRand == null) {
            myRand = new Random();
        }
        long rand = myRand.nextLong();
        String sid;
        try {
            sid = InetAddress.getLocalHost().toString();
        } catch (UnknownHostException e) {
            sid = Thread.currentThread().getName();
        }
        StringBuffer sb = new StringBuffer();
        sb.append(sid);
        sb.append(":");
        sb.append(Long.toString(rand));
        MessageDigest md5 = null;
        try {
            md5 = MessageDigest.getInstance("MD5");
        } catch (NoSuchAlgorithmException e) {
            throw new OMException(e);
        }
        md5.update(sb.toString().getBytes());
        byte[] array = md5.digest();
        StringBuffer sb2 = new StringBuffer();
        for (int j = 0; j < array.length; ++j) {
            int b = array[j] & 0xFF;
            sb2.append(Integer.toHexString(b)); // The problem here! Is a string of "1" the number "01" is Integer.toHexString, reduce the number of digits is
        }
        int begin = myRand.nextInt();
        if (begin < 0) begin = begin * -1;
        begin = begin % 8;
        return sb2.toString().substring(begin, begin + 18).toUpperCase(); // Is raised here StringIndexOutofBoundsException
    }

    /* Omitted */
}

【Error Trace】

java.lang.StringIndexOutOfBoundsException: String index out of range: 25
	at java.lang.String.substring(Unknown Source)
	at org.apache.axiom.om.util.UUIDGenerator.getInitialUUID(UUIDGenerator.java:94)
	at org.apache.axiom.om.util.UUIDGenerator.getUUID(UUIDGenerator.java:54)
	at org.apache.axis2.description.AxisOperation.<init>(AxisOperation.java:90)
	at org.apache.axis2.description.AxisOperation.<init>(AxisOperation.java:95)
	at org.apache.axis2.description.TwoChannelAxisOperation.<init>(TwoChannelAxisOperation.java:52)
	at org.apache.axis2.description.OutInAxisOperation.<init>(OutInAxisOperation.java:65)
	at org.apache.axis2.description.RobustOutOnlyAxisOperation.<init>(RobustOutOnlyAxisOperation.java:47)
	at org.apache.axis2.client.Stub.addAnonymousOperations(Stub.java:233)
	


(原文)

UUIDGenerator.getInitialUUIDのロジックに問題があり、ごく稀にですが、スタブのオブジェクト生成時にStringIndexOutOfBoundsExceptionが発生します。
原因はInteger.toHexStringで数値を文字列化する際に"01"のような数値だと"1"となり、桁数が減ってしまうためです。
なぜこのような処理をしているのか、理解できていないのですが、単純に0埋めすれば解決する問題でしょうか?
このバグを修正していただけると幸いです。


【該当プログラム】

public class UUIDGenerator {
	/* 省略 */
    protected static String getInitialUUID() {
        if (myRand == null) {
            myRand = new Random();
        }
        long rand = myRand.nextLong();
        String sid;
        try {
            sid = InetAddress.getLocalHost().toString();
        } catch (UnknownHostException e) {
            sid = Thread.currentThread().getName();
        }
        StringBuffer sb = new StringBuffer();
        sb.append(sid);
        sb.append(":");
        sb.append(Long.toString(rand));
        MessageDigest md5 = null;
        try {
            md5 = MessageDigest.getInstance("MD5");
        } catch (NoSuchAlgorithmException e) {
            throw new OMException(e);
        }
        md5.update(sb.toString().getBytes());
        byte[] array = md5.digest();
        StringBuffer sb2 = new StringBuffer();
        for (int j = 0; j < array.length; ++j) {
            int b = array[j] & 0xFF;
            sb2.append(Integer.toHexString(b)); // ここが問題!Integer.toHexStringで"01"の数値が"1"の文字列になり、桁数が減る
        }
        int begin = myRand.nextInt();
        if (begin < 0) begin = begin * -1;
        begin = begin % 8;
        return sb2.toString().substring(begin, begin + 18).toUpperCase(); // ここでStringIndexOutofBoundsExceptionが発生
    }

    /* 省略 */
}


【トレース内容】

java.lang.StringIndexOutOfBoundsException: String index out of range: 25
	at java.lang.String.substring(Unknown Source)
	at org.apache.axiom.om.util.UUIDGenerator.getInitialUUID(UUIDGenerator.java:94)
	at org.apache.axiom.om.util.UUIDGenerator.getUUID(UUIDGenerator.java:54)
	at org.apache.axis2.description.AxisOperation.<init>(AxisOperation.java:90)
	at org.apache.axis2.description.AxisOperation.<init>(AxisOperation.java:95)
	at org.apache.axis2.description.TwoChannelAxisOperation.<init>(TwoChannelAxisOperation.java:52)
	at org.apache.axis2.description.OutInAxisOperation.<init>(OutInAxisOperation.java:65)
	at org.apache.axis2.description.RobustOutOnlyAxisOperation.<init>(RobustOutOnlyAxisOperation.java:47)
	at org.apache.axis2.client.Stub.addAnonymousOperations(Stub.java:233)
	


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ws.apache.org
For additional commands, e-mail: dev-help@ws.apache.org


[jira] [Commented] (AXIOM-438) StringIndexOutOfBoundsException occur on rare occasions is when you create a stub object

Posted by "Masaki Nishikawa (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AXIOM-438?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13427787#comment-13427787 ] 

Masaki Nishikawa commented on AXIOM-438:
----------------------------------------

Thank you for answer
 At the contents of the comment is OK.
                
> StringIndexOutOfBoundsException occur on rare occasions is when you create a stub object
> ----------------------------------------------------------------------------------------
>
>                 Key: AXIOM-438
>                 URL: https://issues.apache.org/jira/browse/AXIOM-438
>             Project: Axiom
>          Issue Type: Bug
>          Components: API
>    Affects Versions: 1.2.10
>         Environment: Linux
>            Reporter: Masaki Nishikawa
>            Priority: Trivial
>
> (Google Translated)
> There is a problem with the logic of UUIDGenerator.getInitialUUID, is rare, can occur when generating the object of the stub is StringIndexOutOfBoundsException.
> The cause is because the next "1" s number, places such as "01" when over a string of numeric Integer.toHexString will decrease.
> What are you handling this like why, I do not understand, what the problem be solved by simply zero-fill?
> We appreciate if you fix this bug.
> 【The appropriate program】
> public class UUIDGenerator {
> 	/* Omitted */
>     protected static String getInitialUUID() {
>         if (myRand == null) {
>             myRand = new Random();
>         }
>         long rand = myRand.nextLong();
>         String sid;
>         try {
>             sid = InetAddress.getLocalHost().toString();
>         } catch (UnknownHostException e) {
>             sid = Thread.currentThread().getName();
>         }
>         StringBuffer sb = new StringBuffer();
>         sb.append(sid);
>         sb.append(":");
>         sb.append(Long.toString(rand));
>         MessageDigest md5 = null;
>         try {
>             md5 = MessageDigest.getInstance("MD5");
>         } catch (NoSuchAlgorithmException e) {
>             throw new OMException(e);
>         }
>         md5.update(sb.toString().getBytes());
>         byte[] array = md5.digest();
>         StringBuffer sb2 = new StringBuffer();
>         for (int j = 0; j < array.length; ++j) {
>             int b = array[j] & 0xFF;
>             sb2.append(Integer.toHexString(b)); // The problem here! Is a string of "1" the number "01" is Integer.toHexString, reduce the number of digits is
>         }
>         int begin = myRand.nextInt();
>         if (begin < 0) begin = begin * -1;
>         begin = begin % 8;
>         return sb2.toString().substring(begin, begin + 18).toUpperCase(); // Is raised here StringIndexOutofBoundsException
>     }
>     /* Omitted */
> }
> 【Error Trace】
> java.lang.StringIndexOutOfBoundsException: String index out of range: 25
> 	at java.lang.String.substring(Unknown Source)
> 	at org.apache.axiom.om.util.UUIDGenerator.getInitialUUID(UUIDGenerator.java:94)
> 	at org.apache.axiom.om.util.UUIDGenerator.getUUID(UUIDGenerator.java:54)
> 	at org.apache.axis2.description.AxisOperation.<init>(AxisOperation.java:90)
> 	at org.apache.axis2.description.AxisOperation.<init>(AxisOperation.java:95)
> 	at org.apache.axis2.description.TwoChannelAxisOperation.<init>(TwoChannelAxisOperation.java:52)
> 	at org.apache.axis2.description.OutInAxisOperation.<init>(OutInAxisOperation.java:65)
> 	at org.apache.axis2.description.RobustOutOnlyAxisOperation.<init>(RobustOutOnlyAxisOperation.java:47)
> 	at org.apache.axis2.client.Stub.addAnonymousOperations(Stub.java:233)
> 	
> (原文)
> UUIDGenerator.getInitialUUIDのロジックに問題があり、ごく稀にですが、スタブのオブジェクト生成時にStringIndexOutOfBoundsExceptionが発生します。
> 原因はInteger.toHexStringで数値を文字列化する際に"01"のような数値だと"1"となり、桁数が減ってしまうためです。
> なぜこのような処理をしているのか、理解できていないのですが、単純に0埋めすれば解決する問題でしょうか?
> このバグを修正していただけると幸いです。
> 【該当プログラム】
> public class UUIDGenerator {
> 	/* 省略 */
>     protected static String getInitialUUID() {
>         if (myRand == null) {
>             myRand = new Random();
>         }
>         long rand = myRand.nextLong();
>         String sid;
>         try {
>             sid = InetAddress.getLocalHost().toString();
>         } catch (UnknownHostException e) {
>             sid = Thread.currentThread().getName();
>         }
>         StringBuffer sb = new StringBuffer();
>         sb.append(sid);
>         sb.append(":");
>         sb.append(Long.toString(rand));
>         MessageDigest md5 = null;
>         try {
>             md5 = MessageDigest.getInstance("MD5");
>         } catch (NoSuchAlgorithmException e) {
>             throw new OMException(e);
>         }
>         md5.update(sb.toString().getBytes());
>         byte[] array = md5.digest();
>         StringBuffer sb2 = new StringBuffer();
>         for (int j = 0; j < array.length; ++j) {
>             int b = array[j] & 0xFF;
>             sb2.append(Integer.toHexString(b)); // ここが問題!Integer.toHexStringで"01"の数値が"1"の文字列になり、桁数が減る
>         }
>         int begin = myRand.nextInt();
>         if (begin < 0) begin = begin * -1;
>         begin = begin % 8;
>         return sb2.toString().substring(begin, begin + 18).toUpperCase(); // ここでStringIndexOutofBoundsExceptionが発生
>     }
>     /* 省略 */
> }
> 【トレース内容】
> java.lang.StringIndexOutOfBoundsException: String index out of range: 25
> 	at java.lang.String.substring(Unknown Source)
> 	at org.apache.axiom.om.util.UUIDGenerator.getInitialUUID(UUIDGenerator.java:94)
> 	at org.apache.axiom.om.util.UUIDGenerator.getUUID(UUIDGenerator.java:54)
> 	at org.apache.axis2.description.AxisOperation.<init>(AxisOperation.java:90)
> 	at org.apache.axis2.description.AxisOperation.<init>(AxisOperation.java:95)
> 	at org.apache.axis2.description.TwoChannelAxisOperation.<init>(TwoChannelAxisOperation.java:52)
> 	at org.apache.axis2.description.OutInAxisOperation.<init>(OutInAxisOperation.java:65)
> 	at org.apache.axis2.description.RobustOutOnlyAxisOperation.<init>(RobustOutOnlyAxisOperation.java:47)
> 	at org.apache.axis2.client.Stub.addAnonymousOperations(Stub.java:233)
> 	

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ws.apache.org
For additional commands, e-mail: dev-help@ws.apache.org


[jira] [Resolved] (AXIOM-438) StringIndexOutOfBoundsException occur on rare occasions is when you create a stub object

Posted by "Andreas Veithen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AXIOM-438?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andreas Veithen resolved AXIOM-438.
-----------------------------------

    Resolution: Won't Fix

The UUIDGenerator class is deprecated in recent versions of Axiom and Axis2 no longer uses that class [1]. Fixing that issue would therefore only make sense for old Axis2 versions. However, it is likely that using a new Axiom release with these old Axis2 versions won't work.

[1] http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/description/AxisOperation.java?r1=948589&r2=948588&pathrev=948589
                
> StringIndexOutOfBoundsException occur on rare occasions is when you create a stub object
> ----------------------------------------------------------------------------------------
>
>                 Key: AXIOM-438
>                 URL: https://issues.apache.org/jira/browse/AXIOM-438
>             Project: Axiom
>          Issue Type: Bug
>          Components: API
>    Affects Versions: 1.2.10
>         Environment: Linux
>            Reporter: Masaki Nishikawa
>            Priority: Trivial
>
> (Google Translated)
> There is a problem with the logic of UUIDGenerator.getInitialUUID, is rare, can occur when generating the object of the stub is StringIndexOutOfBoundsException.
> The cause is because the next "1" s number, places such as "01" when over a string of numeric Integer.toHexString will decrease.
> What are you handling this like why, I do not understand, what the problem be solved by simply zero-fill?
> We appreciate if you fix this bug.
> 【The appropriate program】
> public class UUIDGenerator {
> 	/* Omitted */
>     protected static String getInitialUUID() {
>         if (myRand == null) {
>             myRand = new Random();
>         }
>         long rand = myRand.nextLong();
>         String sid;
>         try {
>             sid = InetAddress.getLocalHost().toString();
>         } catch (UnknownHostException e) {
>             sid = Thread.currentThread().getName();
>         }
>         StringBuffer sb = new StringBuffer();
>         sb.append(sid);
>         sb.append(":");
>         sb.append(Long.toString(rand));
>         MessageDigest md5 = null;
>         try {
>             md5 = MessageDigest.getInstance("MD5");
>         } catch (NoSuchAlgorithmException e) {
>             throw new OMException(e);
>         }
>         md5.update(sb.toString().getBytes());
>         byte[] array = md5.digest();
>         StringBuffer sb2 = new StringBuffer();
>         for (int j = 0; j < array.length; ++j) {
>             int b = array[j] & 0xFF;
>             sb2.append(Integer.toHexString(b)); // The problem here! Is a string of "1" the number "01" is Integer.toHexString, reduce the number of digits is
>         }
>         int begin = myRand.nextInt();
>         if (begin < 0) begin = begin * -1;
>         begin = begin % 8;
>         return sb2.toString().substring(begin, begin + 18).toUpperCase(); // Is raised here StringIndexOutofBoundsException
>     }
>     /* Omitted */
> }
> 【Error Trace】
> java.lang.StringIndexOutOfBoundsException: String index out of range: 25
> 	at java.lang.String.substring(Unknown Source)
> 	at org.apache.axiom.om.util.UUIDGenerator.getInitialUUID(UUIDGenerator.java:94)
> 	at org.apache.axiom.om.util.UUIDGenerator.getUUID(UUIDGenerator.java:54)
> 	at org.apache.axis2.description.AxisOperation.<init>(AxisOperation.java:90)
> 	at org.apache.axis2.description.AxisOperation.<init>(AxisOperation.java:95)
> 	at org.apache.axis2.description.TwoChannelAxisOperation.<init>(TwoChannelAxisOperation.java:52)
> 	at org.apache.axis2.description.OutInAxisOperation.<init>(OutInAxisOperation.java:65)
> 	at org.apache.axis2.description.RobustOutOnlyAxisOperation.<init>(RobustOutOnlyAxisOperation.java:47)
> 	at org.apache.axis2.client.Stub.addAnonymousOperations(Stub.java:233)
> 	
> (原文)
> UUIDGenerator.getInitialUUIDのロジックに問題があり、ごく稀にですが、スタブのオブジェクト生成時にStringIndexOutOfBoundsExceptionが発生します。
> 原因はInteger.toHexStringで数値を文字列化する際に"01"のような数値だと"1"となり、桁数が減ってしまうためです。
> なぜこのような処理をしているのか、理解できていないのですが、単純に0埋めすれば解決する問題でしょうか?
> このバグを修正していただけると幸いです。
> 【該当プログラム】
> public class UUIDGenerator {
> 	/* 省略 */
>     protected static String getInitialUUID() {
>         if (myRand == null) {
>             myRand = new Random();
>         }
>         long rand = myRand.nextLong();
>         String sid;
>         try {
>             sid = InetAddress.getLocalHost().toString();
>         } catch (UnknownHostException e) {
>             sid = Thread.currentThread().getName();
>         }
>         StringBuffer sb = new StringBuffer();
>         sb.append(sid);
>         sb.append(":");
>         sb.append(Long.toString(rand));
>         MessageDigest md5 = null;
>         try {
>             md5 = MessageDigest.getInstance("MD5");
>         } catch (NoSuchAlgorithmException e) {
>             throw new OMException(e);
>         }
>         md5.update(sb.toString().getBytes());
>         byte[] array = md5.digest();
>         StringBuffer sb2 = new StringBuffer();
>         for (int j = 0; j < array.length; ++j) {
>             int b = array[j] & 0xFF;
>             sb2.append(Integer.toHexString(b)); // ここが問題!Integer.toHexStringで"01"の数値が"1"の文字列になり、桁数が減る
>         }
>         int begin = myRand.nextInt();
>         if (begin < 0) begin = begin * -1;
>         begin = begin % 8;
>         return sb2.toString().substring(begin, begin + 18).toUpperCase(); // ここでStringIndexOutofBoundsExceptionが発生
>     }
>     /* 省略 */
> }
> 【トレース内容】
> java.lang.StringIndexOutOfBoundsException: String index out of range: 25
> 	at java.lang.String.substring(Unknown Source)
> 	at org.apache.axiom.om.util.UUIDGenerator.getInitialUUID(UUIDGenerator.java:94)
> 	at org.apache.axiom.om.util.UUIDGenerator.getUUID(UUIDGenerator.java:54)
> 	at org.apache.axis2.description.AxisOperation.<init>(AxisOperation.java:90)
> 	at org.apache.axis2.description.AxisOperation.<init>(AxisOperation.java:95)
> 	at org.apache.axis2.description.TwoChannelAxisOperation.<init>(TwoChannelAxisOperation.java:52)
> 	at org.apache.axis2.description.OutInAxisOperation.<init>(OutInAxisOperation.java:65)
> 	at org.apache.axis2.description.RobustOutOnlyAxisOperation.<init>(RobustOutOnlyAxisOperation.java:47)
> 	at org.apache.axis2.client.Stub.addAnonymousOperations(Stub.java:233)
> 	

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ws.apache.org
For additional commands, e-mail: dev-help@ws.apache.org


[jira] [Closed] (AXIOM-438) StringIndexOutOfBoundsException occur on rare occasions is when you create a stub object

Posted by "Masaki Nishikawa (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AXIOM-438?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Masaki Nishikawa closed AXIOM-438.
----------------------------------

    
> StringIndexOutOfBoundsException occur on rare occasions is when you create a stub object
> ----------------------------------------------------------------------------------------
>
>                 Key: AXIOM-438
>                 URL: https://issues.apache.org/jira/browse/AXIOM-438
>             Project: Axiom
>          Issue Type: Bug
>          Components: API
>    Affects Versions: 1.2.10
>         Environment: Linux
>            Reporter: Masaki Nishikawa
>            Priority: Trivial
>
> (Google Translated)
> There is a problem with the logic of UUIDGenerator.getInitialUUID, is rare, can occur when generating the object of the stub is StringIndexOutOfBoundsException.
> The cause is because the next "1" s number, places such as "01" when over a string of numeric Integer.toHexString will decrease.
> What are you handling this like why, I do not understand, what the problem be solved by simply zero-fill?
> We appreciate if you fix this bug.
> 【The appropriate program】
> public class UUIDGenerator {
> 	/* Omitted */
>     protected static String getInitialUUID() {
>         if (myRand == null) {
>             myRand = new Random();
>         }
>         long rand = myRand.nextLong();
>         String sid;
>         try {
>             sid = InetAddress.getLocalHost().toString();
>         } catch (UnknownHostException e) {
>             sid = Thread.currentThread().getName();
>         }
>         StringBuffer sb = new StringBuffer();
>         sb.append(sid);
>         sb.append(":");
>         sb.append(Long.toString(rand));
>         MessageDigest md5 = null;
>         try {
>             md5 = MessageDigest.getInstance("MD5");
>         } catch (NoSuchAlgorithmException e) {
>             throw new OMException(e);
>         }
>         md5.update(sb.toString().getBytes());
>         byte[] array = md5.digest();
>         StringBuffer sb2 = new StringBuffer();
>         for (int j = 0; j < array.length; ++j) {
>             int b = array[j] & 0xFF;
>             sb2.append(Integer.toHexString(b)); // The problem here! Is a string of "1" the number "01" is Integer.toHexString, reduce the number of digits is
>         }
>         int begin = myRand.nextInt();
>         if (begin < 0) begin = begin * -1;
>         begin = begin % 8;
>         return sb2.toString().substring(begin, begin + 18).toUpperCase(); // Is raised here StringIndexOutofBoundsException
>     }
>     /* Omitted */
> }
> 【Error Trace】
> java.lang.StringIndexOutOfBoundsException: String index out of range: 25
> 	at java.lang.String.substring(Unknown Source)
> 	at org.apache.axiom.om.util.UUIDGenerator.getInitialUUID(UUIDGenerator.java:94)
> 	at org.apache.axiom.om.util.UUIDGenerator.getUUID(UUIDGenerator.java:54)
> 	at org.apache.axis2.description.AxisOperation.<init>(AxisOperation.java:90)
> 	at org.apache.axis2.description.AxisOperation.<init>(AxisOperation.java:95)
> 	at org.apache.axis2.description.TwoChannelAxisOperation.<init>(TwoChannelAxisOperation.java:52)
> 	at org.apache.axis2.description.OutInAxisOperation.<init>(OutInAxisOperation.java:65)
> 	at org.apache.axis2.description.RobustOutOnlyAxisOperation.<init>(RobustOutOnlyAxisOperation.java:47)
> 	at org.apache.axis2.client.Stub.addAnonymousOperations(Stub.java:233)
> 	
> (原文)
> UUIDGenerator.getInitialUUIDのロジックに問題があり、ごく稀にですが、スタブのオブジェクト生成時にStringIndexOutOfBoundsExceptionが発生します。
> 原因はInteger.toHexStringで数値を文字列化する際に"01"のような数値だと"1"となり、桁数が減ってしまうためです。
> なぜこのような処理をしているのか、理解できていないのですが、単純に0埋めすれば解決する問題でしょうか?
> このバグを修正していただけると幸いです。
> 【該当プログラム】
> public class UUIDGenerator {
> 	/* 省略 */
>     protected static String getInitialUUID() {
>         if (myRand == null) {
>             myRand = new Random();
>         }
>         long rand = myRand.nextLong();
>         String sid;
>         try {
>             sid = InetAddress.getLocalHost().toString();
>         } catch (UnknownHostException e) {
>             sid = Thread.currentThread().getName();
>         }
>         StringBuffer sb = new StringBuffer();
>         sb.append(sid);
>         sb.append(":");
>         sb.append(Long.toString(rand));
>         MessageDigest md5 = null;
>         try {
>             md5 = MessageDigest.getInstance("MD5");
>         } catch (NoSuchAlgorithmException e) {
>             throw new OMException(e);
>         }
>         md5.update(sb.toString().getBytes());
>         byte[] array = md5.digest();
>         StringBuffer sb2 = new StringBuffer();
>         for (int j = 0; j < array.length; ++j) {
>             int b = array[j] & 0xFF;
>             sb2.append(Integer.toHexString(b)); // ここが問題!Integer.toHexStringで"01"の数値が"1"の文字列になり、桁数が減る
>         }
>         int begin = myRand.nextInt();
>         if (begin < 0) begin = begin * -1;
>         begin = begin % 8;
>         return sb2.toString().substring(begin, begin + 18).toUpperCase(); // ここでStringIndexOutofBoundsExceptionが発生
>     }
>     /* 省略 */
> }
> 【トレース内容】
> java.lang.StringIndexOutOfBoundsException: String index out of range: 25
> 	at java.lang.String.substring(Unknown Source)
> 	at org.apache.axiom.om.util.UUIDGenerator.getInitialUUID(UUIDGenerator.java:94)
> 	at org.apache.axiom.om.util.UUIDGenerator.getUUID(UUIDGenerator.java:54)
> 	at org.apache.axis2.description.AxisOperation.<init>(AxisOperation.java:90)
> 	at org.apache.axis2.description.AxisOperation.<init>(AxisOperation.java:95)
> 	at org.apache.axis2.description.TwoChannelAxisOperation.<init>(TwoChannelAxisOperation.java:52)
> 	at org.apache.axis2.description.OutInAxisOperation.<init>(OutInAxisOperation.java:65)
> 	at org.apache.axis2.description.RobustOutOnlyAxisOperation.<init>(RobustOutOnlyAxisOperation.java:47)
> 	at org.apache.axis2.client.Stub.addAnonymousOperations(Stub.java:233)
> 	

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ws.apache.org
For additional commands, e-mail: dev-help@ws.apache.org