Skip to content

Commit

Permalink
Improved error checking during connector initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
semancik committed Oct 9, 2014
1 parent 35c8a36 commit 0068f82
Showing 1 changed file with 14 additions and 3 deletions.
Expand Up @@ -525,7 +525,11 @@ private Set<URL> scanDirectory(String path) {
// Test if this path is single jar or need to do deep examination
if (isThisJarFileBundle(dir)) {
try {
bundle.add(dir.toURI().toURL());
if (isThisBundleCompatible(dir.toURI().toURL())) {
bundle.add(dir.toURI().toURL());
} else {
LOGGER.warn("Skip loading budle {} due error occured", dir.toURI().toURL());
}
} catch (MalformedURLException e) {
LOGGER.error("This never happend we hope.", e);
throw new SystemException(e);
Expand Down Expand Up @@ -573,7 +577,15 @@ private Boolean isThisBundleCompatible(URL bundleUrl) {
if (null == bundleUrl)
return false;
try {
ConnectorInfoManagerFactory.getInstance().getLocalManager(bundleUrl);
ConnectorInfoManager localManager = ConnectorInfoManagerFactory.getInstance().getLocalManager(bundleUrl);
List<ConnectorInfo> connectorInfos = localManager.getConnectorInfos();
if (connectorInfos == null || connectorInfos.isEmpty()) {
LOGGER.error("Strange error happened. ConnId is not accepting bundle {}. But no error is indicated.", bundleUrl);
return false;
} else {
LOGGER.trace("Found {} compatible connectors in bundle {}", connectorInfos.size(), bundleUrl);
return true;
}
} catch (Exception ex) {
if (LOGGER.isDebugEnabled()) {
LOGGER.error("Error instantiating ICF bundle using URL '{}': {}", new Object[] { bundleUrl, ex.getMessage()}, ex);
Expand All @@ -582,7 +594,6 @@ private Boolean isThisBundleCompatible(URL bundleUrl) {
}
return false;
}
return true;
}

/**
Expand Down

0 comments on commit 0068f82

Please sign in to comment.