nullpointerexception

NPE when drawing TabWidget in android (only on HTC Magic?)

I've received report from the user of an app I've written that he gets FC whenever starting a certain activity. I have not been able to reproduce the issue on the emulator or on my HTC Hero (running 1.5), but this user running HTC Magic (with 1.6) is facing this error every time. What bothers me is that no single step in the stacktrace ...

Why does this code throw a java.lang.NullPointerException?

I have found a source code and i added it to my frame just for testing which it uses Java2D. But it thows an exception. I don't understand why. my class: package ClientGUI; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Image; import java.awt.MediaTracker; import java.awt.RenderingH...

null pointer exception help

I'm getting a NullPointerException that I couldnt handle. I'm a newbie in java so I'd appreciate any help. <% Employee employees[] = (Employee []) request.getAttribute("arr"); Integer arr_size= (Integer) request.getAttribute("arr_size"); for(int i=0;i<employees.length;i++){ %> <tr><td><b>.</b></td><td><%=employees[i].getName()%></td><td...

nullpointer exception when initalizing a class in servlet

class mstLeastCountEdit { mstLeastCount reff; HttpServletRequest request; HttpServletResponse response; String msg = ""; String LcDesc=""; int i = 0; int noOfRows = 0; HttpSession session=request.getSession(true); Integer ccode=(Integer) session.getAttribute("companycode"); void updateEdit(mstLea...

Why do I get this NullPointerException?

I have a class User that contains attributes: nickname, ipAddress, sharedFolder. The idea is to have a user with these attributes and a list of files from a shared folder. This is my code: import java.io.*; import java.util.*; public class User { String nickname; String ipAddress; static ArrayList<String> listOfFiles; ...

How do I initialize an object of a class?

My code is something like: public class Foo { public int a; Bar[] bar = new Bar[10]; a = bar[0].baz; } public class Bar { public int b; public Bar () { //I tried doing away with this constructor, but that didn't //fix anything b = 0; } public int Baz () { //do somthing ...

j2me NullPointerException adding image to a vector

Hello, I'm doing this: private Vector menuOptions; void addOption(String imagefilename) { try { Image i = Image.createImage(imagefilename); menuOptions.addElement((Object)i); } catch (Exception e) { e.printStackTrace(); } } And I'm getting: java.lang.NullPointerException at GraphicMenu.addOptio...

NullPointerException but no null parameters passed to the function

There is a method of a 3rd party library we use (I can't name it because it's a commercial solution) which has a method which looks more or less like this (lots and lots params): numerix.setPrice(Instrument instrument,YieldCurve yc,TradeDate date,Currency c,...) I am 100% sure that each param I pass is non-null. Yet I get a NullPoint...

While loop not working

I am inputting this text file into the command line: 800 5 10 800 1 8 800 7 7 810 2 9 845 2 10 850 1 3 first column is time,then priority,then length the output is sorted by time plus the length, and the next item is outputted if the time of the item is less than or equal to the curren...

"Something wrong here, didn't expect PACKAGE to be resumed" error in andorid LogCat

I have an Android app modeled after the LunarLander example by Google. I am debugging it on a real device, (Motorola Droid) with Android 2.0. When the orientation changes, the program crashes on a null pointer Exception. Logcat from just before crash: 02-01 00:24:27.956: DEBUG/nate(8358): Starting Game 02-01 00:24:36.878: DEBUG/dalvi...

Why do I get a NullPointerException in this code?

public void addEmp(String emp_name, String emp_sal, String did) { EntityManagerFactory emf = Persistence.createEntityManagerFactory("transactions-optional"); EntityManager em = emf.createEntityManager(); try { String s = did; EntityTransaction transaction = em.getTransaction(); transaction.begin...

Java Null Pointer Exception

I attempted to adapt a class I had found on the web for a dynamic array of ints for a dynamic array of "Entities," but now I am getting a "NullPointerException." The code raising the exception is: public void initialize() { buffer = new BufferedImage(800,600,BufferedImage.TYPE_INT_RGB); Entities.put(Entities.getCurrentPos()+1, ...

Null Pointer Exception (with no cause)

Hi guys, I'm monitoring some server logs and there are quite a few NullPointerExceptions. The logs contain the stacktrace and the cause from getCause. The problem is that these NPEs do not contain a cause. In the JavaDocs it says that the cause is null when it's inexistent or unknown (not very helpful). So my question is, has somebod...

Can't determine what is throwing a NullPointer exception.

I have a method that looks like this: try { doStuff(); } catch (Exception ex) { logger.error(ex); } (I don't really use method names like doStuff - this is just to make things easy) In doStuff I do a variety of things, among them is call a data access method (so, another method within doStuff) that ends with the following: } cat...

EOFexception in Java when reading objectinputstream

I want to read multiple objects (my own class Term) that I have output to a .dat file, but I always get a nullPointException or EOFException. ObjectInputStream inputStream = new ObjectInputStream(new FileInputStream(masterFile)); Object o = null; while(( o = inputStream.readObject()) != null){ Term t = (Term)...

Seam not injecting Stateful EJB dependencies

I have not been able to find a solution to this problem and my post to the Seam forum has gone unanswered. I am hope someone here can help. I am a noob working with Seam, so I am sure I am just doing something stupid. Any help anyone can give me would be greatly appreciated... I have wasted hours and gotten nowhere. I used the jboss to...

Java runtime error: null pointer exception

This may be a little unconventional way of asking for help but my code is running into null pointer runtime errors but the scope of the runtime error is too big to post onto stackoverflow. I really want to figure this out so would it be possible for me to email one of you my code to figure out what is wrong? I know runtime errors tell t...

Exception in thread "thread-4" java.lang.NullPointerException

I'd really appreciate some help with my program Exception in thread "Thread-4" java.lang.NullPointerException at ServerConnect.replyChoice(BaseStaInstance.java:63) at ServerConnect.run(BaseStaInstance.java:45) at java.lang.Thread.run(Thread.java:619) my ServerConnect function looks like :- class ServerConnect extends ...

Why do I get a NullPointerException when comparing a String with null?

My code is breaking on the following line with a nullpointerexception: if (stringVariable.equals(null)){ Previous to this statement, I declare the stringVariable and set it to a database field. In this statement, I am trying to detect if the field had a null value, but unfortunately it breaks! Any thoughts? ...

Error android.graphics.Canvas.throwIfRecycled when overlaying bitmaps

Im trying to overlay images on a canvas using the following method: private Bitmap overlay(Bitmap bmp1, Bitmap bmp2) { bmOverlay = Bitmap.createBitmap(70, 70, Bitmap.Config.RGB_565); canvas = new Canvas(bmOverlay); canvas.drawBitmap(bmp1, 0, 0, null); //line 179 canvas.drawBitmap(bmp2, 0, 0, null); return bmOverlay...