Questions tagged [nullpointerexception]
The Java exception thrown when an application attempts to use null in a case where an object is required.
15,841
questions
0
votes
0
answers
10
views
How to share image loaded from server using picasso
String imageUrl = getIntent().getExtras().getString("img");
Picasso.get().load(imageUrl).into(imageView);
shareBtn.setOnClickListener(v -> {
BitmapDrawable ...
0
votes
1
answer
69
views
Can we use @Autowired annotation as a constructor argument? [duplicate]
In my case I am trying to use Environment class to read properties. I tried two options.
Option 1 - I tried to use @Autowired the Enviornment class as shown in the following example.
@Service("...
-1
votes
1
answer
31
views
Java Unexpected Exception : Cannot read the array length because "<local10>" is null
This is NOT about null handling BUT about different java Versions.
When I run the code in the IDE it runs fine.
But when I run the code in Windows via Git Bash I get
java.lang.NullPointerException: ...
0
votes
0
answers
21
views
Fail to initialize resources in android app - then NullPointerException
So, I have this android application and even some users. As I have a crash report system, I can see when someone's app crashes and the cause.
It appears that, though rarely, the app crashes randomly ...
0
votes
0
answers
26
views
Flutter: Cause: null pointer dereference
I'm facing a problem in release mode only,
App open > log-in > home (At the home screen it crashed).
I've checked by running in profile mode.
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault ...
-2
votes
0
answers
16
views
What is the Problem of this NullPointerException Java/EventSourcing [duplicate]
i can not identify the problem of these NullPointerException at this row:
eventProcessor.process(new PayedEvent(LocalDate.of(1970, 3, 20), t));
package veranstaltung;
import javax....
0
votes
0
answers
45
views
Eclipse export runnable Jar File NullPointerException [closed]
i have the Eclipse Version 2022-06 (4.24.0) and i cant export my Project as runnable File.Anyone know a Solution for Eclipse?
Log:
!ENTRY org.eclipse.ui 4 0 2022-07-03 12:35:34.536
!MESSAGE Unhandled ...
-3
votes
0
answers
18
views
java.lang.NullPointerException: Cannot read field "val" because "<local3>" is null at line 19, Solution.mergeTwoLists at line 54, __DriverSolution [closed]
Here is my code
enter image description here
enter image description here
And the error is
enter image description here
-3
votes
0
answers
15
views
J2E Java web developement NullpointerException [duplicate]
Its showing NullpointerException for PreparedStatement stmt =connection.prepareStatement(sql);
pls help having hard time solving it,i am not getting why am i getting this exception
public static List&...
-1
votes
0
answers
35
views
How do I remove the NullPointerException?
I am working on this code challenge:
Problem Description Postfix expressions are an ordering of
mathematical operations, where the operator(+,-,* etc) comes after the
operands.
For instance, an ...
0
votes
0
answers
10
views
Is there a way to get null value from db , it is throwing null pointer exception
Below is the method which returns string value from db for a particular column but that column holds null.I want null value but it is throwing null pointer exception.
dbManager.getAsString(query, ...
0
votes
3
answers
69
views
How to delete Null-elements from the Stream before applying collect?
My stream function sometime returns null, when I do collect them How to delete that null return?
versions.stream().map(vs->{
if(vs.matches("^matched string$")) {
.....
0
votes
1
answer
27
views
In C#, using .editorconfig, is there any way to force developers to declare every parameter is either nullable or not allowed?
In C#, I can express a parameter is nullable in a method's signature like:
private void doSomething(string? value)
Similarly, I can express a parameter must not be null like:
private void doSomething(...
0
votes
0
answers
35
views
SpringBoot Application cannot find wav file in linux server
I have a problem with springboot application that should work as a server for android application. I have audio file (.wav) that android application should receive from a server.
On local host it ...
2
votes
2
answers
49
views
Exception in Stream.anyMatch
I have some code that is playing with the java stream api:
boolean isAuthorized = authorizationByTenant.stream()
.filter(auth -> auth.getTenantName().equalsIgnoreCase(tenant))
...
0
votes
1
answer
22
views
AEM JUnit java.lang.NullPointerException
I need to create a Junit test for a class in an AEM project and I'm having NullPointerException problems:
I create the ClassTestImpl
@ExtendWith({AemContextExtension.class, MockitoExtension.class})
...
0
votes
2
answers
42
views
java.lang.NullPointerException: Attempt to invoke virtual method, causing app to crash
I'm particularly new to this field. I'm trying to create a login page using fragments and it crashed when I tried to run it. I checked the logcat, turns out its a NullPointerException. It highlighted ...
0
votes
0
answers
23
views
Attempt to invoke virtual method 'boolean android.content.Intent.migrateExtraStreamToClipData()' on a null object reference
The error appears when I'm trying to swipe a button. Here is the code of the activity, the error log shows the issue is in the saveReservation() method at startActivity(parentIntent):
private ...
-1
votes
0
answers
13
views
when I try to get fetch the object from getfactory() its showing null when create in jsp file can anyone please help me with this
package com.mycompany.demo.helper;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
public class FactoryProvider {
private static SessionFactory factory;
public ...
0
votes
1
answer
34
views
Why NullPointerException occurs when calling getColor from single instance?
google play crash log:
Caused by: java.lang.NullPointerException:
at com.manager.loader.SkinManager.getColor (SkinManager.java:28)
at base.util.ui.titlebar.BaseTitlebarFragmentActivity....
0
votes
1
answer
27
views
NumberFormatException in Kotlin (IntelliJ)
Here is what I am trying to do, I want the user to enter whatever number and it should be displayed, but I am getting this error.
import java.util.*
This is my code
fun main(){
print("Enter your ...
0
votes
0
answers
23
views
Null pointer exception in adapter crash show in firebase analytics in production build
I get null pointer exception in adapter and can't figure it out what is wrong with my code. Its working fine in test builds but in production build it give crash in firebase analytics.
Adapter code is:...
-1
votes
0
answers
47
views
Null Pointer Exception in Java and Eclipse [duplicate]
I have received an error as "java null pointer exception".
My request:
public class eFinanseArchiveMainClass {
public static void main(String[] args) {
// TODO Auto-generated ...
0
votes
0
answers
17
views
I migrate my android project to androidX, change all needed to be change, but some new errors appears on things I don't touch, Why?
I migrate my application on AndroidX, I fix many problem resulting, until I can build succesly my project. But when I launch my application(success) and try to use it, I have some bug and the app ...
0
votes
0
answers
24
views
How to resolve Java.lang.ThreadLocal.get() is null when trying to run Parallel plus Sequential execution in testng.xml?
In testng.xml, I am running few tests paralleled(parallel="classes" thread-count="5") and few sequentially as two different tests. But for first testmethod from second test it is ...
0
votes
2
answers
54
views
kotlin findViewById returns null
I have the following code which after clicking on the button findViewById returns null but when I set the onclick attribute of the picture itself to change the picture there is no null exception ...
-2
votes
0
answers
53
views
regarding java null pointer exception handling
hey I am a beginner in java development field I want to know that what is the possibilities to take care of null pointer exception in spring boot , is there any solution to add some dependency in ...
0
votes
0
answers
22
views
How to get rid of java.lang.NullPointerException while calling method in method in java [duplicate]
I'm making a command line Pokémon game, in which,
Taschenmonster.java has all attributes and methods of Pokémon
Trainer.java attributes and methods of trainer. The battle method in Arena.java executes ...
0
votes
1
answer
53
views
Flutter Android build not working in existing app on fresh Linux install
I have an existing flutter app (on GitHub here) that is working fine on my Windows 11 and MacOS machines, and was previously working on my Linux machine.
I installed a new distro a few days ago (...
0
votes
1
answer
70
views
Get email body content in selenium java using GmailAPI
Getting
runtimexception : illegalArgumentException cannot invoke method getAt() on null object
unsure what is the null obj it is referring but I'm sure it is happening on execution of email body ...
-1
votes
0
answers
35
views
Nullpointer in computeIfAbsent on a concurrentHasmap
I got a weird Nullpointer exception in the computeIfAbsent method.
I have a concurrent hash map, as I am well aware, that the init process, may be triggered by multiple threads nearly at the same time....
-2
votes
1
answer
63
views
NullPointerException but why? [duplicate]
I have class where
@Enumerated(EnumType.STRING)
private StateOfDispatchToWD stateOfDispatchToWD = StateOfDispatchToWD.NONE;
And getter and setter:
public StateOfDispatchToWD ...
1
vote
1
answer
24
views
Android fragment DataBinding nonnull getter return null
As per the android documentation, To get the data binding within a fragment, I use a non-nullable getter, but sometimes' When I try to access it again, after I'm wait for the user to do something, I ...
0
votes
0
answers
19
views
Remove Android Studio "Method invocation 'getFragment' may produce 'NullPointerException" warning?
Android studio gives me warning Method invocation 'getFragment' may produce 'NullPointerException' on the following statement
toSwitch = ((LoginActivity) getActivity()).getFragment(LoginFragment.class....
-3
votes
0
answers
26
views
NullPointerException error while trying to load another activity that have some methods [duplicate]
I'm facing a problem while I made this dashboard activity and the nav_side_menu activity following a YouTube tutorial
error:
java.lang.RuntimeException: Unable to start activity ComponentInfo{com....
0
votes
1
answer
18
views
Get Data from Firebase but I got error View.findViewById(R.id.tv_percent) must not be null
Does anyone can help me ?
I want to get data from firebase, all the code already green but when I try to move to my IOT fragment it forced close and the error:
java.lang.NullPointerException: itemView....
0
votes
0
answers
34
views
NullPointerException: Attempt to invoke virtual method 'int android.view.ViewGroup.getPaddingBottom()' on a null object reference
Crashing when I am trying to inflate menu to BottomNavigationView but got crash on same. I have updated material design library from 'com.google.android.material:material:1.2.1' to 'com.google.android....
0
votes
1
answer
47
views
Java FlatLaf - NullPointerException when serializing TableModel on another Thread while UI is visible
A NullPointerException is thrown when trying to serialize a TableModel object while the associated JTable object is visible in a JFrame. I created a minimal, reproducible Example and will also include ...
0
votes
0
answers
8
views
I was asked to check the object returned by dimensionChange() but In Main class I am getting null pointer exception error. How can I fix this?
The method dimensionChange() in Rectangle class returning null is the given condition and it is asked to check whether the object returned by dimensionChange() is an instance of class using instanceof ...
0
votes
0
answers
73
views
NullPointerException in java.base/java.util.StringTokenizer.isDelimiter
Sometimes I'm getting a NullPointerException in
java.base/java.util.StringTokenizer.isDelimiter
but I can't reproduce this consistently.
Here's the stacktrace:
java.base/java.util.StringTokenizer....
1
vote
1
answer
57
views
Why does my Android Dialog throw a NullPointer?
i've been struggling with a simple Android Dialog that I need in order to add elements to a list; it's pretty simple (an edit text, a spinner and a button), but when I try to show it it just keeps ...
0
votes
0
answers
26
views
The repository implementation object is null in Spring Data JPA
I am studying the book "Java Persistence with Spring Data and Hibernate", the Spring Data JPA (last) example in Chapter 2.
I closely followed the book, but still I am getting the error:
...
0
votes
1
answer
34
views
If getIntent is null Firebase
I am using firebase realtime database in my application. If the data I send with Intent is empty, the application closes. If the data in the intent is empty, how can I connect to the database and pull ...
0
votes
0
answers
31
views
Java NullPointerException on serialization of TableModel when associated JTable is on visible JFrame
A NullPointerException is thrown when trying to serialize a TableModel object while the associated JTable object is visible in a JFrame. I created a minimal, reproducible Example and will also include ...
1
vote
1
answer
18
views
TypeScript: Is there a cleaner way to null check a hierarchical object structure?
I'm currently null checking an object structure like so:
if (error.response && error.response.data && error.response.data.errorMessage)
{
// Do stuff
}
All I really want to do is ...
0
votes
1
answer
77
views
getClass().getResource() throws a NullPointerException [duplicate]
I'm currently trying to start coding an app with IntelliJ and JavaFX, I have the following code :
package main.gui;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx....
-2
votes
0
answers
15
views
Cannot read field “next” Because “x0”is null [duplicate]
Here is the error message:
Exception in thread "main"java.lang.NullPointerException: Cannot read field "next" because "x0" is null
at com.Marco.LinkedList$Node....
-4
votes
0
answers
20
views
Attempt to invoke virtual method 'android.content.res.AssetManager android.content.Context.getAssets()' on a null object reference [duplicate]
I am modding YoWhatsApp with MT manager. But when I try to mod It throws Java Null errorr.
Even if I don't change anything and recompile it just doesn't start and throws error. I think it's some kind ...
1
vote
1
answer
43
views
Scala null pointer exception cause by .toString on a variable which is not null
Can anyone please explain the following behavior in scala?
Basically in the following piece of code, if you do getOptionValue[Int](None), it returns 0 but when you do getOptionValue[Int](None)....
2
votes
0
answers
46
views
How can a stacktrace show an NPE from code that can't throw an NPE?
Given code that hasn't been touched for two years, and that never saw such a problem before, is there any explanation for this stack trace:
at java.lang.Thread.run(Thread.java:818)\nCaused by: java....