java.lang.ArrayIndexOutOfBoundsException: -1 passing "-1" to dererefence an array at ...

Coderanch | Henry Wong | 2 years ago
  1. 0

    ArrayIndexOutOfBound Help

    Coderanch | 2 years ago | Henry Wong
    java.lang.ArrayIndexOutOfBoundsException: -1 passing "-1" to dererefence an array at ...
  2. 0

    The {{DefaultAcceptHeaderParser}} class seems to have trouble with some accept headers. The relevant part of the exception stack trace is: {noformat} java.lang.ArrayIndexOutOfBoundsException: Negative array index [-1] too large for array size 0 at org.codehaus.groovy.runtime.DefaultGroovyMethodsSupport.normaliseIndex(DefaultGroovyMethodsSupport.java:63) at org.codehaus.groovy.runtime.DefaultGroovyMethods.getAt(DefaultGroovyMethods.java:2437) at org.codehaus.groovy.runtime.DefaultGroovyMethods.getAt(DefaultGroovyMethods.java:2415) at sun.reflect.GeneratedMethodAccessor942.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.codehaus.groovy.runtime.metaclass.ReflectionMetaMethod.invoke(ReflectionMetaMethod.java:51) at org.codehaus.groovy.runtime.metaclass.NewInstanceMetaMethod.invoke(NewInstanceMetaMethod.java:54) at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:230) at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:912) at groovy.lang.ExpandoMetaClass.invokeMethod(ExpandoMetaClass.java:946) at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:756) at org.codehaus.groovy.runtime.InvokerHelper.invokePojoMethod(InvokerHelper.java:766) at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:754) at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodN(ScriptBytecodeAdapter.java:170) at org.codehaus.groovy.grails.web.mime.DefaultAcceptHeaderParser$_parse_closure1.doCall(DefaultAcceptHeaderParser.groovy:52) {noformat} Looking at the HTTP specification, we can see that the accept header follows this grammar: {noformat} Accept = "Accept" ":" #( media-range [ accept-params ] ) media-range = ( "*/*" | ( type "/" "*" ) | ( type "/" subtype ) ) *( ";" parameter ) accept-params = ";" "q" "=" qvalue *( accept-extension ) accept-extension = ";" token [ "=" ( token | quoted-string ) ] {noformat} The important part is that "accept-extension". As you can see, the "=" is optional but the current code assumes that it is always there. We need to make sure that the code works if that "=" is missing.

    Grails JIRA | 8 years ago | Peter Ledbrook
    java.lang.ArrayIndexOutOfBoundsException: Negative array index [-1] too large for array size 0
  3. 0

    Java Mainframe JCL call

    Stack Overflow | 1 year ago | Praveena
    java.lang.ArrayIndexOutOfBoundsException: Array index out of range: -1
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Jenkins issues - [JIRA] [component] (JENKINS-18537) java.lang.ArrayIndexOutOfBoundsException when trying to save data

    nabble.com | 1 year ago
    javax.servlet.ServletException: java.lang.ArrayIndexOutOfBoundsException: Array index out of range: -1
  6. 0

    [RESOLVED]Websphere Development Studio + WAS + Liferay - Forums | Liferay

    liferay.com | 11 months ago
    java.lang.ArrayIndexOutOfBoundsException: Array index out of range: 1

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.ArrayIndexOutOfBoundsException

      -1 passing "-1" to dererefence an array at ...

      at Stack.getTop()
    2. Unknown
      Stack.getTop
      1. Stack.getTop(Stack.java:31)
      1 frame