on 10-28-2008 11:15 AM
Hi,
I am getting "StringIndexOutOfBoundsException: String index out of range: 19" error when I am trying to pass a value into a method in the component controller. Below are the exception details, please help!
java.lang.StringIndexOutOfBoundsException: String index out of range: 19
at java.lang.String.substring(String.java:1441)
at com.dow.dc.component.FinanceDOA_T.callExecuteModelMethod(FinanceDOA_T.java:252)
at com.dow.dc.component.wdp.InternalFinanceDOA_T.callExecuteModelMethod(InternalFinanceDOA_T.java:348)
at com.dow.dc.component.view.V_FINANCE_DOA_DATA.onActionApprove(V_FINANCE_DOA_DATA.java:265)
at com.dow.dc.component.view.wdp.InternalV_FINANCE_DOA_DATA.wdInvokeEventHandler(InternalV_FINANCE_DOA_DATA.java:259)
at com.sap.tc.webdynpro.progmodel.generation.DelegatingView.invokeEventHandler(DelegatingView.java:87)
at com.sap.tc.webdynpro.progmodel.controller.Action.fire(Action.java:67)
at com.sap.tc.webdynpro.clientserver.window.WindowPhaseModel.doHandleActionEvent(WindowPhaseModel.java:420)
at com.sap.tc.webdynpro.clientserver.window.WindowPhaseModel.processRequest(WindowPhaseModel.java:132)
at com.sap.tc.webdynpro.clientserver.window.WebDynproWindow.processRequest(WebDynproWindow.java:335)
at com.sap.tc.webdynpro.clientserver.cal.AbstractClient.executeTasks(AbstractClient.java:143)
at com.sap.tc.webdynpro.clientserver.session.ApplicationSession.doProcessing(ApplicationSession.java:319)
at com.sap.tc.webdynpro.clientserver.session.ClientSession.doApplicationProcessingStandalone(ClientSession.java:713)
at com.sap.tc.webdynpro.clientserver.session.ClientSession.doApplicationProcessing(ClientSession.java:666)
at com.sap.tc.webdynpro.clientserver.session.ClientSession.doProcessing(ClientSession.java:250)
at com.sap.tc.webdynpro.clientserver.session.RequestManager.doProcessing(RequestManager.java:149)
at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doContent(DispatcherServlet.java:62)
at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doPost(DispatcherServlet.java:53)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:401)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:266)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:386)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:364)
at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:1039)
at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:265)
at com.sap.engine.services.httpserver.server.Client.handle(Client.java:95)
at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:175)
at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
at java.security.AccessController.doPrivileged(Native Method)
at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:102)
at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:172)
Thanks,
Harika
public void callExecuteModelMethod( java.lang.String actionFlag )
{
//@@begin callExecuteModelMethod()
IDOA_APPROVAL_DATANode dadNode = wdContext.nodeDOA_APPROVAL_DATA();
IDOA_APPROVAL_DATAElement dadElement =
dadNode.currentDOA_APPROVAL_DATAElement();
String sRequisition = dadElement.getREQUISITION();
String sObjectType = sRequisition.substring(10, 19);
String sObjectKey = sRequisition.substring(20, 40);
String sApprover = dadElement.getAPPROVER();
String sRejectionText = dadElement.getREJECTIONTEXT();
//Access Sap_Wapi_Read_Container_Input Context Node
Sap_Wapi_Create_Event_Input createWapi =
new Sap_Wapi_Create_Event_Input();
createWapi.setObject_Type(sObjectType);
createWapi.setObject_Key(sObjectKey);
createWapi.setEvent("AppDecision");
createWapi.setCommit_Work(true);
Swr_Cont createIC1 = new Swr_Cont();
Swr_Cont createIC2 = new Swr_Cont();
Swr_Cont createIC3 = new Swr_Cont();
createIC1.setElement("AppRejFlag");
createIC1.setValue(actionFlag);
createWapi.addInput_Container(createIC1);
createIC2.setElement("LastAppr");
createIC2.setValue(sApprover);
createWapi.addInput_Container(createIC2);
createIC3.setElement("RejectTxt");
createIC3.setValue(sRejectionText);
createWapi.addInput_Container(createIC3);
String actionType = "";
if (actionFlag.equalsIgnoreCase("A")) {
actionType = "Request has been approved; and will be routed for authorization.";
} else if (actionFlag.equalsIgnoreCase("R")) {
actionType = "Request has been rejected.";
}
IACTION_TYPENode atNode = wdContext.nodeACTION_TYPE();
IACTION_TYPEElement atElement = atNode.createACTION_TYPEElement();
atElement.setACTIONTYPE(actionType);
atNode.addElement(atElement);
//$$begin Service Controller(-2105721085)
wdContext.nodeSap_Wapi_Create_Event_Input().bind(createWapi);
//$$end
wdThis.executeSap_Wapi_Create_Event_Input();
//@@end
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Could you tell me which is line no. 252 in this code as there are many substring function in there one of which is causing a problem.
Whenever you do a substring first check the length of the string. Check the length of both the strings on which you are calling the substring function
Regards,
Murtuza
Edited by: Murtuza Kharodawala on Oct 28, 2008 6:57 PM
Hi Murtuza,
The error line is the one below the bold one in the above code of mine.
And the wdThis.assign() is working fine. And I am not using any substring in my called method...
Harika
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
public void onActionApprove(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
{
//@@begin onActionApprove(ServerEvent)
//Assigning values in the context node to the component controller context
wdThis.assign();
//Calling the model execution methods
wdThis.wdGetFinanceDOA_TController().wdGetContext().currentContextElement().setActionFlag("A");
wdThis.wdGetFinanceDOA_TController().callExecuteModelMethod(action);
wdThis.wdFirePlugToConfirm();
//@@end
}
This is the code that I am trying to run.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi!
can you please post the code? i think you try to substring a string like test.substring(0, 19), but the string is only 18 (or less) characters long.
In this case you get an StringIndexOutOfBoundsException.
Regards,
Markus
Edited by: Markus Billek on Oct 28, 2008 1:37 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.