mkodekar / guava-libraries

Automatically exported from code.google.com/p/guava-libraries
Apache License 2.0
0 stars 0 forks source link

ExceptionInInitializerError #1806

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hi,

I've got this:
java.lang.ExceptionInInitializerError
    at com.google.common.base.Splitter.<init>(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.<clinit>(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

Original issue reported on code.google.com by smrtprj...@gmail.com on 17 Jul 2014 at 10:44

GoogleCodeExporter commented 9 years ago
Guava 17.0

Original comment by smrtprj...@gmail.com on 17 Jul 2014 at 10:45

GoogleCodeExporter commented 9 years ago
String parameters aren't null.

Original comment by smrtprj...@gmail.com on 17 Jul 2014 at 2:34

GoogleCodeExporter commented 9 years ago
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/co
mmon/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.

Original comment by cgdecker@google.com on 17 Jul 2014 at 3:53

GoogleCodeExporter commented 9 years ago
Hi,
I have on guava lib in the project, but I use proguard.

Original comment by smrtprj...@gmail.com on 17 Jul 2014 at 4:55

GoogleCodeExporter commented 9 years ago
one guava

Original comment by smrtprj...@gmail.com on 17 Jul 2014 at 4:55

GoogleCodeExporter commented 9 years ago
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?

Original comment by cgdecker@google.com on 17 Jul 2014 at 5:09

GoogleCodeExporter commented 9 years ago
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?

Original comment by smrtprj...@gmail.com on 17 Jul 2014 at 5:59

GoogleCodeExporter commented 9 years ago
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.

Original comment by cgdecker@google.com on 17 Jul 2014 at 6:05

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

Original comment by smrtprj...@gmail.com on 21 Jul 2014 at 4:42

GoogleCodeExporter commented 9 years ago
This issue has been migrated to GitHub.

It can be found at https://github.com/google/guava/issues/<issue id>

Original comment by cgdecker@google.com on 1 Nov 2014 at 4:08

GoogleCodeExporter commented 9 years ago

Original comment by cgdecker@google.com on 1 Nov 2014 at 4:17

GoogleCodeExporter commented 9 years ago

Original comment by cgdecker@google.com on 3 Nov 2014 at 9:07