Yiyuan GUO created NETBEANS-5718: ------------------------------------ Summary: A divide by zero bug in websocket Key: NETBEANS-5718 URL: https://issues.apache.org/jira/browse/NETBEANS-5718 Project: NetBeans Issue Type: Bug Reporter: Yiyuan GUO
In the file[ webcommon/netserver/src/org/netbeans/modules/netserver/websocket/Utils.java|https://github.com/apache/netbeans/blob/39496d3400eada7398a8428f05c90589aa1f3b74/webcommon/netserver/src/org/netbeans/modules/netserver/websocket/Utils.java], the method _decodeNumber_ has the following [code|https://github.com/apache/netbeans/blob/39496d3400eada7398a8428f05c90589aa1f3b74/webcommon/netserver/src/org/netbeans/modules/netserver/websocket/Utils.java#L213]: {code:java} private static int decodeNumber(String code) { long number = 0; int spaces = 0; for (int i=0; i<code.length(); i++) { char c = code.charAt(i); if (c >= '0' && c <= '9') { number *= 10; number += (c-'0'); } if (c == ' ') { spaces++; } } return (int)(number/spaces); } {code} If the variable _code_ contains no spaces, a divide by zero will happen when performing the division: {code:java} return (int)(number/spaces); {code} -- This message was sent by Atlassian Jira (v8.3.4#803005) --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@netbeans.apache.org For additional commands, e-mail: commits-h...@netbeans.apache.org For further information about the NetBeans mailing lists, visit: https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists