aricneto / TwistyTimer

Twisty Timer is a material design twisty puzzle timer for Android. It uses the TNoodle library to generate scramble sequences for all current official speedsolving puzzles.
GNU General Public License v3.0
242 stars 54 forks source link

Importing from txt crashes with ClassNotFoundException org.apache.commons.lang3.StringUtils #29

Closed arestivo closed 5 years ago

arestivo commented 8 years ago

Finally managed to export my old times from Cube Companion but it seems a jar is missing from this latest build that is preventing me from importing them.

04-11 03:31:01.735 31251 31270 E AndroidRuntime: FATAL EXCEPTION: AsyncTask #3
04-11 03:31:01.735 31251 31270 E AndroidRuntime: Process: com.aricneto.twistytimer, PID: 31251
04-11 03:31:01.735 31251 31270 E AndroidRuntime: java.lang.RuntimeException: An error occurred while executing doInBackground()
04-11 03:31:01.735 31251 31270 E AndroidRuntime:    at android.os.AsyncTask$3.done(AsyncTask.java:309)
04-11 03:31:01.735 31251 31270 E AndroidRuntime:    at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354)
04-11 03:31:01.735 31251 31270 E AndroidRuntime:    at java.util.concurrent.FutureTask.setException(FutureTask.java:223)
04-11 03:31:01.735 31251 31270 E AndroidRuntime:    at java.util.concurrent.FutureTask.run(FutureTask.java:242)
04-11 03:31:01.735 31251 31270 E AndroidRuntime:    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
04-11 03:31:01.735 31251 31270 E AndroidRuntime:    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
04-11 03:31:01.735 31251 31270 E AndroidRuntime:    at java.lang.Thread.run(Thread.java:818)
04-11 03:31:01.735 31251 31270 E AndroidRuntime: Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Lorg/apache/commons/lang3/StringUtils;
04-11 03:31:01.735 31251 31270 E AndroidRuntime:    at com.e.b.a(Unknown Source)
04-11 03:31:01.735 31251 31270 E AndroidRuntime:    at com.e.b.a(Unknown Source)
04-11 03:31:01.735 31251 31270 E AndroidRuntime:    at com.e.b.a(Unknown Source)
04-11 03:31:01.735 31251 31270 E AndroidRuntime:    at com.e.d.a(Unknown Source)
04-11 03:31:01.735 31251 31270 E AndroidRuntime:    at com.aricneto.twistytimer.activity.m.a(Unknown Source)
04-11 03:31:01.735 31251 31270 E AndroidRuntime:    at com.aricneto.twistytimer.activity.m.doInBackground(Unknown Source)
04-11 03:31:01.735 31251 31270 E AndroidRuntime:    at android.os.AsyncTask$2.call(AsyncTask.java:295)
04-11 03:31:01.735 31251 31270 E AndroidRuntime:    at java.util.concurrent.FutureTask.run(FutureTask.java:237)
04-11 03:31:01.735 31251 31270 E AndroidRuntime:    ... 3 more
04-11 03:31:01.735 31251 31270 E AndroidRuntime: Caused by: java.lang.ClassNotFoundException: Didn't find class "org.apache.commons.lang3.StringUtils" on path: DexPathList[[zip file "/data/app/com.aricneto.twistytimer-2/base.apk"],nativeLibraryDirectories=[/data/app/com.aricneto.twistytimer-2/lib/arm, /vendor/lib, /system/lib]]
04-11 03:31:01.735 31251 31270 E AndroidRuntime:    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
04-11 03:31:01.735 31251 31270 E AndroidRuntime:    at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
04-11 03:31:01.735 31251 31270 E AndroidRuntime:    at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
04-11 03:31:01.735 31251 31270 E AndroidRuntime:    ... 11 more
04-11 03:31:01.735 31251 31270 E AndroidRuntime:    Suppressed: java.lang.ClassNotFoundException: org.apache.commons.lang3.StringUtils
04-11 03:31:01.735 31251 31270 E AndroidRuntime:        at java.lang.Class.classForName(Native Method)
04-11 03:31:01.735 31251 31270 E AndroidRuntime:        at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
04-11 03:31:01.735 31251 31270 E AndroidRuntime:        at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
04-11 03:31:01.735 31251 31270 E AndroidRuntime:        at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
04-11 03:31:01.735 31251 31270 E AndroidRuntime:        ... 12 more
04-11 03:31:01.735 31251 31270 E AndroidRuntime:    Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available
04-11 03:31:01.737 31251 31267 E Surface : getSlotFromBufferLocked: unknown buffer: 0xb9bc9bc0
04-11 03:31:01.737  2242  3432 W ActivityManager:   Force finishing activity com.aricneto.twistytimer/.activity.MainActivity
aricneto commented 8 years ago

Thanks for reporting that bug, I'll look into it. Can you tell me your phone and Android version?

arestivo commented 8 years ago

Moto g 2015 / Marshmallow

damo commented 8 years ago

Just thought I'd add the "OpenCSV" library via a Gradle dependency instead of keeping the copy of the JAR embedded in the project tree. In passing, I noticed that http://opencsv.sourceforge.net/dependencies.html lists Commons Lang-3 as a dependency of OpenCSV.

From looking a bit at the OpenCSV code, it seems that the missing "StringUtils" class is invoked if OpenCSV encounters quotes in the middle of a value. The reporter of this issue may have created a comment or category name with quotes in it.

The trigger for the crash is probably that the Twisty Timer export code did not use "CSVWriter", so the written values were not being escaped to make them compatible with the CSV format. That made "CSVParser" resort to some edge cases that involved Commons Lang3 "StringUtils". I've changed the export code on my active branch to use "CSVWriter", so things will be escaped properly if ever that gets released.

The root problem is that there is no dependency on Commons Lang3, which is required by OpenCSV. Unless you can think of a reason not to, I will add the OpenCSV dependency, and its knock-on dependencies, to the Gradle scripts and remove the JAR file.