I want to convert String
object to IntWritable
Object in Hadoop.
any process is available for conversion.
IntWritable value = new IntWritable(Integer.parseInt(someString))
... and deal with the possibility that parseInt
may throw a NumberFormatException
.
Someone asked:
How to overcome this NumberFormatException ???
The exception will occur if someString
does not represent an integer.
What do you do?
You catch it and handle it of course! How you handle it (i.e. what you should code your application to do) will depending on the context. We can't advise on that.
Java exceptions and exception handling are described in the Oracle Java Tutorials - here.