Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Persistency in Session 1

Status
Not open for further replies.

Ngai88

Programmer
Sep 8, 2004
56
US
Hello,
I use Eclipse as my IDE. I can compile & build_war no problem on the following piece of code. But I notice that there is a warning when I bring my mouse beside this line, the warning says " The static method getIncidentId(Persistent Session) from the type SessionInfo should be accessed in a static way.

this is the line where the warning shows up...

incidentId = sessionInfo.getIncidentId(session);

what should I do to resolve this?

thanks,
Ngai
===========================================================

protected ControllerResponse runActivateCDKState(ControllerRequest request,
ControllerResponse response)
throws ControllerException {
if (log.isDebugEnabled()) {
log.debug("BEGIN: runActivateCDKState");
}

if (!checkSession(request, response)) {
return (response);
}
/*
* get data from the user session
*/
String incidentId = null;
SessionInfo sessionInfo = new SessionInfo();
PersistentSession session = request.getSession();
try {
incidentId = sessionInfo.getIncidentId(session);
} catch (ServletException ex) {
log.error("Exception: error accessing user's session information.");
log.error("Exception: " + ex.getMessage());
}

String team = null;
try {
NotificationDBO dboNotif = new NotificationDBO();
dboNotif.setDBName(request.getDBName());

boolean bActive = dboNotif.doActivate(false, team, incidentId);

if (bActive) {

if (log.isDebugEnabled()) {
log.debug("END: runActivateCDKState - Successful!");
}

} else {
ErrorCollection ec = new ErrorCollection();
ec.addError("Error activating CDK team.");
response.saveErrors(ec);

log.error("Error activating CDK team.");

if (log.isDebugEnabled()) {
log.debug("END:.....................runActivateCDKState - Unsuccessful!");
}
}
} catch (DBException dbex) {
log.error("Exception: runActivateCDKState(): " + dbex.getMessage());
}
//end catch

runMemberStatsState(request, response);
return (response);
}

 
Code:
Integer i = new Integer(7);
int ii = i.parseInt ("49");

While 'parseInt' is a static Method, it doesn't depend on a specific Instance like i. That's the basic idea of static Methods.
But for a not so well known class like Integer, you will not know from head, whether the method is static or not, and the notation i.parseInt suggests, that it operates on 'i'.

Write Integer.parseInt () instead.

In your case:
Code:
SessionInfo.getIncidentId(session);


seeking a job as java-programmer in Berlin:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top