You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Johan Compagner (JIRA)" <ji...@apache.org> on 2009/07/14 13:02:14 UTC
[jira] Commented: (WICKET-2366) Refactor:
org.apache.wicket.util.string.Strings#fromEscapedUnicode(String
escapedUnicodeString)
[ https://issues.apache.org/jira/browse/WICKET-2366?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12730782#action_12730782 ]
Johan Compagner commented on WICKET-2366:
-----------------------------------------
thats very weird code
i am glad it will never be true for both ifs...
because then an out of mem will happen for sure on almost all the heaps..
a char array of int maxvalue is about 4GB of memory if i calculate correctly.
> Refactor: org.apache.wicket.util.string.Strings#fromEscapedUnicode(String escapedUnicodeString)
> -----------------------------------------------------------------------------------------------
>
> Key: WICKET-2366
> URL: https://issues.apache.org/jira/browse/WICKET-2366
> Project: Wicket
> Issue Type: Bug
> Affects Versions: 1.4-RC5, 1.4-RC6, 1.4-RC7, 1.4-RC8
> Environment: trunk
> Reporter: Martin Funk
>
> trying to understand the code I failed to see in which case the first two if statments hold true.
> this smells so bad, I didn't check beyond.
> public static String fromEscapedUnicode(String escapedUnicodeString)
> {
> int off = 0;
> char[] in = escapedUnicodeString.toCharArray();
> int len = in.length;
> char[] convtBuf = new char[len];
> if (convtBuf.length < len)
> {
> int newLen = len * 2;
> if (newLen < 0)
> {
> newLen = Integer.MAX_VALUE;
> }
> convtBuf = new char[newLen];
> }
> [...]
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.