public Command showPopupDialog(Component c) in dialog class throwing an error - java

Am calling a popup dialog, this throws an error.
This code previously worked, but i recently uploaded a new build and my new build now produces an error message on the 15/07/2019
public Command showPopupDialog(Component c). this is the method in the Dialog class am calling.
Getting the following error message
java.lang.NullPointerException
at com.codename1.ui.plaf.Border.paintBorderBackground(Border.java:1435)
[EDT] 0:0:0,19 - Exception: java.lang.NullPointerException - null
at com.codename1.ui.plaf.Border.paintBorderBackground(Border.java:1267)
at com.codename1.ui.Component.paintBackgroundImpl(Component.java:2661)
at com.codename1.ui.Component.paintComponentBackground(Component.java:2625)
at com.codename1.ui.Container.paintComponentBackground(Container.java:2546)
at com.codename1.ui.Component.internalPaintImpl(Component.java:2239)
at com.codename1.ui.Component.paintInternalImpl(Component.java:2228)
at com.codename1.ui.Component.paintInternal(Component.java:2203)
at com.codename1.ui.Container.paint(Container.java:1639)
at com.codename1.ui.Form.paint(Form.java:4180)
at com.codename1.ui.Component.internalPaintImpl(Component.java:2255)
at com.codename1.ui.Form.internalPaintImpl(Form.java:4190)
at com.codename1.ui.Component.paintInternalImpl(Component.java:2228)
at com.codename1.ui.Component.paintInternal(Component.java:2203)
at com.codename1.ui.Component.paintInternal(Component.java:2171)
[EDT] 0:0:0,66 - Exception: java.lang.NullPointerException - null
at com.codename1.ui.Component.paintComponent(Component.java:2468)
at com.codename1.ui.animations.CommonTransitions.paint(CommonTransitions.java:1139)
at com.codename1.ui.animations.CommonTransitions.initTransition(CommonTransitions.java:469)
at com.codename1.ui.Display.initTransition(Display.java:1576)
at com.codename1.ui.Display.setCurrent(Display.java:1535)
at com.codename1.ui.Form.showModal(Form.java:2303)
at com.codename1.ui.Dialog.showModal(Dialog.java:1138)
at com.codename1.ui.Dialog.show(Dialog.java:582)
at com.codename1.ui.Dialog.showPopupDialog(Dialog.java:1287)
at com.codename1.ui.Dialog.showPopupDialog(Dialog.java:1154)

Either you're passing a parameter that's null, or you are trying to call a method on an object that is null.
So the simplest way of finding out which is null, is doing this:
System.out.println("myObject = "+myObject);
for every object that you're using near the nullpointer exception until you find something that's null.

This is a regression due to the fix for this issue. We fixed it and it will be available in the next update.
I'm guessing you have a style for PopupDialog in your theme. I suggest removing it as a workaround.

Related

Error in dynamoDB mapper scan() : java.lang.NullPointerException: null

I am getting below error while calling
dynamoDBMapper.scan(Person.class, new DynamoDBScanExpression())
java.lang.NullPointerException: null
at com.amazonaws.services.dynamodbv2.model.ScanRequest.setScanFilter(ScanRequest.java)
at com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBMapper.createScanRequestFromExpression(DynamoDBMapper.java:1692)
at com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBMapper.scan(DynamoDBMapper.java:1569)
at com.amazonaws.services.dynamodbv2.datamodeling.AbstractDynamoDBMapper.scan(AbstractDynamoDBMapper.java:236)
With the same dynamoDBMapper, dynamoDBMapper.save(person1) is working fine.
The NullPointerExecption is coming inside of ScanRequest.setScanFilter method of the AWS SDK.
Although, the method setScanFilter has only one line of code, the stacktrace is not showing the line-number where the exception occurred.
The method ScanRequest.setScanFilter looks like this.
public void setScanFilter(java.util.Map<String, Condition> scanFilter) {
this.scanFilter = scanFilter;
}
Not sure how this.scanFilter = scanFilter can cause a NullPointerException
Spring Boot - 2.2.6.RELEASE
DynamoDB SDK - 1.11.555
Java - Corretto-8.242.08.1
#ShrinivasShukla I also found the NPE when Contrast is wired up in Application. In my case Probably Contrast is disabling/blocking scanRequest.setScanFilter(scanExpression.getScanFilter() to work.

Android file is and isn't null

That is the best way in which I can describe what's going on.
This is my line of code:
if (offer.getFamily().getProfileImage() == null)
And this is what the debugger is showing:
Both offer and family aren't null.
So instead of going inside the if like it should it tries to get the file path and of course it fails with a NullPointerException.
java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.isEmpty()' on a null object reference
at java.io.UnixFileSystem.resolve(UnixFileSystem.java:95)
at java.io.UnixFileSystem.resolve(UnixFileSystem.java:130)
at java.io.File.getAbsolutePath(File.java:524)
at com.yournanny.utilities.ProfileImageUtilities.showProfileImage(ProfileImageUtilities.java:109)
Here is where I get the error:
public static void showProfileImage(User user, ImageView image) {
image.setImageBitmap(BitmapFactory.decodeFile(user.getProfileImage().getAbsolutePath()));
}
What is going on here?
Update
Looking at the comments I broke the chains and re-run it, neither offer or getFamily() return null, if I call other method over them I get the expected values.
But getProfileImage() is definitely returning null, the problem is that somehow it isn't null enough when I compare it in the if.
But on calling getProfileImage().getAbsolutePath() I get this:
Well apparently the problem was with the deserialization of the offer (and particularly of the family inside of it).
I was getting offer through a retrofit get call.
I added transient to the profileImage attribute and this fixed the problem:
private transient File profileImage;
Now this is what the debugger shows:
So I'm guessing gson (I'm using it to deserialize the retrofit responses) was creating a file without a assigning it a path and that's why it was and wasn't null.
But a proper explanation would be great.
The File was non-null but its name was null internally.

com.sun.jdi.InvocationException occurred invoking method error in ognlRuntime

I am getting "com.sun.jdi.InvocationException occurred invoking method" error when I debug in eclipse and is in ognlRuntime.
The error occured when I am passing a value from jsp to the action class.
This is the code in jsp for passing the value
<s:textfield name="partReplace.part.number" cssStyle="width:50px;" value ="%{partReplace.part.number}"/></td>
and when I enter vlue in that textfield it is not setting in the action class. I debuuged and found the "com.sun.jdi.InvocationException occurred invoking method" error in ognlRuntime and it is not taking the value..
Your problem seems to be the same of this question;
if so, the guilty should be an incorrect override of the toString() method of your class, invoked by the Eclipse Debugger.
Correct your custom toString() method, or block him from throwing exceptions (a big try-catch inside) or remove it completely, and retry.
P.S: this is the first result on Google searching your Exception... and is on SO too :|

Exception breakpoint occurred at EventDispatchThread.java

we are getting this error at the end of running application. I search in google buti don't know what cause this error and what this means. What to do and how to solve it?
i even don't know what raise this exception...
Exception breakpoint occurred at line 145 of EventDispatchThread.java.
java.lang.NullPointerException:
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at oracle.jbo.uicli.jui.JUTableBinding$JUTableModel$2.run(JUTableBinding.java:1209)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
Don't know what kind of searches you have performed on Google. I would suggest looking up each error (or rather each class where error occurs). Starting from the beginning as subsequent errors may be a due to error propagation. Two searches for EventDispatchThread and JUTableBinding.java may provide some insight at what went wrong.
http://www.docjar.org/docs/api/java/awt/EventDispatchThread.html
It seems that this class deals with AWT components ("takes events off the EventQueue and dispatches them to the appropriate AWT components")
For the JUTableBinding.java there are quite a few pages that say about NullPointerException
https://forums.oracle.com/forums/thread.jspa?threadID=515213
https://forums.oracle.com/forums/thread.jspa?threadID=2343921
https://kr.forums.oracle.com/forums/thread.jspa?threadID=503593
Some of them say that the problem may be with jdk version (seems 1.6 and above throw errors). I would assume that may be the case. Try to recompile using earlier versions of jdk and check whether error is still there. If it is not this then we will investigate further.
"I've looked into the code and found out that JUTableBinding.JUTableModel calls
mScrollUnit = control.getScrollableUnitIncrement(null,
SwingConstants.VERTICAL, 0);
(Line 947)
This was okay in Java 5, since JTable's getScrollableUnitIncrement just returned the row height."
"I changed the line to:
mScrollUnit = control.getScrollableUnitIncrement(
control.getVisibleRect(), SwingConstants.VERTICAL, 0);
and everything works fine on Java 6..."
Hope it helps.

CConvertException in Play! Framework

I'm fixing up a HTML template for rendering a PDF file. The problem is that the new code I'm using works for one template but throws a CConvertException in another. The console doesn't give me any hints other than the following error:
Oops: CConvertException
An unexpected error occured caused by exception CConvertException:
ERROR: An unhandled exception occured: ERROR: An Exception occured while reconstructing the pdf document: ERROR: An unhandled exception occured: null
The new code involves using a new Java Extension that converts a String into another, as follows:
#{if person?.name != null} ${person?.name.getInitials().toString()} #{/if}
For some reason, this exact code breaks one template but works just fine in another. What am I doing wrong?
Don't know for sure if this is the cause, but your use of the safe navigation operator ?. is kind of weird here. And wouldn't getInitials() automatically return a String?
Why not just write (without the surrounding if statement):
// Returns the name or an empty String if name or person is null.
${person?.name?.getInitials() ?: ""}

Categories