Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

ArrayIndexOutOfBoundsExeption on Nifi SplitText processor?

ArrayIndexOutOfBoundsExeption on Nifi SplitText processor?

Expert Contributor

Hi i am trying to split a csv file into single lines using the splittext processor but keep getting the ArrayIndexOutOfBoundsExeption error. I have the Line Split Count set to 1. Is there something i am doing wrong?. Thanks

8 REPLIES 8

Re: ArrayIndexOutOfBoundsExeption on Nifi SplitText processor?

I believe you are running into NIFI-3278, which is a regression. A possible workaround is to use ReplaceText to remove/replace occurrences of the carriage return character ('\r').

Re: ArrayIndexOutOfBoundsExeption on Nifi SplitText processor?

Expert Contributor

Hi, @Matt Burgess. Thanks for the reply. I am fairly new to NiFi and not sure what to replace that character with.

I am using the trucking events data. The first two lines are as follows:

driverId,truckId,eventTime,eventType,longitude,latitude,eventKey,CorrelationId,driverName,routeId,routeName,eventDate
14,25,59:21.4,Normal,-94.58,37.03,14|25|9223370572464814373,3.66088E+18,Adis Cesir,160405074,Joplin to Kansas City Route 2,2016-05-27-22

Thanks

Re: ArrayIndexOutOfBoundsExeption on Nifi SplitText processor?

I'm guessing this is a file with Windows-style line endings (\r\n). If that's the case you can search for \r\n and replace with \n, that should effectively switch the line endings to Unix-style endings and hopefully skirt the error you're seeing.

Re: ArrayIndexOutOfBoundsExeption on Nifi SplitText processor?

Expert Contributor

Hi, thanks for your time, i appreciate it. I tried to replace ('\r\n') with ('\n'). It does'nt give any errors, but nothing i passed from the replaceText to the splitText processor.

11161-replace.png

Re: ArrayIndexOutOfBoundsExeption on Nifi SplitText processor?

try just \r\n for Search Value, \n for Replacement Value, and Literal Replace as the Replacement Strategy. This type of line-ending conversion has definitely been done before, but at the moment I can't seem to find any examples.

Re: ArrayIndexOutOfBoundsExeption on Nifi SplitText processor?

Expert Contributor

@Roger Young,

Try putting just /r/n in the search and /n in the replacement. No parentheses or tick marks. Also try making the evaluation mode line by line. I think what you have is looking for '\r\n' with actual tick marks (single quotes) at the front and back, which you certainly don't have, so it will not change anything.

Enjoy!

John

Re: ArrayIndexOutOfBoundsExeption on Nifi SplitText processor?

New Contributor

Matt,

I am using Nifi 1.1.1 in Windows. I have a ANSI text file with flattened jsons on each line. When I pass this file via ListFile -> FetchFile -> SplitText, is fails with "ArrayIndexOutOfBoundsExeption". There are about 600+ jsons and total size of the file is about 180KB.

Now when I try the same file after removing few json lines, it goes thru and lines(jsons) are splitted for downstream processing. I also tried to move the jsons around to ensure it is not something in the data. I am pretty sure "\r\n" is not an issue. Several files have been processed in the same pipe.

So my question is there some limit on the file size which is causing this "ArrayIndexOutOfBoundsExeption"? How can we debug this situation?

Highlighted

Re: ArrayIndexOutOfBoundsExeption on Nifi SplitText processor?

Expert Contributor

@Roger Young

Try using \r\n for the search text, without the parentheses or the quote marks. For the replacement text use \n, again without the other characters. Also, try line-by-line for the evaluation mode. I think that will let it match and remove the \r characters.

Enjoy!

John

Don't have an account?
Coming from Hortonworks? Activate your account here