Help writing error handler
Hi,
I am a newbie to Java and need some help finding an error.
I run a testing and support website which has been handed over to me with little java training and knowlegde.
Anyway the problem is that there a section where you can attach files, this works fine when saving an issue the first time, but when trying to update/modify issue with more files, it doesnt work ..(no error, etc).
What i need to know is how to write a error handle to capture what part of the script,code is not working.
Not sure if this is the right code but may help;
uatregister.Attachment[] attachments = issue.get_file_attachments();
for(int i=1; i<(attachments.length+1); i++)
attachments[i-1].set_hard_file_name(issue.get_hie_issue_no() + "_evid_" + i + attachments[i-1].get_soft_file_name().substring(attachments[i-1].get_soft_file_name().indexOf("."), attachments[i-1].get_soft_file_name().length()));
database.Query[] queries = issue.get_attachment_sql();
for(int i=0; i<queries.length; i++)
db.update(queries, formPreparedByContact);
String filesAttached = request.getParameter("filesAttached");
String filename;
if(!filesAttached.equals("No Files Attached"))
{
attachments = issue.get_file_attachments();
java.util.StringTokenizer tokens = new java.util.StringTokenizer(filesAttached, "\n", false);
while(tokens.hasMoreTokens())
{
filename = tokens.nextToken();
for(int i=0; i><attachments.length; i++)
{
if(attachments.get_soft_file_name().equals(filename.substring(0, (filename.length()-1))))
{
try
{
Runtime.getRuntime().exec("move \"" + uatregister.Attachment.EVIDENCE_LOCATION + "temp\\" + filename.substring(0, (filename.length()-1)) + "\" \"" + uatregister.Attachment.EVIDENCE_LOCATION + "" + attachments.get_hard_file_name() + "\"");
}
catch(Exception e)
{
new ViewableException(e);
}
}
}
}
}
else
{
try
{
Runtime.getRuntime().exec("rm " + uatregister.Attachment.EVIDENCE_LOCATION + "temp\\*.*");
}
catch(Exception e)
{
}
}
response.sendRedirect("viewUATIssue.jsp?testplanid="+request.getParameter("testplanid")+"&test="+request.getParameter("test")+"&testplanissueno="+request.getParameter("testplanissueno")+"&issueno="+request.getParameter("issueno")+"&releaseid="+request.getParameter("releaseid"));
}
else
Any assistance would be greatly apprecated>

