Search in sources :

Example 1 with UnsupportedVersion

use of org.jboss.jandex.UnsupportedVersion in project core by weld.

the class JandexIndexBeanArchiveHandler method getIndex.

private Index getIndex(final File beanArchiveFile) {
    Preconditions.checkArgumentNotNull(beanArchiveFile, "beanArchiveFile");
    logger.debugv("Try to get Jandex index for: {0}", beanArchiveFile);
    Index index = null;
    try (ZipFile zip = new ZipFile(beanArchiveFile)) {
        // Open the bean archive and try to find the index file
        ZipEntry entry = zip.getEntry(JANDEX_INDEX_NAME);
        if (entry != null) {
            index = new IndexReader(zip.getInputStream(entry)).read();
        }
    } catch (IllegalArgumentException e) {
        CommonLogger.LOG.warnv("Jandex index is not valid: {0}", beanArchiveFile);
    } catch (UnsupportedVersion e) {
        CommonLogger.LOG.warnv("Version of Jandex index is not supported: {0}", beanArchiveFile);
    } catch (IOException e) {
        CommonLogger.LOG.warnv("Cannot get Jandex index from: {0}", beanArchiveFile);
        CommonLogger.LOG.catchingDebug(e);
    }
    logger.debugv("Jandex index {0}found: {1}", index == null ? "NOT " : "", beanArchiveFile);
    return index;
}
Also used : ZipFile(java.util.zip.ZipFile) ZipEntry(java.util.zip.ZipEntry) IndexReader(org.jboss.jandex.IndexReader) Index(org.jboss.jandex.Index) IOException(java.io.IOException) UnsupportedVersion(org.jboss.jandex.UnsupportedVersion)

Aggregations

IOException (java.io.IOException)1 ZipEntry (java.util.zip.ZipEntry)1 ZipFile (java.util.zip.ZipFile)1 Index (org.jboss.jandex.Index)1 IndexReader (org.jboss.jandex.IndexReader)1 UnsupportedVersion (org.jboss.jandex.UnsupportedVersion)1