Java Mailing List Archive

http://www.gg3721.com/

Home » user.groovy »

[groovy-user] Can't force unboxing :((

Andrew Perepelytsya

2008-08-14

Replies: Find Java Web Hosting

Author LoginPost Reply

Hi,

This has been driving me mad for a while, feel my pain.

The script is executed via the GroovyShell:

import org.springmodules.jcr.SessionFactoryUtils
import javax.jcr.ImportUUIDBehavior
import javax.jcr.Workspace

Workspace workspace = session.workspace

file = new File('/temp/jcr_sys_export_with_binaries.xml')

int imports = ImportUUIDBehavior.IMPORT_UUID_COLLISION_REPLACE_EXISTING

workspace.importXml("/", file.newInputStream(), imports)



and it always generates this error:

Caused by: groovy.lang.MissingMethodException: No signature of method:
org.apache.jackrabbit.core.XAWorkspace.importXml() is applicable for
argument types: (java.lang.String, java.io.BufferedInputStre
am, java.lang.Integer) values: {/, java.io.BufferedInputStream@(protected)}
    at
org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap (ScriptBytecodeAdapter.java:54)
    at Script1.run(Script1.groovy:22)
    at groovy.lang.GroovyShell.evaluate (GroovyShell.java:543)
    at groovy.lang.GroovyShell.evaluate (GroovyShell.java:518)


The quirk seems to be that I can't force the imports constant to be unboxed
into a primitive int. Here's the API ref:
http://day.com/maven/jsr170/javadocs/jcr-1.0/javax/jcr/Workspace.html#importXML(java.lang.String,%20java.io.InputStream,%20int)

No casts helped, calling imports.intValue() , etc. It just keeps looking for
the java.lang.Integer method param match. Tried with groovy 1.5.4, 1.5.6,
1.6-beta-1 with no success.

Is there a way to make autoboxing not stand in the way in this scenario?

Thanks,
Andrew
--
Sent from the groovy - user mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

  http://xircles.codehaus.org/manage_email


©2008 gg3721.com - Jax Systems, LLC, U.S.A.