summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMD2011-05-19 12:37:19 (EDT)
committerRyan D. Brooks2011-05-19 12:37:19 (EDT)
commit2ea846b754da9eda037c9807e2a924f7f2da26d8 (patch)
tree615ebeefb41212362b8b424b91f122b87f854ea3
parent9341e8ff9ae5c0fcc4d5e3db5b010a82ddade1c8 (diff)
downloadorg.eclipse.osee-2ea846b754da9eda037c9807e2a924f7f2da26d8.zip
org.eclipse.osee-2ea846b754da9eda037c9807e2a924f7f2da26d8.tar.gz
org.eclipse.osee-2ea846b754da9eda037c9807e2a924f7f2da26d8.tar.bz2
bug[bgz_344183]: Fix ArtifactNameComparator to handle long numeric names
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactNameComparator.java11
1 files changed, 7 insertions, 4 deletions
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactNameComparator.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactNameComparator.java
index 3b54b28..5c4fe9c 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactNameComparator.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactNameComparator.java
@@ -19,6 +19,7 @@ public class ArtifactNameComparator implements Comparator<IArtifact> {
private static final Pattern numberPattern = Pattern.compile("[+-]?\\d+");
private final Matcher numberMatcher = numberPattern.matcher("");
private boolean descending = false;
+ private static final int NUMBER_STRING_LIMIT = 19;
public ArtifactNameComparator(boolean descending) {
this.descending = descending;
@@ -33,10 +34,12 @@ public class ArtifactNameComparator implements Comparator<IArtifact> {
if (numberMatcher.matches()) {
numberMatcher.reset(name2);
if (numberMatcher.matches()) {
- if (descending) {
- return Integer.valueOf(name2).compareTo(Integer.valueOf(name1));
- } else {
- return Integer.valueOf(name1).compareTo(Integer.valueOf(name2));
+ if ((name1.length() < NUMBER_STRING_LIMIT) && (name2.length() < NUMBER_STRING_LIMIT)) {
+ if (descending) {
+ return Long.valueOf(name2).compareTo(Long.valueOf(name1));
+ } else {
+ return Long.valueOf(name1).compareTo(Long.valueOf(name2));
+ }
}
}
}