Skip to content

Commit 202ff98

Browse files
committed
Fix version form file name issue.
1 parent 3bd9920 commit 202ff98

File tree

1 file changed

+3
-5
lines changed
  • joylive-core/joylive-core-api/src/main/java/com/jd/live/agent/core/util/type

1 file changed

+3
-5
lines changed

joylive-core/joylive-core-api/src/main/java/com/jd/live/agent/core/util/type/Artifact.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -149,16 +149,14 @@ private Map<String, String> getFileInfo(File file) {
149149
int pos = name.lastIndexOf('.');
150150
name = name.substring(0, pos);
151151

152-
int end = name.length() - 1;
153-
int start = name.lastIndexOf('-');
152+
int start = name.indexOf('-');
154153
while (start > 0) {
155154
if (isDigit(name.charAt(start + 1))) {
156-
result.put(VERSION, name.substring(start + 1, end + 1));
155+
result.put(VERSION, name.substring(start + 1));
157156
result.put(ARTIFACT_ID, name.substring(0, start));
158157
break;
159158
}
160-
end = start - 1;
161-
start = name.lastIndexOf('-', end);
159+
start = name.indexOf('-', start + 1);
162160
}
163161
return result;
164162
}

0 commit comments

Comments
 (0)