You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by st...@apache.org on 2005/04/21 16:26:12 UTC
svn commit: r164066 - in
/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core:
NodeImpl.java util/ValueHelper.java
Author: stefan
Date: Thu Apr 21 07:26:11 2005
New Revision: 164066
URL: http://svn.apache.org/viewcvs?rev=164066&view=rev
Log:
fixed bug in Node.setProperty(String, Value, int) and setProperty(String, Value[], int):
type argument was ignored in certain situations
Modified:
incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/NodeImpl.java
incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/util/ValueHelper.java
Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/NodeImpl.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/NodeImpl.java?rev=164066&r1=164065&r2=164066&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/NodeImpl.java (original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/NodeImpl.java Thu Apr 21 07:26:11 2005
@@ -1858,7 +1858,11 @@
BitSet status = new BitSet();
PropertyImpl prop = getOrCreateProperty(name, type, true, status);
try {
- prop.setValue(values);
+ if (type == PropertyType.UNDEFINED) {
+ prop.setValue(values);
+ } else {
+ prop.setValue(ValueHelper.convert(values, type));
+ }
} catch (RepositoryException re) {
if (status.get(CREATED)) {
// setting value failed, get rid of newly created property
@@ -1994,7 +1998,11 @@
BitSet status = new BitSet();
PropertyImpl prop = getOrCreateProperty(name, type, false, status);
try {
- prop.setValue(value);
+ if (type == PropertyType.UNDEFINED) {
+ prop.setValue(value);
+ } else {
+ prop.setValue(ValueHelper.convert(value, type));
+ }
} catch (RepositoryException re) {
if (status.get(CREATED)) {
// setting value failed, get rid of newly created property
Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/util/ValueHelper.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/util/ValueHelper.java?rev=164066&r1=164065&r2=164066&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/util/ValueHelper.java (original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/util/ValueHelper.java Thu Apr 21 07:26:11 2005
@@ -89,6 +89,25 @@
}
/**
+ * @param srcValues
+ * @param targetType
+ * @return
+ * @throws ValueFormatException
+ * @throws IllegalArgumentException
+ */
+ public static Value[] convert(Value[] srcValues, int targetType)
+ throws ValueFormatException, IllegalArgumentException {
+ if (srcValues == null) {
+ return null;
+ }
+ Value[] newValues = new Value[srcValues.length];
+ for (int i = 0; i < srcValues.length; i++) {
+ newValues[i] = convert(srcValues[i], targetType);
+ }
+ return newValues;
+ }
+
+ /**
* @param srcValue
* @param targetType
* @return