Lines 36-42
Link Here
|
36 |
private static final String RSA_EXT = ".rsa"; //$NON-NLS-1$ |
36 |
private static final String RSA_EXT = ".rsa"; //$NON-NLS-1$ |
37 |
private static final String SF_EXT = ".sf"; //$NON-NLS-1$ |
37 |
private static final String SF_EXT = ".sf"; //$NON-NLS-1$ |
38 |
|
38 |
|
|
|
39 |
private String sourceLocation, destinationLocation, descriptorString; |
40 |
|
39 |
public IStatus compare(IArtifactRepository source, IArtifactDescriptor sourceDescriptor, IArtifactRepository destination, IArtifactDescriptor destinationDescriptor) { |
41 |
public IStatus compare(IArtifactRepository source, IArtifactDescriptor sourceDescriptor, IArtifactRepository destination, IArtifactDescriptor destinationDescriptor) { |
|
|
42 |
// Cache information for potential error messages |
43 |
sourceLocation = URIUtil.toUnencodedString(sourceDescriptor.getRepository().getLocation()); |
44 |
destinationLocation = URIUtil.toUnencodedString(destination.getLocation()); |
45 |
descriptorString = sourceDescriptor.toString(); |
46 |
|
40 |
String classifier = sourceDescriptor.getArtifactKey().getClassifier(); |
47 |
String classifier = sourceDescriptor.getArtifactKey().getClassifier(); |
41 |
if (!OSGI_BUNDLE_CLASSIFIER.equals(classifier)) { |
48 |
if (!OSGI_BUNDLE_CLASSIFIER.equals(classifier)) { |
42 |
return Status.OK_STATUS; |
49 |
return Status.OK_STATUS; |
Lines 71-77
Link Here
|
71 |
final int firstFileSize = firstFile.size(); |
78 |
final int firstFileSize = firstFile.size(); |
72 |
final int secondFileSize = secondFile.size(); |
79 |
final int secondFileSize = secondFile.size(); |
73 |
if (firstFileSize != secondFileSize) { |
80 |
if (firstFileSize != secondFileSize) { |
74 |
return newErrorStatus(NLS.bind(Messages.differentNumberOfEntries, new String[] {sourceFile.getName(), Integer.toString(firstFileSize), destinationFile.getName(), Integer.toString(secondFileSize)})); |
81 |
return newErrorStatus(NLS.bind(Messages.differentNumberOfEntries, new String[] {descriptorString, sourceLocation, Integer.toString(firstFileSize), destinationLocation, Integer.toString(secondFileSize)})); |
75 |
} |
82 |
} |
76 |
for (Enumeration enumeration = firstFile.entries(); enumeration.hasMoreElements();) { |
83 |
for (Enumeration enumeration = firstFile.entries(); enumeration.hasMoreElements();) { |
77 |
ZipEntry entry = (ZipEntry) enumeration.nextElement(); |
84 |
ZipEntry entry = (ZipEntry) enumeration.nextElement(); |
Lines 93-99
Link Here
|
93 |
try { |
100 |
try { |
94 |
result = compareClasses(firstStream, entry.getSize(), secondStream, entry2.getSize()); |
101 |
result = compareClasses(firstStream, entry.getSize(), secondStream, entry2.getSize()); |
95 |
} catch (ClassFormatException e) { |
102 |
} catch (ClassFormatException e) { |
96 |
return newErrorStatus(NLS.bind(Messages.differentEntry, entryName, sourceFile.getAbsolutePath()), e); |
103 |
return newErrorStatus(NLS.bind(Messages.differentEntry, new String[] {entryName, descriptorString, sourceLocation}), e); |
97 |
} |
104 |
} |
98 |
} else if (lowerCase.endsWith(JAR_EXTENSION)) { |
105 |
} else if (lowerCase.endsWith(JAR_EXTENSION)) { |
99 |
result = compareNestedJars(firstStream, entry.getSize(), secondStream, entry2.getSize(), entryName); |
106 |
result = compareNestedJars(firstStream, entry.getSize(), secondStream, entry2.getSize(), entryName); |
Lines 105-118
Link Here
|
105 |
result = compareBytes(firstStream, entry.getSize(), secondStream, entry2.getSize()); |
112 |
result = compareBytes(firstStream, entry.getSize(), secondStream, entry2.getSize()); |
106 |
} |
113 |
} |
107 |
if (!result) |
114 |
if (!result) |
108 |
return newErrorStatus(NLS.bind(Messages.differentEntry, entryName, sourceFile.getAbsolutePath())); |
115 |
return newErrorStatus(NLS.bind(Messages.differentEntry, new String[] {entryName, descriptorString, sourceLocation})); |
109 |
} finally { |
116 |
} finally { |
110 |
Utility.close(firstStream); |
117 |
Utility.close(firstStream); |
111 |
Utility.close(secondStream); |
118 |
Utility.close(secondStream); |
112 |
} |
119 |
} |
113 |
} else if (!entry.isDirectory()) { |
120 |
} else if (!entry.isDirectory()) { |
114 |
// missing entry, entry2 == null |
121 |
// missing entry, entry2 == null |
115 |
return newErrorStatus(NLS.bind(Messages.missingEntry, entryName, sourceFile.getAbsolutePath())); |
122 |
return newErrorStatus(NLS.bind(Messages.missingEntry, new String[] {entryName, descriptorString, sourceLocation})); |
116 |
} |
123 |
} |
117 |
} |
124 |
} |
118 |
} catch (CoreException e) { |
125 |
} catch (CoreException e) { |