almcken / google-voice-java

Automatically exported from code.google.com/p/google-voice-java
0 stars 0 forks source link

integer.parseInt in Group.createGroupSettingsFromJsonResponse faulty #36

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
This is something I ran into while unit testing, I used a json part from my own 
google-voice account (only the names were changed to protect the innocent) so I 
MAY have the input string wrong.

Location of failure - 
com.techventus.server.voice.datatypes.Group.createGroupSettingsFromJsonResponse(
String json) line 100.

Instead of just grabbing the digit after "greetings": it grabs the rest of the 
entire string(see below).

I was able to fix this in my local copy by adding .substring(0,1)); to the end 
of the line. This would only grab the first character, but it would only be 
viable for integer values of 0-9, 10 and higher would be cut off.

this could also be fixed by using the ParsingUtil.removeUninterestingParts 
method that the rest of the variables inside the method use (assuming that my 
input string is valid) and would be valid for any integer value.

appologies if I'm barking up the wrong tree.

What steps will reproduce the problem?
run Group.createGroupSettingsFromJsonResponse with json string 
"\"groups\":{\"testID\":{\"id\":\"testID\",\"name\":\"testName\",\"disabledForwa
rdingIds\":{},\"isCustomForwarding\":false,\"isCustomGreeting\":false,\"isCustom
DirectConnect\":false,\"directConnect\":false,\"greetingId\":0,\"isCircle\":true
,\"isCustomTranscriptionLanguage\":false,\"transcriptionLanguage\":\"\"},\"group
List\"";

What is the expected output? What do you see instead?

expected: no error

actual - (fail trace)
java.lang.NumberFormatException: For input string: 
"0,"isCircle":true,"isCustomTranscriptionLanguage":false,"transcriptionLanguage"
:""}"

Please use labels and text to provide additional information.

Original issue reported on code.google.com by Biodro...@gmail.com on 18 Apr 2012 at 8:56

GoogleCodeExporter commented 9 years ago
note: I have made no commited changes to SVN only my local copy.

Original comment by Biodro...@gmail.com on 18 Apr 2012 at 8:57

GoogleCodeExporter commented 9 years ago
OK, I will try to test later in the next few weeks.  It is not a feature I have 
used much.  Is it something you might be able to debug, BioDroid?

Original comment by malone.j...@gmail.com on 18 Apr 2012 at 9:18

GoogleCodeExporter commented 9 years ago
Assuming my input string is valid, and I have every reason to believe it is, I 
can have it fixed next update.

Original comment by Biodro...@gmail.com on 18 Apr 2012 at 10:23

GoogleCodeExporter commented 9 years ago
Assuming my input string is valid, and I have every reason to believe it is, I 
can have it fixed next commit.

Original comment by Biodro...@gmail.com on 18 Apr 2012 at 10:23

GoogleCodeExporter commented 9 years ago
OK, it looks like you have privileges, so go for it.

Original comment by malone.j...@gmail.com on 19 Apr 2012 at 5:47

GoogleCodeExporter commented 9 years ago
fixed 

Original comment by Biodro...@gmail.com on 19 Apr 2012 at 4:10