View | Details | Raw Unified | Return to bug 216446 | Differences between
and this patch

Collapse All | Expand All

(-)model/org/eclipse/jdt/internal/core/JavaModelManager.java (+2 lines)
Lines 1069-1074 Link Here
1069
						if (target instanceof File) {
1069
						if (target instanceof File) {
1070
							long timestamp = DeltaProcessor.getTimeStamp((java.io.File)target);
1070
							long timestamp = DeltaProcessor.getTimeStamp((java.io.File)target);
1071
							externalTimeStamps.put(path, new Long(timestamp));
1071
							externalTimeStamps.put(path, new Long(timestamp));
1072
						} else {
1073
							externalTimeStamps.put(path, DeltaProcessingState.MISSING_JAR);
1072
						}
1074
						}
1073
					}
1075
					}
1074
				}
1076
				}
(-)model/org/eclipse/jdt/internal/core/DeltaProcessor.java (-3 / +4 lines)
Lines 864-870 Link Here
864
						Object targetLibrary = JavaModel.getTarget(entryPath, true);
864
						Object targetLibrary = JavaModel.getTarget(entryPath, true);
865
865
866
						if (targetLibrary == null){ // missing JAR
866
						if (targetLibrary == null){ // missing JAR
867
							if (this.state.getExternalLibTimeStamps().remove(entryPath) != null /* file was known*/
867
							Long oldTimestamp = (Long) this.state.getExternalLibTimeStamps().put(entryPath, DeltaProcessingState.MISSING_JAR);
868
							if (oldTimestamp != null && oldTimestamp != DeltaProcessingState.MISSING_JAR/* file was known*/
868
									&& this.state.roots.get(entryPath) != null /* and it was on the classpath*/) {
869
									&& this.state.roots.get(entryPath) != null /* and it was on the classpath*/) {
869
								externalArchivesStatus.put(entryPath, EXTERNAL_JAR_REMOVED);
870
								externalArchivesStatus.put(entryPath, EXTERNAL_JAR_REMOVED);
870
								// the jar was physically removed: remove the index
871
								// the jar was physically removed: remove the index
Lines 878-888 Link Here
878
							// check timestamp to figure if JAR has changed in some way
879
							// check timestamp to figure if JAR has changed in some way
879
							Long oldTimestamp =(Long) this.state.getExternalLibTimeStamps().get(entryPath);
880
							Long oldTimestamp =(Long) this.state.getExternalLibTimeStamps().get(entryPath);
880
							long newTimeStamp = getTimeStamp(externalFile);
881
							long newTimeStamp = getTimeStamp(externalFile);
881
							if (oldTimestamp != null){
882
							if (oldTimestamp != null && oldTimestamp != DeltaProcessingState.MISSING_JAR) {
882
883
883
								if (newTimeStamp == 0){ // file doesn't exist
884
								if (newTimeStamp == 0){ // file doesn't exist
884
									externalArchivesStatus.put(entryPath, EXTERNAL_JAR_REMOVED);
885
									externalArchivesStatus.put(entryPath, EXTERNAL_JAR_REMOVED);
885
									this.state.getExternalLibTimeStamps().remove(entryPath);
886
									this.state.getExternalLibTimeStamps().put(entryPath, DeltaProcessingState.MISSING_JAR);
886
									// remove the index
887
									// remove the index
887
									this.manager.indexManager.removeIndex(entryPath);
888
									this.manager.indexManager.removeIndex(entryPath);
888
889
(-)model/org/eclipse/jdt/internal/core/DeltaProcessingState.java (-1 / +3 lines)
Lines 30-35 Link Here
30
 * Keep the global states used during Java element delta processing.
30
 * Keep the global states used during Java element delta processing.
31
 */
31
 */
32
public class DeltaProcessingState implements IResourceChangeListener {
32
public class DeltaProcessingState implements IResourceChangeListener {
33
	
34
	public static final Long MISSING_JAR = new Long(-1);
33
35
34
	/*
36
	/*
35
	 * Collection of listeners for Java element deltas
37
	 * Collection of listeners for Java element deltas
Lines 449-455 Link Here
449
				while (size-- > 0) {
451
				while (size-- > 0) {
450
					String key = in.readUTF();
452
					String key = in.readUTF();
451
					long timestamp = in.readLong();
453
					long timestamp = in.readLong();
452
					timeStamps.put(Path.fromPortableString(key), new Long(timestamp));
454
					timeStamps.put(Path.fromPortableString(key), timestamp == -1 ? MISSING_JAR : new Long(timestamp));
453
				}
455
				}
454
			} catch (IOException e) {
456
			} catch (IOException e) {
455
				if (timestampsFile.exists())
457
				if (timestampsFile.exists())
(-)src/org/eclipse/jdt/core/tests/model/ClasspathTests.java (-1 / +20 lines)
Lines 2687-2693 Link Here
2687
 * Ensures that a marker is removed if adding an internal jar that is on the classpath in another project
2687
 * Ensures that a marker is removed if adding an internal jar that is on the classpath in another project
2688
 * (regression test for https://bugs.eclipse.org/bugs/show_bug.cgi?id=213723 )
2688
 * (regression test for https://bugs.eclipse.org/bugs/show_bug.cgi?id=213723 )
2689
 */
2689
 */
2690
public void testFixClasspath() throws CoreException {
2690
public void testFixClasspath1() throws CoreException {
2691
	try {
2691
	try {
2692
		createProject("P1");
2692
		createProject("P1");
2693
		IJavaProject project = createJavaProject("P2", new String[0], new String[] {"/P1/lib.jar"}, "bin");
2693
		IJavaProject project = createJavaProject("P2", new String[0], new String[] {"/P1/lib.jar"}, "bin");
Lines 2703-2708 Link Here
2703
		deleteProject("P2");
2703
		deleteProject("P2");
2704
	}
2704
	}
2705
}
2705
}
2706
/*
2707
 * Ensures that a marker is removed if adding an external jar, restarting and refreshing
2708
 * (regression test for https://bugs.eclipse.org/bugs/show_bug.cgi?id=216446 )
2709
 */
2710
public void testFixClasspath2() throws CoreException {
2711
	try {
2712
		IJavaProject p = createJavaProject("P", new String[0], new String[] {getExternalResourcePath("externalLib.abc")}, "");
2713
		waitForAutoBuild(); // 1 marker
2714
		createExternalFile("externalLib.abc", "");
2715
		
2716
		simulateExitRestart();
2717
		refreshExternalArchives(p);
2718
		
2719
		assertMarkers("Unexpected markers", "", p);
2720
	} finally {
2721
		deleteExternalResource("externalLib.abc");
2722
		deleteProject("P");
2723
	}
2724
}
2706
/**
2725
/**
2707
 * Test IJavaProject.hasClasspathCycle(IClasspathEntry[]).
2726
 * Test IJavaProject.hasClasspathCycle(IClasspathEntry[]).
2708
 */
2727
 */

Return to bug 216446