Questions tagged [nullpointerexception]
The Java exception thrown when an application attempts to use null in a case where an object is required.
nullpointerexception
16,006
questions
-1
votes
1
answer
48
views
Runtime Error: field "val" because "<local5>.next" is null (Linked list reversal error) [duplicate]
The prev.next.val is working fine inside the while loop but if I print the same outside it gives error. I am not able to understand it why? But if I print the prev.next.val outside the while loop with ...
-1
votes
0
answers
112
views
java.lang.NullPointerException: Cannot invoke "org.springframework.core.env.Environment.getProperty(String)" because "this.env" is null
writing a common service to get user details by username as below:
package com.pustaknotika.common;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.slf4j.Logger;
...
-1
votes
0
answers
39
views
What could be causing this NullPointerException in the release build, and how can I prevent it from occurring?
I'm encountering a NullPointerException in my Jetpack Compose application, but only in the release build. The error message is:
java.lang.NullPointerException: Attempt to read from field 'androidx....
-1
votes
1
answer
47
views
Issue with ActionContext.getContext() returns null when migrating from Struts 2.5.33 to Struts 6.4.0
I am migrating from Struts 2.5.33 to Struts 6.4.0.
After following the guide at https://cwiki.apache.org/confluence/display/WW/Struts+2.5+to+6.0.0+migration, the app could not display the homepage ...
-1
votes
0
answers
25
views
Make IntelliJ IDEA warn for potential NullPointerExceptions during unboxing without assuming everything is @Nullable
Is there any way to more granularly control IntelliJ IDEA's inspections' "Nullability and data flow problems" option "Treat non-annotated members and parameters as @Nullable"? ...
-2
votes
0
answers
44
views
Redundant check for null triggers wrong compiler warning?
The following code
public final double[] array = {1, 1}; //cannot be null because 'array' is final
private double[] getArray() {
if (null != array && someCondition) { //redundant check ...
-1
votes
0
answers
32
views
New Object is returned from constructor without its dependency injected [duplicate]
I have this spring-boot code:
@SpringBootApplication
public class DemoApplication {
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
...
0
votes
0
answers
14
views
Apache pig throwing Nullpointer exception when filtering using a parameter ERROR 2000: Error processing rule PartitionFilterOptimizer
I am trying to store data in Apache hive using filter operation where MYVARIABLE is a parameter sent.
Filtering using the variable sends nullpointer exception .This happens when I try to store data in ...
0
votes
1
answer
40
views
Attempt to invoke virtual method 'android.os.CountDownTimer android.os.CountDownTimer.start()' on a null object reference
Error showing in logcat after running quiz app
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'android.os.CountDownTimer android.os.CountDownTimer.start()' on a null ...
1
vote
1
answer
48
views
Constructor parameter is null until parent is not initialized
Look at the following code:
abstract class A {
init {
f()
}
abstract fun f()
}
class B(val p: () -> Unit) : A() {
override fun f() {
try {
p()
...
2
votes
0
answers
65
views
Why does Java to invoke Integer.intValue() whenever the ternary operator ends up in the else case? [duplicate]
When I supply seed as anything greater than 4000, it does return it as is. But for any seed less than or equal to 4000 (i.e. when the ternary operator condition evaluates to false) this program ends ...
0
votes
0
answers
26
views
How do I fix this nullPointException exception in my program? [duplicate]
I'm trying to create a simple card game where the user faces against a computer (which is a class in my method that takes its turn automatically after the user), but I'm encountering a ...
0
votes
1
answer
81
views
I have a nullpointerexception problem in javafx, jdbc, postgresql, scene builder
I have a problem in fixing my java.lang.NullPointerException error.
Im able to connect to database, but I can't get data and put them into a Tableview. I always recieving: Cannot invoke "javafx....
0
votes
1
answer
60
views
NullPointerException Spark Scala when calling dataset in main from test class
I am trying to call a function that is defined in my Main Scala application from within a Test class. The function returns a Dataset of a class that is also defined in my Main app.
I want the data to ...
0
votes
0
answers
19
views
Simple animation using a JLabel and ImageIcon throwing an exception
I'm making a simple static animation at the start of my program, and it uses a timer and ImageIcons to work. Here is the code:
int staticChecker = 0;
private void btnStartMouseClicked(java.awt....