Author: angela
Date: Thu Mar 15 15:18:23 2012
New Revision: 1301035
URL: http://svn.apache.org/viewvc?rev=1301035&view=rev
Log:
OAK-16 : Proper ValueFactory implementation and Value handling
- fix Property#getType
Modified:
jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyImpl.java
Modified:
jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyImpl.java
URL:
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyImpl.java?rev=1301035&r1=1301034&r2=1301035&view=diff
==============================================================================
---
jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyImpl.java
(original)
+++
jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyImpl.java
Thu Mar 15 15:18:23 2012
@@ -513,18 +513,20 @@ public class PropertyImpl extends ItemIm
return null;
}
+ /**
+ * @see javax.jcr.Property#getType()
+ */
@Override
public int getType() throws RepositoryException {
if (isMultiple()) {
Value[] values = getValues();
if (values.length == 0) {
- return PropertyType.UNDEFINED;
- }
- else {
+ // retrieve the type from the property definition
+ return getRequiredType(PropertyType.UNDEFINED);
+ } else {
return values[0].getType();
}
- }
- else {
+ } else {
return getValue().getType();
}
}
@@ -544,7 +546,7 @@ public class PropertyImpl extends ItemIm
private int getRequiredType(int defaultType) throws RepositoryException {
// check type according to definition of this property
PropertyDefinition def = getDefinition();
- int reqType = def == null ? PropertyType.UNDEFINED :
getDefinition().getRequiredType();
+ int reqType = (def == null) ? PropertyType.UNDEFINED :
getDefinition().getRequiredType();
if (reqType == PropertyType.UNDEFINED) {
if (defaultType == PropertyType.UNDEFINED) {
reqType = PropertyType.STRING;