Skip to content

Commit 435ff6f

Browse files
authored
Merge pull request #218 from jbentley6/aerogear-214
aerogear-214 : Fixes IndexOutOfBounds issue
2 parents 6a1ea6c + d823684 commit 435ff6f

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

src/main/java/org/jboss/aerogear/keycloak/metrics/ResourceExtractor.java

+11-9
Original file line numberDiff line numberDiff line change
@@ -65,21 +65,23 @@ static String getResource(UriInfo uriInfo) {
6565
static String getURI(UriInfo uriInfo) {
6666
if (URI_METRICS_ENABLED) {
6767
List<String> matchedURIs = uriInfo.getMatchedURIs();
68-
StringBuilder sb = new StringBuilder();
68+
if (!matchedURIs.isEmpty()) {
69+
StringBuilder sb = new StringBuilder();
6970

70-
if (URI_METRICS_FILTER != null && URI_METRICS_FILTER.length() != 0) {
71-
String[] filter = URI_METRICS_FILTER.split(",");
71+
if (URI_METRICS_FILTER != null && URI_METRICS_FILTER.length() != 0) {
72+
String[] filter = URI_METRICS_FILTER.split(",");
7273

73-
for (int i = 0; i < filter.length; i++) {
74-
if (matchedURIs.get(0).contains(filter[i])) {
74+
for (int i = 0; i < filter.length; i++) {
75+
if (matchedURIs.get(0).contains(filter[i])) {
7576

76-
sb = getURIDetailed(sb, matchedURIs);
77+
sb = getURIDetailed(sb, matchedURIs);
78+
}
7779
}
80+
} else {
81+
sb = getURIDetailed(sb, matchedURIs);
7882
}
79-
} else {
80-
sb = getURIDetailed(sb, matchedURIs);
83+
return sb.toString();
8184
}
82-
return sb.toString();
8385
}
8486
return "";
8587
}

0 commit comments

Comments
 (0)