You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by tr...@apache.org on 2004/11/05 15:18:47 UTC
svn commit: rev 56665 - incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core
Author: tripod
Date: Fri Nov 5 06:18:46 2004
New Revision: 56665
Modified:
incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/NodeImpl.java
incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/PropertyImpl.java
Log:
- Node.setProperty() results to invalid state, if node is checked in and property does not exist yet.
Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/NodeImpl.java
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/NodeImpl.java (original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/NodeImpl.java Fri Nov 5 06:18:46 2004
@@ -171,6 +171,7 @@
} catch (PathNotFoundException pnfe) {
// fall through
}
+
// property does not exist yet...
QName qName;
try {
@@ -204,6 +205,12 @@
String msg = "there's already a child node with name " + name;
log.error(msg);
throw new RepositoryException(msg);
+ }
+ // check if versioning allows write
+ if (!safeIsCheckedOut()) {
+ String msg = "Cannot set the value of a property of a checked-in node " + safeGetJCRPath();
+ log.error(msg);
+ throw new VersionException(msg);
}
String parentUUID = ((NodeState) state).getUUID();
Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/PropertyImpl.java
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/PropertyImpl.java (original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/PropertyImpl.java Fri Nov 5 06:18:46 2004
@@ -368,8 +368,14 @@
}
PropertyState state = (PropertyState) getItemState();
- InternalValue val = state.getValues()[0];
- return val.toJCRValue(session.getNamespaceResolver());
+ try {
+ InternalValue val = state.getValues()[0];
+ return val.toJCRValue(session.getNamespaceResolver());
+ } catch (RepositoryException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new RepositoryException("Unable to get value of " + safeGetJCRPath() + ":" + e);
+ }
}
/**
@@ -888,7 +894,9 @@
// check if versioning allows write
if (!((NodeImpl) getParent()).safeIsCheckedOut()) {
- throw new VersionException("Cannot alter the value of a property of a checked-in node " + safeGetJCRPath());
+ String msg = "Cannot alter the value of a property of a checked-in node " + safeGetJCRPath();
+ log.error(msg);
+ throw new VersionException(msg);
}
// check protected flag