Why don't we use a different implementation and module for this instead ? -g
On Jan 31, 2010, at 10:07 PM, [email protected] wrote: > Revision > 31392 > Author > fgiust > Date > 2010-01-31 22:07:49 +0100 (Sun, 31 Jan 2010) > Log Message > > MAGNOLIA-2988 ntReg.getNodeTypeDef() has a different return type in > jackrabbit 2.0, so this causes a binary incompatibility if we compile the > provider class with jackrabbit 1.6 > Modified Paths > > • > community/magnolia/trunk/magnolia-core/src/main/java/info/magnolia/jackrabbit/ProviderImpl.java > Diff > > Modified: > community/magnolia/trunk/magnolia-core/src/main/java/info/magnolia/jackrabbit/ProviderImpl.java > (31391 => 31392) > > --- > community/magnolia/trunk/magnolia-core/src/main/java/info/magnolia/jackrabbit/ProviderImpl.java > 2010-01-31 18:15:13 UTC (rev 31391) > +++ > community/magnolia/trunk/magnolia-core/src/main/java/info/magnolia/jackrabbit/ProviderImpl.java > 2010-01-31 21:07:49 UTC (rev 31392) > > @@ -73,6 +73,7 @@ > > import java.io.FileNotFoundException; > > import java.io.IOException; > > import java.io.InputStream; > > +import java.lang.reflect.InvocationTargetException; > > import java.lang.reflect.Method; > > import java.util.Hashtable; > > import java.util.Iterator; > > @@ -333,18 +334,45 @@ > > } > > > > try { > > - ntReg.getNodeTypeDef(ntname); > > + > + // return value has changed in jackrabbit 2, we still > have to use reflection here > + // ntReg.getNodeTypeDef(ntname); > + > + Method method = > ntReg.getClass().getMethod("getNodeTypeDef", Name.class); > + method.invoke(ntReg, ntname); > > } > > - catch (NoSuchNodeTypeException nsne) { > - log.info("Registering nodetype {}", ntname); > //$NON-NLS-1$ > > + catch (IllegalArgumentException e) > + { > + throw new RepositoryException(e.getMessage(), e); > + } > + catch (IllegalAccessException e) > + { > + throw new RepositoryException(e.getMessage(), e); > + } > + catch (SecurityException e) > + { > + throw new RepositoryException(e.getMessage(), e); > + } > + catch (NoSuchMethodException e) > + { > + throw new RepositoryException(e.getMessage(), e); > + } > + catch (InvocationTargetException ite) > + { > + if (ite.getTargetException() instanceof > NoSuchNodeTypeException) > + { > + log.info("Registering nodetype {}", ntname); > //$NON-NLS-1$ > > > > - try { > - // reflection for jackrabbit 1+2 compatibility > - getMethod(NodeTypeRegistry.class, > "registerNodeType").invoke(ntReg, new Object[]{def}); > > + try > + { > + // reflection for jackrabbit 1+2 compatibility > + getMethod(NodeTypeRegistry.class, > "registerNodeType").invoke(ntReg, new Object[]{def }); > + } > + catch (Exception e) > + { > + throw new RepositoryException(e.getMessage(), e); > + } > > } > > - catch (Exception e) { > - throw new RepositoryException(e.getMessage(), e); > - } > > } > > } > > > > > > ---------------------------------------------------------------- > For list details see > http://www.magnolia-cms.com/home/community/mailing-lists.html > To unsubscribe, E-mail to: <[email protected]> > ----------------------------------------------------------------
