Reputation: 705
OpenLogger is giving the me the following error:
Expression Language Interpret Exception Error:Method NotesXspDocument.getItemValueInteger(number) not found, or illegal parameters - Error on chkReview:
Interpret exception
Error:Method NotesXspDocument.getItemValueInteger(number) not found, or illegal parameters
The component chkReview only has 2 lines where getItemValueInteger is used, which is on the onClick event (single checkbox):
var reviewField:string = "numberOfReviewQuestions"+compositeData.reviewTeam;
var currentNumberReview = document1.getItemValueInteger(reviewField);
var sectionReview:string = compositeData.section + compositeData.reviewTeam;
var currentNumberSection = document1.getItemValueInteger(sectionReview);
compositeData.reviewTeam & compositeData.section both return a string. As such, I'm not sure if I have tunnel vision or not, however, I can't see what's wrong with my code? Can anyone point in the right direction? Stack trace below if this helps, and full onClick code also, thanks:
try{
var strCurrVal = getComponent('txtReviewSummary').getValue();
var strNewVal ="";
var strText ="";
var dt = new Date();
var strUser = userBean.getDisplayName();
var reviewField:string = "numberOfReviewQuestions"+compositeData.reviewTeam;
var currentNumberReview = document1.getItemValueInteger(reviewField);
var sectionReview:string = compositeData.section + compositeData.reviewTeam;
var currentNumberSection = document1.getItemValueInteger(sectionReview);
if (getComponent('chkReview').getValue() == "true") {
// checkbox selected - do something
var dateTimeFormat = new java.text.SimpleDateFormat("dd/MM/yyyy kk:mm");
var dateTimeString = dateTimeFormat.format(dt);
var strReview = " - [Review] - ("+dateTimeString+" - " + strUser + ")";
strNewVal = strCurrVal+strReview;
strText = "Review complete for " + compositeData.fieldName;
document1.replaceItemValue(reviewField, currentNumberReview-1);
} else {
// checkbox not selected- do something else
strNewVal = @Left(strCurrVal, " - [Review]");
strText = "Removed review for " + compositeData.fieldName + ". Previous value was: " + strNewVal;
document1.replaceItemValue(reviewField, currentNumberReview+1);
}
var arrNotes:array = AddNoteItem(currentDocument, dt, strText, strUser);
document1.replaceItemValue(concatReviewSummary, strNewVal);
document1.save();
}catch(e){
openLogBean.addError(e,this.getParent());
}
> com.ibm.jscript.InterpretException: Interpret exception at
> com.paulwithers.openLog.OpenLogErrorHolder.getInterpretException(OpenLogErrorHolder.java:114)
> at
> com.paulwithers.openLog.OpenLogErrorHolder.addError(OpenLogErrorHolder.java:216)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:90)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
> at java.lang.reflect.Method.invoke(Method.java:508) at
> com.ibm.jscript.types.JavaAccessObject.call(JavaAccessObject.java:322)
> at com.ibm.jscript.types.FBSObject.call(FBSObject.java:161) at
> com.ibm.jscript.ASTTree.ASTCall.interpret(ASTCall.java:197) at
> com.ibm.jscript.ASTTree.ASTTry.interpretCatch(ASTTry.java:150) at
> com.ibm.jscript.ASTTree.ASTTry.interpret(ASTTry.java:113) at
> com.ibm.jscript.ASTTree.ASTProgram.interpret(ASTProgram.java:119) at
> com.ibm.jscript.ASTTree.ASTProgram.interpretEx(ASTProgram.java:139) at
> com.ibm.jscript.JSExpression._interpretExpression(JSExpression.java:435)
> at com.ibm.jscript.JSExpression.access$1(JSExpression.java:424) at
> com.ibm.jscript.JSExpression$2.run(JSExpression.java:414) at
> java.security.AccessController.doPrivileged(AccessController.java:730)
> at
> com.ibm.jscript.JSExpression.interpretExpression(JSExpression.java:410)
> at com.ibm.jscript.JSExpression.evaluateValue(JSExpression.java:251)
> at com.ibm.jscript.JSExpression.evaluateValue(JSExpression.java:234)
> at
> com.ibm.xsp.javascript.JavaScriptInterpreter.interpret(JavaScriptInterpreter.java:222)
> at
> com.ibm.xsp.binding.javascript.JavaScriptMethodBinding.invoke(JavaScriptMethodBinding.java:111)
> at
> com.ibm.xsp.application.ActionListenerImpl.processAction(ActionListenerImpl.java:60)
> at javax.faces.component.UICommand.broadcast(UICommand.java:324) at
> com.ibm.xsp.component.UIEventHandler.broadcast(UIEventHandler.java:366)
> at
> com.ibm.xsp.component.UIDataPanelBase.broadcast(UIDataPanelBase.java:400)
> at
> com.ibm.xsp.component.UIDataPanelBase.broadcast(UIDataPanelBase.java:400)
> at
> com.ibm.xsp.component.UIDataPanelBase.broadcast(UIDataPanelBase.java:400)
> at
> com.ibm.xsp.component.UIDataPanelBase.broadcast(UIDataPanelBase.java:400)
> at
> com.ibm.xsp.component.UIDataPanelBase.broadcast(UIDataPanelBase.java:400)
> at
> com.ibm.xsp.component.UIViewRootEx.broadcast(UIViewRootEx.java:1535)
> at
> javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:307)
> at
> javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:428)
> at
> com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:94)
> at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:210)
> at
> com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:96)
> at
> com.ibm.xsp.controller.FacesControllerImpl.execute(FacesControllerImpl.java:256)
> at com.ibm.xsp.webapp.FacesServlet.serviceView(FacesServlet.java:227)
> at
> com.ibm.xsp.webapp.FacesServletEx.serviceView(FacesServletEx.java:157)
> at com.ibm.xsp.webapp.FacesServlet.service(FacesServlet.java:159) at
> com.ibm.xsp.webapp.FacesServletEx.service(FacesServletEx.java:138) at
> com.ibm.xsp.webapp.DesignerFacesServlet.service(DesignerFacesServlet.java:103)
> at
> com.ibm.designer.runtime.domino.adapter.ComponentModule.invokeServlet(ComponentModule.java:588)
> at
> com.ibm.domino.xsp.module.nsf.NSFComponentModule.invokeServlet(NSFComponentModule.java:1335)
> at
> com.ibm.designer.runtime.domino.adapter.ComponentModule$AdapterInvoker.invokeServlet(ComponentModule.java:865)
> at
> com.ibm.designer.runtime.domino.adapter.ComponentModule$ServletInvoker.doService(ComponentModule.java:808)
> at
> com.ibm.designer.runtime.domino.adapter.ComponentModule.doService(ComponentModule.java:577)
> at
> com.ibm.domino.xsp.module.nsf.NSFComponentModule.doService(NSFComponentModule.java:1319)
> at
> com.ibm.domino.xsp.module.nsf.NSFService.doServiceInternal(NSFService.java:662)
> at
> com.ibm.domino.xsp.module.nsf.NSFService.doService(NSFService.java:482)
> at
> com.ibm.designer.runtime.domino.adapter.LCDEnvironment.doService(LCDEnvironment.java:357)
> at
> com.ibm.designer.runtime.domino.adapter.LCDEnvironment.service(LCDEnvironment.java:313)
> at
> com.ibm.domino.xsp.bridge.http.engine.XspCmdManager.service(XspCmdManager.java:272)
> Caused by: java.lang.Throwable: Error:Method
> NotesXspDocument.getItemValueInteger(number) not found, or illegal
> parameters at
> com.paulwithers.openLog.OpenLogErrorHolder.getInterpretException(OpenLogErrorHolder.java:113)
> ... 52 more
Upvotes: 0
Views: 69
Reputation: 901
Slightly different take then Paul (although he may be correct), XPage runtime is interpreting the composition of reviewField or sectionReview as a number, and attempting to find a method "getItemValueInteger" that runs using a numeric parameter.
I'd focus in on this:
var sectionReview:string = compositeData.section + compositeData.reviewTeam;
as the other seems to be unambiguously a String; good to remember that the ":string" are hints but not contracts, so you might want to coerce the composition of compositeData.section and compositeData.reviewTeam into a string, to be certain.
Example:
var reviewField:string = "numberOfReviewQuestions"+compositeData.reviewTeam;
var currentNumberReview = document1.getItemValueInteger(@Text(reviewField));
var sectionReview:string = compositeData.section + compositeData.reviewTeam;
var currentNumberSection = document1.getItemValueInteger(@Text(sectionReview));
I'm drawn to this approach as for me, when compositeData is unavailable, I get null pointer exceptions, not data type errors, in similar structures. Similarly, if document1 is unavailable or uninitialized, the error is generally not a method invocation error, but that document1 is null or not an object.
Upvotes: 1
Reputation: 15739
Most likely it's a timing issue. The assumption is false that everything on your XPage is processed in a single pass, so if it's on the XPage, it must exist. The compositeData
variable probably hasn't been set at the time you're trying to use it. Confirm that by printing out the value. The other scenario, less likely, is document1
hasn't been initialised yet. Again, you can check that in your code by calling a standard non-parameterised method (getNoteID()
may work).
Upvotes: 0