The Kat's Work - Blog
Main | Blog | Registration | Login
0:06 AM
Welcome Guest | RSS
Main » 2011 » August » 10 » RichtextItem Java Class Crashes Notes (Domino) Server
8:11 PM
RichtextItem Java Class Crashes Notes (Domino) Server

This problem and solution were found by my esteemed colleague Andrew "Andy C” Cunliffe.

The problem

In Lotus Notes 8.5 java agents that worked fine in past versions was causing server crashes. Specifically when working with richtextitem class in a java agent. 

The code being effectively this (taken from the help)

import lotus.domino.*;

public class JavaAgent extends AgentBase {

 public void NotesMain() {

 try {
 Session session = getSession();
 AgentContext agentContext = session.getAgentContext();

 // (Your code goes here)

 DocumentCollection dc = agentContext.getUnprocessedDocuments();
 Document doc = dc.getFirstDocument();
 RichTextItem rti = (RichTextItem)doc.getFirstItem("Body");
 RichTextNavigator rtnav = rti.createNavigator;
 rti.appendText("Beginning text.");
 } catch(Exception e) {

(Quite distressing that the actual example given in the help causes a server crash.)


Andy, was able to find that the command beginInsert was causing the crash. This command has been recently changed it now accepts an optional Boolean argument that works as below.
·    true to put the insertion position at the end of the element 
·    false (default) to put the insertion position at the beginning of the element 
Now this is the sticking point, in previous notes versions there was no option and the behaviour of the beginInsert command was to put the insertion point at the end of the element. 

So you can see they have changed the behaviour of the command having the new function be the default and the original function be the alternative function. This was further exasperated by the realisation that the setting of the optional argument to true (i.e. to pick the original function) stops the server crashing.

The Solution

So to conclude the solution to this problem is to change the beginInsert command from



rti.beginInsert(rtnav , true);

I can only think that the new "insertion position at the beginning of the element” is massively resource hungry or not properly garbage collected. Our more high spec servers were able to survive this code. While the server in question could only run the code in "insertion position at the end of the element” mode.

Views: 4977 | Added by: The_Kat | Rating: 5.0/1
Total comments: 0
Name *:
Email *:
Code *:
Login form
«  August 2011  »
Entries archive
Site friends
  • Create your own site
  • My Blog
  • Statistics

    Total online: 1
    Guests: 1
    Users: 0
    Copyright MyCorp © 2019
    Website builderuCoz