Program: 102156
Project: 102156
Buggy source:
/** 
 * Extract an   {@link URL} from the given {@link IConnectionProfile} usingthe given property key and test its connectivity. <p> If the URL requires authentication then the authentication security type, username and password will all be extracted from the {@link IConnectionProfile}. Thus, the values for the authentication should be stored in the connection profile using the keys from  {@link ICredentialsCommon}.
 * @param connectionProfile
 * @param propertyKey
 * @return
 */
public static Exception testURLConnection(IConnectionProfile connectionProfile,final String propertyKey){
  Properties connProperties=connectionProfile.getBaseProperties();
  String xmlFile=connProperties == null ? null : (String)connProperties.get(propertyKey);
  try {
    URL url=URLHelper.buildURL(xmlFile);
    String securityType=connProperties.getProperty(ICredentialsCommon.SECURITY_TYPE_ID);
    boolean resolved=false;
    Map<String,String> connPropMap=new HashMap<String,String>();
    connPropMap.put("String_Node_Str","String_Node_Str");
    if (securityType == null || SecurityType.None.name().equals(securityType)) {
      resolved=URLHelper.resolveUrl(url,null,null,connPropMap,true);
    }
 else {
      String userName=connProperties.getProperty(ICredentialsCommon.USERNAME_PROP_ID);
      String password=connProperties.getProperty(ICredentialsCommon.PASSWORD_PROP_ID);
      resolved=URLHelper.resolveUrl(url,userName,password,connPropMap,true);
    }
    if (!resolved) {
      throw new Exception(DatatoolsUiConstants.UTIL.getString("String_Node_Str"));
    }
  }
 catch (  Exception ex) {
    return ex;
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Extract an   {@link URL} from the given {@link IConnectionProfile} usingthe given property key and test its connectivity. <p> If the URL requires authentication then the authentication security type, username and password will all be extracted from the {@link IConnectionProfile}. Thus, the values for the authentication should be stored in the connection profile using the keys from  {@link ICredentialsCommon}.
 * @param connectionProfile
 * @param propertyKey
 * @return
 */
public static Exception testURLConnection(IConnectionProfile connectionProfile,final String propertyKey){
  Properties connProperties=connectionProfile.getBaseProperties();
  String xmlFile=connProperties == null ? null : (String)connProperties.get(propertyKey);
  try {
    URL url=URLHelper.buildURL(xmlFile);
    String securityType=connProperties.getProperty(ICredentialsCommon.SECURITY_TYPE_ID);
    boolean resolved=false;
    Map<String,String> connPropMap=new HashMap<String,String>();
    connPropMap.put("String_Node_Str","String_Node_Str");
    connPropMap.put("String_Node_Str","String_Node_Str");
    if (securityType == null || SecurityType.None.name().equals(securityType)) {
      resolved=URLHelper.resolveUrl(url,null,null,connPropMap,true);
    }
 else {
      String userName=connProperties.getProperty(ICredentialsCommon.USERNAME_PROP_ID);
      String password=connProperties.getProperty(ICredentialsCommon.PASSWORD_PROP_ID);
      resolved=URLHelper.resolveUrl(url,userName,password,connPropMap,true);
    }
    if (!resolved) {
      throw new Exception(DatatoolsUiConstants.UTIL.getString("String_Node_Str"));
    }
  }
 catch (  Exception ex) {
    return ex;
  }
  return null;
}