Program: 178027
Project: 178027
Buggy source:
/** 
 * Remove the Coverage configuration from GeoServer. <BR> First, the associated layer is removed, then the Coverage configuration itself. <P> <B>CHECKME</B> Maybe the coveragestore has to be removed as well. <P> REST URL: <TT>http://localhost:8080/geoserver/rest/workspaces/it.geosolutions/coveragestores/gbRESTtestStore/coverages/resttestdem.xml</TT>
 * @return true if the operation completed successfully.
 */
public boolean unpublishCoverage(String workspace,String storename,String layername){
  try {
    URL deleteLayerUrl=new URL(restURL + "String_Node_Str" + layername);
    if (LOGGER.isDebugEnabled()) {
      LOGGER.debug("String_Node_Str" + "String_Node_Str" + layername);
    }
    boolean layerDeleted=HTTPUtils.delete(deleteLayerUrl.toExternalForm(),gsuser,gspass);
    if (!layerDeleted) {
      LOGGER.warn("String_Node_Str" + layername + "String_Node_Str");
      return false;
    }
    URL deleteCovUrl=new URL(restURL + "String_Node_Str" + workspace+ "String_Node_Str"+ storename+ "String_Node_Str"+ layername);
    if (LOGGER.isDebugEnabled()) {
      LOGGER.debug("String_Node_Str" + "String_Node_Str" + workspace + "String_Node_Str"+ storename+ "String_Node_Str"+ layername);
    }
    boolean covDeleted=HTTPUtils.delete(deleteCovUrl.toExternalForm(),gsuser,gspass);
    if (!covDeleted) {
      LOGGER.warn("String_Node_Str" + workspace + "String_Node_Str"+ storename+ "String_Node_Str"+ layername+ "String_Node_Str");
    }
 else {
      LOGGER.info("String_Node_Str" + workspace + "String_Node_Str"+ storename+ "String_Node_Str"+ layername);
    }
    return covDeleted;
  }
 catch (  MalformedURLException ex) {
    LOGGER.error(ex);
    return false;
  }
}

Fixed version (ground truth):
/** 
 * Remove the Coverage configuration from GeoServer. <BR> First, the associated layer is removed, then the Coverage configuration itself. <P> <B>CHECKME</B> Maybe the coveragestore has to be removed as well. <P> REST URL: <TT>http://localhost:8080/geoserver/rest/workspaces/it.geosolutions/coveragestores/gbRESTtestStore/coverages/resttestdem.xml</TT>
 * @return true if the operation completed successfully.
 */
public boolean unpublishCoverage(String workspace,String storename,String layerName){
  try {
    final String fqLayerName;
    if (workspace == null) {
      fqLayerName=layerName;
      if (LOGGER.isEnabledFor(Level.WARN)) {
        LOGGER.warn("String_Node_Str" + layerName + "String_Node_Str");
      }
    }
 else {
      fqLayerName=workspace + "String_Node_Str" + layerName;
    }
    URL deleteLayerUrl=new URL(restURL + "String_Node_Str" + fqLayerName);
    if (LOGGER.isDebugEnabled()) {
      LOGGER.debug("String_Node_Str" + "String_Node_Str" + fqLayerName);
    }
    boolean layerDeleted=HTTPUtils.delete(deleteLayerUrl.toExternalForm(),gsuser,gspass);
    if (!layerDeleted) {
      LOGGER.warn("String_Node_Str" + fqLayerName + "String_Node_Str");
      return false;
    }
    URL deleteCovUrl=new URL(restURL + "String_Node_Str" + workspace+ "String_Node_Str"+ storename+ "String_Node_Str"+ layerName);
    if (LOGGER.isDebugEnabled()) {
      LOGGER.debug("String_Node_Str" + "String_Node_Str" + workspace + "String_Node_Str"+ storename+ "String_Node_Str"+ layerName);
    }
    boolean covDeleted=HTTPUtils.delete(deleteCovUrl.toExternalForm(),gsuser,gspass);
    if (!covDeleted) {
      LOGGER.warn("String_Node_Str" + workspace + "String_Node_Str"+ storename+ "String_Node_Str"+ layerName+ "String_Node_Str");
    }
 else {
      LOGGER.info("String_Node_Str" + workspace + "String_Node_Str"+ storename+ "String_Node_Str"+ layerName);
    }
    return covDeleted;
  }
 catch (  MalformedURLException ex) {
    if (LOGGER.isEnabledFor(Level.ERROR))     LOGGER.error(ex);
    return false;
  }
}