nullpointerexception

Android: NullPointerException at android.app.ActivityThread$PackageInfo$ServiceDispatcher.doConnected(ActivityThread.java:1012)

Hello, I am getting a NullPointerException at android.app.ActivityThread$PackageInfo$ServiceDispatcher.doConnected(ActivityThread.java:1012). My application is not even in the stack trace, so I have no idea what is going on. I am trying to connect to a service when it happens. How can I fix this problem? Thanks, Isaac Waller ...

What would cause a NullPointerException when running a JAR from the command line, but not from an IDE?

I have a project in Eclipse. When I run it from inside Eclipse, everything works just fine. However, when I run the Ant build script and execute the JAR either from the command line or using a batch script, I get a NullPointerException. The NullPointerException in question is being thrown from a third-party JAR that I compiled from sour...

What causes a NullPointerException in the AWT-EventQueue-0 thread

I'm trying to do something to track down the problem, but there's not much I can do until paintContents, and everything there looks good through my debugger, but I'll double check to make sure I didn't miss anything. At the very least, I would like to know how to silently handle these (such as catching them and being able to output a mea...

Why doesn't Java tell you which pointer is null?

I've always wondered why the JVM doesn't tell you which pointer (or more precisely, which variable) is null when a NullPointerException is thrown. A line number isn't specific enough because the offending line can often contain numerous variables that could have caused the error. Is there any compiler or JVM flag that would make these ...

Avoiding null pointer exceptions in a large c++ code base

I have inherited a large c++ code base and I have a task to avoid any null pointer exceptions that can happen in the code base. Are there are static analysis tools available, I am thinking lint, that you have used successfully. What other things do you look out for? ...

nullpointerexception on request.getHeaderNames method call in websphere

In websphere (version 6 sp11) on request.getHeaderNames method call, i get this exception java.lang.NullPointerException at com.ibm.ws.webcontainer.srt.SRTServletRequest.getHeaderNames(SRTServletRequest.java:345) at .... I dont have source code for SRTServletRequest. Has anybody faced this problem? ...

What's wrong with this code?

I wrote this code: public class FileViewer extends JPanel implements ActionListener { /** * */ private static final long serialVersionUID = 1L; JFileChooser chooser; FileNameExtensionFilter filter = null; JEditorPane pane = null; JTextField text = null; JButton button; JTextArea o = null; URL url; public FileViewer(JTextArea...

solving this NullPointerException on java's binarySearch

I'm solving sphere's online judge shortest path problem. This bit of code is giving me trouble: int sourceIndex = Arrays.binarySearch(citiesIds,source); int destinationIndex= Arrays.binarySearch(citiesIds, destination); double [] distancesFromSource = g.distancesFrom(sourceIndex); int destinationDistance = (int)distancesFromSource[de...

Nullpointer exception

There is a possiblity that this may be a dupicate question. I initialize a String variable to null.I may or may not update it with a value.Now I want to check whether this variable is not equal to null and whatever I try I get a null pointer exception.I can't afford to throw nullpointer exception as it is costly.Is there any workaround t...

Why am I getting a crash when exiting my Activity?

I am experiencing a crash in my app when I quit (via the back button) out of my Activity. So far as I can tell this is happening in the Android codebase and not mine, but I'm not completely convinced of that. Here's the stacktrace from adb: AndroidRuntime E Uncaught handler: thread main exiting due to uncaught exception AndroidRuntim...

Can NullPointerExceptions cause Tomcat performance issues after they've stopped happening?

Hi, all. One of my applications runs on a Windows Service instance of Tomcat 5.5, running Java 1.6. We've got an issue in the code where the application creates a NullPointerException if a SOAP request times out. We had an issue, this morning, where the component on the other side of the SOAP request was unavailable. The result was a...

NullPointerException while adding data to the database from online page

Hi All, I am getting a NullPointerException Exception while adding data from the online JSP page. The error description is as follows: javax.transaction.TransactionRolledbackException: CORBA TRANSACTION_ROLLEDBACK 0x0 No; nested exception is: org.omg.CORBA.TRANSACTION_ROLLEDBACK: javax.transaction.TransactionRolledbackException: ; ne...

Impossible null pointer

Hey, I have a real weird problem. I have 2 classes: (very important note: this is an example cause I can't paste the original code, I wrote it as text with no compiler) class B { private int num = 9; public int getNum(){ return num; } public void setNum(int num){ this.num = num; } } class A { pri...

Problems with createImage(int width, int height)

I have the following code, which is run every 10ms as part of a game: private void gameRender() { if(dbImage == null) { //createImage() returns null if GraphicsEnvironment.isHeadless() //returns true. (java.awt.GraphicsEnvironment) dbImage = createImage(PWIDTH, PHEIGHT); if(dbImage == null) ...

Android: this.getApplication() returns NULL pointer

I'm running the following line in an Activity, which is within the same application, but in a different package: AppObject appObj = (AppObject)this.getApplication(); // FYI: AppObject is my extension class of Application. It returns only a null pointer, while when I move it to the "main" package and run it from there it returns the ap...

Spring security - SecurityContext.authentication null in taglib and jsp but ok in controller

Hi all, I've been struggling with this issue for a little while now. Found several posts about it but none solved my problem. It will probably have something to do with the fact that a SecurityContext is boud to a specific Thread but even then I do not know how to solve it: Consider following code to retrieve the user that was logged i...

Java NullPointerException

I'm writing two classes to handle simple auctions. I have a class ready and working, which handles the operations for a single auction, and now I'm writing another class like an auction house, to keep track of all the auctions available. When testing the following part of the class: import java.util.ArrayList; public class AuctionHouse...

Strange nullPointerException in Java

I'm writing an app for Java ME, and I need a class for holding some data(PhoneBook). When I'm trying to launch this app, I'm always getting a nullPointerException. I'm calling the constructor of a class, and it allocates memory for 10 elements, so it shouldn't be null. What am I doing wrong? import javax.microedition.lcdui.*; import ja...

NullPointerException when trying to set a jcheckbox

Trying to set it so if a certain condition is met then one of two check-boxes will be checked. However I keep getting a nullpointerexception error. the code is.. //Set the flat rate or hourly billing check boxes. if(flatRateint > 0) { InvoiceUI.jCheckBox1.setSelected(true); } else { InvoiceUI.jCheck...

When/how often to check whether object is null

I was writing some code and while unit testing I got a Null Pointer Exception...Now I'm wondering how often should we be checking that object is not null before doing get operations on it? For example, code was: HashMap paramMap = new HashMap(); getSqlMapClientTemplate().queryForObject("reexamination.isAuthorized", paramMap); return ((...