Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid Integer conversion/cast #164

Open
chucklepie opened this issue Feb 16, 2017 · 0 comments
Open

Invalid Integer conversion/cast #164

chucklepie opened this issue Feb 16, 2017 · 0 comments

Comments

@chucklepie
Copy link

Hello,
In my code there is a repeating pattern of functions that return a String object but a cast is missing when returning Integer, for example:

String integerStringValue = "-";
try
{
  int vInt = Integer.parseInt(value);
  
  integerStringValue = vInt;   //no cast/toString here
}
catch (NumberFormatException localNumberFormatException) {}

Also, this pattern is repeating where a method returns a String but the toString/cast is missing:

if ((v1IsNumber) && (v2IsNumber))
{
return Integer.parseInt(v1) + Integer.parseInt(v2); //method expecting a string
}

Hope this helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant