From 579bae7c3da0e6bc6e6ac4efb7aa0080641a6079 Mon Sep 17 00:00:00 2001 From: Decebal Suiu Date: Sun, 24 Aug 2014 22:50:08 +0300 Subject: [PATCH] defense for #21 --- .../java/ro/fortsoft/pf4j/DefaultExtensionFinder.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/pf4j/src/main/java/ro/fortsoft/pf4j/DefaultExtensionFinder.java b/pf4j/src/main/java/ro/fortsoft/pf4j/DefaultExtensionFinder.java index 90b5c54..758b0c3 100644 --- a/pf4j/src/main/java/ro/fortsoft/pf4j/DefaultExtensionFinder.java +++ b/pf4j/src/main/java/ro/fortsoft/pf4j/DefaultExtensionFinder.java @@ -175,9 +175,13 @@ public class DefaultExtensionFinder implements ExtensionFinder, PluginStateListe try { URL url = plugin.getPluginClassLoader().getResource(ExtensionsIndexer.EXTENSIONS_RESOURCE); - log.debug("Read '{}'", url.getFile()); - Reader reader = new InputStreamReader(url.openStream(), "UTF-8"); - ExtensionsIndexer.readIndex(reader, bucket); + if (url != null) { + log.debug("Read '{}'", url.getFile()); + Reader reader = new InputStreamReader(url.openStream(), "UTF-8"); + ExtensionsIndexer.readIndex(reader, bucket); + } else { + log.debug("Cannot find '{}'", ExtensionsIndexer.EXTENSIONS_RESOURCE); + } if (bucket.isEmpty()) { log.debug("No extensions found"); -- 2.39.5