Program: 177998
Project: 177998
Buggy source:
/** 
 * Publish a Mosaic already in a filesystem readable by GeoServer. <P> Sample cUrl usage:<BR> <TT>curl -u admin:geoserver -XPUT -H 'Content-type: text' -d "file:$ABSPORTDIR" http://$GSIP:$GSPORT/$SERVLET/rest/workspaces/$WORKSPACE/coveragestores/$BAREDIR/external.imagemosaic </TT>
 * @param workspace an existing workspace
 * @param storeName the name of the coverageStore to be created
 * @param mosaicDir the directory where the raster images are located
 * @param coverageEncoder the set of parameters to be set to the coverage (bbox, srs, ...)
 * @param layerEncoder the set of parameters to be set to the layer (defaultstyle, wmspath, ...)
 * @return the created RESTCoverageStore
 * @deprecated this is keep only for backward compatibility usecreateExternalMosaic and getCoverageStore separately
 * @throws FileNotFoundException
 */
public RESTCoverageStore publishExternalMosaic(String workspace,String storeName,File mosaicDir,GSCoverageEncoder coverageEncoder,GSLayerEncoder layerEncoder) throws FileNotFoundException {
  if (!createExternalMosaic(workspace,storeName,mosaicDir,coverageEncoder,layerEncoder)) {
    return null;
  }
  GeoServerRESTReader reader;
  try {
    reader=new GeoServerRESTReader(restURL,gsuser,gspass);
  }
 catch (  MalformedURLException e1) {
    LOGGER.warn("String_Node_Str" + storeName,e1);
    return null;
  }
  final RESTCoverageStore store=reader.getCoverageStore(workspace,storeName);
  if (store == null) {
    LOGGER.warn("String_Node_Str" + workspace + "String_Node_Str"+ storeName+ "String_Node_Str");
    return null;
  }
  return store;
}

Fixed version (ground truth):
/** 
 * Publish a Mosaic already in a filesystem readable by GeoServer. <P> Sample cUrl usage:<BR> <TT>curl -u admin:geoserver -XPUT -H 'Content-type: text' -d "file:$ABSPORTDIR" http://$GSIP:$GSPORT/$SERVLET/rest/workspaces/$WORKSPACE/coveragestores/$BAREDIR/external.imagemosaic </TT>
 * @param workspace an existing workspace
 * @param storeName the name of the coverageStore to be created
 * @param mosaicDir the directory where the raster images are located
 * @param coverageEncoder the set of parameters to be set to the coverage (bbox, srs, ...)
 * @param layerEncoder the set of parameters to be set to the layer (defaultstyle, wmspath, ...)
 * @return true if the operation completed successfully.
 * @throws FileNotFoundException
 */
public boolean publishExternalMosaic(String workspace,final String storeName,File mosaicDir,GSCoverageEncoder coverageEncoder,GSLayerEncoder layerEncoder) throws FileNotFoundException, IllegalArgumentException {
  if (coverageEncoder == null) {
    throw new IllegalArgumentException("String_Node_Str" + mosaicDir);
  }
  String coverageName=coverageEncoder.getName();
  if (layerEncoder == null) {
    throw new IllegalArgumentException("String_Node_Str" + workspace + "String_Node_Str"+ coverageName);
  }
  RESTCoverageStore store=createExternaMosaicDatastore(workspace,storeName,mosaicDir,ParameterConfigure.NONE,ParameterUpdate.OVERWRITE);
  if (store == null) {
    return false;
  }
  if (!createCoverage(workspace,storeName,coverageEncoder)) {
    if (LOGGER.isEnabledFor(Level.ERROR))     LOGGER.error("String_Node_Str" + coverageName);
    return false;
  }
  if (!configureLayer(workspace,coverageName,layerEncoder)) {
    if (LOGGER.isEnabledFor(Level.ERROR))     LOGGER.error("String_Node_Str" + coverageName);
    return false;
  }
  return true;
}