tag:blogger.com,1999:blog-4128549255969916400.post451161176304635159..comments2023-10-17T04:25:21.366-07:00Comments on Lotus Notes: JDBC connectivity with Oracle in Domino-Part IVRishihttp://www.blogger.com/profile/16536022541896398201noreply@blogger.comBlogger3125tag:blogger.com,1999:blog-4128549255969916400.post-65001832523267115022009-06-25T20:48:29.537-07:002009-06-25T20:48:29.537-07:00A few suggestions from a long time Java Developer:...A few suggestions from a long time Java Developer:<br /><br />Java classes use 1st letter Capitalization as a convention:<br /><br />public class activityClass extends AgentBase {<br />public class ActivityClass extends AgentBase {<br /><br />Conversely variables start with lowercase letters:<br /><br />String UserName = session.getUserName();<br />String userName = session.getUserName();<br /><br />as do methods:<br /><br />qs= t1.ManageTable1(db,cdoc);<br />qs= t1.manageTable1(db, cdoc);<br /><br />Catching and printing Exceptions is a mistake for more reasons than I have time to explain. Suffice to say you should be throwing the checked exceptions from your methods unless you plan to do something about them.<br /><br />catch(Exception e){ e.printStackTrace(); }<br /><br />Encapsulation is an important part of writing Java objects. These variables should have private accessors.<br /><br />public Session session;<br />public AgentContext agentContext;<br />public RichTextItem RtActivityLog;<br />public RichTextStyle RtStyle1;<br />public Document logdoc;<br />public Database db;<br />public Database logdb;<br /><br />also I recommend you get a code formatter and Java IDE. Eclipse is free and is an excellent IDE with suitable Java code formatting abilities. It will also enable you to step through your code in debug mode so you can isolate bugs like your NullPointerException very quickly.<br /><br />Posted by Paul HillRishihttps://www.blogger.com/profile/16536022541896398201noreply@blogger.comtag:blogger.com,1999:blog-4128549255969916400.post-50324182272701969752009-06-25T02:42:29.860-07:002009-06-25T02:42:29.860-07:00@ NotesSensei,
I've already tried putting all...@ NotesSensei,<br /><br />I've already tried putting all the in "NotesMain()" but ended up with same "NullPointerException".Actually while doing analysis , I've found without passing "Session" as a argument my program were unable to initialize Session.Posted the code, What do you say ??Rishihttps://www.blogger.com/profile/16536022541896398201noreply@blogger.comtag:blogger.com,1999:blog-4128549255969916400.post-9427687099234637122009-06-25T02:03:55.583-07:002009-06-25T02:03:55.583-07:00YOu need to move your stuff into NotesMain(), not ...YOu need to move your stuff into NotesMain(), not in the constructor.NotesSenseihttps://www.blogger.com/profile/05786554785308622213noreply@blogger.com