migrator / guava-libraries-2

Guava: Google Core Libraries for Java 1.6+
0 stars 0 forks source link

ExceptionInInitializerError #45

Open migrator opened 9 years ago

migrator commented 9 years ago

Hi,

I've got this: java.lang.ExceptionInInitializerError at com.google.common.base.Splitter.(SourceFile:110) at com.google.common.base.Splitter.on(SourceFile:174) at com.x.y.BaseApplication.count(SourceFile:900) at com.x.y.CheckNewApps.doInBackground(SourceFile:106) at com.x.y.CheckNewApps.doInBackground(SourceFile:1) at android.os.AsyncTask$2.call(AsyncTask.java:288) at java.util.concurrent.FutureTask.run(FutureTask.java:237) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) at java.lang.Thread.run(Thread.java:811) Caused by: java.lang.UnsupportedOperationException at com.google.common.base.CharMatcher.a(SourceFile:775) at com.google.common.base.CharMatcher.(SourceFile:212) ... 11 more

This is the code: public int count(String string, String substring) { int count=0; try{ count = Iterables.size(Splitter.on(substring).split(string)) - 1; } catch (Exception e){ ... }

Yes, count = ... is the line 900?

How can it be? It comes from Galaxy S3 4.4.4 Thanks

relevance: 1

migrator commented 9 years ago

summary: Not Defined

Guava 17.0

status Not Defined creator: smrtprj...@gmail.com created at: Jul 17, 2014

migrator commented 9 years ago

summary: Not Defined

String parameters aren't null.

status Not Defined creator: smrtprj...@gmail.com created at: Jul 17, 2014

migrator commented 9 years ago

summary: Not Defined

That's pretty strange. The UOE is clearly coming from here:

public static final CharMatcher JAVA_ISO_CONTROL = inRange('\u0000', '\u001f') .or(inRange('\u007f', '\u009f')) .withToString("CharMatcher.JAVA_ISO_CONTROL");

(https://code.google.com/p/guava-libraries/source/browse/guava/src/com/google/common/base/CharMatcher.java?name=v17.0#212)

But withToString is being called on a CharMatcher returned by or(...), and the Or CharMatcher definitely overrides withToString and doesn't throw UOE from it.

Is there another version of Guava on your classpath somehow? Seems unlikely to cause this issue given that the problem here seems to be constrained to just 1 class, but probably worth checking. I also wonder if the obfuscation that appears to have been done could be causing it somehow. This obviously doesn't normally happen, as it would cause CharMatcher and anything that uses it to never work.

status Not Defined creator: cgdecker@google.com created at: Jul 17, 2014

migrator commented 9 years ago

summary: Not Defined

Hi, I have on guava lib in the project, but I use proguard.

status Not Defined creator: smrtprj...@gmail.com created at: Jul 17, 2014

migrator commented 9 years ago

summary: Not Defined

one guava

status Not Defined creator: smrtprj...@gmail.com created at: Jul 17, 2014

migrator commented 9 years ago

summary: Not Defined

I have to think this is somehow caused by proguard. I wonder if it's for some reason stripping out the override of withToString from CharMatcher.Or, causing the default implementation of withToString on CharMatcher to be called?

status Not Defined creator: cgdecker@google.com created at: Jul 17, 2014

migrator commented 9 years ago

summary: Not Defined

I'm no an expert, I cannot help you :D But if it's a proguard thing why this comes in one device? Is it possibe? Why one device? Or it's a rare bug and it was just an accident?

status Not Defined creator: smrtprj...@gmail.com created at: Jul 17, 2014

migrator commented 9 years ago

summary: Not Defined

I really have no idea... I don't know much about proguard myself. For Guava 17's original source code, what happened should be impossible. So at the very least I don't think this is a problem with Guava itself. What exactly is causing it, though, I'm not sure.

status Not Defined creator: cgdecker@google.com created at: Jul 17, 2014

migrator commented 9 years ago

summary: Not Defined

Is it uptodate? Seems to be a bit old https://code.google.com/p/guava-libraries/wiki/UsingProGuardWithGuava

status Not Defined creator: smrtprj...@gmail.com created at: Jul 21, 2014