Questions tagged as 'nullpointerexception'

2
answers

I used an array in the parameter of a method and I do not know how to execute

import javax.swing.JOptionPane; public class Cliente { private String nome; private String telefone; private int codigo; private String rua; void setRua(String z) { rua = z; } void setTelefone(String t) {...
asked by 01.02.2015 / 20:45
1
answer

NullPointerException occurring

My teacher uses EasyAccept technology as error validation. One of the tests requires the use of Exception . In the code below, I was able to handle in a way that I think is appropriate, but it persists in one and the same error. p...
asked by 15.10.2015 / 21:19
1
answer

Vector Initialized but Null

I'm freaking out with a simple piece of code. My application is for giving information to use on a course. I add several cities, and then I try to add to the vector, but at the end the vector is always null. Here is the code: Ponto_Turi...
asked by 12.01.2017 / 00:58
1
answer

Why are you saying that this object is null?

papelX.moderador = abc.Id; papelX.participantes.Add(abc); I'm finding a NullReferenceException in this code above. I am creating a papelX object and will use some properties of the object abc . Visual Studio is saying that on...
asked by 23.06.2016 / 05:12
1
answer

Problem running eventhandler

I have a class, which is executed under a button, it makes two select in a bank. I am trying to do this with EventHandler , however, when running the system, it executes, but gives the error in the line: OnDataChange(info);...
asked by 05.06.2016 / 01:29
1
answer

Error using Lock Screen

I'm trying to block the screen with the following code: protected void onBloquear(View view) { DevicePolicyManager mDPM = null; mDPM.lockNow(); } Source: link But it gives the following error. Caused by: java.lang.NullPointe...
asked by 14.12.2016 / 23:41
2
answers

I'm having a nullpointer error and I do not know how to fix

The code I'm using is this: public ForumGroups getMainGroup() { if (Constants.SQL_ENABLED) { int lowest = -1; ForumGroups g = null; for (ForumGroup group : forumGroups) { if (group.ge...
asked by 27.08.2015 / 16:08
1
answer

java.lang.NullPointerException in this code

This is giving java.lang.NullPointerException error in these two classes. import javax.swing.JButton; import javax.swing.JPanel; import javax.swing.JTextArea; import javax.swing.JTextField; public class PrimosPanel extends JPanel { priva...
asked by 09.12.2014 / 11:22
1
answer

Generic object reference error

   System.NullReferenceException: Object reference not set to an instance of an object. This error is giving in the following code snippet: Arquivo arquivo = new Arquivo(); ArquivoVersao versao = new ArquivoVersao(); versao.XNOME = "teste"...
asked by 06.02.2015 / 19:48
1
answer

NullPointerException when trying to get Java compiler instance

Next, I'm trying to get a Java compiler instance through the following code: JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); if (compiler == null) { System.out.println("No compiler"); return; } The problem is that it...
asked by 05.10.2016 / 00:43