About Duffbert...

Duffbert's Random Musings is a blog where I talk about whatever happens to be running through my head at any given moment... I'm Thomas Duff, and you can find out more about me here...

Email Me!

Search This Site!

Custom Search

I'm published!

Co-author of the book IBM Lotus Sametime 8 Essentials: A User's Guide
SametimeBookCoverImage.jpg

Purchase on Amazon

Co-author of the book IBM Sametime 8.5.2 Administration Guide
SametimeAdminBookCoverImage.jpg

Purchase on Amazon

MiscLinks

Visitor Count...



View My Stats

« Rebuilding a Notes Mail Inbox | Main| What is the $ConflictAction Field Used For? »

Java RichTextItem AppendText Method Crashes or Causes a Red Box and Hang when String Value Parameter is Null

Category Software Development

I've not run into this myself, but I see how it could easily ruin your day if you did...  :-)   From the KnowledgeBase...

Java RichTextItem AppendText Method Crashes or Causes a Red Box and Hang when String Value Parameter is Null

Document Number:  1111025

Problem
Calling the Java appendString method (of the RichTextItem class) with a null String value parameter results in either a Red Box and hang or a crash.

In the case where the Notes Client hangs, the following Red Box error appears beforehand:

"Sorry, an uncorrectable error has occurred.
LookupHandle: null handle
Press ENTER to abort the application"

When the system crashes, the Fatal Thread will be one of the following:
(Note: the first example can occur on a Notes client or Domino server, the second example has only been observed on a Domino server)

jvm._IBM_GetInterface

or

nnotes._Panic
nnotes._LockHandle
nnotes._OSLockObject
nlsxbe.ANotes::ANUnicodeToLMBCSLong
nlsxbe._Java_lotus_domino_local_RichTextItem_NappendText



The crash issue where the single fatal thread entry jvm._IBM_GetInterface is observed occurs in Notes 6.0 and 6.0.1 when the String value parameter passed is derived from a field, for example when using the getItemValueString method (of the Document class).

For example:

string2 = udoc.getItemValueString("somefield");
ubody.appendText(string2);


The Red Box hang and crash issue containing the fatal thread entry nlsxbe._Java_lotus_domino_local_RichTextItem_NappendText is observed in Notes 6.x when the parameter is derived from a String object which is derived using the substring method (it is unknown if the issue will also occur when the String is based on values returned by other methods).


For example:

string1 = stuff.substring(0, 0);
ubody.appendText(string1);

Content
This issue has been reported to Lotus software Quality Engineering in two separate Software Problem Reports (SPRs):

SPR TDON5M6NBH covers the portion of the issue where getTextItemString was used to provide the string value and the appendText call resulted in a crash.  This issue has been addressed in Notes/Domino 6.0.2.

Excerpt from the Lotus Notes and Domino Release 6.0.2 MR fix list (available at http://www.ibm.com/developerworks/lotus):

Java        

  • SPR# TDON5M6NBH - Fixed a server crash when the Java RichTextItem class executed the appendText method with a NULL parameter.


SPR MKIN5XETBB covers the portion of the issue where the string value was derived from the substring method and the appendText call resulted in a Red Box error and a system hang.

Workaround:
In order to avoid these issues, add a check to first see if the returned string value is null (this avoids the issue in SPR TDON5M6NBH) and then check if the value is a length of 0 (this avoids the issue in SPR MKIN5XETBB).

For example:

                if (stringx != null)  {
                         if (stringx.length() != 0) {
                                ubody.appendText(stringx);
                                }
                        }


Supporting Information:

Here is a full example of the code that recreates the issue described in SPR MKIN5XETBB:

import lotus.domino.*;

public class JavaAgent extends AgentBase {

        public void NotesMain() {

                String stuffx = "123";
                String string1 = null;

                try {
                        Session session = getSession();
                        AgentContext agentContext = session.getAgentContext();
                        Database db = agentContext.getCurrentDatabase();    
                        Document uMemo    = db.createDocument();
                        RichTextItem ubody = uMemo.createRichTextItem("Body");

                     string1 = stuffx.substring(0, 0);                        
                        ubody.appendText(string1);

                } catch(Exception e) {
                e.printStackTrace();
                }
        }
}

Comments

Gravatar Image1 - Emoticon Emoticon Emoticon Emoticon Emoticon Emoticon Emoticon

Post A Comment

:-D:-o:-p:-x:-(:-):-\:angry::cool::cry::emb::grin::huh::laugh::lips::rolleyes:;-)

Want to support this blog or just say thanks?

When you shop Amazon, start your shopping experience here.

When you do that, all your purchases during that session earn me an affiliate commission via the Amazon Affiliate program. You don't have to buy the book I linked you to (although I wouldn't complain!). Simply use that as your starting point.

Thanks!

Thomas "Duffbert" Duff

Ads of Relevance...