Error on the first :JavaImportSort

2 views
Skip to first unread message

Steven K. Wong

unread,
Sep 4, 2009, 1:12:44 PM9/4/09
to eclim-user
Using eclim from source 77b4eb8a4fdd7a6dd19c2b750c0d743a7615bda9 (Thu
Sep 3 21:21:57 2009 -0700): Start Eclipse, start Vim, then immediately
execute the command :JavaImportSort. The command gives the following
error. But if I execute the command again (without restarting Eclipse
or Vim), the error doesn't happen and the command runs fine.

java.lang.NullPointerException
while executing command: -command java_import_order -p "nccp"
Error detected while processing function
eclim#java#import#SortImports..<SNR>53_
CompareImports..<SNR>53_CompareClasses:
line 1:
E121: Undefined variable: s:import_order
E116: Invalid arguments for function len(s:import_order)
E15: Invalid expression: len(s:import_order)
line 2:
E121: Undefined variable: max
E15: Invalid expression: max
line 3:
E121: Undefined variable: max
E15: Invalid expression: max
line 5:
E121: Undefined variable: s:import_order
E15: Invalid expression: s:import_order
line 19:
E121: Undefined variable: c1index
E15: Invalid expression: c1index < c2index || (c1index == c2index &&
a:c1 < a:c2
)
line 23:
E121: Undefined variable: c1index
E15: Invalid expression: c1index > c2index || (c1index == c2index &&
a:c1 > a:c2
)
line 1:
E121: Undefined variable: s:import_order
E116: Invalid arguments for function len(s:import_order)
E15: Invalid expression: len(s:import_order)
line 2:
E121: Undefined variable: max
E15: Invalid expression: max
line 3:
E121: Undefined variable: max
E15: Invalid expression: max
line 5:
E121: Undefined variable: s:import_order
E15: Invalid expression: s:import_order
line 19:
E121: Undefined variable: c1index
E15: Invalid expression: c1index < c2index || (c1index == c2index &&
a:c1 < a:c2
)
line 23:
E121: Undefined variable: c1index
E15: Invalid expression: c1index > c2index || (c1index == c2index &&
a:c1 > a:c2
)
line 1:
E121: Undefined variable: s:import_order
E116: Invalid arguments for function len(s:import_order)
E15: Invalid expression: len(s:import_order)
line 2:
E121: Undefined variable: max
E15: Invalid expression: max
line 3:
E121: Undefined variable: max
E15: Invalid expression: max
line 5:
E121: Undefined variable: s:import_order

Eric Van Dewoestine

unread,
Sep 4, 2009, 1:42:17 PM9/4/09
to eclim...@googlegroups.com
On Fri, Sep 4, 2009 at 10:12 AM, Steven K. Wong <skws...@gmail.com> wrote:
>
> Using eclim from source 77b4eb8a4fdd7a6dd19c2b750c0d743a7615bda9 (Thu
> Sep 3 21:21:57 2009 -0700): Start Eclipse, start Vim, then immediately
> execute the command :JavaImportSort. The command gives the following
> error. But if I execute the command again (without restarting Eclipse
> or Vim), the error doesn't happen and the command runs fine.
>
> java.lang.NullPointerException
> while executing command: -command java_import_order -p "nccp"
> Error detected while processing function
> eclim#java#import#SortImports..<SNR>53_
> CompareImports..<SNR>53_CompareClasses:
> line    1:
> E121: Undefined variable: s:import_order

So far I can't reproduce the NPE that you received. I've tried
running the command as quick as I can after eclimd binds to the port,
but the best can do is generate a RuntimeException if I run the
command before it's registered internally in eclimd.

I can fix the vim side to handle the error more gracefully, but I'd
like to find out why you are getting an NPE. Can you try running that
java_import_order command at a command line to retrieve the full stack
trace:

$ $ECLIPSE_HOME/eclim -command java_import_order -p "nccp"

--
eric

Steven K. Wong

unread,
Sep 4, 2009, 2:30:02 PM9/4/09
to eclim-user
By "immediately" I simply meant I didn't do anything else (execute
other commands, etc.) between starting Vim and
executing :JavaImportSort (other than :e the file). Sorry, didn't mean
to rush you. :)

Here's the stack trace you want:

java.lang.NullPointerException
at org.eclipse.jface.resource.JFaceResources.getResources
(JFaceResources.java:207)
at org.eclipse.jface.resource.ImageRegistry.<init>(ImageRegistry.java:
152)
at org.eclipse.jface.resource.ImageRegistry.<init>(ImageRegistry.java:
124)
at org.eclipse.jdt.internal.ui.JavaPluginImages.getImageRegistry
(JavaPluginImages.java:534)
at org.eclipse.jdt.internal.ui.JavaPluginImages.get
(JavaPluginImages.java:491)
at
org.eclipse.jdt.internal.ui.preferences.ImportOrganizeConfigurationBlock
$ImportOrganizeLabelProvider.<init>
(ImportOrganizeConfigurationBlock.java:112)
at
org.eclipse.jdt.internal.ui.preferences.ImportOrganizeConfigurationBlock.<init>
(ImportOrganizeConfigurationBlock.java:190)
at org.eclim.plugin.jdt.command.include.ImportOrderCommand.execute
(ImportOrderCommand.java:61)
at org.eclim.command.Main.main(Main.java:89)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.martiansoftware.nailgun.NGSession.run(NGSession.java:334)


On Sep 4, 10:42 am, Eric Van Dewoestine <ervan...@gmail.com> wrote:

Eric Van Dewoestine

unread,
Sep 4, 2009, 3:06:29 PM9/4/09
to eclim...@googlegroups.com

I just remembered that you're running eclimd inside of the eclipse
gui. Using that mode I can reproduce the issue. I'll work on a fix
for this later today.

--
eric

Eric Van Dewoestine

unread,
Sep 4, 2009, 3:24:28 PM9/4/09
to eclim...@googlegroups.com

This was pretty quick to fix, so I went ahead and did it. Pull the
latest code and that should resolve the error.

--
eric

Steven K. Wong

unread,
Sep 5, 2009, 3:18:36 PM9/5/09
to eclim-user
Yes, it's fixed.


On Sep 4, 12:24 pm, Eric Van Dewoestine <ervan...@gmail.com> wrote:
> On Fri, Sep 4, 2009 at 12:06 PM, Eric Van Dewoestine <ervan...@gmail.com> wrote:
Reply all
Reply to author
Forward
0 new messages