Program: 178018
Project: 178018
Buggy source:
/** 
 * Publish a table in a PostGis store as a new layer. <P>This is the equivalent call with cUrl: <PRE>  {@code curl -u admin:geoserver -XPOST -H 'Content-type: text/xml' \-d "<featureType><name>easia_gaul_1_aggr</name><nativeCRS>EPSG:4326</nativeCRS><enabled>true</enabled></featureType>" \ http://localhost:8080/geoserver/rest/workspaces/it.geosolutions/datastores/pg_kids/featuretypes}</PRE> and a PUT to <BR>restURL + "/rest/layers/" + layerName
 */
public boolean publishDBLayer(String workspace,String storename,String layername,String srs,String defaultStyle){
  StringBuilder postUrl=new StringBuilder(restURL).append("String_Node_Str").append(workspace).append("String_Node_Str").append(storename).append("String_Node_Str");
  GSFeatureTypeEncoder fte=new GSFeatureTypeEncoder();
  fte.addName(layername);
  fte.addSRS(srs);
  String ftypeXml=fte.toString();
  String configuredResult=HTTPUtils.postXml(postUrl.toString(),ftypeXml,this.gsuser,this.gspass);
  boolean published=configuredResult != null;
  boolean configured=false;
  if (!published) {
    LOGGER.warn("String_Node_Str" + configuredResult + "String_Node_Str"+ workspace+ "String_Node_Str"+ storename+ "String_Node_Str"+ layername);
  }
 else {
    LOGGER.info("String_Node_Str" + layername + "String_Node_Str");
    GSLayerEncoder layerEncoder=new GSLayerEncoder();
    layerEncoder.addDefaultStyle(defaultStyle);
    configured=configureLayer(workspace,layername,layerEncoder);
    if (!configured) {
      LOGGER.warn("String_Node_Str" + configuredResult + "String_Node_Str"+ workspace+ "String_Node_Str"+ storename+ "String_Node_Str"+ layername);
    }
 else {
      LOGGER.info("String_Node_Str" + layername + "String_Node_Str");
    }
  }
  return published && configured;
}

Fixed version (ground truth):
/** 
 * Publish a table in a PostGis store as a new layer. <P> This is the equivalent call with cUrl: <PRE>  {@code curl -u admin:geoserver -XPOST -H 'Content-type: text/xml' \-d "<featureType><name>easia_gaul_1_aggr</name><nativeCRS>EPSG:4326</nativeCRS><enabled>true</enabled></featureType>" \ http://localhost:8080/geoserver/rest/workspaces/it.geosolutions/datastores/pg_kids/featuretypes}</PRE> and a PUT to <BR> restURL + "/rest/layers/" + layerName
 */
public boolean publishDBLayer(String workspace,String storename,String layername,String srs,String defaultStyle){
  StringBuilder postUrl=new StringBuilder(restURL).append("String_Node_Str").append(workspace).append("String_Node_Str").append(storename).append("String_Node_Str");
  GSFeatureTypeEncoder fte=new GSFeatureTypeEncoder();
  fte.addName(layername);
  fte.addSRS(srs);
  String ftypeXml=fte.toString();
  String configuredResult=HTTPUtils.postXml(postUrl.toString(),ftypeXml,this.gsuser,this.gspass);
  boolean published=configuredResult != null;
  boolean configured=false;
  if (!published) {
    LOGGER.warn("String_Node_Str" + configuredResult + "String_Node_Str"+ workspace+ "String_Node_Str"+ storename+ "String_Node_Str"+ layername);
  }
 else {
    LOGGER.info("String_Node_Str" + layername + "String_Node_Str");
    GSLayerEncoder layerEncoder=new GSLayerEncoder();
    layerEncoder.addDefaultStyle(defaultStyle);
    configured=configureLayer(workspace,layername,layerEncoder);
    if (!configured) {
      LOGGER.warn("String_Node_Str" + configuredResult + "String_Node_Str"+ workspace+ "String_Node_Str"+ storename+ "String_Node_Str"+ layername);
    }
 else {
      LOGGER.info("String_Node_Str" + layername + "String_Node_Str");
    }
  }
  return published && configured;
}