Buggy code:
public class RestSdmxClient implements GenericSDMXClient { protected boolean dotStat = false ; protected URL wsEndpoint = null ; protected String name = null ; protected boolean needsCredentials = false ; protected boolean needsURLEncoding = false ; protected boolean supportsCompression = false ; protected boolean containsCredentials = false ; protected String user = null ; protected String pw = null ; private static final String sourceClass = RestSdmxClient . class . getSimpleName ( ) ; protected static Logger logger = Configuration . getSdmxLogger ( ) ; public RestSdmxClient ( String name , URL endpoint , boolean needsCredentials , boolean needsURLEncoding , boolean supportsCompression ) { } @ Override public Map < String , Dataflow > getDataflows ( ) throws SdmxException { } @ Override public Dataflow getDataflow ( String dataflow , String agency , String version ) throws SdmxException { } @ Override public DataFlowStructure getDataFlowStructure ( DSDIdentifier dsd , boolean full ) throws SdmxException { } @ Override public Map < String , String > getCodes ( String codeList , String agency , String version ) throws SdmxException { } @ Override public List < PortableTimeSeries > getTimeSeries ( Dataflow dataflow , DataFlowStructure dsd , String resource , String startTime , String endTime ) throws SdmxException { } @ Override public boolean needsCredentials ( ) { } @ Override public void setCredentials ( String user , String pw ) { } protected InputStreamReader runQuery ( String query , String acceptHeader ) throws SdmxException { final String sourceMethod = "runQuery" ; RestSdmxClient . logger . entering ( RestSdmxClient . sourceClass , sourceMethod ) ; if ( needsURLEncoding ) { query = query . replace ( "|" , "%2B" ) ; query = query . replace ( "+" , "%2B" ) ; } RestSdmxClient . logger . info ( ( "Contacting<seq2seq4repair_space>web<seq2seq4repair_space>service<seq2seq4repair_space>with<seq2seq4repair_space>query:<seq2seq4repair_space>" + query ) ) ; try { URL url = new URL ( query ) ; HttpURLConnection conn = ( ( HttpURLConnection ) ( url . openConnection ( ) ) ) ; conn . setRequestMethod ( "GET" ) ; handleHttpHeaders ( conn , acceptHeader ) ; int code = conn . getResponseCode ( ) ; if ( code == 200 ) { RestSdmxClient . logger . fine ( ( "Connection<seq2seq4repair_space>opened.<seq2seq4repair_space>Code:<seq2seq4repair_space>" + code ) ) ; if ( supportsCompression ) { <START_BUG> return new InputStreamReader ( new GZIPInputStream ( conn . getInputStream ( ) ) ) ; <END_BUG> } else { return new InputStreamReader ( conn . getInputStream ( ) , "UTF-8" ) ; } } else { String msg = ( ( ( "Connection<seq2seq4repair_space>failed.<seq2seq4repair_space>HTTP<seq2seq4repair_space>error<seq2seq4repair_space>code<seq2seq4repair_space>:<seq2seq4repair_space>" + code ) + ",<seq2seq4repair_space>message:<seq2seq4repair_space>" ) + ( conn . getResponseMessage ( ) ) ) + "\n" ; switch ( code ) { case 400 : msg += "SDMX<seq2seq4repair_space>meaning:<seq2seq4repair_space>there<seq2seq4repair_space>is<seq2seq4repair_space>a<seq2seq4repair_space>problem<seq2seq4repair_space>with<seq2seq4repair_space>the<seq2seq4repair_space>syntax<seq2seq4repair_space>of<seq2seq4repair_space>the<seq2seq4repair_space>query" ; RestSdmxClient . logger . severe ( msg ) ; throw new SdmxException ( msg ) ; case 403 : msg += "SDMX<seq2seq4repair_space>meaning:<seq2seq4repair_space>The<seq2seq4repair_space>syntax<seq2seq4repair_space>of<seq2seq4repair_space>the<seq2seq4repair_space>query<seq2seq4repair_space>is<seq2seq4repair_space>OK<seq2seq4repair_space>but<seq2seq4repair_space>it<seq2seq4repair_space>has<seq2seq4repair_space>no<seq2seq4repair_space>meaning" ; RestSdmxClient . logger . severe ( msg ) ; throw new SdmxException ( msg ) ; case 404 : msg += "SDMX<seq2seq4repair_space>meaning:<seq2seq4repair_space>No<seq2seq4repair_space>results<seq2seq4repair_space>matching<seq2seq4repair_space>the<seq2seq4repair_space>query." ; RestSdmxClient . logger . severe ( msg ) ; throw new SdmxException ( msg ) ; case 406 : msg += "SDMX<seq2seq4repair_space>meaning:<seq2seq4repair_space>Not<seq2seq4repair_space>a<seq2seq4repair_space>supported<seq2seq4repair_space>format." ; RestSdmxClient . logger . severe ( msg ) ; throw new SdmxException ( msg ) ; case 500 : msg += "SDMX<seq2seq4repair_space>meaning:<seq2seq4repair_space>Error<seq2seq4repair_space>on<seq2seq4repair_space>the<seq2seq4repair_space>provider<seq2seq4repair_space>side." ; RestSdmxClient . logger . severe ( msg ) ; throw new SdmxException ( msg ) ; case 501 : msg += "SDMX<seq2seq4repair_space>meaning:<seq2seq4repair_space>Feature<seq2seq4repair_space>not<seq2seq4repair_space>supported." ; RestSdmxClient . logger . severe ( msg ) ; throw new SdmxException ( msg ) ; case 503 : msg += "SDMX<seq2seq4repair_space>meaning:<seq2seq4repair_space>Service<seq2seq4repair_space>temporarily<seq2seq4repair_space>unavailable.<seq2seq4repair_space>Please<seq2seq4repair_space>try<seq2seq4repair_space>again<seq2seq4repair_space>later.." ; RestSdmxClient . logger . severe ( msg ) ; throw new SdmxException ( msg ) ; default : RestSdmxClient . logger . severe ( msg ) ; throw new SdmxException ( msg ) ; } } } catch ( IOException e ) { RestSdmxClient . logger . severe ( ( "Exception<seq2seq4repair_space>caught<seq2seq4repair_space>calling<seq2seq4repair_space>provider<seq2seq4repair_space>" + ( name ) ) ) ; RestSdmxClient . logger . log ( Level . FINER , "Exception:<seq2seq4repair_space>" , e ) ; throw new SdmxException ( ( ( ( "Exception.<seq2seq4repair_space>Class:<seq2seq4repair_space>" + ( e . getClass ( ) . getName ( ) ) ) + "<seq2seq4repair_space>.Message:<seq2seq4repair_space>" ) + ( e . getMessage ( ) ) ) ) ; } } protected void handleHttpHeaders ( HttpURLConnection conn , String acceptHeader ) { } protected String buildDataQuery ( URL endpoint , Dataflow dataflow , String resource , String startTime , String endTime ) throws SdmxException { } protected String buildDSDQuery ( URL endpoint , String dsd , String agency , String version , boolean full ) throws SdmxException { } protected String buildFlowQuery ( URL endpoint , String dataflow , String agency , String version ) throws SdmxException { } protected String buildCodelistQuery ( URL endpoint , String codeList , String agency , String version ) throws SdmxException { } }

Fix:
return new InputStreamReader ( new GZIPInputStream ( conn . getInputStream ( ) ) , "UTF-8" ) ;