remove npe when no jars on classpath, in ide

This commit is contained in:
gtully 2014-10-07 14:07:49 +01:00
parent 838bbebeeb
commit 57fc29b6ce
1 changed files with 7 additions and 5 deletions

View File

@ -43,11 +43,13 @@ public final class ActiveMQConnectionMetaData implements ConnectionMetaData {
Package p = Package.getPackage("org.apache.activemq");
if (p != null) {
version = p.getImplementationVersion();
Pattern pattern = Pattern.compile("(\\d+)\\.(\\d+).*");
Matcher m = pattern.matcher(version);
if (m.matches()) {
major = Integer.parseInt(m.group(1));
minor = Integer.parseInt(m.group(2));
if (version != null) {
Pattern pattern = Pattern.compile("(\\d+)\\.(\\d+).*");
Matcher m = pattern.matcher(version);
if (m.matches()) {
major = Integer.parseInt(m.group(1));
minor = Integer.parseInt(m.group(2));
}
}
}
} catch (Throwable e) {