Search in sources :

Example 1 with VersionNotFoundException

use of org.androidannotations.internal.exception.VersionNotFoundException in project androidannotations by androidannotations.

the class AndroidAnnotationsPlugin method getVersionFromPropertyFile.

private String getVersionFromPropertyFile(String name) throws FileNotFoundException, VersionNotFoundException {
    String filename = name + ".properties";
    Properties properties;
    try {
        URL url = getClass().getClassLoader().getResource(filename);
        properties = new Properties();
        properties.load(url.openStream());
    } catch (Exception e) {
        logger.error("Property file {} couldn't be parsed", filename);
        throw new FileNotFoundException("Property file " + filename + " couldn't be parsed.");
    }
    String version = properties.getProperty("version");
    if (version == null) {
        logger.error("{} plugin is missing 'version' property!", getName());
        throw new VersionNotFoundException(this);
    }
    return version;
}
Also used : FileNotFoundException(java.io.FileNotFoundException) Properties(java.util.Properties) VersionNotFoundException(org.androidannotations.internal.exception.VersionNotFoundException) URL(java.net.URL) VersionNotFoundException(org.androidannotations.internal.exception.VersionNotFoundException) FileNotFoundException(java.io.FileNotFoundException)

Aggregations

FileNotFoundException (java.io.FileNotFoundException)1 URL (java.net.URL)1 Properties (java.util.Properties)1 VersionNotFoundException (org.androidannotations.internal.exception.VersionNotFoundException)1