Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- selection.add( new Blah( URL ) ); // create an object and adding it to an arrayList <= [ERROR SHOWN HERE]
- My class:
- public Blah(String _URL) throws MalformedURLException, IOException {
- this.URL = _URL;
- Pattern p = Pattern.compile("\\.com\\/[a-z]+\\/(\\d+)");
- Matcher m = p.matcher(getStoreURL());
- if (m.find()) {
- System.out.println( "ID = [" + m.group(1) + "]" ); // works fine
- this.id = Long.parseLong(m.group(1));
- }
- String genreJson = IOUtils.toString(new URL(apiURL + this.id)); // Get the json
- ObjectMapper mapper = new ObjectMapper();
- JsonNode root = mapper.readTree(genreJson);
- setName(root.path(String.valueOf(getId())).path("data").path("name").asText()); // get the name
- System.out.println("In Blah :: getName() " + getName()); // Works fine
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement