Lines 507-524
Link Here
|
507 |
|
507 |
|
508 |
public void saveExternalLibTimeStamps() throws CoreException { |
508 |
public void saveExternalLibTimeStamps() throws CoreException { |
509 |
if (this.externalTimeStamps == null) return; |
509 |
if (this.externalTimeStamps == null) return; |
|
|
510 |
|
511 |
// cleanup to avoid any leak ( https://bugs.eclipse.org/bugs/show_bug.cgi?id=244849 ) |
512 |
HashSet toRemove = new HashSet(); |
513 |
if (this.roots != null) { |
514 |
Enumeration keys = this.externalTimeStamps.keys(); |
515 |
while (keys.hasMoreElements()) { |
516 |
Object key = keys.nextElement(); |
517 |
if (this.roots.get(key) == null) { |
518 |
toRemove.add(key); |
519 |
} |
520 |
} |
521 |
} |
522 |
|
510 |
File timestamps = getTimeStampsFile(); |
523 |
File timestamps = getTimeStampsFile(); |
511 |
DataOutputStream out = null; |
524 |
DataOutputStream out = null; |
512 |
try { |
525 |
try { |
513 |
out = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(timestamps))); |
526 |
out = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(timestamps))); |
514 |
out.writeInt(this.externalTimeStamps.size()); |
527 |
out.writeInt(this.externalTimeStamps.size() - toRemove.size()); |
515 |
Iterator entries = this.externalTimeStamps.entrySet().iterator(); |
528 |
Iterator entries = this.externalTimeStamps.entrySet().iterator(); |
516 |
while (entries.hasNext()) { |
529 |
while (entries.hasNext()) { |
517 |
Map.Entry entry = (Map.Entry) entries.next(); |
530 |
Map.Entry entry = (Map.Entry) entries.next(); |
518 |
IPath key = (IPath) entry.getKey(); |
531 |
IPath key = (IPath) entry.getKey(); |
519 |
out.writeUTF(key.toPortableString()); |
532 |
if (!toRemove.contains(key)) { |
520 |
Long timestamp = (Long) entry.getValue(); |
533 |
out.writeUTF(key.toPortableString()); |
521 |
out.writeLong(timestamp.longValue()); |
534 |
Long timestamp = (Long) entry.getValue(); |
|
|
535 |
out.writeLong(timestamp.longValue()); |
536 |
} |
522 |
} |
537 |
} |
523 |
} catch (IOException e) { |
538 |
} catch (IOException e) { |
524 |
IStatus status = new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, IStatus.ERROR, "Problems while saving timestamps", e); //$NON-NLS-1$ |
539 |
IStatus status = new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, IStatus.ERROR, "Problems while saving timestamps", e); //$NON-NLS-1$ |