From 6745fb4925662915a968b72d3fb9f5c2b6b582e8 Mon Sep 17 00:00:00 2001 From: BoykoAlex Date: Fri, 16 Feb 2018 16:07:01 -0500 Subject: [PATCH] Handle fully qualified type names in resource from JMX bean --- .../ide/vscode/boot/java/utils/SpringResource.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/headless-services/commons/commons-boot/src/main/java/org/springframework/ide/vscode/boot/java/utils/SpringResource.java b/headless-services/commons/commons-boot/src/main/java/org/springframework/ide/vscode/boot/java/utils/SpringResource.java index a518c4f6e..6424782cd 100644 --- a/headless-services/commons/commons-boot/src/main/java/org/springframework/ide/vscode/boot/java/utils/SpringResource.java +++ b/headless-services/commons/commons-boot/src/main/java/org/springframework/ide/vscode/boot/java/utils/SpringResource.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2017 Pivotal, Inc. + * Copyright (c) 2017, 2018 Pivotal, Inc. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -36,6 +36,9 @@ public class SpringResource { private IJavaProject project; private static final Pattern BRACKETS = Pattern.compile("\\[[^\\]]*\\]"); + + private static final String ID_PATTERN = "\\p{javaJavaIdentifierStart}\\p{javaJavaIdentifierPart}*"; + private static final String REGEX_FQCN = ID_PATTERN + "(\\." + ID_PATTERN + ")*"; public SpringResource(SourceLinks sourceLinks, String toParse, IJavaProject project) { this.sourceLinks = sourceLinks; @@ -44,6 +47,10 @@ public class SpringResource { if (matcher.find()) { type = toParse.substring(0, matcher.start()).trim(); path = toParse.substring(matcher.start()+1, matcher.end()-1); + } else if (Pattern.matches(REGEX_FQCN, toParse)) { + // Resource is fully qualified Java type name + type = CLASS_PATH_RESOURCE; + path = toParse.replace('.','/') + SourceLinks.CLASS; } else { path = toParse; }