neeradkumar / libgdx-users

Automatically exported from code.google.com/p/libgdx-users
0 stars 0 forks source link

PatternSyntaxException in AndroidFileHandle.java #21

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
Trying to run the gdx-tests on an HTC Desire with Android 2.3.7.

What is the expected output? What do you see instead?
I see a "Force Close" when choosing an item from the testlist.

Problem comes from:
Package: com.badlogic.gdx.backends.android
File: AndroidFileHandle.java

I believe its the malformed regex "\\"
Row 36: super(fileName.replaceAll("\\", "/"), type);
Row 46: name = name.replaceAll("\\", "/");

Possible solution: use replace("\\", "/")
or rewrite the regex (escape the backslashes).

My logcat:
-------------
05-19 21:11:33.625: W/dalvikvm(26686): threadid=9: thread exiting with uncaught 
exception (group=0x40015560)
05-19 21:11:33.625: E/AndroidRuntime(26686): FATAL EXCEPTION: GLThread 10
05-19 21:11:33.625: E/AndroidRuntime(26686): 
java.util.regex.PatternSyntaxException: Syntax error 
U_REGEX_BAD_ESCAPE_SEQUENCE near index 1:
05-19 21:11:33.625: E/AndroidRuntime(26686): \
05-19 21:11:33.625: E/AndroidRuntime(26686):  ^
05-19 21:11:33.625: E/AndroidRuntime(26686):    at 
java.util.regex.Pattern.compileImpl(Native Method)
05-19 21:11:33.625: E/AndroidRuntime(26686):    at 
java.util.regex.Pattern.compile(Pattern.java:400)
05-19 21:11:33.625: E/AndroidRuntime(26686):    at 
java.util.regex.Pattern.<init>(Pattern.java:383)
05-19 21:11:33.625: E/AndroidRuntime(26686):    at 
java.util.regex.Pattern.compile(Pattern.java:374)
05-19 21:11:33.625: E/AndroidRuntime(26686):    at 
java.lang.String.replaceAll(String.java:1963)
05-19 21:11:33.625: E/AndroidRuntime(26686):    at 
com.badlogic.gdx.backends.android.AndroidFileHandle.<init>(AndroidFileHandle.jav
a:36)
05-19 21:11:33.625: E/AndroidRuntime(26686):    at 
com.badlogic.gdx.backends.android.AndroidFiles.internal(AndroidFiles.java:55)
05-19 21:11:33.625: E/AndroidRuntime(26686):    at 
com.badlogic.gdx.tests.ShadowMappingTest.setupScene(ShadowMappingTest.java:86)
05-19 21:11:33.625: E/AndroidRuntime(26686):    at 
com.badlogic.gdx.tests.ShadowMappingTest.create(ShadowMappingTest.java:70)
05-19 21:11:33.625: E/AndroidRuntime(26686):    at 
com.badlogic.gdx.backends.android.AndroidGraphics.onSurfaceChanged(AndroidGraphi
cs.java:292)
05-19 21:11:33.625: E/AndroidRuntime(26686):    at 
android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1356)
05-19 21:11:33.625: E/AndroidRuntime(26686):    at 
android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1118)

Original issue reported on code.google.com by r...@ernell.se on 19 May 2012 at 7:41

GoogleCodeExporter commented 8 years ago
The problem has been resolved in latest version by using replace(....)
Thanks.

Original comment by r...@ernell.se on 21 May 2012 at 10:41