Fixed random IndexOutofBound exception.

This commit is contained in:
Heng Sin Low 2010-10-26 19:06:06 +08:00
parent 2c4cb3b712
commit 836c789066
1 changed files with 21 additions and 21 deletions

View File

@ -294,7 +294,7 @@ public class CConnection implements Serializable, Cloneable
{ {
return m_webPort; return m_webPort;
} }
/** /**
* set web port * set web port
* @param webPort * @param webPort
@ -303,7 +303,7 @@ public class CConnection implements Serializable, Cloneable
{ {
m_webPort = webPort; m_webPort = webPort;
} }
/** /**
* Set Web Port * Set Web Port
* @param webPortString web port as String * @param webPortString web port as String
@ -321,8 +321,8 @@ public class CConnection implements Serializable, Cloneable
{ {
log.severe(e.toString ()); log.severe(e.toString ());
} }
} }
/** /**
* @return ssl port * @return ssl port
*/ */
@ -330,7 +330,7 @@ public class CConnection implements Serializable, Cloneable
{ {
return m_sslPort; return m_sslPort;
} }
/** /**
* set ssl port * set ssl port
* @param sslPort * @param sslPort
@ -339,7 +339,7 @@ public class CConnection implements Serializable, Cloneable
{ {
m_sslPort = sslPort; m_sslPort = sslPort;
} }
/** /**
* Set SSL Port * Set SSL Port
* @param sslPortString web port as String * @param sslPortString web port as String
@ -358,7 +358,7 @@ public class CConnection implements Serializable, Cloneable
log.severe(e.toString ()); log.severe(e.toString ());
} }
} }
/** /**
* Is Application Server OK * Is Application Server OK
* @param tryContactAgain try to contact again * @param tryContactAgain try to contact again
@ -368,20 +368,20 @@ public class CConnection implements Serializable, Cloneable
{ {
if (!tryContactAgain && m_queryAppsServer) if (!tryContactAgain && m_queryAppsServer)
return m_okApps; return m_okApps;
if (getAppServerCredential() == null) if (getAppServerCredential() == null)
{ {
m_okApps = false; m_okApps = false;
return m_okApps; return m_okApps;
} }
m_queryAppsServer = true; m_queryAppsServer = true;
try try
{ {
Status status = Service.locate(Status.class); Status status = Service.locate(Status.class);
m_version = status.getDateVersion(); m_version = status.getDateVersion();
} }
catch (Throwable t) catch (Throwable t)
{ {
m_okApps = false; m_okApps = false;
@ -1066,7 +1066,7 @@ public class CConnection implements Serializable, Cloneable
.append (",FWhost=").append (escape(m_fw_host)) .append (",FWhost=").append (escape(m_fw_host))
.append (",FWport=").append (m_fw_port) .append (",FWport=").append (m_fw_port)
.append (",UID=").append (escape(m_db_uid)) .append (",UID=").append (escape(m_db_uid))
.append (",PWD=").append (escape(m_db_pwd)) .append (",PWD=").append (escape(m_db_pwd))
.append("]"); .append("]");
; // the format is read by setAttributes ; // the format is read by setAttributes
return sb.toString (); return sb.toString ();
@ -1075,7 +1075,7 @@ public class CConnection implements Serializable, Cloneable
private String escape(String value) { private String escape(String value) {
if (value == null) if (value == null)
return null; return null;
// use html like escape sequence to escape = and , // use html like escape sequence to escape = and ,
value = value.replace("=", "&eq;"); value = value.replace("=", "&eq;");
value = value.replace(",", ","); value = value.replace(",", ",");
@ -1096,7 +1096,7 @@ public class CConnection implements Serializable, Cloneable
{ {
String[] pairComponents = pair.split("[=]"); String[] pairComponents = pair.split("[=]");
String key = pairComponents[0]; String key = pairComponents[0];
String value = unescape(pairComponents[1]); String value = pairComponents.length == 2 ? unescape(pairComponents[1]) : "";
if ("name".equalsIgnoreCase(key)) if ("name".equalsIgnoreCase(key))
{ {
setName(value); setName(value);
@ -1153,11 +1153,11 @@ public class CConnection implements Serializable, Cloneable
{ {
setSSLPort(value); setSSLPort(value);
} }
} }
} }
catch (Exception e) catch (Exception e)
{ {
log.severe(attributes + " - " + e.toString ()); log.log(Level.SEVERE, attributes + " - " + e.toString (), e);
} }
} // setAttributes } // setAttributes
@ -1394,12 +1394,12 @@ public class CConnection implements Serializable, Cloneable
{ {
m_okApps = false; m_okApps = false;
m_queryAppsServer = true; m_queryAppsServer = true;
if (getAppsHost().equalsIgnoreCase("MyAppsServer")) { if (getAppsHost().equalsIgnoreCase("MyAppsServer")) {
log.warning (getAppsHost() + " ignored"); log.warning (getAppsHost() + " ignored");
return m_okApps; // false return m_okApps; // false
} }
Status status = Service.locate(Status.class); Status status = Service.locate(Status.class);
try { try {
updateInfoFromServer(status); updateInfoFromServer(status);
@ -1407,7 +1407,7 @@ public class CConnection implements Serializable, Cloneable
} catch (Exception e) { } catch (Exception e) {
m_appsException = e; m_appsException = e;
} }
return m_okApps; return m_okApps;
} // setAppsServerInfo } // setAppsServerInfo
@ -1507,7 +1507,7 @@ public class CConnection implements Serializable, Cloneable
securityPrincipal.secret= secret; securityPrincipal.secret= secret;
m_server = null; m_server = null;
} }
public SecurityPrincipal getAppServerCredential() public SecurityPrincipal getAppServerCredential()
{ {
return securityPrincipal; return securityPrincipal;