Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8098530

ArrayIndexOutOfBoundsException at sun.awt.X11.XEvent.getFieldsAsString

XMLWordPrintable

    • x86_64
    • linux

      FULL PRODUCT VERSION :
      Java version: 1.7.0_79, Oracle Corporation, OpenJDK 64-Bit Server VM
      Java package: openjdk-7-jre:amd64-7u79-2.5.5-1

      ADDITIONAL OS VERSION INFORMATION :
      Linux Debian GNU/Linux unstable (sid)

      A DESCRIPTION OF THE PROBLEM :
      This is an upstream bug report for:
      https://josm.openstreetmap.de/ticket/11530

      An ArrayIndexOutOfBoundsException is thrown when sun.awt.X11.XToolkit tries to log a message.

      The stacktrace mentions an index of 85. The portion of code where the bug occurs is:

      83 String More ...getFieldsAsString() {
      84 StringBuilder ret = new StringBuilder(1320);
      85
      86 ret.append("type = ").append( XlibWrapper.eventToString[get_type()] ).append(", ");

      So get_type() returns 85, but XlibWrapper.eventToString[ contains only 36 items:

      51 public final static String eventToString[]=
      52 {"<none:0>", "<none:1>", "KeyPress", "KeyRelease", "ButtonPress", "ButtonRelease",
      53 "MotionNotify", "EnterNotify", "LeaveNotify", "FocusIn", "FocusOut",
      54 "KeymapNotify", "Expose", "GraphicsExpose", "NoExpose", "VisibilityNotify",
      55 "CreateNotify", "DestroyNotify", "UnmapNotify", "MapNotify", "MapRequest",
      56 "ReparentNotify", "ConfigureNotify", "ConfigureRequest", "GravityNotify",
      57 "ResizeRequest", "CirculateNotify", "CirculateRequest", "PropertyNotify",
      58 "SelectionClear", "SelectionRequest", "SelectionNotify", "ColormapNotify",
      59 "ClientMessage", "MappingNotify", "LASTEvent"};



      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      no error
      ACTUAL -
      ArrayIndexOutOfBoundsException

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      java.lang.ArrayIndexOutOfBoundsException: 85
      at sun.awt.X11.XEvent.getFieldsAsString(XEvent.java:86)
      at sun.awt.X11.XWrapperBase.toString(XWrapperBase.java:37)
      at sun.awt.X11.XEvent.toString(XEvent.java:8)
      at java.lang.String.valueOf(String.java:2847)
      at sun.util.logging.PlatformLogger$JavaLoggerProxy.doLog(PlatformLogger.java:663)
      at sun.util.logging.PlatformLogger.finer(PlatformLogger.java:424)
      at sun.awt.X11.XToolkit.run(XToolkit.java:559)
      at sun.awt.X11.XToolkit.run(XToolkit.java:505)
      at java.lang.Thread.run(Thread.java:745)

      REPRODUCIBILITY :
      This bug can be reproduced often.

            dmarkov Dmitry Markov
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: