Buggy code:
@ Path ( "//dataset" ) public class MetadataService { public static final String IMPORT_BULKDATASET_METADATA_REQ_KEY = "dataset" ; public static final String IMPORT_BULKDATASET_ENCODING_REQ_KEY = "encoding" ; public static final String IMPORT_BULKDATASET_FORMAT_TYPE_REQ_KEY = "formatType" ; public static final String IMPORT_BULKDATASET_CSV_SEP_REQ_KEY = "csvSeparator" ; public static final String IMPORT_BULKDATASET_CSV_SKIP_FIRS_ROW_REQ_KEY = "skipFirstRow" ; public static final String IMPORT_BULKDATASET_FILE_REQ_KEY = "file" ; @ Context ServletContext context ; static Logger log = Logger . getLogger ( MetadataService . class ) ; @ GET @ Path ( "//{tenant}" ) @ Produces ( MediaType . APPLICATION_JSON ) public String getAllCurrent ( @ PathParam ( "tenant" ) String tenant ) throws NumberFormatException , UnknownHostException { } @ GET @ Path ( "//download//{tenant}//{datasetCode}//{format}" ) @ Produces ( MediaType . APPLICATION_OCTET_STREAM ) public Response downloadData ( @ PathParam ( "tenant" ) String tenant , @ PathParam ( "datasetCode" ) String datasetCode , @ PathParam ( "format" ) String format ) throws NumberFormatException , UnknownHostException { } @ GET @ Path ( "//{tenant}//{datasetCode}" ) @ Produces ( MediaType . APPLICATION_JSON ) public String get ( @ PathParam ( "tenant" ) String tenant , @ PathParam ( "datasetCode" ) String datasetCode ) throws NumberFormatException , UnknownHostException { MetadataService . log . debug ( ( "[MetadataService::get]<seq2seq4repair_space>-<seq2seq4repair_space>START<seq2seq4repair_space>-<seq2seq4repair_space>datasetCode:<seq2seq4repair_space>" + datasetCode ) ) ; System . out . println ( ( "DatasetItem<seq2seq4repair_space>requested<seq2seq4repair_space>with<seq2seq4repair_space>datasetCode=" + datasetCode ) ) ; MongoClient mongo = MongoSingleton . getMongoClient ( ) ; String supportDb = Config . getInstance ( ) . getDbSupport ( ) ; String supportDatasetCollection = Config . getInstance ( ) . getCollectionSupportDataset ( ) ; String supportApiCollection = Config . getInstance ( ) . getCollectionSupportApi ( ) ; MongoDBMetadataDAO metadataDAO = new MongoDBMetadataDAO ( mongo , supportDb , supportDatasetCollection ) ; Metadata metadata = metadataDAO . readCurrentMetadataByCode ( datasetCode ) ; MongoDBApiDAO apiDAO = new MongoDBApiDAO ( mongo , supportDb , supportApiCollection ) ; MyApi api = apiDAO . readApiByCode ( datasetCode ) ; <START_BUG> String baseApiUrl = Config . getInstance ( ) . getBaseApiUrl ( ) ; <END_BUG> String supportStreamCollection = Config . getInstance ( ) . getCollectionSupportStream ( ) ; MongoDBStreamDAO streamDAO = new MongoDBStreamDAO ( mongo , supportDb , supportStreamCollection ) ; StreamOut stream = streamDAO . readStreamByMetadata ( metadata ) ; return new org . csi . yucca . storage . datamanagementapi . model . metadata . MetadataWithExtraAttribute ( metadata , stream , api , baseApiUrl ) . toJson ( ) ; } @ POST @ Path ( "//{tenant}" ) @ Produces ( MediaType . APPLICATION_JSON ) public String createMetadata ( @ PathParam ( "tenant" ) String tenant , @ Context HttpServletRequest request ) throws NumberFormatException , UnknownHostException { } @ POST @ Path ( "//add//{tenant}//{datasetCode}" ) @ Produces ( MediaType . APPLICATION_JSON ) public String addDataa ( @ PathParam ( "tenant" ) String tenant , @ PathParam ( "datasetCode" ) String datasetCode , @ Context HttpServletRequest request ) throws NumberFormatException , UnknownHostException { } @ PUT @ Produces ( MediaType . APPLICATION_JSON ) @ Path ( "//{tenant}//{datasetCode}" ) public String updateMetadata ( @ PathParam ( "tenant" ) String tenant , @ PathParam ( "datasetCode" ) String datasetCode , final String metadataInput ) throws NumberFormatException , UnknownHostException { } @ SuppressWarnings ( "unused" ) private int size ( InputStream stream ) { } private String read ( InputStream stream ) { } private String readFileRows ( InputStream stream , String encoding ) throws UnsupportedEncodingException { } }

Fix:
String baseApiUrl = Config . getInstance ( ) . getStoreApiAddress ( ) ;