Code example for ParseException

0
HeaderElement[] elements = BasicHeaderValueParser.parseElements(s, null);
        if (elements.length > 0) {
            return create(elements[0]);
        } else { 
            throw new ParseException("Invalid content type: " + s);
        } 
    } 
 
    /** 
     * Extracts <code>Content-Type</code> value from {@link HttpEntity} exactly as 
     * specified by the <code>Content-Type</code> header of the entity. Returns <code>null</code> 
     * if not specified. 
     * 
     * @param entity HTTP entity 
     * @return content type 
     * @throws ParseException if the given text does not represent a valid 
     * <code>Content-Type</code> value. 
     */ 
    public static ContentType get( 
            final HttpEntity entity) throws ParseException, UnsupportedCharsetException {