jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r915339 [4/4] - in /jackrabbit/trunk/jackrabbit-jcr-server/src: main/java/org/apache/jackrabbit/server/io/ main/java/org/apache/jackrabbit/server/jcr/ main/java/org/apache/jackrabbit/server/remoting/davex/ main/java/org/apache/jackrabbit/se...
Date Tue, 23 Feb 2010 13:37:40 GMT
Modified: jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/simple/VersionHistoryResourceImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/simple/VersionHistoryResourceImpl.java?rev=915339&r1=915338&r2=915339&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/simple/VersionHistoryResourceImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/simple/VersionHistoryResourceImpl.java
Tue Feb 23 13:37:38 2010
@@ -31,6 +31,7 @@
 import org.apache.jackrabbit.webdav.property.ResourceType;
 import org.apache.jackrabbit.webdav.property.DavProperty;
 import org.apache.jackrabbit.webdav.property.DavPropertyName;
+import org.apache.jackrabbit.webdav.property.PropEntry;
 import org.apache.jackrabbit.webdav.version.VersionHistoryResource;
 import org.apache.jackrabbit.webdav.version.VersionResource;
 import org.slf4j.Logger;
@@ -68,8 +69,9 @@
      * @return
      * @see DavResource#getMembers()
      */
+    @Override
     public DavResourceIterator getMembers() {
-        ArrayList list = new ArrayList();
+        ArrayList<DavResource> list = new ArrayList<DavResource>();
         if (exists() && isCollection()) {
             try {
                 // only display versions as members of the vh. the jcr:versionLabels
@@ -85,9 +87,11 @@
                     list.add(childRes);
                 }
             } catch (RepositoryException e) {
-                // should not occure
+                // should not occur
+                log.error("Unexpected error",e);
             } catch (DavException e) {
-                // should not occure
+                // should not occur
+                log.error("Unexpected error",e);
             }
         }
         return new DavResourceIteratorImpl(list);
@@ -98,6 +102,7 @@
      *
      * @see DavResource#addMember(DavResource, InputContext)
      */
+    @Override
     public void addMember(DavResource member, InputContext inputContext) throws DavException
{
         throw new DavException(DavServletResponse.SC_FORBIDDEN);
     }
@@ -110,6 +115,7 @@
      * while deleting.
      * @see DavResource#removeMember(org.apache.jackrabbit.webdav.DavResource)
      */
+    @Override
     public void removeMember(DavResource member) throws DavException {
         if (exists()) {
             VersionHistory versionHistory = (VersionHistory) getNode();
@@ -138,7 +144,8 @@
      *
      * @see DavResource#setProperty(DavProperty)
      */
-    public void setProperty(DavProperty property) throws DavException {
+    @Override
+    public void setProperty(DavProperty<?> property) throws DavException {
         throw new DavException(DavServletResponse.SC_FORBIDDEN);
     }
 
@@ -147,6 +154,7 @@
      *
      * @see DavResource#removeProperty(DavPropertyName)
      */
+    @Override
     public void removeProperty(DavPropertyName propertyName) throws DavException {
         throw new DavException(DavServletResponse.SC_FORBIDDEN);
     }
@@ -156,7 +164,8 @@
      *
      * @see DavResource#alterProperties(List)
      */
-    public MultiStatusResponse alterProperties(List changeList) throws DavException {
+    @Override
+    public MultiStatusResponse alterProperties(List<? extends PropEntry> changeList)
throws DavException {
         throw new DavException(DavServletResponse.SC_FORBIDDEN);
     }
 
@@ -173,18 +182,18 @@
     public VersionResource[] getVersions() throws DavException {
         try {
             VersionIterator vIter = ((VersionHistory)getNode()).getAllVersions();
-            ArrayList l = new ArrayList();
+            ArrayList<VersionResource> l = new ArrayList<VersionResource>();
             while (vIter.hasNext()) {
                     DavResourceLocator versionLoc = getLocatorFromNode(vIter.nextVersion());
                     DavResource vr = createResourceFromLocator(versionLoc);
                     if (vr instanceof VersionResource) {
-                        l.add(vr);
+                        l.add((VersionResource) vr);
                     } else {
                         // severe error since resource factory doesn't behave correctly.
                         throw new DavException(DavServletResponse.SC_INTERNAL_SERVER_ERROR);
                     }
             }
-            return (VersionResource[]) l.toArray(new VersionResource[l.size()]);
+            return l.toArray(new VersionResource[l.size()]);
         } catch (RepositoryException e) {
             throw new JcrDavException(e);
         }
@@ -194,11 +203,12 @@
     /**
      * Fill the property set for this resource.
      */
+    @Override
     protected void initProperties() {
         if (!propsInitialized) {
             super.initProperties();
 
-            // change resourcetype defined by default item collection
+            // change resource type defined by default item collection
             properties.add(new ResourceType(new int[] {ResourceType.COLLECTION, ResourceType.VERSION_HISTORY}));
 
             // required root-version property for version-history resource
@@ -212,11 +222,11 @@
             // required, protected version-set property for version-history resource
             try {
                 VersionIterator vIter = ((VersionHistory)getNode()).getAllVersions();
-                ArrayList l = new ArrayList();
+                ArrayList<Version> l = new ArrayList<Version>();
                 while (vIter.hasNext()) {
                     l.add(vIter.nextVersion());
                 }
-                properties.add(getHrefProperty(VersionHistoryResource.VERSION_SET, (Version[])
l.toArray(new Version[l.size()]), true, false));
+                properties.add(getHrefProperty(VersionHistoryResource.VERSION_SET, l.toArray(new
Version[l.size()]), true, false));
             } catch (RepositoryException e) {
                 log.error(e.getMessage());
             }

Modified: jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/simple/VersionResourceImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/simple/VersionResourceImpl.java?rev=915339&r1=915338&r2=915339&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/simple/VersionResourceImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/simple/VersionResourceImpl.java
Tue Feb 23 13:37:38 2010
@@ -32,6 +32,7 @@
 import org.apache.jackrabbit.webdav.property.DefaultDavProperty;
 import org.apache.jackrabbit.webdav.property.HrefProperty;
 import org.apache.jackrabbit.webdav.property.DavProperty;
+import org.apache.jackrabbit.webdav.property.PropEntry;
 import org.apache.jackrabbit.webdav.version.LabelInfo;
 import org.apache.jackrabbit.webdav.version.LabelSetProperty;
 import org.apache.jackrabbit.webdav.version.VersionHistoryResource;
@@ -50,7 +51,6 @@
 
 import java.util.ArrayList;
 import java.util.List;
-import java.util.Collections;
 
 /**
  * <code>VersionResourceImpl</code> represents a JCR version.
@@ -86,6 +86,7 @@
      *
      * @return always false
      */
+    @Override
     public boolean isCollection() {
         return false;
     }
@@ -93,8 +94,9 @@
     /**
      * @return An empty <code>DavResourceIterator</code>
      */
+    @Override
     public DavResourceIterator getMembers() {
-        return new DavResourceIteratorImpl(Collections.EMPTY_LIST);
+        return DavResourceIteratorImpl.EMPTY;
     }
 
     /**
@@ -102,6 +104,7 @@
      *
      * @see DavResource#addMember(DavResource, InputContext)
      */
+    @Override
     public void addMember(DavResource member, InputContext inputContext) throws DavException
{
         throw new DavException(DavServletResponse.SC_FORBIDDEN);
     }
@@ -111,6 +114,7 @@
      *
      * @see DavResource#removeMember(DavResource)
      */
+    @Override
     public void removeMember(DavResource member) throws DavException {
         throw new DavException(DavServletResponse.SC_FORBIDDEN);
     }
@@ -120,7 +124,8 @@
      *
      * @see DavResource#setProperty(DavProperty)
      */
-    public void setProperty(DavProperty property) throws DavException {
+    @Override
+    public void setProperty(DavProperty<?> property) throws DavException {
         throw new DavException(DavServletResponse.SC_FORBIDDEN);
     }
 
@@ -129,6 +134,7 @@
      *
      * @see DavResource#removeProperty(DavPropertyName)
      */
+    @Override
     public void removeProperty(DavPropertyName propertyName) throws DavException {
         throw new DavException(DavServletResponse.SC_FORBIDDEN);
     }
@@ -138,7 +144,8 @@
      *
      * @see DavResource#alterProperties(List)
      */
-    public MultiStatusResponse alterProperties(List changeList) throws DavException {
+    @Override
+    public MultiStatusResponse alterProperties(List<? extends PropEntry> changeList)
throws DavException {
         throw new DavException(DavServletResponse.SC_FORBIDDEN);
     }
 
@@ -222,6 +229,7 @@
      *
      * @see org.apache.jackrabbit.webdav.version.report.SupportedReportSetProperty
      */
+    @Override
     protected void initSupportedReports() {
         super.initSupportedReports();
         if (exists()) {
@@ -232,6 +240,7 @@
     /**
      * Fill the property set for this resource.
      */
+    @Override
     protected void initProperties() {
         if (!propsInitialized) {
             super.initProperties();
@@ -239,10 +248,10 @@
             try {
                 String creationDate = HttpDateFormat.creationDateFormat().format(v.getCreated().getTime());
                 // replace dummy creation date from default collection
-                properties.add(new DefaultDavProperty(DavPropertyName.CREATIONDATE, creationDate));
+                properties.add(new DefaultDavProperty<String>(DavPropertyName.CREATIONDATE,
creationDate));
 
                 // required, protected DAV:version-name property
-                properties.add(new DefaultDavProperty(VERSION_NAME, v.getName(), true));
+                properties.add(new DefaultDavProperty<String>(VERSION_NAME, v.getName(),
true));
 
                 // required, protected DAV:label-name-set property
                 String[] labels = getVersionHistoryItem().getVersionLabels(v);
@@ -258,7 +267,7 @@
 
                 // required DAV:checkout-set (computed) property
                 PropertyIterator it = v.getReferences();
-                List nodeList = new ArrayList();
+                List<Node> nodeList = new ArrayList<Node>();
                 while (it.hasNext()) {
                     Property p = it.nextProperty();
                     if (JcrConstants.JCR_BASEVERSION.equals(p.getName())) {
@@ -268,7 +277,7 @@
                         }
                     }
                 }
-                properties.add(getHrefProperty(CHECKOUT_SET, (Node[]) nodeList.toArray(new
Node[nodeList.size()]), true, false));
+                properties.add(getHrefProperty(CHECKOUT_SET, nodeList.toArray(new Node[nodeList.size()]),
true, false));
 
             } catch (RepositoryException e) {
                 log.error(e.getMessage());

Modified: jackrabbit/trunk/jackrabbit-jcr-server/src/test/java/org/apache/jackrabbit/server/BasicCredentialsProviderTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-server/src/test/java/org/apache/jackrabbit/server/BasicCredentialsProviderTest.java?rev=915339&r1=915338&r2=915339&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-server/src/test/java/org/apache/jackrabbit/server/BasicCredentialsProviderTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-server/src/test/java/org/apache/jackrabbit/server/BasicCredentialsProviderTest.java
Tue Feb 23 13:37:38 2010
@@ -32,7 +32,6 @@
 import java.util.Map;
 import java.util.Locale;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.security.Principal;
 import java.io.UnsupportedEncodingException;
 import java.io.IOException;
@@ -68,21 +67,20 @@
     }
 
     public void testDefaultPassword() throws ServletException, LoginException {
-        Map m = new HashMap();
+        Map<String, char[]> m = new HashMap<String, char[]>();
         m.put("userId", new char[0]);
         m.put("userId:", new char[0]);
         m.put("userId:pw", "pw".toCharArray());
 
-        for (Iterator it = m.keySet().iterator(); it.hasNext();) {
-            String defaultHeaderValue = it.next().toString();
-            char[] pw = (char[]) m.get(defaultHeaderValue);
+        for (String uid : m.keySet()) {
+            char[] pw = m.get(uid);
 
-            CredentialsProvider cb = new BasicCredentialsProvider(defaultHeaderValue);
+            CredentialsProvider cb = new BasicCredentialsProvider(uid);
             Credentials creds = cb.getCredentials(new RequestImpl(null));
 
             assertNotNull(creds);
             assertTrue(creds instanceof SimpleCredentials);
-            assertEquals("userId",((SimpleCredentials) creds).getUserID());
+            assertEquals("userId", ((SimpleCredentials) creds).getUserID());
             if (pw.length == 0) {
                 assertEquals(0, ((SimpleCredentials) creds).getPassword().length);
             } else {
@@ -118,11 +116,11 @@
             return authHeader;
         }
 
-        public Enumeration getHeaders(String name) {
+        public Enumeration<?> getHeaders(String name) {
             return null;
         }
 
-        public Enumeration getHeaderNames() {
+        public Enumeration<?> getHeaderNames() {
             return null;
         }
 
@@ -206,7 +204,7 @@
             return null;
         }
 
-        public Enumeration getAttributeNames() {
+        public Enumeration<?> getAttributeNames() {
             return null;
         }
 
@@ -233,7 +231,7 @@
             return null;
         }
 
-        public Enumeration getParameterNames() {
+        public Enumeration<?> getParameterNames() {
             return null;
         }
 
@@ -241,7 +239,7 @@
             return new String[0];
         }
 
-        public Map getParameterMap() {
+        public Map<?,?> getParameterMap() {
             return null;
         }
 
@@ -283,7 +281,7 @@
             return null;
         }
 
-        public Enumeration getLocales() {
+        public Enumeration<?> getLocales() {
             return null;
         }
 
@@ -299,4 +297,4 @@
             return null;
         }
     }
-}
\ No newline at end of file
+}

Modified: jackrabbit/trunk/jackrabbit-jcr-server/src/test/java/org/apache/jackrabbit/server/remoting/davex/DiffParserTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-server/src/test/java/org/apache/jackrabbit/server/remoting/davex/DiffParserTest.java?rev=915339&r1=915338&r2=915339&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-server/src/test/java/org/apache/jackrabbit/server/remoting/davex/DiffParserTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-server/src/test/java/org/apache/jackrabbit/server/remoting/davex/DiffParserTest.java
Tue Feb 23 13:37:38 2010
@@ -20,14 +20,13 @@
 
 import java.io.IOException;
 import java.util.ArrayList;
-import java.util.Iterator;
 import java.util.List;
 
 /** <code>DiffParserTest</code>... */
 public class DiffParserTest extends TestCase {
 
     public void testSetProperty() throws IOException, DiffException {
-        ArrayList l = new ArrayList();
+        ArrayList<String> l = new ArrayList<String>();
         l.add("\"simple string\"");
         l.add("2345");
         l.add("true");
@@ -35,11 +34,11 @@
         l.add("234.3455");
         l.add("null");
 
-        for (int i = 0; i < l.size(); i++) {
-            final String value = l.get(i).toString();
+        for (final String value : l) {
             String diff = "^/a/prop : " + value;
 
             DummyDiffHandler handler = new DummyDiffHandler() {
+                @Override
                 public void setProperty(String targetPath, String diffValue) {
                     assertEquals(targetPath, "/a/prop");
                     assertEquals(value, diffValue);
@@ -52,16 +51,15 @@
 
     public void testSetPropertyMissing() throws IOException,
             DiffException {
-        ArrayList l = new ArrayList();
+        ArrayList<String> l = new ArrayList<String>();
         l.add("");
         l.add(null);
 
-        for (int i = 0; i < l.size(); i++) {
-            Object obj = l.get(i);
-            String value = (obj == null) ? "" : obj.toString();
-            String diff = "^/a/prop : " + value;
+        for (String value : l) {
+            String diff = "^/a/prop : " + ((value == null) ? "" : value);
 
             DummyDiffHandler handler = new DummyDiffHandler() {
+                @Override
                 public void setProperty(String targetPath, String diffValue) {
                     assertEquals(targetPath, "/a/prop");
                     assertTrue(diffValue == null || "".equals(diffValue));
@@ -78,6 +76,7 @@
         String diff = "^/a/prop : " + value;
 
         DiffHandler handler = new DummyDiffHandler() {
+            @Override
             public void setProperty(String targetPath, String diffValue) {
                 assertEquals(targetPath, "/a/prop");
                 assertEquals(value, diffValue);
@@ -94,6 +93,7 @@
         String diff = "^/a/prop : " + value;
 
         DiffHandler handler = new DummyDiffHandler() {
+            @Override
             public void setProperty(String targetPath, String diffValue) {
                 assertEquals(targetPath, "/a/prop");
                 assertEquals(value, diffValue);
@@ -109,6 +109,7 @@
         String diff = "^/a/prop : " + value;
 
         DiffHandler handler = new DummyDiffHandler() {
+            @Override
             public void setProperty(String targetPath, String diffValue) {
                 assertEquals(targetPath, "/a/prop");
                 assertEquals(value, diffValue);
@@ -125,6 +126,7 @@
         String diff = "^/a/prop : " + value;
 
         DiffHandler handler = new DummyDiffHandler() {
+            @Override
             public void setProperty(String targetPath, String diffValue) {
                 assertEquals(targetPath, "/a/prop");
                 assertEquals(value, diffValue);
@@ -139,22 +141,24 @@
         String diff = "^abc : \r+def : \n-ghi : \r\n^jkl : \n\r>mno : \n";
 
         DiffHandler handler = new DummyDiffHandler() {
-            public void addNode(String targetPath, String diffValue)
-                    throws DiffException {
+            @Override
+            public void addNode(String targetPath, String diffValue) {
                 assertEquals("def", targetPath);
                 assertEquals("", diffValue);
             }
+            @Override
             public void setProperty(String targetPath, String diffValue) {
                 assertTrue("abc".equals(targetPath) || "jkl".equals(targetPath));
                 assertEquals("", diffValue);
             }
-            public void remove(String targetPath, String diffValue)
-                    throws DiffException {
+            @Override
+            public void remove(String targetPath, String diffValue) {
                 assertEquals("ghi", targetPath);
                 assertEquals("", diffValue);
             }
 
-            public void move(String targetPath, String diffValue) throws DiffException {
+            @Override
+            public void move(String targetPath, String diffValue) {
                 assertEquals("mno", targetPath);
                 assertEquals("\n", diffValue);
             }
@@ -165,7 +169,7 @@
     }
 
     public void testValidDiffs() throws IOException, DiffException {
-        List l = new ArrayList();
+        List<String[]> l = new ArrayList<String[]>();
         // unquoted string value
         l.add(new String[] {"+/a/b : 134", "/a/b","134"});
         l.add(new String[] {"+/a/b : 2.3", "/a/b","2.3"});
@@ -187,21 +191,21 @@
         l.add(new String[] {"+/a/b : \r", "/a/b","\r"});
         l.add(new String[] {"+/a/b : \r\n", "/a/b","\r\n"});
         l.add(new String[] {"+/a/b : \r\n\n\r", "/a/b","\r\n\n\r"});
-        // path containing whilespace
+        // path containing white space
         l.add(new String[] {"+/a   /b : 123", "/a   /b","123"});
         l.add(new String[] {"+/a\r\t/b : 123", "/a\r\t/b","123"});
-        // path having trailing whitespace
+        // path having trailing white space
         l.add(new String[] {"+/a/b  : 123", "/a/b","123"});
         l.add(new String[] {"+/a/b\r : 123", "/a/b\r","123"});
         l.add(new String[] {"+/a/b\r\n\n\r\n: 123", "/a/b\r\n\n\r\n","123"});
         // path containing reserved characters
         l.add(new String[] {"++abc+ : val", "+abc+","val"});
         l.add(new String[] {"++++++ : val", "+++++","val"});
-        // value containing reserver characters
+        // value containing reserved characters
         l.add(new String[] {"+/a/b : +", "/a/b","+"});
         l.add(new String[] {"+/a/b : +->+-", "/a/b","+->+-"});
         l.add(new String[] {"+/a/b : \"+->+-\"", "/a/b","\"+->+-\""});
-        // other whitespace than ' ' used as key-value separator
+        // other white space than ' ' used as key-value separator
         l.add(new String[] {"+/a/b :\r123", "/a/b","123"});
         l.add(new String[] {"+/a/b\r: 123", "/a/b","123"});
         l.add(new String[] {"+/a/b\r:\r123", "/a/b","123"});
@@ -216,11 +220,10 @@
         l.add(new String[] {"+/a/b : ", "/a/b", ""});
         l.add(new String[] {"+/a/b :\n", "/a/b", ""});
 
-        for (Iterator it = l.iterator(); it.hasNext();) {
-            final String[] strs = (String[]) it.next();
+        for (final String[] strs : l) {
             DiffHandler hndl = new DummyDiffHandler() {
-                public void setProperty(String targetPath, String diffValue)
-                        throws DiffException {
+                @Override
+                public void setProperty(String targetPath, String diffValue) {
                     assertEquals(strs[1], targetPath);
                     assertEquals(strs[2], diffValue);
                 }
@@ -229,27 +232,27 @@
             parser.parse(strs[0]);
         }
 
-        l = new ArrayList();
+        List<String> l2 = new ArrayList<String>();
         // multiple commands
-        l.add("+abc :\n\n+def : val");
-        l.add("+abc :\n\n+def : val\n");
-        l.add("+abc : \r+def : val");
-        l.add("+/a/b : val\r+abc : \r ");
-        l.add("+/a/b : val\r+abc :\n\n ");
+        l2.add("+abc :\n\n+def : val");
+        l2.add("+abc :\n\n+def : val\n");
+        l2.add("+abc : \r+def : val");
+        l2.add("+/a/b : val\r+abc : \r ");
+        l2.add("+/a/b : val\r+abc :\n\n ");
         // missing value in the last action.
-        l.add("+/a/b : \r+abc :\n");
-        l.add("+/a/b : \\r+abc : abc\r\r+abc :\r");
-        l.add("+abc :\n\n+def : val\r\r>abc : ");
+        l2.add("+/a/b : \r+abc :\n");
+        l2.add("+/a/b : \\r+abc : abc\r\r+abc :\r");
+        l2.add("+abc :\n\n+def : val\r\r>abc : ");
 
-        for (Iterator it = l.iterator(); it.hasNext();) {
-            final List li = new ArrayList();
+        for (String diff : l2) {
+            final List<String> li = new ArrayList<String>();
             DiffHandler dh = new DummyDiffHandler() {
-                public void addNode(String targetPath, String diffValue) throws DiffException
{
+                @Override
+                public void addNode(String targetPath, String diffValue) {
                     li.add(diffValue);
                 }
             };
 
-            String diff = it.next().toString();
             DiffParser parser = new DiffParser(dh);
             parser.parse(diff);
             assertEquals(2, li.size());
@@ -259,7 +262,8 @@
     public void testSeparatorLines() throws IOException, DiffException {
         String diff = "+abc :\n\n+val : val";
         DiffHandler dh = new DummyDiffHandler() {
-            public void addNode(String targetPath, String diffValue) throws DiffException
{
+            @Override
+            public void addNode(String targetPath, String diffValue) {
                 if ("abc".equals(targetPath)) {
                     assertEquals("", diffValue);
                 } else {
@@ -271,16 +275,18 @@
 
         diff = "+abc :\n+val : val";
         dh = new DummyDiffHandler() {
-            public void addNode(String targetPath, String diffValue) throws DiffException
{
+            @Override
+            public void addNode(String targetPath, String diffValue) {
                 assertEquals("+val : val", diffValue);
             }
         };
         new DiffParser(dh).parse(diff);
 
-        // TODO: check again: currently all line-sep. chars before an diff-char are ignored
unless they are escaped in way the handler understands (e.g. JSON does: \\r for \r).
+        // TODO: check again: currently all line separation chars before an diff-char are
ignored unless they are escaped in way the handler understands (e.g. JSON does: \\r for \r).
         diff = "+abc :\r\r\r+def : val";
         dh = new DummyDiffHandler() {
-            public void addNode(String targetPath, String diffValue) throws DiffException
{
+            @Override
+            public void addNode(String targetPath, String diffValue) {
                 if ("abc".equals(targetPath)) {
                     assertEquals("", diffValue);
                 } else {
@@ -292,7 +298,8 @@
 
         diff = "+abc : val\r+def :\n\n ";
         dh = new DummyDiffHandler() {
-            public void addNode(String targetPath, String diffValue) throws DiffException
{
+            @Override
+            public void addNode(String targetPath, String diffValue) {
                 if ("abc".equals(targetPath)) {
                     assertEquals("val", diffValue);
                 } else {
@@ -306,7 +313,8 @@
     public void testUnicodeLineSep() throws IOException, DiffException {
         String diff = "+abc : val" + new String(new byte[] {Character.LINE_SEPARATOR}, "utf-8")
+ "+abc : val";
         DiffHandler dh = new DummyDiffHandler() {
-            public void addNode(String targetPath, String diffValue) throws DiffException
{
+            @Override
+            public void addNode(String targetPath, String diffValue) {
                 assertEquals("abc", targetPath);
                 assertEquals("val", diffValue);
             }
@@ -315,35 +323,34 @@
     }
 
     public void testInvalidDiff() throws IOException, DiffException {
-        List l = new ArrayList();
+        List<String> l = new ArrayList<String>();
         l.add("");
         // path, separator and value missing
         l.add("+");
         l.add("+/a/b : val\r+");
-        // path starting with whitespace, separator and value missing
+        // path starting with white space, separator and value missing
         l.add("+\n");
         // separator and value missing
         l.add("+/a/b");
         l.add("+/a/b : val\r+abc\n");
         l.add("+/a/b :");
-        // invalid for separator and value are missing (all : and whitespace
+        // invalid for separator and value are missing (all : and white space
         // is interpreted as part of the path.
         l.add("+/a/b:");
         l.add("+/a/b:val");
         l.add("+/a/b: val");
         l.add("+/a/b:\rval");
         l.add("+/a/b :: val");
-        // diff starting with whitespace
+        // diff starting with white space
         l.add(" +/a/b: val");
         l.add("\r\r\r\r\r\r+/a/b: val");
-        // key starting with whitespace
+        // key starting with white space
         l.add("+\r/a/b : 123");
         l.add("+ /a/b : 123");
         // key starting with colon
         l.add("+:/a/b : 123");
 
-        for (Iterator it = l.iterator(); it.hasNext();) {
-            String diff = it.next().toString();
+        for (String diff : l) {
             try {
                 DiffParser parser = new DiffParser(new DummyDiffHandler());
                 parser.parse(diff);

Modified: jackrabbit/trunk/jackrabbit-jcr-server/src/test/java/org/apache/jackrabbit/server/remoting/davex/JsonDiffHandlerTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-server/src/test/java/org/apache/jackrabbit/server/remoting/davex/JsonDiffHandlerTest.java?rev=915339&r1=915338&r2=915339&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-server/src/test/java/org/apache/jackrabbit/server/remoting/davex/JsonDiffHandlerTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-server/src/test/java/org/apache/jackrabbit/server/remoting/davex/JsonDiffHandlerTest.java
Tue Feb 23 13:37:38 2010
@@ -17,41 +17,23 @@
 package org.apache.jackrabbit.server.remoting.davex;
 
 import junit.framework.TestCase;
+import org.xml.sax.ContentHandler;
 
-import javax.jcr.Property;
-import javax.jcr.Session;
-import javax.jcr.Repository;
-import javax.jcr.Workspace;
 import javax.jcr.Credentials;
-import javax.jcr.LoginException;
-import javax.jcr.RepositoryException;
-import javax.jcr.Node;
-import javax.jcr.ItemNotFoundException;
 import javax.jcr.Item;
-import javax.jcr.PathNotFoundException;
-import javax.jcr.ItemExistsException;
-import javax.jcr.AccessDeniedException;
-import javax.jcr.InvalidItemStateException;
+import javax.jcr.Node;
+import javax.jcr.Property;
+import javax.jcr.Repository;
+import javax.jcr.Session;
 import javax.jcr.ValueFactory;
-import javax.jcr.UnsupportedRepositoryOperationException;
-import javax.jcr.InvalidSerializedDataException;
-import javax.jcr.NamespaceException;
-import javax.jcr.lock.LockException;
-import javax.jcr.nodetype.ConstraintViolationException;
-import javax.jcr.nodetype.NoSuchNodeTypeException;
+import javax.jcr.Workspace;
 import javax.jcr.retention.RetentionManager;
 import javax.jcr.security.AccessControlManager;
-import javax.jcr.version.VersionException;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.security.AccessControlException;
 import java.io.InputStream;
-import java.io.IOException;
 import java.io.OutputStream;
-
-import org.xml.sax.ContentHandler;
-import org.xml.sax.SAXException;
+import java.security.AccessControlException;
+import java.util.HashMap;
+import java.util.Map;
 
 /**
  * <code>JsonDiffHandlerTest</code>...
@@ -59,7 +41,7 @@
 public class JsonDiffHandlerTest extends TestCase {
 
     public void testGetItemPath() throws Exception {
-        Map m = new HashMap();
+        Map<String, String> m = new HashMap<String, String>();
         m.put("abc", "/reqPath/abc");
         m.put("abc/def/ghi", "/reqPath/abc/def/ghi");
         m.put("/abc", "/abc");
@@ -82,9 +64,8 @@
         m.put("/./abc/def/../ghi", "/abc/ghi");
         
         JsonDiffHandler handler = new JsonDiffHandler(new DummySession(), "/reqPath", null);
-        for (Iterator it = m.keySet().iterator(); it.hasNext();) {
-            String targetPath = it.next().toString();
-            String expItemPath = m.get(targetPath).toString();
+        for (String targetPath : m.keySet()) {
+            String expItemPath = m.get(targetPath);
             assertEquals(expItemPath, handler.getItemPath(targetPath));
         }
     }
@@ -111,77 +92,77 @@
             return null;
         }
 
-        public Session impersonate(Credentials credentials) throws LoginException, RepositoryException
{
+        public Session impersonate(Credentials credentials) {
             return null;
         }
 
-        public Node getRootNode() throws RepositoryException {
+        public Node getRootNode() {
             return null;
         }
 
-        public Node getNodeByUUID(String uuid) throws ItemNotFoundException, RepositoryException
{
+        public Node getNodeByUUID(String uuid) {
             return null;
         }
 
-        public Item getItem(String absPath) throws PathNotFoundException, RepositoryException
{
+        public Item getItem(String absPath) {
             return null;
         }
 
-        public boolean itemExists(String absPath) throws RepositoryException {
+        public boolean itemExists(String absPath) {
             return false;
         }
 
-        public void move(String srcAbsPath, String destAbsPath) throws ItemExistsException,
PathNotFoundException, VersionException, ConstraintViolationException, LockException, RepositoryException
{
+        public void move(String srcAbsPath, String destAbsPath) {
         }
 
-        public void save() throws AccessDeniedException, ItemExistsException, ConstraintViolationException,
InvalidItemStateException, VersionException, LockException, NoSuchNodeTypeException, RepositoryException
{
+        public void save() {
         }
 
-        public void refresh(boolean keepChanges) throws RepositoryException {
+        public void refresh(boolean keepChanges) {
         }
 
-        public boolean hasPendingChanges() throws RepositoryException {
+        public boolean hasPendingChanges() {
             return false;
         }
 
-        public ValueFactory getValueFactory() throws UnsupportedRepositoryOperationException,
RepositoryException {
+        public ValueFactory getValueFactory() {
             return null;
         }
 
-        public void checkPermission(String absPath, String actions) throws AccessControlException,
RepositoryException {
+        public void checkPermission(String absPath, String actions) throws AccessControlException
{
         }
 
-        public ContentHandler getImportContentHandler(String parentAbsPath, int uuidBehavior)
throws PathNotFoundException, ConstraintViolationException, VersionException, LockException,
RepositoryException {
+        public ContentHandler getImportContentHandler(String parentAbsPath, int uuidBehavior)
{
             return null;
         }
 
-        public void importXML(String parentAbsPath, InputStream in, int uuidBehavior) throws
IOException, PathNotFoundException, ItemExistsException, ConstraintViolationException, VersionException,
InvalidSerializedDataException, LockException, RepositoryException {
+        public void importXML(String parentAbsPath, InputStream in, int uuidBehavior) {
         }
 
-        public void exportSystemView(String absPath, ContentHandler contentHandler, boolean
skipBinary, boolean noRecurse) throws PathNotFoundException, SAXException, RepositoryException
{
+        public void exportSystemView(String absPath, ContentHandler contentHandler, boolean
skipBinary, boolean noRecurse) {
         }
 
-        public void exportSystemView(String absPath, OutputStream out, boolean skipBinary,
boolean noRecurse) throws IOException, PathNotFoundException, RepositoryException {
+        public void exportSystemView(String absPath, OutputStream out, boolean skipBinary,
boolean noRecurse) {
         }
 
-        public void exportDocumentView(String absPath, ContentHandler contentHandler, boolean
skipBinary, boolean noRecurse) throws PathNotFoundException, SAXException, RepositoryException
{
+        public void exportDocumentView(String absPath, ContentHandler contentHandler, boolean
skipBinary, boolean noRecurse) {
         }
 
-        public void exportDocumentView(String absPath, OutputStream out, boolean skipBinary,
boolean noRecurse) throws IOException, PathNotFoundException, RepositoryException {
+        public void exportDocumentView(String absPath, OutputStream out, boolean skipBinary,
boolean noRecurse) {
         }
 
-        public void setNamespacePrefix(String prefix, String uri) throws NamespaceException,
RepositoryException {
+        public void setNamespacePrefix(String prefix, String uri) {
         }
 
-        public String[] getNamespacePrefixes() throws RepositoryException {
+        public String[] getNamespacePrefixes() {
             return new String[0];
         }
 
-        public String getNamespaceURI(String prefix) throws NamespaceException, RepositoryException
{
+        public String getNamespaceURI(String prefix) {
             return null;
         }
 
-        public String getNamespacePrefix(String uri) throws NamespaceException, RepositoryException
{
+        public String getNamespacePrefix(String uri) {
             return null;
         }
 
@@ -202,65 +183,54 @@
         public void removeLockToken(String lt) {
         }
 
-        public AccessControlManager getAccessControlManager()
-                throws UnsupportedRepositoryOperationException,
-                RepositoryException {
+        public AccessControlManager getAccessControlManager() {
             // TODO Auto-generated method stub
             return null;
         }
 
-        public Node getNode(String arg0) throws PathNotFoundException,
-                RepositoryException {
+        public Node getNode(String arg0) {
             // TODO Auto-generated method stub
             return null;
         }
 
-        public Node getNodeByIdentifier(String arg0)
-                throws ItemNotFoundException, RepositoryException {
+        public Node getNodeByIdentifier(String arg0) {
             // TODO Auto-generated method stub
             return null;
         }
 
-        public Property getProperty(String arg0) throws PathNotFoundException,
-                RepositoryException {
+        public Property getProperty(String arg0) {
             // TODO Auto-generated method stub
             return null;
         }
 
-        public RetentionManager getRetentionManager()
-                throws UnsupportedRepositoryOperationException,
-                RepositoryException {
+        public RetentionManager getRetentionManager() {
             // TODO Auto-generated method stub
             return null;
         }
 
-        public boolean hasCapability(String arg0, Object arg1, Object[] arg2)
-                throws RepositoryException {
+        public boolean hasCapability(String arg0, Object arg1, Object[] arg2) {
             // TODO Auto-generated method stub
             return false;
         }
 
-        public boolean hasPermission(String arg0, String arg1)
-                throws RepositoryException {
+        public boolean hasPermission(String arg0, String arg1) {
             // TODO Auto-generated method stub
             return false;
         }
 
-        public boolean nodeExists(String arg0) throws RepositoryException {
+        public boolean nodeExists(String arg0) {
             // TODO Auto-generated method stub
             return false;
         }
 
-        public boolean propertyExists(String arg0) throws RepositoryException {
+        public boolean propertyExists(String arg0) {
             // TODO Auto-generated method stub
             return false;
         }
 
-        public void removeItem(String arg0) throws VersionException,
-                LockException, ConstraintViolationException,
-                PathNotFoundException, RepositoryException {
+        public void removeItem(String arg0) {
             // TODO Auto-generated method stub
             
         }
     }
-}
\ No newline at end of file
+}

Modified: jackrabbit/trunk/jackrabbit-jcr-server/src/test/java/org/apache/jackrabbit/webdav/simple/LocatorFactoryImplExTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-server/src/test/java/org/apache/jackrabbit/webdav/simple/LocatorFactoryImplExTest.java?rev=915339&r1=915338&r2=915339&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-server/src/test/java/org/apache/jackrabbit/webdav/simple/LocatorFactoryImplExTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-server/src/test/java/org/apache/jackrabbit/webdav/simple/LocatorFactoryImplExTest.java
Tue Feb 23 13:37:38 2010
@@ -25,6 +25,7 @@
 
     private DavLocatorFactory factory;
 
+    @Override
     protected void setUp() throws Exception {
         super.setUp();
         // for simplicity (not yet used) ignore the path prefix.
@@ -49,4 +50,4 @@
         assertEquals(locator, locator2);
         assertEquals(nodePath, locator2.getRepositoryPath());
     }
-}
\ No newline at end of file
+}



Mime
View raw message