From 4e1db7fef0ef131b718447af9cf7c2ac40e8f0e2 Mon Sep 17 00:00:00 2001 From: Andy Clement Date: Fri, 26 Jun 2015 13:45:06 -0700 Subject: [PATCH] Fixed coping with nulls on include patterns too Issue: #122 --- .../org/springsource/loaded/TypeRegistry.java | 31 +++++++++++-------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/springloaded/src/main/java/org/springsource/loaded/TypeRegistry.java b/springloaded/src/main/java/org/springsource/loaded/TypeRegistry.java index 5143128..50bd165 100644 --- a/springloaded/src/main/java/org/springsource/loaded/TypeRegistry.java +++ b/springloaded/src/main/java/org/springsource/loaded/TypeRegistry.java @@ -841,17 +841,20 @@ public class TypeRegistry { } } else { + String matchName = null; // There are inclusion patterns, we must match one and not be excluded - boolean isIncluded = false; - String matchName = slashedName.replace('/', '.'); - for (TypePattern typepattern : inclusionPatterns) { - if (typepattern.matches(matchName)) { - isIncluded = true; - break; + if (slashedName != null) { + boolean isIncluded = false; + matchName = slashedName.replace('/', '.'); + for (TypePattern typepattern : inclusionPatterns) { + if (typepattern.matches(matchName)) { + isIncluded = true; + break; + } + } + if (!isIncluded) { + return false; } - } - if (!isIncluded) { - return false; } // Ok it matched an inclusion, but it must not match any exclusions if (exclusionPatterns.isEmpty()) { @@ -859,10 +862,12 @@ public class TypeRegistry { } else { boolean isExcluded = false; - for (TypePattern typepattern : exclusionPatterns) { - if (typepattern.matches(matchName)) { - isExcluded = true; - break; + if (slashedName != null) { + for (TypePattern typepattern : exclusionPatterns) { + if (typepattern.matches(matchName)) { + isExcluded = true; + break; + } } } return !isExcluded;