Community
Participate
Working Groups
According to the ICommand documentation, you can add arguments where the key is a string, but the value is null. This generates a .project file something like: <<snip>> <buildSpec> <buildCommand> <name>org.eclipse.jdt.core.javabuilder</name> <arguments> <dictionary> <key>keyOnly</key> <value></value> </dictionary> </arguments> </buildCommand> </buildSpec> <<snip>> However, when the workbench is started again, the following error is displayed in the debug console: java.lang.IllegalArgumentException: Application not found: org.eclipse.ui.workbench at org.eclipse.core.internal.boot.InternalBootLoader.run (InternalBootLoader.java:641) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:319) at EclipseRuntimeLauncher.main(EclipseRuntimeLauncher.java:16) Exception in thread "main" And the following in generated in the .log file <?xml version="1.0" encoding="UTF-8"?> <log> <log-entry date="Tue Apr 30 14:47:34 EDT 2002"> <status plugin-id="org.eclipse.core.runtime" severity="WARNING" message="Problems occurred when invoking code from plug-in: org.eclipse.core.runtime." code="2"> <exception message="null" trace=" java.lang.NullPointerException at java.util.Hashtable.put(Hashtable.java(Compiled Code)) at org.eclipse.core.internal.resources.ModelObjectReader.readHashtable (ModelObjectReader.java:152) at org.eclipse.core.internal.resources.ModelObjectReader.readBuildCommand (ModelObjectReader.java:118) at org.eclipse.core.internal.resources.ModelObjectReader.readBuildSpec (ModelObjectReader.java:135) at org.eclipse.core.internal.resources.ModelObjectReader.readProjectDescription (ModelObjectReader.java:163) at org.eclipse.core.internal.resources.ModelObjectReader.read (ModelObjectReader.java:105) at org.eclipse.core.internal.resources.ModelObjectReader.read (ModelObjectReader.java:70) at org.eclipse.core.internal.resources.ModelObjectReader.read (ModelObjectReader.java:81) at org.eclipse.core.internal.localstore.FileSystemResourceManager.read (FileSystemResourceManager.java:301) at org.eclipse.core.internal.resources.SaveManager.restoreMetaInfo (SaveManager.java:530) at org.eclipse.core.internal.resources.SaveManager.restoreMetaInfo (SaveManager.java:562) at org.eclipse.core.internal.resources.SaveManager.restore (SaveManager.java:466) at org.eclipse.core.internal.resources.SaveManager.startup (SaveManager.java:912) at org.eclipse.core.internal.resources.Workspace.startup (Workspace.java:1466) at org.eclipse.core.internal.resources.Workspace.open (Workspace.java:1265) at org.eclipse.core.resources.ResourcesPlugin.startup (ResourcesPlugin.java:155) at org.eclipse.core.internal.plugins.PluginDescriptor$1.run (PluginDescriptor.java:677) at org.eclipse.core.internal.runtime.InternalPlatform.run (InternalPlatform.java:782) at org.eclipse.core.internal.plugins.PluginDescriptor.internalDoPluginActivation (PluginDescriptor.java:689) at org.eclipse.core.internal.plugins.PluginDescriptor.doPluginActivation (PluginDescriptor.java:176) at org.eclipse.core.internal.plugins.PluginClassLoader.activatePlugin (PluginClassLoader.java:52) at org.eclipse.core.internal.plugins.PluginClassLoader.findClassParentsSelf (PluginClassLoader.java:130) at org.eclipse.core.internal.boot.DelegatingURLClassLoader.loadClass (DelegatingURLClassLoader.java:771) at org.eclipse.core.internal.boot.DelegatingURLClassLoader.access$0 (DelegatingURLClassLoader.java:765) at org.eclipse.core.internal.boot.DelegatingURLClassLoader$DelegateLoader.loadClass (DelegatingURLClassLoader.java:65) at org.eclipse.core.internal.boot.DelegatingURLClassLoader.findClassPrerequisites (DelegatingURLClassLoader.java:425) at org.eclipse.core.internal.boot.DelegatingURLClassLoader.loadClass (DelegatingURLClassLoader.java:779) at org.eclipse.core.internal.boot.DelegatingURLClassLoader.loadClass (DelegatingURLClassLoader.java:751) at java.lang.ClassLoader.loadClass(ClassLoader.java:257) at java.lang.Class.newInstance0(Native Method) at java.lang.Class.newInstance(Class.java:254) at org.eclipse.core.internal.plugins.PluginDescriptor.createExecutableExtension (PluginDescriptor.java:128) at org.eclipse.core.internal.plugins.PluginDescriptor.createExecutableExtension (PluginDescriptor.java:157) at org.eclipse.core.internal.plugins.ConfigurationElement.createExecutableExtension (ConfigurationElement.java:96) at org.eclipse.core.internal.runtime.InternalPlatform.loaderGetRunnable (InternalPlatform.java:431) at java.lang.reflect.Method.invoke(Native Method) at org.eclipse.core.internal.boot.InternalBootLoader.getRunnable (InternalBootLoader.java:354) at org.eclipse.core.internal.boot.InternalBootLoader.run (InternalBootLoader.java:639) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:319) at EclipseRuntimeLauncher.main(EclipseRuntimeLauncher.java:16) "> </exception> </status> </log-entry> <log-entry date="Tue Apr 30 14:47:34 EDT 2002"> <status plugin-id="org.eclipse.core.runtime" severity="ERROR" message="Plugin org.eclipse.ui was unable to instantiate class org.eclipse.ui.internal.Workbench." code="2"> <exception message="Plugin org.eclipse.core.resources activation failed while loading class org.eclipse.core.resources.WorkspaceLock" trace=" org.eclipse.core.internal.boot.DelegatingLoaderException: org.eclipse.core.runtime.CoreException: Problems encountered starting up plug- in: org.eclipse.core.resources. at org.eclipse.core.internal.plugins.PluginDescriptor.internalDoPluginActivation (PluginDescriptor.java:695) at org.eclipse.core.internal.plugins.PluginDescriptor.doPluginActivation (PluginDescriptor.java:176) at org.eclipse.core.internal.plugins.PluginClassLoader.activatePlugin (PluginClassLoader.java:52) at org.eclipse.core.internal.plugins.PluginClassLoader.findClassParentsSelf (PluginClassLoader.java:130) at org.eclipse.core.internal.boot.DelegatingURLClassLoader.loadClass (DelegatingURLClassLoader.java:771) at org.eclipse.core.internal.boot.DelegatingURLClassLoader.access$0 (DelegatingURLClassLoader.java:765) at org.eclipse.core.internal.boot.DelegatingURLClassLoader$DelegateLoader.loadClass (DelegatingURLClassLoader.java:65) at org.eclipse.core.internal.boot.DelegatingURLClassLoader.findClassPrerequisites (DelegatingURLClassLoader.java:425) at org.eclipse.core.internal.boot.DelegatingURLClassLoader.loadClass (DelegatingURLClassLoader.java:779) at org.eclipse.core.internal.boot.DelegatingURLClassLoader.loadClass (DelegatingURLClassLoader.java:751) at java.lang.ClassLoader.loadClass(ClassLoader.java:257) at java.lang.Class.newInstance0(Native Method) at java.lang.Class.newInstance(Class.java:254) at org.eclipse.core.internal.plugins.PluginDescriptor.createExecutableExtension (PluginDescriptor.java:128) at org.eclipse.core.internal.plugins.PluginDescriptor.createExecutableExtension (PluginDescriptor.java:157) at org.eclipse.core.internal.plugins.ConfigurationElement.createExecutableExtension (ConfigurationElement.java:96) at org.eclipse.core.internal.runtime.InternalPlatform.loaderGetRunnable (InternalPlatform.java:431) at java.lang.reflect.Method.invoke(Native Method) at org.eclipse.core.internal.boot.InternalBootLoader.getRunnable (InternalBootLoader.java:354) at org.eclipse.core.internal.boot.InternalBootLoader.run (InternalBootLoader.java:639) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:319) at EclipseRuntimeLauncher.main(EclipseRuntimeLauncher.java:16) "> </exception> </status> </log-entry> If you modify the .project file manually to add something to the value element, then the workbench starts up properly.
Out of curiousity, how would you do this via code? (since I don't believe that Maps allow you to have null as values)
You are allowed to use null for a value (as long as the implementation supports it). Also, it is possible the value could be an empty string which would give the same result. I'm running into this problem for the tool script support. I'd like to release this code by thursday but can't if this problem exist.
Not sure if this will be able to be fixed by Thursday. The case of key -> "" is an interesting one and I'm not sure how we can preserve that in the file. Will think about it.
Fixed and released to HEAD.
Please note that your code which sets the builder command argument values to be null should be changed if you are relying on null coming back as the value across sessions. Upon further review of the ICommand spec, it says that the Map of arguments contains Strings only as both the keys and the values. With this assumption, the Reader code which reads from the XML file on disk was changed so when we come across an XML file with an empty tag it is assumed that the value is an empty String and not null.
I've already made the change so that the argument value is always a string, not a null. Could the ICommand docs be updated a bit. When you see: * @return a table of command arguments (key type : <code>String</code> * value type : <code>String</code>), or <code>null</code> it hard to notice that ")" character in the second line. At a quick glance, it looks like value type is either string or null.
Is this better? * @param args a table of command arguments (keys and values must * both be of type <code>String</code>), or <code>null</code>
Yes, better.
Updated and released code comment.