I recently updated my app and there is one exception that occurs a lot. When I look at Crashlytics summary I saw this stacktrace:
[Fatal Exception: java.lang.NullPointerException]
com.company.app.model.ClassA.method1
com.company.app.model.ClassB.method2
com.company.app.view.ClassB.onTouch
android.view.View.dispatchTouchEvent (View.java:7241)
android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:2174)
android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:1875)
android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:2174)
.....
From my understanding, there is no line number shown on the top 3 lines because I use Proguard to obfuscate the app.
But what baffled me is that, it is not possible that ClassA.method1 is called directly or indirectly by ClassB.method2 (I have checked it multiple times). So now I am stuck. Does this mean that the name of methods shown here is inaccurate? And if that is the case, how should I proceed?
Thank you.
Related
Our app is minified and the deobfuscated mappings is uploaded to Play developer console so I am expecting the real line numbers translated when there is a crash. However, the latest stacktrace shows lots of which is making it really hard to troubleshoot. Additionally there is no line number at all. Any idea how this can be improved?
An example stacktrace is like this. I have replaced real class and method names as myclass1 and mymethod0 to mymethod8. Not sure where are these access$xxx methods coming from.
Caused by: java.lang.NullPointerException
at myclass1.mymethod0(myclass1.java)
at <OR>.mymethod1(myclass1.java)
at <OR>.mymethod2(myclass1.java)
at <OR>.mymethod3(myclass1.java)
at <OR>.mymethod4(myclass1.java)
at <OR>.mymethod5(myclass1.java)
at <OR>.mymethod6(myclass1.java)
at <OR>.access$100(myclass1.java)
at <OR>.access$500(myclass1.java)
at <OR>.access$600(myclass1.java)
at myclass1.mymethod7(myclass1.java)
at myclass1.mymethod0(myclass1.java)
at <OR>.mymethod1(myclass1.java)
at <OR>.mymethod2(myclass1.java)
at <OR>.mymethod3(myclass1.java)
at <OR>.mymethod4(myclass1.java)
at <OR>.mymethod5(myclass1.java)
at <OR>.mymethod6(myclass1.java)
at <OR>.access$100(myclass1.java)
at <OR>.access$500(myclass1.java)
at <OR>.access$600(myclass1.java)
at myclass1.mymethod0(myclass1.java)
at <OR>.mymethod1(myclass1.java)
at <OR>.mymethod2(myclass1.java)
at <OR>.mymethod3(myclass1.java)
at <OR>.mymethod4(myclass1.java)
at <OR>.mymethod5(myclass1.java)
at <OR>.mymethod6(myclass1.java)
at <OR>.access$100(myclass1.java)
at <OR>.access$500(myclass1.java)
at <OR>.access$600(myclass1.java)
at myclass1$6.mymethod9(myclass1.java)
I'm trying to build an uberjar using lein uberjar. During compiling, the following gets thrown:
Exception in thread "main" java.lang.NullPointerException, compiling:(/tmp/form-init8223412427040046857.clj:1:73)
at clojure.lang.Compiler.load(Compiler.java:7391)
at clojure.lang.Compiler.loadFile(Compiler.java:7317)
at clojure.main$load_script.invokeStatic(main.clj:275)
at clojure.main$init_opt.invokeStatic(main.clj:277)
at clojure.main$init_opt.invoke(main.clj:277)
at clojure.main$initialize.invokeStatic(main.clj:308)
at clojure.main$null_opt.invokeStatic(main.clj:342)
at clojure.main$null_opt.invoke(main.clj:339)
at clojure.main$main.invokeStatic(main.clj:421)
at clojure.main$main.doInvoke(main.clj:384)
at clojure.lang.RestFn.invoke(RestFn.java:421)
at clojure.lang.Var.invoke(Var.java:383)
at clojure.lang.AFn.applyToHelper(AFn.java:156)
at clojure.lang.Var.applyTo(Var.java:700)
at clojure.main.main(main.java:37)
Caused by: java.lang.NullPointerException
at clojure.string$lower_case.invokeStatic(string.clj:217)
at clojure.string$lower_case.invoke(string.clj:213)
at kappa.joke_classifier$is_jokable_QMARK_.invokeStatic(joke_classifier.clj:32)
at kappa.joke_classifier$is_jokable_QMARK_.invoke(joke_classifier.clj:29)
at kappa.core$maybe_joke.invokeStatic(core.clj:47)
at kappa.core$maybe_joke.invoke(core.clj:45)
at clojure.core$run_BANG_$fn__7276.invoke(core.clj:7393)
at clojure.lang.PersistentVector.reduce(PersistentVector.java:341)
at clojure.core$reduce.invokeStatic(core.clj:6544)
at clojure.core$run_BANG_.invokeStatic(core.clj:7388)
at clojure.core$run_BANG_.invoke(core.clj:7388)
at kappa.core$run.invokeStatic(core.clj:58)
at kappa.core$run.invoke(core.clj:53)
at kappa.core$_main.invokeStatic(core.clj:66)
at kappa.core$_main.doInvoke(core.clj:61)
at clojure.lang.RestFn.invoke(RestFn.java:397)
at clojure.lang.Var.invoke(Var.java:375)
at user$eval5.invokeStatic(form-init8223412427040046857.clj:1)
at user$eval5.invoke(form-init8223412427040046857.clj:1)
at clojure.lang.Compiler.eval(Compiler.java:6927)
at clojure.lang.Compiler.eval(Compiler.java:6917)
at clojure.lang.Compiler.load(Compiler.java:7379)
... 14 more
The code using string/lower-case looks as follows:
(defn is-jokable? [msg]
(and
(> 30 (count msg))
(= :positive (.classify classifier (str/lower-case msg)))
(< 1 (:positive (.probabilities classifier (str/lower-case msg))))))
As can be seen from the stack trace, my -main function calls a function that eventually calls is-jokable, and str/lower-case seems to be called with nil. If I understand correctly this is because of the AOT compilation happening for uberjars, but I'm not quite sure why exactly this problem occurs... I've already tried to read up on AOT, but didn't find anything helpful. Can you explain the inner workings of AOT to me?
I'm almost embarrassed I have posted this, it must have been too late in the night... ;)
I got completely distracted by the compiling and invokeStatic hints in the stacktrace, and just now found that this was indeed an everyday bug where I expected a map to contain a key/value pair that wasn't existent, leading to nil being passed to the function in question.
Thanks for the helpful comments!
With reference to my previous question,
Executing a lisp function from Java
I was able to call lisp code from Java using ABCL.
But the problem is, the already existing lisp code uses CL-PPCRE package.
I can not compile the code as it says 'CL-PPCRE not found'.
I have tried different approaches to add that package,
including
1) how does one compile a clisp program which uses cl-ppcre?
2)https://groups.google.com/forum/#!topic/cl-ppcre/juSfOhEDa1k
Doesnot work!
Other thing is, that executing (compile-file aima.asd) works perfectly fine although it does also require cl-pprce
(defpackage #:aima-asd
(:use :cl :asdf))
(in-package :aima-asd)
(defsystem aima
:name "aima"
:version "0.1"
:components ((:file "defpackage")
(:file "main" :depends-on ("defpackage")))
:depends-on (:cl-ppcre))
The final java code is
interpreter.eval("(load \"aima/asdf.lisp\")");
interpreter.eval("(compile-file \"aima/aima.asd\")");
interpreter.eval("(compile-file \"aima/defpackage.lisp\")");
interpreter.eval("(in-package :aima)");
interpreter.eval("(load \"aima/aima.lisp\")");
interpreter.eval("(aima-load 'all)");
The error message is
Error loading C:/Users/Administrator.NUIG-1Z7HN12/workspace/aima/probability/domains/edit-nets.lisp at line 376 (offset 16389)
#<THREAD "main" {3A188AF2}>: Debugger invoked on condition of type READER-ERROR
The package "CL-PPCRE" can't be found.
[1] AIMA(1):
Can anyone help me?
You need to load cl-ppcre before you can use it. You can do that by using (asdf:load-system :aima), provided that you put both aima and cl-ppcre into locations that your ASDF searches.
I used QuickLisp to add cl-ppcre (because nothing else worked for me).
Here is what I did
(load \"~/QuickLisp.lisp\")")
(quicklisp-quickstart:install)
(load "~/quicklisp/setup.lisp")
(ql:quickload :cl-ppcre)
First 2 lines are only a one time things. Once quickLisp is installed you can start from line 3.
I'm using iText (in the latest version 5.4.4) for a generic print of user interfaces.
I have a Problem on some UIs, getting a NullPointerException:
23.10.2013 14:53:23.066 - ERROR -Container.doAdd()
com.itextpdf.text.DocumentException: java.lang.NullPointerException
...
Caused by: java.lang.NullPointerException
at com.itextpdf.text.pdf.ColumnText.setSimpleVars(ColumnText.java:312)
at com.itextpdf.text.pdf.ColumnText.setACopy(ColumnText.java:305)
at com.itextpdf.text.pdf.ColumnText.duplicate(ColumnText.java:294)
at com.itextpdf.text.pdf.PdfPCell.<init>(PdfPCell.java:255)
at com.itextpdf.text.pdf.PdfPRow.<init>(PdfPRow.java:131)
at com.itextpdf.text.pdf.PdfPTable.<init>(PdfPTable.java:261)
at com.itextpdf.text.pdf.ColumnText.setSimpleVars(ColumnText.java:347)
at com.itextpdf.text.pdf.ColumnText.setACopy(ColumnText.java:305)
at com.itextpdf.text.pdf.ColumnText.duplicate(ColumnText.java:294)
at com.itextpdf.text.pdf.PdfPCell.getMaxHeight(PdfPCell.java:968)
at com.itextpdf.text.pdf.PdfPRow.calculateHeights(PdfPRow.java:209)
at com.itextpdf.text.pdf.PdfPRow.getMaxHeights(PdfPRow.java:592)
at com.itextpdf.text.pdf.PdfPTable.getRowHeight(PdfPTable.java:990)
at com.itextpdf.text.pdf.PdfPTable.getRowHeight(PdfPTable.java:971)
at com.itextpdf.text.pdf.ColumnText.goComposite(ColumnText.java:1821)
at com.itextpdf.text.pdf.ColumnText.go(ColumnText.java:882)
at com.itextpdf.text.pdf.ColumnText.go(ColumnText.java:877)
at com.itextpdf.text.pdf.PdfPRow.splitRow(PdfPRow.java:736)
at com.itextpdf.text.pdf.ColumnText.goComposite(ColumnText.java:1662)
at com.itextpdf.text.pdf.ColumnText.go(ColumnText.java:882)
at com.itextpdf.text.pdf.ColumnText.go(ColumnText.java:877)
at com.itextpdf.text.pdf.ColumnText.go(ColumnText.java:866)
at com.itextpdf.text.pdf.PdfDocument.addPTable(PdfDocument.java:2602)
at com.itextpdf.text.pdf.PdfDocument.add(PdfDocument.java:727)
... 24 more
After days of debugging my own code and the code of iText, I think I found the responsible line in class com.itextpdf.text.pdf.PdfPRow line 699:
newCells[k].setColumn(null);
I removed this line in the iText-API and the NullPointer does not appear any more. Then the program generates a PDF again, but there still is a problem that there is to many vertical space, which i couldn't fix yet.
Does anybody have the same Problem? Is it a bug in iText?
Thanks for help!
MaKu
I frequently get what appears to be a stackoverflow error ;-) from YUICompressor. The following is the first part of thousands of error lines that come from attempting to compress a 24074 byte css stylesheet (not the "Caused by java.lang.StackOverflowError about 8 lines down):
iMac1:src jas$ min ../style2.min.css style2.css
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.yahoo.platform.yui.compressor.Bootstrap.main(Bootstrap.java:21)
Caused by: java.lang.StackOverflowError
at java.lang.Character.codePointAt(Character.java:2335)
at java.util.regex.Pattern$CharProperty.match(Pattern.java:3344)
at java.util.regex.Pattern$Branch.match(Pattern.java:4114)
... (plus 1021 more error lines)
The errors happen usually after adding a couple of lines to the file getting compressed. The css is fine, and works perfectly in the uncompressed format. I don't see a particular pattern to the types of selectors added to the file that cause the errors. In this case, adding the following selector to a previously compressible file resulted in the errors:
#thisisatest
{
margin-left:87px;
}
I am wondering if there is perhaps a flag to java to enlarge the stack that might help. Or if that is not the problem, what is?
EDIT:
As I was posting this question, it dawned on me that I should check the java command to see if there was a parameter to enlarge the stack. Turns out that it is -Xssn, where "n" is a parameter to indicate the stack size. Its default value is 512k. So I tried 1024k but that still led to the stackoverflow. Trying 2048k works however, and I think this could be the solution.
EDIT 2:
While I no longer use this method for minification any longer, to be more specific here is the full command (which I have set up as a shell alias), showing how the -Xss2048k parameter is used:
java -Xss2048k -jar ~/Documents/RepHunter/Website\ Materials/Code/Third\ Party\ Libraries/YUI\ Compressor/yuicompressor-2.4.8.jar --type css -o
As posted in my edit, the solution was to add the parameters to the java command. The clue was the error line at the 5-th "at" line, as follows:
at com.yahoo.platform.yui.compressor.Bootstrap.main(Bootstrap.java:21)
Caused by: java.lang.StackOverflowError
Seeing that the issue was a "StackOverlowError" ;-) gave the suggestion to try to increase the stack size. The default is 512k. My first try of 1024k did not work. However increasing it to 2048k did work, and I have had no further issues.