Bug 25538

Summary: Conflict of classfolder and outputfolder not reported
Product: [Eclipse Project] JDT Reporter: Martin Aeschlimann <martinae>
Component: CoreAssignee: Jerome Lanneluc <jerome_lanneluc>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 2.1   
Target Milestone: 2.1 M4   
Hardware: PC   
OS: Windows 2000   
Whiteboard:

Description Martin Aeschlimann CLA 2002-10-30 09:31:30 EST
20021029

1. create new project
   - no source folders
   - output folder at project
   - new class folder lib
2. select the class folder in the package explorer, Refactor->Rename to lib2
3. -> NPE
The problem is that JavaCore.create(IFolder) returns null for the class folder.
From debugging I see that the reason is that 'conflictsWithOutputLocation' 
return true and no Java element handle is created.

java.lang.NullPointerException
	at 
org.eclipse.jdt.internal.corext.refactoring.changes.RenameSourceFolderChange.get
JavaProject(RenameSourceFolderChange.java:91)
	at 
org.eclipse.jdt.internal.corext.refactoring.changes.RenameSourceFolderChange.mod
ifyClassPath(RenameSourceFolderChange.java:66)
	at 
org.eclipse.jdt.internal.corext.refactoring.changes.RenameSourceFolderChange.doR
ename(RenameSourceFolderChange.java:57)
	at 
org.eclipse.jdt.internal.corext.refactoring.AbstractJavaElementRenameChange.perf
orm(AbstractJavaElementRenameChange.java:68)
	at 
org.eclipse.jdt.internal.ui.refactoring.PerformChangeOperation$1.execute
(PerformChangeOperation.java:147)
	at org.eclipse.ui.actions.WorkspaceModifyOperation$1.run
(WorkspaceModifyOperation.java:65)
	at org.eclipse.core.internal.resources.Workspace.run
(Workspace.java:1378)
	at org.eclipse.ui.actions.WorkspaceModifyOperation.run
(WorkspaceModifyOperation.java:79)
	at 
org.eclipse.jdt.internal.ui.refactoring.PerformChangeOperation.executeChange
(PerformChangeOperation.java:154)
	at org.eclipse.jdt.internal.ui.refactoring.PerformChangeOperation.run
(PerformChangeOperation.java:124)
	at org.eclipse.jface.operation.ModalContext.runInCurrentThread
(ModalContext.java:296)
	at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:246)
	at org.eclipse.jface.window.ApplicationWindow$1.run
(ApplicationWindow.java:391)
Comment 1 Jerome Lanneluc CLA 2002-12-02 09:49:19 EST
Fixed JavaConventions and added regression test 
ClasspathTests.testClasspathValidation11()
Comment 2 David Audel CLA 2002-12-17 10:05:44 EST
Verified.
Comment 3 Jerome Lanneluc CLA 2003-01-08 11:18:28 EST
Actually, the JavaConventions should allow this case since the project's output 
folder is not used. Changed 'conflictsWithOutputLocation' to return false in 
this case.

Moved test to FactoryTests.testCreateLibInOutput()