You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by an...@apache.org on 2006/10/16 11:15:27 UTC
svn commit: r464423 -
/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/NodeImpl.java
Author: angela
Date: Mon Oct 16 02:15:27 2006
New Revision: 464423
URL: http://svn.apache.org/viewvc?view=rev&rev=464423
Log:
work in progress
- canAddMixin: should throw NoSuchNodeTypeException but catch LockExc.
and VersionExc.
- setProperty: missing handling for null entries in values array.
Modified:
jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/NodeImpl.java
Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/NodeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/NodeImpl.java?view=diff&rev=464423&r1=464422&r2=464423
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/NodeImpl.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/NodeImpl.java Mon Oct 16 02:15:27 2006
@@ -745,10 +745,13 @@
session.getValidator().checkIsWritable(getNodeState(), ItemStateValidator.CHECK_ALL);
// then make sure the new mixin would not conflict.
return isValidMixin(getQName(mixinName));
- } catch (NoSuchNodeTypeException e) {
+ } catch (NodeTypeConflictException e) {
log.debug("Cannot add mixin '" + mixinName + "': " + e.getMessage());
return false;
- } catch (NodeTypeConflictException e) {
+ } catch (LockException e) {
+ log.debug("Cannot add mixin '" + mixinName + "': " + e.getMessage());
+ return false;
+ } catch (VersionException e) {
log.debug("Cannot add mixin '" + mixinName + "': " + e.getMessage());
return false;
}
@@ -1419,7 +1422,19 @@
// make sure, the final type is not set to undefined
if (targetType == PropertyType.UNDEFINED) {
if (type == PropertyType.UNDEFINED) {
- targetType = (values.length > 0) ? values[0].getType() : PropertyType.STRING;
+ // try to retrieve type from the values array
+ if (values.length > 0) {
+ for (int i = 0; i < values.length; i++) {
+ if (values[i] != null) {
+ targetType = values[i].getType();
+ break;
+ }
+ }
+ }
+ if (targetType == PropertyType.UNDEFINED) {
+ // fallback
+ targetType = PropertyType.STRING;
+ }
} else {
targetType = type;
}