Program: 52231
Project: 52231
Buggy source:
/** 
 * Implement WebDAV PUT http request. This might be simpler with a real HTTP client library, but java.net.HttpURLConnection is part of the standard SDK and it demonstrates the concepts.
 * @param lni the lni
 * @param collHandle the coll handle
 * @param packager the packager
 * @param source the source
 * @param endpoint the endpoint
 * @throws RemoteException the remote exception
 * @throws ProtocolException the protocol exception
 * @throws IOException Signals that an I/O exception has occurred.
 * @throws FileNotFoundException the file not found exception
 */
private static void doPut(LNISoapServlet lni,String collHandle,String packager,String source,String endpoint) throws java.rmi.RemoteException, ProtocolException, IOException, FileNotFoundException {
  String collURI=doLookup(lni,collHandle,null);
  URL url=LNIClientUtils.makeDAVURL(endpoint,collURI,packager);
  System.err.println("String_Node_Str" + source + "String_Node_Str"+ url.toString());
  HttpURLConnection conn=(HttpURLConnection)url.openConnection();
  conn.setRequestMethod("String_Node_Str");
  conn.setDoOutput(true);
  fixBasicAuth(url,conn);
  conn.connect();
  InputStream in=new FileInputStream(source);
  OutputStream out=conn.getOutputStream();
  copyStream(in,out);
  in.close();
  out.close();
  int status=conn.getResponseCode();
  if (status < 200 || status >= 300) {
    die(status,"String_Node_Str" + String.valueOf(status) + "String_Node_Str"+ conn.getResponseMessage());
  }
  System.err.println("String_Node_Str" + source);
  System.err.println("String_Node_Str" + String.valueOf(conn.getResponseCode()) + "String_Node_Str"+ conn.getResponseMessage());
  String loc=conn.getHeaderField("String_Node_Str");
  System.err.println("String_Node_Str" + ((loc == null) ? "String_Node_Str" : loc));
}

Fixed version (ground truth):
/** 
 * Implement WebDAV PUT http request. This might be simpler with a real HTTP client library, but java.net.HttpURLConnection is part of the standard SDK and it demonstrates the concepts.
 * @param lni the lni
 * @param collHandle the coll handle
 * @param packager the packager
 * @param source the source
 * @param endpoint the endpoint
 * @throws RemoteException the remote exception
 * @throws ProtocolException the protocol exception
 * @throws IOException Signals that an I/O exception has occurred.
 * @throws FileNotFoundException the file not found exception
 */
private static void doPut(LNISoapServlet lni,String collHandle,String packager,String source,String endpoint) throws java.rmi.RemoteException, ProtocolException, IOException, FileNotFoundException {
  String collURI=doLookup(lni,collHandle,null);
  URL url=LNIClientUtils.makeDAVURL(endpoint,collURI,packager);
  System.err.println("String_Node_Str" + source + "String_Node_Str"+ url.toString());
  HttpURLConnection conn=(HttpURLConnection)url.openConnection();
  conn.setRequestMethod("String_Node_Str");
  conn.setDoOutput(true);
  fixBasicAuth(url,conn);
  conn.connect();
  InputStream in=new FileInputStream(source);
  OutputStream out=conn.getOutputStream();
  try {
    copyStream(in,out);
  }
  finally {
    in.close();
    out.close();
  }
  int status=conn.getResponseCode();
  if (status < 200 || status >= 300) {
    die(status,"String_Node_Str" + String.valueOf(status) + "String_Node_Str"+ conn.getResponseMessage());
  }
  System.err.println("String_Node_Str" + source);
  System.err.println("String_Node_Str" + String.valueOf(conn.getResponseCode()) + "String_Node_Str"+ conn.getResponseMessage());
  String loc=conn.getHeaderField("String_Node_Str");
  System.err.println("String_Node_Str" + ((loc == null) ? "String_Node_Str" : loc));
}