src/main/java/com/github/jreddit/parser/listing/RedditListingParser.java
public void validate(Object response) throws RedditParseException {
        
        // Check for null
        if (response == null) {
            throw new RedditParseException();
        }
        
        // Check it is a JSON response
        if (!(response instanceof JSONObject)) {
            throw new RedditParseException("not a JSON response");
        }
        
        // Cast to JSON object
        JSONObject jsonResponse = ((JSONObject) response);
        
        // Check for error
        if (jsonResponse.get("error") != null) {
            throw new RedditParseException(JsonUtils.safeJsonToInteger(jsonResponse.get("error")));
        }
        
        // Check that data exists
        if (jsonResponse.get("data") == null && jsonResponse.get("json") == null) {
            throw new RedditParseException("data is missing from listing");
        }
        
    }
public void validate(Object response) throws RedditParseException {
        
        // Check for null
        if (response == null) {
            throw new RedditParseException();
        }
        
        // Check it is a JSON response
        if (!(response instanceof JSONObject)) {
            throw new RedditParseException("not a JSON response");
        }
        
        // Cast to JSON object
        JSONObject jsonResponse = ((JSONObject) response);
        
        // Check for error
        if (jsonResponse.get("error") != null) {
            throw new RedditParseException(JsonUtils.safeJsonToInteger(jsonResponse.get("error")));
        }
        
        // Check that data exists
        if (jsonResponse.get("data") == null && jsonResponse.get("json") == null) {
            throw new RedditParseException("data is missing from listing");
        }
        
    }
public void validate ( Object response ) throws RedditParseException { // Check for null if ( response == null ) { throw new RedditParseException ( ) ; } // Check it is a JSON response if ( ! ( response instanceof JSONObject ) ) { throw new RedditParseException ( "not a JSON response" ) ; } // Cast to JSON object JSONObject jsonResponse = ( ( JSONObject ) response ) ; // Check for error if ( jsonResponse . get ( "error" ) != null ) { throw new RedditParseException ( JsonUtils . safeJsonToInteger ( jsonResponse . get ( "error" ) ) ) ; } // Check that data exists if ( jsonResponse . get ( "data" ) == null && jsonResponse . get ( "json" ) == null ) { throw new RedditParseException ( "data is missing from listing" ) ; } }
Validate that it is indeed the starting of a listing of reddit things.

@param response Object returned by JSON parser

@throws RedditRequestException If the response is not valid listing of reddit things
Validate that it is indeed the starting of a listing of reddit things .