Skip to content

Commit 0646e4f

Browse files
committed
Update ManifestArtifactResourceResolver.java
1 parent 7acd043 commit 0646e4f

1 file changed

Lines changed: 11 additions & 10 deletions

File tree

microsphere-java-core/src/main/java/io/microsphere/classloading/ManifestArtifactResourceResolver.java

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,10 @@
2626

2727
import static io.microsphere.classloading.Artifact.create;
2828
import static io.microsphere.constants.FileConstants.JAR_EXTENSION;
29+
import static io.microsphere.constants.PathConstants.SLASH_CHAR;
2930
import static io.microsphere.constants.PropertyConstants.MICROSPHERE_PROPERTY_NAME_PREFIX;
3031
import static io.microsphere.constants.SymbolConstants.COMMA;
32+
import static io.microsphere.constants.SymbolConstants.HYPHEN_CHAR;
3133
import static io.microsphere.net.URLUtils.isArchiveURL;
3234
import static io.microsphere.util.StringUtils.split;
3335
import static java.lang.System.getProperty;
@@ -129,22 +131,21 @@ private String resolveArtifactId(Attributes attributes, URL artifactResourceURL,
129131
artifactId = resolveArtifactId(artifactResourceURL);
130132
}
131133

132-
if (artifactId == null) {
133-
if (logger.isTraceEnabled()) {
134-
logger.trace("The artifactId can't be resolved from the {} of artifact[resource: {}] : {}",
135-
artifactResourceURL.getPath(),
136-
MANIFEST_RESOURCE_PATH,
137-
attributes.entrySet()
138-
);
139-
}
134+
if (logger.isTraceEnabled()) {
135+
logger.trace("The artifactId was resolved from the '{}' of resource URL['{}'] of : {} , attributes : {}",
136+
MANIFEST_RESOURCE_PATH,
137+
artifactResourceURL.getPath(),
138+
artifactId,
139+
attributes.entrySet()
140+
);
140141
}
141142

142143
return artifactId;
143144
}
144145

145146
private String resolveArtifactId(URL artifactResourceURL) {
146147
String path = artifactResourceURL.getPath();
147-
int lastSlashIndex = path.lastIndexOf('/');
148+
int lastSlashIndex = path.lastIndexOf(SLASH_CHAR);
148149
if (lastSlashIndex < 0) {
149150
return null;
150151
}
@@ -153,7 +154,7 @@ private String resolveArtifactId(URL artifactResourceURL) {
153154
return null;
154155
}
155156
String jarFileName = path.substring(lastSlashIndex + 1, fileExtensionIndex);
156-
int lastHyphenIndex = jarFileName.lastIndexOf('-');
157+
int lastHyphenIndex = jarFileName.lastIndexOf(HYPHEN_CHAR);
157158
if (lastHyphenIndex < 0) {
158159
return jarFileName;
159160
}

0 commit comments

Comments
 (0)