When i try to read a file from HDFS, i want to substring the record by java
code (javada line.substring(1,9)) but i am getting outofindex error. When i
do the same operation on same file by PIG code there is no problem.

I took following error, What shoul i do in Java. 


java.lang.StringIndexOutOfBoundsException: String index out of range: 9
        at java.lang.String.substring(String.java:1934)
        at WordCount$Map.map(WordCount.java:19)
        at WordCount$Map.map(WordCount.java:12)
        at org.apache.hadoop.mapred.MapRunner.run(MapRunner.java:50)
        at org.apache.hadoop.mapred.MapTask.runOldMapper(MapTask.java:358)
        at org.apache.hadoop.mapred.MapTask.run(MapTask.java:307)
        at org.apache.hadoop.mapred.Child.main(Child.java:170)

-- 
View this message in context: 
http://old.nabble.com/java-code---parsing-string--outofindex--error--File-on-HDFS-tp26322437p26322437.html
Sent from the Hadoop core-dev mailing list archive at Nabble.com.

Reply via email to