jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From resc...@apache.org
Subject svn commit: r588666 - in /jackrabbit/trunk: jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ jackrabbit-spi-commons/src/test/java/org/apache/jackrabbit/value/ jackrabbit-spi/src/main/java/org/apache/jackrabbit/spi/
Date Fri, 26 Oct 2007 14:35:57 GMT
Author: reschke
Date: Fri Oct 26 07:35:56 2007
New Revision: 588666

URL: http://svn.apache.org/viewvc?rev=588666&view=rev
Log:
JCR-1190: allow QValueFactory methods to throw exceptions.

Modified:
    jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/SessionItemStateManager.java
    jackrabbit/trunk/jackrabbit-spi-commons/src/test/java/org/apache/jackrabbit/value/QValueTest.java
    jackrabbit/trunk/jackrabbit-spi/src/main/java/org/apache/jackrabbit/spi/QValueFactory.java

Modified: jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/SessionItemStateManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/SessionItemStateManager.java?rev=588666&r1=588665&r2=588666&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/SessionItemStateManager.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/SessionItemStateManager.java
Fri Oct 26 07:35:56 2007
@@ -702,7 +702,7 @@
      * @return the computed values
      */
     private QValue[] computeSystemGeneratedPropertyValues(NodeState parent,
-                                                          QPropertyDefinition def) {
+                                                          QPropertyDefinition def) throws
RepositoryException {
         QValue[] genValues = null;
         QValue[] qDefaultValues = def.getDefaultValues();
         if (qDefaultValues != null && qDefaultValues.length > 0) {
@@ -747,7 +747,7 @@
      * @param factory
      * @return An array of QValue objects from the given <code>Name</code>s
      */
-    private static QValue[] getQValues(Name[] qNames, QValueFactory factory) {
+    private static QValue[] getQValues(Name[] qNames, QValueFactory factory) throws RepositoryException
{
         QValue[] ret = new QValue[qNames.length];
         for (int i = 0; i < qNames.length; i++) {
             ret[i] = factory.create(qNames[i]);
@@ -755,7 +755,7 @@
         return ret;
     }
 
-    private static QValue[] getQValues(String uniqueID, QValueFactory factory) {
+    private static QValue[] getQValues(String uniqueID, QValueFactory factory) throws RepositoryException
{
         if (uniqueID == null) {
             uniqueID = UUID.randomUUID().toString();
         }

Modified: jackrabbit/trunk/jackrabbit-spi-commons/src/test/java/org/apache/jackrabbit/value/QValueTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi-commons/src/test/java/org/apache/jackrabbit/value/QValueTest.java?rev=588666&r1=588665&r2=588666&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi-commons/src/test/java/org/apache/jackrabbit/value/QValueTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-spi-commons/src/test/java/org/apache/jackrabbit/value/QValueTest.java
Fri Oct 26 07:35:56 2007
@@ -20,6 +20,8 @@
 
 import javax.jcr.PropertyType;
 import javax.jcr.RepositoryException;
+import javax.jcr.ValueFormatException;
+
 import java.util.Calendar;
 import java.util.Arrays;
 import java.io.InputStream;
@@ -55,7 +57,7 @@
     private static final QValueFactory factory = QValueFactoryImpl.getInstance();
 
     //---------------------------------------------------------------< DATE >---
-    public void testNullDateValue() throws IOException {
+    public void testNullDateValue() throws IOException, RepositoryException {
         try {
             factory.create((Calendar) null);
             fail();
@@ -70,11 +72,11 @@
         }
     }
 
-    public void testDateValueType() {
+    public void testDateValueType() throws RepositoryException {
         QValue v = factory.create(CALENDAR);
         assertTrue("Type of a date value must be PropertyType.DATE", v.getType() == PropertyType.DATE);
     }
-    public void testDateValueEquality() {
+    public void testDateValueEquality() throws RepositoryException {
         QValue v = factory.create(CALENDAR);
         QValue otherV = factory.create(CALENDAR);
         assertEquals("Equality of qualified date value must be calculated based on their
String representation.", v, otherV);
@@ -93,7 +95,7 @@
     }
 
     //----------------------------------------------------------< REFERENCE >---
-    public void testNullReferenceValue() throws IOException {
+    public void testNullReferenceValue() throws IOException, RepositoryException {
         try {
             factory.create(null, PropertyType.REFERENCE);
             fail();
@@ -102,18 +104,18 @@
         }
     }
 
-    public void testReferenceValueType() {
+    public void testReferenceValueType() throws RepositoryException {
         QValue v = factory.create(REFERENCE, PropertyType.REFERENCE);
         assertTrue("Type of a date value must be PropertyType.REFERENCE.", v.getType() ==
PropertyType.REFERENCE);
     }
 
-    public void testReferenceValueEquality() {
+    public void testReferenceValueEquality() throws RepositoryException {
         QValue v = factory.create(REFERENCE, PropertyType.REFERENCE);
         QValue otherV = factory.create(REFERENCE, PropertyType.REFERENCE);
         assertEquals("Qualified ref values created from the same string must be equal.",
v, otherV);
     }
 
-    public void testEqualityDifferentTypes() {
+    public void testEqualityDifferentTypes() throws RepositoryException {
         QValue v = factory.create(REFERENCE, PropertyType.REFERENCE);
         QValue v2 = factory.create(REFERENCE, PropertyType.STRING);
         assertFalse(v.equals(v2));
@@ -121,7 +123,7 @@
 
 
     //---------------------------------------------------------------< Name >---
-    public void testNullQNameValue() throws IOException {
+    public void testNullQNameValue() throws IOException, RepositoryException {
         try {
             factory.create((Name) null);
             fail();
@@ -130,14 +132,14 @@
         }
     }
 
-    public void testQNameValueType() throws IOException {
+    public void testQNameValueType() throws IOException, RepositoryException {
         QValue v = factory.create(NameConstants.JCR_DATA);
         assertTrue(v.getType() == PropertyType.NAME);
         v = factory.create(NameConstants.JCR_DATA.toString(), PropertyType.NAME);
         assertTrue(v.getType() == PropertyType.NAME);
     }
 
-    public void testQNameValueEquality() throws IOException {
+    public void testQNameValueEquality() throws IOException, RepositoryException {
         QValue v = factory.create(NameConstants.JCR_DATA);
         QValue v2 = factory.create(NameConstants.JCR_DATA.toString(), PropertyType.NAME);
         assertTrue(v.equals(v2));
@@ -149,7 +151,7 @@
     }
 
     //--------------------------------------------------------------< QPath >---
-    public void testNullPathValue() throws IOException {
+    public void testNullPathValue() throws IOException, RepositoryException {
         try {
             factory.create((Path) null);
             fail();
@@ -158,7 +160,7 @@
         }
     }
 
-    public void testPathValueType() throws IOException {
+    public void testPathValueType() throws IOException, RepositoryException {
         QValue v = factory.create(ROOT_PATH);
         assertTrue(v.getType() == PropertyType.PATH);
         v = factory.create(ROOT_PATH.toString(), PropertyType.PATH);
@@ -166,7 +168,7 @@
     }
 
 
-    public void testPathValueEquality() throws IOException {
+    public void testPathValueEquality() throws IOException, RepositoryException {
         QValue v = factory.create(ROOT_PATH);
         QValue v2 = factory.create(ROOT_PATH.toString(), PropertyType.PATH);
         assertTrue(v.equals(v2));
@@ -199,7 +201,7 @@
         }
     }
 
-    public void testBinaryValueType() throws IOException {
+    public void testBinaryValueType() throws IOException, RepositoryException {
         QValue v = factory.create(new byte[] {'a', 'b', 'c'});
         assertTrue(v.getType() == PropertyType.BINARY);
     }

Modified: jackrabbit/trunk/jackrabbit-spi/src/main/java/org/apache/jackrabbit/spi/QValueFactory.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi/src/main/java/org/apache/jackrabbit/spi/QValueFactory.java?rev=588666&r1=588665&r2=588666&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi/src/main/java/org/apache/jackrabbit/spi/QValueFactory.java
(original)
+++ jackrabbit/trunk/jackrabbit-spi/src/main/java/org/apache/jackrabbit/spi/QValueFactory.java
Fri Oct 26 07:35:56 2007
@@ -22,6 +22,7 @@
 import java.util.Calendar;
 
 import javax.jcr.RepositoryException;
+import javax.jcr.ValueFormatException;
 
 /**
  * <code>QValueFactory</code> defines methods to create <code>QValue</code>
@@ -39,7 +40,7 @@
      * @return a new <code>QValue</code>.
      * @see QValue#getType()
      */
-    public QValue create(String value, int type);
+    public QValue create(String value, int type) throws ValueFormatException, RepositoryException;
 
     /**
      * Create a new <code>QValue</code> with type {@link javax.jcr.PropertyType#DATE}.
@@ -48,7 +49,7 @@
      * of the new <code>QValue</code>.
      * @return a new <code>QValue</code>.
      */
-    public QValue create(Calendar value);
+    public QValue create(Calendar value) throws RepositoryException;
 
     /**
      * Create a new <code>QValue</code> with type {@link javax.jcr.PropertyType#DOUBLE}.
@@ -57,7 +58,7 @@
      * of the new <code>QValue</code>.
      * @return a new <code>QValue</code>.
      */
-    public QValue create(double value);
+    public QValue create(double value) throws RepositoryException;
 
     /**
      * Create a new <code>QValue</code> with type {@link javax.jcr.PropertyType#LONG}.
@@ -66,7 +67,7 @@
      * of the new <code>QValue</code>.
      * @return a new <code>QValue</code>.
      */
-    public QValue create(long value);
+    public QValue create(long value) throws RepositoryException;
 
     /**
      * Create a new <code>QValue</code> with type {@link javax.jcr.PropertyType#NAME}.
@@ -74,7 +75,7 @@
      * @param value A non-null <code>Name</code>.
      * @return a new <code>QValue</code>.
      */
-    public QValue create(Name value);
+    public QValue create(Name value) throws RepositoryException;
 
     /**
      * Create a new <code>QValue</code> with type {@link javax.jcr.PropertyType#PATH}.
@@ -82,7 +83,7 @@
      * @param value A non-null <code>Path</code>.
      * @return a new <code>QValue</code>.
      */
-    public QValue create(Path value);
+    public QValue create(Path value) throws RepositoryException;
 
 
     /**
@@ -91,7 +92,7 @@
      * @param value
      * @return a new <code>QValue</code>.
      */
-    public QValue create(byte[] value);
+    public QValue create(byte[] value) throws RepositoryException;
 
     /**
      * Creates a QValue that contains the given binary stream.
@@ -112,5 +113,5 @@
      * @return a new binarly <code>QValue</code>.
      * @throws IOException
      */
-    public QValue create(File value) throws IOException;
+    public QValue create(File value) throws RepositoryException, IOException;
 }



Mime
View raw message