Program: 177993
Project: 177993
Buggy source:
/** 
 * Publish a zipped shapefile. <P> These are the equivalent calls with cUrl: <PRE>  {@code curl -u admin:geoserver -XPUT -H 'Content-type: application/zip' \ --data-binary @$ZIPFILE \ http://$GSIP:$GSPORT/$SERVLET/rest/workspaces/$WORKSPACE/datastores/$STORENAME/file.shp curl -u admin:geoserver -XPOST -H 'Content-type: text/xml'  \ -d "<featureType><name>$BARE</name><nativeCRS>EPSG:4326</nativeCRS><enabled>true</enabled></featureType>"  \ http://$GSIP:$GSPORT/$SERVLET/rest/workspaces/$WORKSPACE/datastores/$STORENAME/featuretypes/$LAYERNAME}</PRE>
 * @return true if the operation completed successfully.
 */
public boolean publishShp(String workspace,String storename,String layername,File zipFile,String srs) throws FileNotFoundException {
  StringBuilder sbUrl=new StringBuilder(restURL).append("String_Node_Str").append(workspace).append("String_Node_Str").append(storename).append("String_Node_Str");
  String sentResult=HTTPUtils.put(sbUrl.toString(),zipFile,"String_Node_Str",gsuser,gspass);
  boolean shpSent=sentResult != null;
  if (shpSent) {
    LOGGER.info("String_Node_Str" + layername + "String_Node_Str"+ zipFile+ "String_Node_Str");
    StringBuilder postUrl=new StringBuilder(restURL).append("String_Node_Str").append(workspace).append("String_Node_Str").append(storename).append("String_Node_Str").append(layername);
    GSFeatureTypeEncoder fte=new GSFeatureTypeEncoder();
    fte.addName(layername);
    fte.addSRS(srs);
    fte.addProjectionPolicy(ProjectionPolicy.REPROJECT_TO_DECLARED);
    String configuredResult=HTTPUtils.putXml(postUrl.toString(),fte.toString(),this.gsuser,this.gspass);
    boolean shpConfigured=configuredResult != null;
    if (!shpConfigured) {
      LOGGER.warn("String_Node_Str" + workspace + "String_Node_Str"+ storename+ "String_Node_Str"+ layername+ "String_Node_Str"+ zipFile);
    }
 else {
      LOGGER.info("String_Node_Str" + layername + "String_Node_Str");
    }
    return shpConfigured;
  }
 else {
    LOGGER.warn("String_Node_Str" + workspace + "String_Node_Str"+ storename+ "String_Node_Str"+ layername+ "String_Node_Str"+ zipFile);
    return false;
  }
}

Fixed version (ground truth):
/** 
 * Publish a zipped shapefile.<br> http://docs.geoserver.org/stable/en/user /restconfig/rest-config-examples/rest- config-examples-curl.html#uploading-a-shapefile
 * @param workspace the name of the workspace to use
 * @param storename the name of the store to create
 * @param layername the name of the layer to configure
 * @param zipFile the zip file containing the shapefile
 * @param srs the native CRS
 * @param params parameters to append to the url (can be null).<br> Accepted parameters are:<br> <ul> <li><b>charset</b> used to set the charset</li> </ul>
 * @return true if success false otherwise
 * @throws FileNotFoundException
 */
public boolean publishShp(String workspace,String storename,String layername,File zipFile,String srs,NameValuePair... params) throws FileNotFoundException {
  StringBuilder sbUrl=new StringBuilder(restURL).append("String_Node_Str").append(workspace).append("String_Node_Str").append(storename).append("String_Node_Str");
  if (params != null) {
    final int paramsSize=params.length;
    if (paramsSize > 0) {
      sbUrl.append(params[0].getName()).append("String_Node_Str").append(params[0].getValue());
      for (int i=1; i < paramsSize; i++) {
        sbUrl.append("String_Node_Str").append(params[i].getName()).append("String_Node_Str").append(params[i].getValue());
      }
    }
  }
  String sentResult=HTTPUtils.put(sbUrl.toString(),zipFile,"String_Node_Str",gsuser,gspass);
  boolean shpSent=sentResult != null;
  if (shpSent) {
    LOGGER.info("String_Node_Str" + layername + "String_Node_Str"+ zipFile+ "String_Node_Str");
    StringBuilder postUrl=new StringBuilder(restURL).append("String_Node_Str").append(workspace).append("String_Node_Str").append(storename).append("String_Node_Str").append(layername);
    GSFeatureTypeEncoder fte=new GSFeatureTypeEncoder();
    fte.addName(layername);
    fte.addSRS(srs);
    fte.addProjectionPolicy(ProjectionPolicy.REPROJECT_TO_DECLARED);
    String configuredResult=HTTPUtils.putXml(postUrl.toString(),fte.toString(),this.gsuser,this.gspass);
    boolean shpConfigured=configuredResult != null;
    if (!shpConfigured) {
      LOGGER.warn("String_Node_Str" + workspace + "String_Node_Str"+ storename+ "String_Node_Str"+ layername+ "String_Node_Str"+ zipFile);
    }
 else {
      LOGGER.info("String_Node_Str" + layername + "String_Node_Str");
    }
    return shpConfigured;
  }
 else {
    LOGGER.warn("String_Node_Str" + workspace + "String_Node_Str"+ storename+ "String_Node_Str"+ layername+ "String_Node_Str"+ zipFile);
    return false;
  }
}