Experience fragment plain.html rendition arrayIndexOutOfBound Exception when href starts with # | Community
Skip to main content
New Participant
Jan 21, 2022 9:12 AM UTC
Solved

Experience fragment plain.html rendition arrayIndexOutOfBound Exception when href starts with #

Exception: line#94 arrayIndexOutOfBound Exception if used # in href while accessing with plain.html. 
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
ibishika
ibishikaAccepted solution
Level 4
Jan 25, 2022 4:50 AM UTC

In that case you can check the same before you call this method and it will solve your issue for now.

3 replies

ibishika
Level 4
Jan 21, 2022 7:18 PM UTC

That's because when you have just "#" in the path and try splitting it using "/" then the array length will be 1 holding the original value and which means you can just access 0th index.

To solve this issue, put a if statement before line no 94 to check if there is "/" character present in the path. Something like this:

if(path.contains("/")) {

 //line no 94

} else {

pathPrefix = path;

}

 

 

Translate
subhdAuthor
New Participant
Jan 24, 2022 10:56 AM UTC

The code snippet is from the aem bundle not the project code.

Translate
ibishika
ibishikaAccepted solution
Level 4
Jan 25, 2022 4:50 AM UTC

In that case you can check the same before you call this method and it will solve your issue for now.

Translate