nullpointerexception

Getting TDS driver - java.lang.NullPointerException. this exception is not consistent

核能气质少年 提交于 2020-01-03 06:46:14
问题 I am getting exception when a method is called from 3 or 4 threads. This method get a DataBase connection inside method and populate some values from DB and then connection (connection, resultset and prepareStatement) getting closed properly inside method only. Still getting exception. Thread_1 - abc() method called. connection opened and closed inside method. Thread_2 - abc() method called. connection opened and closed inside method. Thread_3 - abc() method called. connection opened and

ArrayList null pointer exception

丶灬走出姿态 提交于 2020-01-03 03:17:08
问题 I have created an arraylist, and a ListView. I intend to iterate through the ListView, and checking whether they are checked or not, and then add the object (using ListView.getItem()) to my arraylist. however I get a NullPointerException. The ArrayList people_selected, is declared at top of class like this: ArrayList<PeopleDetails> selected_people; And my code: for (int i = 0; i < people_list.getCount(); i++) { item_view = people_list.getAdapter().getView(i, null, null); chBox = (CheckBox)

Null pointer exception when loading fragment

限于喜欢 提交于 2020-01-02 23:18:11
问题 I am working on my final project in android-programming course (so I'm still pretty new). I'm building my own media player. I implemented a Drawer that contains the different media types (video, audio, stream etc.) and what I want is to have each clicked item load a fragment that will tackle the task. The first one I'm working on is the audio fragment. It is th esecond on the list but i think it'll e easier than the video. Anyway. when I click on "audio" (picture link) I get a null pointer

strange java string array null pointer exception [duplicate]

荒凉一梦 提交于 2020-01-02 21:13:33
问题 This question already has answers here : What is a NullPointerException, and how do I fix it? (12 answers) Closed last year . This problem came up in a practice test: create a new string array, initialize it to null, then initializing the first element and printing it. Why does this result in a null pointer exception? Why doesn't it print "one"? Is it something to do with string immutability? public static void main(String args[]) { try { String arr[] = new String[10]; arr = null; arr[0] =

Java order of OR comparison

一曲冷凌霜 提交于 2020-01-02 06:23:09
问题 does the following snippet throw NPE when argument is null? public void doSomething(String string) { if (string.trim().equals("") || string==null) { [...] } } I've found this in someone else's code (someone else who should be more experienced than me). Since I've been facing difficulties with this code, I want to ask if the comparison should be inverted or the Java compiler is someway smart enough to swap the operands. I don't have direct control over this code, nor this throws me NPE because

Autowired property is null - Spring Boot Configuration

北战南征 提交于 2020-01-01 18:53:34
问题 I am stuck with null values in an autowired property. I am hoping I could get some help. We are using for the project spring-boot version 0.5.0.M6. The four configuration files with beans are in one package and are sorted by "area": Data source configuration Global method security configuration (as we use Spring-ACL) MVC configuration Spring Security configuration The main method that bootstraps everything is in the following file: @EnableAspectJAutoProxy @EnableSpringConfigured

Eclipse Luna gives NullPointerException when debugging hits a breakpoint

有些话、适合烂在心里 提交于 2020-01-01 11:36:48
问题 Whenever I hit a breakpoint in my code, I see an obnoxious dialog informing me that "Perspective switch job has encountered a problem", the details of which simply say "NullPointerException". The error log shows this stack trace: java.lang.NullPointerException at org.eclipse.ui.internal.WorkbenchPage.showPart(WorkbenchPage.java:1298) at org.eclipse.ui.internal.WorkbenchPage.busyShowView(WorkbenchPage.java:1269) at org.eclipse.ui.internal.WorkbenchPage$13.run(WorkbenchPage.java:4144) at org

converting blob to an image stream and assign it to jLabel

我怕爱的太早我们不能终老 提交于 2020-01-01 06:35:13
问题 I am just trying to Convert a blob string which is in Database to Byte array and then after converting it convert to buffered Image and then assign it to a label Here's my code package ims.project; import java.sql.*; import javax.swing.*; import java.awt.*; import java.awt.image.BufferedImage; import java.io.ByteArrayInputStream; import javax.imageio.ImageIO; public class readingdata extends JFrame { readingdata() { JPanel pane = new JPanel(); JLabel label1 = new JLabel("help"); JLabel label2

Android proguard obfuscated code is causing NullPointerException when it really shouldn't be

独自空忆成欢 提交于 2020-01-01 05:22:12
问题 I have distributed an application on the Android Marketplace. I am getting error reports back in from a small handful of users (maybe 2%) where they are getting NullPointerExceptions where it doesn't make logical sense. I have never been able to replicate this myself. The code is relatively straightforward and is a common code path that EVERY user has to follow. I've actually taken every separate line of code that could possibly be creating the NPE and wrapped it in a try-catch block and

Switching to a specific fragment gives strange java.lang.NullPointerException

落花浮王杯 提交于 2020-01-01 04:35:31
问题 Here is the problem i am currently facing. I have switched from Eclipse with ADT plugin to Android Studio recently and an error i never encountered on Eclipse appeared with Android studio. When I switch to a specific fragment called "LineFragment" I get the following error : java.lang.NullPointerException: Attempt to write to field 'int android.support.v4.app.Fragment.mNextAnim' on a null object reference at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:708) at android