• Post Reply Bookmark Topic Watch Topic
  • New Topic

NullPointerException  RSS feed

 
Rangini Ramchander
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
java.lang.NullPointerException
at com.realsoftinc.admc.modules.osmonmodule.SunSolStub.GetPCpuTime(Unknown Source)
at com.realsoftinc.admc.modules.osmonmodule.OsMonModuleSunSol$ProcessMonitor.run(Unknown Source)
at java.util.TimerThread.mainLoop(Timer.java:432)
at java.util.TimerThread.run(Timer.java:382)
**********testof admcprocxmllogfillvector******** com.realsoftinc.admc.lib.admin


I am facing the Nullpointer exception, pls give me solution exactly where it is throwing this exception.

public final class ProcessMonitor extends TimerTask{
//double CpuTime;
double CfgCpuTime;
String PrComd;
String x_Priority ="";
private static final double CpuTime = 0;

public void run(){

if (runMonitor) {

if(fname ==null)
fname="";
if(line==-1)
line =0;

String msgTrap;
String date = dateObj.getDateTimeString();
//For each Process in Cfg file, Test it
for (int i = 1; i < cfgVect.getProcessVectSize(); i++) {
//Get Process Command Cfg file
PrComd = gcf.solProcCfg.getCommand(i);

// Get the Maximum number of process
String process = gcf.solProcCfg.getProcess(i);

String x_cfgPriority = gcf.solProcCfg.getPriority(i);
if(x_cfgPriority.endsWith("1"))
x_Priority = AdmcTrapDestInfo.ADMC_INFO_ALARM;
else if(x_cfgPriority.endsWith("2"))
x_Priority = AdmcTrapDestInfo.ADMC_MINOR_ALARM;
else if(x_cfgPriority.endsWith("3"))
x_Priority = AdmcTrapDestInfo.ADMC_MAJOR_ALARM;
else if(x_cfgPriority.endsWith("4"))
x_Priority = AdmcTrapDestInfo.ADMC_CRITICAL_ALARM;

//Get the Percentage of the Cpu time from Configs
CfgCpuTime = gcf.solProcCfg.getCpuTime(i);

try {
//Get the Percentage of the Cpu time from System..
double CpuTime = SunSolStub.GetPCpuTime(process);
} catch (IOException e) {
// TODO Auto-generated catch block
System.out.println("Exception from CpuTime:");
e.printStackTrace();
}
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
double CpuTime = SunSolStub.GetPCpuTime(process);

Is 'process' null? What will GetPCpuTime do if it is? The problem could be elsewhere, but a NullPointer usually points to a null value, and this is the one getting passed around.
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is a beginner topic, not an advanced one; I'll move this to the Java in General (Beginner) forum for you.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!