You are not logged in.
Announcement
Unanswered posts
|
Pages: 1

try to get the desire number from String as URL like
"http://www.avanquest.com/UK/software/3d-dinosaur-hunter-51492?meta=education&cat=curriculum-learning&sub=KS2?tr1=AQ_UK_AF_AF"
i am using indexof to get position of "?meta=" then use substring function to get 5 digit as mentioned 51492 and output in tmap in new column as "Av-"+column
use var1 in Var window of tMap ...whereas var1 contained this
row2.ProductURL.substring(row2.ProductURL.indexOf("?meta=") - 5, row2.ProductURL.indexOf("?meta="))
but on run(F6) this process give error as below
Starting job testing at 17:13 18/11/2011.
[statistics] connecting to socket on port 3824
[statistics] connected
Exception in component tMap_4
java.lang.StringIndexOutOfBoundsException: String index out of range: -6
at java.lang.String.substring(Unknown Source)
at log_reader.testing_0_1.testing.tFileInputDelimited_2Process(testing.java:759)
at log_reader.testing_0_1.testing.runJobInTOS(testing.java:1097)
at log_reader.testing_0_1.testing.main(testing.java:965)
51492
51494
51496
51497
51498
51499
51500
51502
51503
51504
51518
51519
51520
51521
51525
[statistics] disconnected
Job testing ended at 17:13 18/11/2011. [exit code=1]
-----
in attached windows i used tlogrow to check but if do with toutputdelimitedfile same error occurred
Last edited by asa436 (2011-11-18 13:30:21)
Offline

Hi
This error is caused by your input file.
Check the line below 51525 in your input file whether its length is longer than six.
Or maybe it's just a String like this "\n". Delete it.
In short, to avoid StringIndexOutOfBoundsException, make sure the min length of each line is six.
Best regards!
Pedro
Offline
Pages: 1