Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Cause of Error is Not Identified  RSS feed

 
Michael Scott
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have the following Java agent which runs on my client, but not on a server. I've excluded some lines of code that aren't relevant here. However, I've included all the error handling code because one of the problems I've encountered is that no error message is written to a log database and it's not apparent why.

In the middle of the code is the comment 'DOES NOT EXECUTE' which identifies the line causing the problem, but all that the log database shows is the prior line ('Point A') and not the following line ('Point B'). I'd expect to see an error such as 'XfoObj class not found'. Our server admin has verified that there is sufficient memory while the agent runs.

I'd appreciate any ideas on why the cause of the error is not being identified by the error handling code. Thanks.
_____________________________

import lotus.domino.*;
import java.io.*;
import java.util.*;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.Transformer;
import javax.xml.transform.stream.StreamSource;
import javax.xml.transform.stream.StreamResult;
import jp.co.antenna.XfoJavaCtl.*;

class ErrDump implements MessageListener {

public void onMessage(int errLevel, int errCode, String errMessage) {
System.out.println("ErrorLevel = " + errLevel + "\nErrorCode = " + errCode + "\n" + errMessage);
}
}

public class JavaAgent extends AgentBase {
public void NotesMain() {

try {
Session session = getSession();
AgentContext agentContext = session.getAgentContext();
Database db = agentContext.getCurrentDatabase();
RichTextItem foStreamItem = null;
String foXML = null;
try {
foStreamItem = (RichTextItem) db.getView
("Vw_lookup").getDocumentByKey("FO").getFirstItem
("Stream");
foXML = foStreamItem.getText();
} catch (NotesException ne) {
ne.printStackTrace();
}

if ( foXML != null ) {
XfoObj axfo = null;
ByteArrayInputStream is = null;
ByteArrayOutputStream os = null;
try {
System.out.println("Point A");
axfo = new XfoObj(); /* <= DOES NOT EXECUTE /*
System.out.println("Point B");

ErrDump eDump = new ErrDump();
axfo.setMessageListener(eDump);
axfo.setExitLevel(4);
}
catch (XfoException e) {
System.out.println("ErrorLevel = " +
e.getErrorLevel() + "\nErrorCode = " +
e.getErrorCode() + "\n" + e.getErrorMessage());
return;
}
catch (Exception e)
{
e.printStackTrace();
return;
}
finally
{
try {
axfo.releaseObjectEx();
}
catch (XfoException e) {
System.out.println("ErrorLevel = " + e.getErrorLevel()
+ "\nErrorCode = " + e.getErrorCode() + "\n" +
e.getErrorMessage());
return;
}
try {
is.close();
} catch (Exception e) {}
try {
os.close();
} catch (Exception e) {}
}
}
} catch(Exception e) {
e.printStackTrace();
}
}
}
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hmmm... I don't know. But I did some formatting to look at this, so I'll post that with Code Tags to make it more inviting for the next person. (Nice to see someone else using Lotus Notes. )

[ June 15, 2006: Message edited by: marc weber ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!