Hello everyone,
I have a strange issue. On very rare occasions I get the wrong
information out of my JSP pages. What I mean is when a request comes in
I get the information that is stored in a different session. I have
tried bombarding the server to see if it is a threading issue and can't
seem to repeat it. All of my variables are either session values or
local to the request so it shouldn't be a threading issue anyway. Has
any one else seen this? I have included the JSP source below. It is
protected via login using the 2.2 security model. If anyone needs more
info let me know.
Thank you in advance,
Chris Heinemann
my env:
NT 4 SP6
dual 733 PIII
512 MB ram
JRun 3 SP1
the JSP page:
<%@ page import="java.util.*" %>
<%@ page import="com.hm.*" %>
<%@ page import="java.sql.*" %>
<%@ page import="java.io.*" %>
<%@ page import="java.util.*" %>
<%@ page import="java.text.*" %>
<%@ page import="com.hm.email.*" %>
<%@ page import="com.hm.utils.*" %>
<%
UrlUtils.debug (request,2);
boolean ptr_view = false;
String cmd = request.getParameter ("ACTION");
if (cmd != null){
if (cmd.equals ("printerview")){
ptr_view = true;
}}
%>
<!-- BEGIN -->
<a name="top" ></a>
<%-- jsp:include page="ctls.jsp" flush="true" / --%>
<html><head></head><body>
<jsp:include page="ErrorsAndMessages.jsp" flush="true" />
<script language="JavaScript" src="/formtools.js"></script>
<script>
window.self.name="HM_main";
</script>
<% if (request.isUserInRole ("admin")){
%>
<jsp:include page="admin.jsp" flush="TRUE" />
<%
}
%>
<%
Annuity a = null;
String file = null;
File account_data_file = null;
Person p = (Person)session.getAttribute ("PERSON");
try{
if (p == null){
Connection con = Person.getConnected();
p = Person.getPerson (con,request.getRemoteUser());
session.setAttribute ("PERSON",p);
con.close();
}
}catch (Exception e){
out.print ("<!-- \n");
out.print ("Message : "+e.getMessage()+"\n\n");
out.print ("Stack Trace : \n");
PrintWriter pw = new PrintWriter (response.getWriter());
e.printStackTrace(pw);
out.print ("\n-->\n");
}
if (p != null){
%>
<%
ServletContext test = config.getServletContext();
File temp = (File)test.getAttribute("javax.servlet.context.tempdir");
String tempdir = temp.getPath();
//String tempdir = "C:/temp/";
Vector accounts = p.getAnnuityAccounts();
int size = accounts.size();
String act = null;
%>
<table>
<%
for (int j=0;j<size;j++){
act = (String)accounts.elementAt (j);
%>
<TR><TD><a href="#num<%=j%>" ><%=act%></A></TD></TR>
<%
}
%>
</table>
<p>
<%
boolean ok = true;
for (int j=0;j<size;j++){
act = (String)accounts.elementAt (j);
file = tempdir+"/"+act;
account_data_file = new File (file);
/*
if date on file is after 7AM of most recent 7AM then
use the cached data
else
attempt to refresh cache
*/
boolean cache_version_ok = false;
if (account_data_file.exists ()){
Calendar then = Calendar.getInstance();
then.set (Calendar.HOUR,7);
then.set (Calendar.MINUTE,0);
then.set (Calendar.SECOND,0);
Calendar now = Calendar.getInstance ();
int i = now.get (Calendar.DAY_OF_WEEK);
if (i == Calendar.SUNDAY)
then.set (Calendar.DATE,(then.get(Calendar.DATE)-1));
if (i == Calendar.MONDAY){
then.set (Calendar.DATE,(then.get(Calendar.DATE)-1));
then.set (Calendar.DATE,(then.get(Calendar.DATE)-1));
}
if (then.after (now))
then.set (Calendar.DATE,(then.get(Calendar.DATE)-1));
//check if file_timestamp is > acceptable cache time stamp then
// set cache_version_ok = true
if (account_data_file.lastModified() > then.getTime().getTime()){
cache_version_ok = true;
}
}
%>
<table>
<tr><td>
<a name="num<%=j%>" ></a>
<%-- =cache_version_ok --%>
<%-- =account_data_file.getPath() --%>
<%
try{
if (!cache_version_ok){
//do an attempt at updating the cache
%>
<jsp:include page="GetAnnuityInfo.jsp" flush="true" >
<jsp:param name="ACCOUNT" value="<%=act%>" />
</jsp:include>
<%
}else{
%><!-- cache version is acceptable --><%
}
}catch (Exception e){
out.print ("<!-- \n");
out.print ("Message : "+e.getMessage()+"\n\n");
out.print ("Stack Trace : \n");
PrintWriter pw = new PrintWriter (response.getWriter());
e.printStackTrace(pw);
out.print ("\n-->\n");
}
if (account_data_file.exists()){
p.setAttribute ((String)accounts.elementAt (j),
Annuity.parseAnnuityPropertiesFile (file));
a = (Annuity)p.getAttribute (act);
SimpleDateFormat sdf = new SimpleDateFormat ("EEEE MMM dd,yyyy ");
java.util.Date file_time_stamp = new java.util.Date
(account_data_file.lastModified());
try{
String test_for_valid_data = sdf.format
(a.getEffectiveDate().getTime());
%>
<p>
Contract number : <%=act%><br>
Effective as of : <%=test_for_valid_data %><br>
<% String time = sdf.format (a.getFixedAsOfDate().getTime());
if (time.indexOf ("Sunday Nov 30,0002") >= 0)
time = "Not Applicable";
%>
Fixed Values as of : <%=time %><br>
Variable Values as of : <%=sdf.format
(a.getVariableAsOfDate().getTime()) %><br>
<p>
<table width="100%" border=0 bgcolor="#000000" cellspacing=2
cellpadding=0 >
<tr >
<td >
<table width="100%" bgcolor="#000000" border=1 cellpadding=5
cellspacing=2 >
<tr>
<TD bgcolor="#FFFFFF" >Investment Account</td>
<td bgcolor="#FFFFFF">Price</td>
<td bgcolor="#FFFFFF">Units Owned</td>
<td bgcolor="#FFFFFF">Retire Cash Value</td>
<td bgcolor="#FFFFFF">Premium Allocation</td>
</tr>
<%
int rcv = 0;
int percent = 0;
Enumeration keys = a.getFundNames ();
while (keys.hasMoreElements ()){
String fname = (String)keys.nextElement ();
Fund f = a.getFund (fname);
%>
<tr >
<!-- td><%=fname%></td -->
<%
try{
char bob [] = {',',' ','.'};
rcv = rcv + Integer.parseInt (StringUtils.dropChar (f.value,bob));
}catch (Exception e){
out.print ("<!-- \n");
out.print ("Message : "+e.getMessage()+"\n\n");
out.print ("Stack Trace : \n");
PrintWriter pw = new PrintWriter (response.getWriter());
e.printStackTrace(pw);
out.print ("\n-->\n");
}
try{
percent = percent + Integer.parseInt (f.allocation);
}catch (Exception e){
out.print ("<!-- \n");
out.print ("Message : "+e.getMessage()+"\n\n");
out.print ("Stack Trace : \n");
PrintWriter pw = new PrintWriter (response.getWriter());
e.printStackTrace(pw);
out.print ("\n-->\n");
}
%>
<td bgcolor="#FFFFFF"><%=f.name%> </td>
<td bgcolor="#FFFFFF"><%=f.price%> </td>
<td bgcolor="#FFFFFF"><%=f.units%> </td>
<td bgcolor="#FFFFFF"><%=f.value%> </td>
<td bgcolor="#FFFFFF"><%=f.allocation%> </td>
<% if (a.getSuspenseCode().equals ("0")){ %>
<td bgcolor="#FFFFFF">
<a href="transfer.jsp?AccountNum=<%=act%>&Fund=<%=f.type%>" >Transfer
Money FROM this fund to others</a>
</td>
<% } %>
</tr>
<%
} //end of while
DecimalFormat df = new DecimalFormat ();
%>
<tr>
<td colspan=3 bgcolor="#FFFFFF" >Total</td>
<td bgcolor="#FFFFFF" ><%=df.format((rcv/100.0))%></td>
<td bgcolor="#FFFFFF" ><%=percent%></td>
</tr>
</table>
</td></tr>
</table>
<%--
<br>'<%=a.getSuspenseCode()%>'
--%>
<%
}catch (Exception e){
out.print ("<!-- \n");
out.print ("Message : "+e.getMessage()+"\n\n");
out.print ("Stack Trace : \n");
PrintWriter pw = new PrintWriter (response.getWriter());
e.printStackTrace(pw);
out.print ("\n-->\n");
%>
<p><B> Sorry the account information is unavailable right now. This is
probably due to the host connection dropping
and your information could not be found in cache. Please bear with us
and thank you for using our site.</b></p>
<%
}
}else{
%><p><B> Sorry the account information is unavailable right now. This
is probably due to the host connection dropping
and your information could not be found in cache. Please bear with us
and thank you for using our site.</b></p>
<% }
%>
</td></tr></table>
<table>
<tr width="100%">
<td width="25%"><a href=#top >Back to the top</a></td>
</tr>
</table>
</p>
<%
}
}
%>
<!-- END -->
<%-- put in the left and bottom ctl stuff --%>
</BODY></HTML>
------------------------------------------------------------------------------
Archives: http://www.egroups.com/group/jrun-interest/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/jrun_talk
or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the
body.