public UrlList getUrlList(String url) { UrlList urlList = null; try { String key = Hash.hashKey(url); GetObjectRequest req = new GetObjectRequest(bucketName, key); S3Object s3Object = s3client.getObject(req); InputStream objectData = s3Object.getObjectContent(); BufferedReader reader = new BufferedReader(new InputStreamReader(objectData)); StringBuilder s3Content = new StringBuilder(); String line; while ((line = reader.readLine()) != null) { s3Content.append(line + "\r\n"); } reader.close(); objectData.close(); ObjectMapper mapper = new ObjectMapper(); mapper.setVisibility(PropertyAccessor.ALL, Visibility.NONE); mapper.setVisibility(PropertyAccessor.FIELD, Visibility.ANY); urlList = mapper.readValue(s3Content.toString(), UrlList.class); } catch (AmazonS3Exception ase) { System.out.println("S3UrlListDA : document does not exist"); ase.printStackTrace(); } catch (IOException e) { System.out.println("S3UrlListDA : IOException while fetching document from S3"); e.printStackTrace(); } catch (NoSuchAlgorithmException e) { // TODO Auto-generated catch block e.printStackTrace(); } return urlList; }