nullpointerexception

Testing RxJava2 using Espresso and getting a null pointer exception when suscribeOn

☆樱花仙子☆ 提交于 2019-12-23 07:26:02
问题 Android Studio 3.0 Beta2 I am testing getting a list for an endpoint using RxJava2. The app works fine when running normally. However, when I test using espresso I get a null pointer exception when I try and subscribeOn(scheduler) . For the schedulers I use the trampoline() for both subscribeOn and observeOn which are injected. Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'io.reactivex.Observable io.reactivex.Observable.subscribeOn(io.reactivex.Scheduler)' on a

Testing RxJava2 using Espresso and getting a null pointer exception when suscribeOn

时间秒杀一切 提交于 2019-12-23 07:24:50
问题 Android Studio 3.0 Beta2 I am testing getting a list for an endpoint using RxJava2. The app works fine when running normally. However, when I test using espresso I get a null pointer exception when I try and subscribeOn(scheduler) . For the schedulers I use the trampoline() for both subscribeOn and observeOn which are injected. Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'io.reactivex.Observable io.reactivex.Observable.subscribeOn(io.reactivex.Scheduler)' on a

Getting Instrumentation run failed due to 'java.lang.NullPointerException'

£可爱£侵袭症+ 提交于 2019-12-23 07:08:28
问题 I am trying to write Unit test cases for Activities in my app by extending the test class with ActivityUnitTestCase . I could successfully run the test cases earlier but now I'm always getting the exception while running them. Even though I'm pretty familiar with handling NullPointerExceptions , I couldn't figure out the problem that's causing this. I couldn't find any similar questions so I'm posting this one. Stack trace shows me there is a null object reference at this line in my code

NullPointerException thrown in where it can't be thrown

做~自己de王妃 提交于 2019-12-23 06:59:28
问题 I get a NullPointerException in a piece of code which can't throw it. I start thinking to have found a bug in JRE. I am using javac 1.8.0_51 as compiler, and the problem occurs both in jre 1.8.0_45 and the latest 1.8.0_60. The line throwing the exception is inside a loop, which is inside a closure lambda function. We are running such closure in spark 1.4. The line is executed 1-2 million times, and I get the error not deterministically, with the same input, once every 3 or 4 run. I'm pasting

Getting java.lang.nullPointerException using SharedPreferences

99封情书 提交于 2019-12-23 05:47:03
问题 I am trying to save the date of file parsing, so that when next time user, opens the application, the date can be checked against the last parsing date. I am using shared preference to save the data and retrieve it, but getting error. Here is the code : SharedPreferences settings = getPreferences(0); String today = new Date(System.currentTimeMillis()).toString(); SharedPreferences.Editor edit = settings.edit(); System.out.println("******** Today : " + today); edit.putString("lastdate", today)

Exception in thread “main” java.lang.NullPointerException at opennlp.tools.postag.POSTaggerME.train()

笑着哭i 提交于 2019-12-23 05:31:20
问题 There are same problem! I get InputSteram = null , I used IntelliJ IDEA, OpenNLP 1.9.1. on Ubuntu 18.04 public void makeDataTrainingModel() { model = null; System.out.println("POS model started"); //InputStream dataIn = null; InputStreamFactory dataIn = null; try { dataIn = new InputStreamFactory() { public InputStream createInputStream() throws IOException { return NLPClassifier.class.getResourceAsStream("/home/int/src /main/resources/en-pos.txt"); } }; //I get null pointer here in dataIn

Flashlight (Torch) is opening but not closing

半城伤御伤魂 提交于 2019-12-23 05:27:34
问题 Following is the code which I used for opening Torch and closing it. But when I close it, it crashes. LogCat says " Runtime Exception : Fail to connect to camera service "! + hasFlash is not getting any value and is throwing Nullpointer exception. (I'm using it to check if the flash is present or not.) What am I doing Wrong? boolean hasFlash = this.getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA_FLASH); if(hasFlash==true) { if(s.equalsIgnoreCase("FlashLight On") || s

Flashlight (Torch) is opening but not closing

匆匆过客 提交于 2019-12-23 05:27:13
问题 Following is the code which I used for opening Torch and closing it. But when I close it, it crashes. LogCat says " Runtime Exception : Fail to connect to camera service "! + hasFlash is not getting any value and is throwing Nullpointer exception. (I'm using it to check if the flash is present or not.) What am I doing Wrong? boolean hasFlash = this.getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA_FLASH); if(hasFlash==true) { if(s.equalsIgnoreCase("FlashLight On") || s

java code for importing xls data into mysql database [duplicate]

蓝咒 提交于 2019-12-23 05:11:16
问题 This question already has answers here : What is a NullPointerException, and how do I fix it? (12 answers) Closed 3 years ago . I'm trying to import xls file into mysql but getting an error of Nullpointer EXCEPTION please give me the solution package abhi; public class ImportData { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub try{ Class.forName("com.mysql.jdbc.Driver"); Connection con = (Connection) DriverManager.getConnection("jdbc:mysql:/

java code for importing xls data into mysql database [duplicate]

拜拜、爱过 提交于 2019-12-23 05:10:03
问题 This question already has answers here : What is a NullPointerException, and how do I fix it? (12 answers) Closed 3 years ago . I'm trying to import xls file into mysql but getting an error of Nullpointer EXCEPTION please give me the solution package abhi; public class ImportData { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub try{ Class.forName("com.mysql.jdbc.Driver"); Connection con = (Connection) DriverManager.getConnection("jdbc:mysql:/