← Back to team overview

sikuli-driver team mailing list archive

[Bug 1840077] Re: [1.1.4] API: Crash when running under OpenJ9 JVM on Windows

 

Thanks for finding and the evaluation.

** Changed in: sikuli
       Status: New => Fix Committed

** Changed in: sikuli
   Importance: Undecided => High

** Changed in: sikuli
     Assignee: (unassigned) => RaiMan (raimund-hocke)

** Changed in: sikuli
    Milestone: None => 1.1.4

-- 
You received this bug notification because you are a member of Sikuli
Drivers, which is subscribed to Sikuli.
https://bugs.launchpad.net/bugs/1840077

Title:
  [1.1.4] API: Crash when running under OpenJ9 JVM on Windows

Status in Sikuli:
  Fix Committed

Bug description:
  SikuliX API crashes on Windows when running under OpenJ9 JVM (formerly IBM J9).
  The crash happens when the JVM loads the Finder class.

  I'm using SikuliX1 API version 1.1.4, latest build.

  This is a simple test program to reproduce the crash:

  public class SikuliBug {
   public static void main(String[] args) {
    new org.sikuli.script.Pattern("blah");
   }
  }

  Exception in thread "main" java.lang.ExceptionInInitializerError
          at java.lang.J9VMInternals.ensureError(J9VMInternals.java:148)
          at java.lang.J9VMInternals.recordInitializationFailure(J9VMInternals.java:137)
          at org.sikuli.script.Pattern.<init>(Pattern.java:123)
          at SikuliBug.main(SikuliBug.java:3)
  Caused by: java.lang.IllegalArgumentException: Last character in replacement string can't be \, character to be escaped is required.
          at java.lang.String.checkLastChar(String.java:62)
          at java.lang.String.replaceAll(String.java:3530)
          at org.sikuli.script.support.RunTime.addToWindowsSystemPath(RunTime.java:1722)
          at org.sikuli.script.support.RunTime.libsExport(RunTime.java:1661)
          at org.sikuli.script.support.RunTime.libsLoad(RunTime.java:1486)
          at org.sikuli.script.support.RunTime.loadLibrary(RunTime.java:1690)
          at org.sikuli.script.Finder$Finder2.<clinit>(Finder.java:571)
          ... 2 more

  The problem happens on this line in addToWindowsSystemPath():

   String libsPath = (fLibsFolder.getAbsolutePath()).replaceAll("/",
  "\\");

  Proposed fix:

  Use replace() instead of replaceAll()

   String libsPath = (fLibsFolder.getAbsolutePath()).replace("/", "\\");

  This is more appropriate anyway, since you just want to replace all
  occurences of a fixed string or a character.

  By the way, try to run this line with the JVM of your choice (you
  might be surprised):

  "C:/bang/bang".replaceAll("/", "\\")

  I get this with Oracle JVM:

  Exception in thread "main" java.lang.IllegalArgumentException: character to be escaped is missing
          at java.util.regex.Matcher.appendReplacement(Matcher.java:809)
          at java.util.regex.Matcher.replaceAll(Matcher.java:955)
          at java.lang.String.replaceAll(String.java:2223)
          at J9StringReplaceAllBug.main(SikuliBug.java:4)

To manage notifications about this bug go to:
https://bugs.launchpad.net/sikuli/+bug/1840077/+subscriptions


References