您好,我的代碼正在生成一個數組outoutof異常,在代碼中捕獲但代碼突然終止。我希望代碼繼續。如果一個arrayoutofboundexception例外的被抓還是我做錯了什麼,請幫助捕捉錯誤.Exception是expected.Below是代碼: -ArrayOutofBound異常未捕獲
try{
CsgLogin=Ldap.getdomain(requesterLoginId);//This returns domain\usernmae
LoginIDArray = CsgLogin.split("\\\\");
requesterLoginId = LoginIDArray[1]; //Exception generated here
} catch(Exception e) {
System.out.println("Error in the GLDAP lookup or error in Domain Mapping");
e.printStackTrace();
}
輸出:
java.lang.ArrayIndexOutOfBoundsException: 1
at com.cs.ws.LdapConnect.getdomain(LdapConnect.java:131)
at com.cs.ws.AgentConnector.startOfBreakGlass(AgentConnector.java:476)
at com.cs.ws.AgentConnector.runBreakGlassProcess(AgentConnector.java:208)
at com.cs.ws.MyAccessTimer.main(MyAccessTimer.java:93)
Error in the GLDAP lookup or error in Domain Mapping
java.lang.StringIndexOutOfBoundsException: String index out of range: -1
at java.lang.String.substring(String.java:1768)
at com.cs.ws.DomainMap.getDomain(DomainMap.java:21)
at com.cs.ws.AgentConnector.startOfBreakGlass(AgentConnector.java:477)
at com.cs.ws.AgentConnector.runBreakGlassProcess(AgentConnector.java:208)
at com.cs.ws.MyAccessTimer.main(MyAccessTimer.java:93)
我們可以看到一些輸出嗎? (stacktrace) – trutheality 2012-04-12 03:19:06
正如我的想法 - 它被抓住了。這是另一個例外。 – trutheality 2012-04-12 03:35:51