Lines 13-18
Link Here
|
13 |
import java.util.ArrayList; |
13 |
import java.util.ArrayList; |
14 |
import java.util.StringTokenizer; |
14 |
import java.util.StringTokenizer; |
15 |
|
15 |
|
|
|
16 |
import org.osgi.framework.Version; |
17 |
|
16 |
public class VersionedIdentifier { |
18 |
public class VersionedIdentifier { |
17 |
private String identifier = ""; //$NON-NLS-1$ |
19 |
private String identifier = ""; //$NON-NLS-1$ |
18 |
private int major = 0; |
20 |
private int major = 0; |
Lines 34-40
Link Here
|
34 |
if (s == null || (s = s.trim()).equals("")) //$NON-NLS-1$ |
36 |
if (s == null || (s = s.trim()).equals("")) //$NON-NLS-1$ |
35 |
return; |
37 |
return; |
36 |
|
38 |
|
37 |
int loc = s.lastIndexOf(ID_SEPARATOR); |
39 |
int loc = testUnderScores(s); |
38 |
if (loc != -1) { |
40 |
if (loc != -1) { |
39 |
this.identifier = s.substring(0, loc); |
41 |
this.identifier = s.substring(0, loc); |
40 |
version = s.substring(loc + 1); |
42 |
version = s.substring(loc + 1); |
Lines 45-50
Link Here
|
45 |
this.identifier = s; |
47 |
this.identifier = s; |
46 |
} |
48 |
} |
47 |
|
49 |
|
|
|
50 |
private int testUnderScores(String fileName) { |
51 |
int underScore = fileName.indexOf('_'); |
52 |
while (underScore >= 0) { |
53 |
try { |
54 |
Version.parseVersion(fileName.substring(underScore + 1)); |
55 |
} catch (IllegalArgumentException iae) { |
56 |
// continue to next underscore |
57 |
underScore = fileName.indexOf('_', underScore + 1); |
58 |
continue; |
59 |
} |
60 |
break; |
61 |
} |
62 |
return underScore; |
63 |
} |
64 |
|
48 |
public VersionedIdentifier(String id, String version) { |
65 |
public VersionedIdentifier(String id, String version) { |
49 |
this(id+ID_SEPARATOR+ (version==null?"0.0.0":version) ); //$NON-NLS-1$ |
66 |
this(id+ID_SEPARATOR+ (version==null?"0.0.0":version) ); //$NON-NLS-1$ |
50 |
this.version = version; |
67 |
this.version = version; |