Program: 151621
Project: 151621
Buggy source:
public static FileResource<?> downloadFromIndexRef(final PluginRef ref,final PipeOut out,final DirectoryResource pluginDir) throws Exception {
  DefaultHttpClient client=new DefaultHttpClient();
  String[] artifactParts=ref.getArtifact().toIdentifier().split("String_Node_Str");
  if (artifactParts.length != 3) {
    throw new RuntimeException("String_Node_Str" + "String_Node_Str" + ref.getArtifact());
  }
  String packageLocation=artifactParts[0].replaceAll("String_Node_Str","String_Node_Str");
  String baseUrl;
  if (ref.getHomeRepo().endsWith("String_Node_Str")) {
    baseUrl=ref.getHomeRepo() + packageLocation + "String_Node_Str"+ artifactParts[1]+ "String_Node_Str"+ artifactParts[2];
  }
 else {
    baseUrl=ref.getHomeRepo() + "String_Node_Str" + packageLocation+ "String_Node_Str"+ artifactParts[1]+ "String_Node_Str"+ artifactParts[2];
  }
  HttpGet httpGetManifest=new HttpGet(baseUrl + "String_Node_Str");
  out.print("String_Node_Str");
  HttpResponse response=client.execute(httpGetManifest);
switch (response.getStatusLine().getStatusCode()) {
case 200:
    out.println("String_Node_Str");
  Document document=DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(response.getEntity().getContent());
XPath xpath=XPathFactory.newInstance().newXPath();
XPathExpression checkSnapshotExpr=xpath.compile("String_Node_Str");
XPathExpression findJar=xpath.compile("String_Node_Str");
NodeList list=(NodeList)checkSnapshotExpr.evaluate(document,XPathConstants.NODESET);
out.print("String_Node_Str");
if (list.getLength() != 0) {
Node n=(Node)findJar.evaluate(document,XPathConstants.NODE);
if (n == null) {
out.println("String_Node_Str");
return null;
}
String version=n.getFirstChild().getTextContent();
out.println("String_Node_Str" + version);
String fileName=artifactParts[1] + "String_Node_Str" + version+ "String_Node_Str";
HttpGet jarGet=new HttpGet(baseUrl + "String_Node_Str" + fileName);
out.print("String_Node_Str" + baseUrl + "String_Node_Str"+ fileName+ "String_Node_Str");
response=client.execute(jarGet);
try {
FileResource<?> target=(FileResource<?>)pluginDir.getChild(fileName);
if (!target.exists() && target.createNewFile()) {
target.setContents(response.getEntity().getContent());
out.println("String_Node_Str");
return target;
}
 else {
throw new IllegalStateException("String_Node_Str" + target.getFullyQualifiedName() + "String_Node_Str");
}
}
 catch (IOException e) {
out.println("String_Node_Str" + e.getMessage());
return null;
}
}
 else {
out.println("String_Node_Str");
return null;
}
case 404:
String requestUrl=baseUrl + "String_Node_Str" + artifactParts[2]+ "String_Node_Str";
httpGetManifest=new HttpGet(requestUrl);
response=client.execute(httpGetManifest);
if (response.getStatusLine().getStatusCode() != 200) {
printError(response.getStatusLine().getStatusCode(),requestUrl,out);
return null;
}
 else {
}
break;
default :
out.println("String_Node_Str" + response.getStatusLine().getStatusCode());
return null;
}
return null;
}

Fixed version (ground truth):
public static FileResource<?> downloadFromIndexRef(final PluginRef ref,final PipeOut out,final DirectoryResource pluginDir) throws Exception {
  DefaultHttpClient client=new DefaultHttpClient();
  String[] artifactParts=ref.getArtifact().toIdentifier().split("String_Node_Str");
  if (artifactParts.length != 3) {
    throw new RuntimeException("String_Node_Str" + "String_Node_Str" + ref.getArtifact());
  }
  String packageLocation=artifactParts[0].replaceAll("String_Node_Str","String_Node_Str");
  String baseUrl;
  if (ref.getHomeRepo().endsWith("String_Node_Str")) {
    baseUrl=ref.getHomeRepo() + packageLocation + "String_Node_Str"+ artifactParts[1]+ "String_Node_Str"+ artifactParts[2];
  }
 else {
    baseUrl=ref.getHomeRepo() + "String_Node_Str" + packageLocation+ "String_Node_Str"+ artifactParts[1]+ "String_Node_Str"+ artifactParts[2];
  }
  HttpGet httpGetManifest=new HttpGet(baseUrl + "String_Node_Str");
  out.print("String_Node_Str");
  HttpResponse response=new DefaultHttpClient().execute(httpGetManifest);
switch (response.getStatusLine().getStatusCode()) {
case 200:
    out.println("String_Node_Str");
  Document document=DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(response.getEntity().getContent());
XPath xpath=XPathFactory.newInstance().newXPath();
XPathExpression checkSnapshotExpr=xpath.compile("String_Node_Str");
XPathExpression findJar=xpath.compile("String_Node_Str");
NodeList list=(NodeList)checkSnapshotExpr.evaluate(document,XPathConstants.NODESET);
out.print("String_Node_Str");
if (list.getLength() != 0) {
Node n=(Node)findJar.evaluate(document,XPathConstants.NODE);
if (n == null) {
out.println("String_Node_Str");
return null;
}
String version=n.getFirstChild().getTextContent();
out.println("String_Node_Str" + version);
String fileName=artifactParts[1] + "String_Node_Str" + version+ "String_Node_Str";
HttpGet jarGet=new HttpGet(baseUrl + "String_Node_Str" + fileName);
out.print("String_Node_Str" + baseUrl + "String_Node_Str"+ fileName+ "String_Node_Str");
response=new DefaultHttpClient().execute(jarGet);
try {
FileResource<?> target=(FileResource<?>)pluginDir.getChild(fileName);
if (!target.exists() && target.createNewFile()) {
target.setContents(response.getEntity().getContent());
out.println("String_Node_Str");
return target;
}
 else {
throw new IllegalStateException("String_Node_Str" + target.getFullyQualifiedName() + "String_Node_Str");
}
}
 catch (IOException e) {
out.println("String_Node_Str" + e.getMessage());
return null;
}
}
 else {
out.println("String_Node_Str");
return null;
}
case 404:
String requestUrl=baseUrl + "String_Node_Str" + artifactParts[2]+ "String_Node_Str";
httpGetManifest=new HttpGet(requestUrl);
response=new DefaultHttpClient().execute(httpGetManifest);
if (response.getStatusLine().getStatusCode() != 200) {
printError(response.getStatusLine().getStatusCode(),requestUrl,out);
return null;
}
 else {
}
break;
default :
out.println("String_Node_Str" + response.getStatusLine().getStatusCode());
return null;
}
return null;
}