Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » Java Model Status "Invalid name specified" exception - Possible bug
Java Model Status "Invalid name specified" exception - Possible bug [message #695939] Tue, 12 July 2011 17:47 Go to next message
Eclipse UserFriend
Hi there.

I have the following piece of code:

try {
	for (IPackageFragmentRoot root : project.getPackageFragmentRoots()) {
		if (root.getElementName().equals("src")) {
			for (ICompilationUnit unit : root.getPackageFragment("soap.service.implementation.strongProfile.delegate").getCompilationUnits()) {
				for (IImportDeclaration dec : unit.getImports()) {
					dec.rename("soap.service.implementation.reader.HeadlineReader", true, null);
				}
			}
		}
	}
}catch(Exception e) {
	e.printStackTrace();
}


For some strange reason, I keep getting the following exception

Java Model Exception: Java Model Status [Invalid name specified: soap.service.implementation.reader.HeadlineReader]


I actually take the import from the exception that is printed out in the console and paste it into my class and it works fine. Is this an Eclipse bug?! Is there another way that I can rename an import in an ICompilation unit? Please help. thanks

[Updated on: Wed, 13 July 2011 17:05] by Moderator

Re: Java Model Status "Invalid name specified" exception [message #696043 is a reply to message #695939] Wed, 13 July 2011 03:11 Go to previous messageGo to next message
Eclipse UserFriend
There seems to be some problem. Please open a bug at https://bugs.eclipse.org/bugs/enter_bug.cgi?product=JDT;component=Core.
You could actually use ImportRewrite class to modify the imports.
Re: Java Model Status "Invalid name specified" exception [message #696117 is a reply to message #696043] Wed, 13 July 2011 05:56 Go to previous messageGo to next message
Eclipse UserFriend
Will this work for my java project? Isn't ImportRewrite part of the javascript development toolkit, not JDT Core?

[Updated on: Wed, 13 July 2011 05:58] by Moderator

Re: Java Model Status "Invalid name specified" exception [message #696137 is a reply to message #696043] Wed, 13 July 2011 06:16 Go to previous messageGo to next message
Eclipse UserFriend
On 13.07.2011 09:11, Satyam Kandula wrote:
> There seems to be some problem. Please open a bug at
> https://bugs.eclipse.org/bugs/enter_bug.cgi?product=JDT;component=Core.
https://bugs.eclipse.org/351940

Dani
> You could actually use ImportRewrite class to modify the imports.
Re: Java Model Status "Invalid name specified" exception [message #696393 is a reply to message #696137] Wed, 13 July 2011 17:05 Go to previous messageGo to next message
Eclipse UserFriend
@Dani Thanks for that Smile To get around the issue, I delete the import and then recreate it with the new name.

[Updated on: Wed, 13 July 2011 17:05] by Moderator

Re: Java Model Status "Invalid name specified" exception [message #696544 is a reply to message #696117] Thu, 14 July 2011 05:05 Go to previous messageGo to next message
Eclipse UserFriend
ImportRewrite exists for JDT/Core.
Re: Java Model Status "Invalid name specified" exception [message #698551 is a reply to message #696544] Tue, 19 July 2011 13:00 Go to previous messageGo to next message
Eclipse UserFriend
But how do you use it to modify the imports?
Re: Java Model Status "Invalid name specified" exception [message #698716 is a reply to message #698551] Wed, 20 July 2011 00:48 Go to previous message
Eclipse UserFriend
ASTRewrite class's javadoc has an example.
Previous Topic:Debugging a remote Java application with Eclipse as the server (Socket listen)
Next Topic:Autocomplete function return value
Goto Forum:
  


Current Time: Thu Mar 13 15:26:46 EDT 2025

Powered by FUDForum. Page generated in 0.05334 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top