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

** Summary changed:

- [1.1.4] API: Crash when running under OpenJ9 JVM on Windows
+ [1.1.4] API: Crash when running under OpenJ9 JVM on Windows --- fixed 
2019-08-19 build #365

You received this bug notification because you are a member of Sikuli
Drivers, which is subscribed to Sikuli.

  [1.1.4] API: Crash when running under OpenJ9 JVM on Windows --- fixed
  2019-08-19 build #365

Status in Sikuli:
  Fix Committed

Bug description:
  SikuliX API crashes on Windows when running under OpenJ9 JVM (formerly IBM 
  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 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.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:

Mailing list: https://launchpad.net/~sikuli-driver
Post to     : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp

Reply via email to