You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by sa...@apache.org on 2011/12/13 11:24:40 UTC
svn commit: r1213638 - in /ofbiz/branches/jackrabbit20100709/framework:
example/src/org/ofbiz/example/JackrabbitEvents.java
jcr/src/org/ofbiz/jcr/api/JcrFileHelper.java
jcr/src/org/ofbiz/jcr/api/jackrabbit/JackrabbitFileHelper.java
Author: sascharodekamp
Date: Tue Dec 13 10:24:40 2011
New Revision: 1213638
URL: http://svn.apache.org/viewvc?rev=1213638&view=rev
Log:
Fix the build, missed some exceptions in the fileHelper.
Modified:
ofbiz/branches/jackrabbit20100709/framework/example/src/org/ofbiz/example/JackrabbitEvents.java
ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/api/JcrFileHelper.java
ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/api/jackrabbit/JackrabbitFileHelper.java
Modified: ofbiz/branches/jackrabbit20100709/framework/example/src/org/ofbiz/example/JackrabbitEvents.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20100709/framework/example/src/org/ofbiz/example/JackrabbitEvents.java?rev=1213638&r1=1213637&r2=1213638&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20100709/framework/example/src/org/ofbiz/example/JackrabbitEvents.java (original)
+++ ofbiz/branches/jackrabbit20100709/framework/example/src/org/ofbiz/example/JackrabbitEvents.java Tue Dec 13 10:24:40 2011
@@ -129,10 +129,20 @@ public class JackrabbitEvents {
JcrDataHelper articleHelper = new JackrabbitArticleHelper(userLogin);
JackrabbitArticle ormArticle = null;
- if (UtilValidate.isEmpty(version)) {
- ormArticle = articleHelper.readContentFromRepository(contentPath, language);
- } else {
- ormArticle = articleHelper.readContentFromRepository(contentPath, language, version);
+ try {
+ if (UtilValidate.isEmpty(version)) {
+ ormArticle = articleHelper.readContentFromRepository(contentPath, language);
+ } else {
+ ormArticle = articleHelper.readContentFromRepository(contentPath, language, version);
+ }
+ } catch (ClassCastException e) {
+ Debug.logError(e, module);
+ request.setAttribute("_ERROR_MESSAGE_", e.getMessage());
+ return "error";
+ } catch (PathNotFoundException e) {
+ Debug.logError(e, module);
+ request.setAttribute("_ERROR_MESSAGE_", e.getMessage());
+ return "error";
}
request.setAttribute("path", ormArticle.getPath());
@@ -159,7 +169,18 @@ public class JackrabbitEvents {
String contentPath = request.getParameter("path");
JcrDataHelper articleHelper = new JackrabbitArticleHelper(userLogin);
- JackrabbitArticle ormArticle = articleHelper.readContentFromRepository(contentPath);
+ JackrabbitArticle ormArticle = null;
+ try {
+ ormArticle = articleHelper.readContentFromRepository(contentPath);
+ } catch (ClassCastException e1) {
+ Debug.logError(e1, module);
+ request.setAttribute("_ERROR_MESSAGE_", e1.getMessage());
+ return "error";
+ } catch (PathNotFoundException e1) {
+ Debug.logError(e1, module);
+ request.setAttribute("_ERROR_MESSAGE_", e1.getMessage());
+ return "error";
+ }
ormArticle.setTitle(request.getParameter("title"));
ormArticle.setContent(request.getParameter("content"));
@@ -359,7 +380,18 @@ public class JackrabbitEvents {
}
JcrFileHelper fileHelper = new JackrabbitFileHelper(userLogin);
- JackrabbitHierarchyNode orm = fileHelper.getRepositoryContent(contentPath);
+ JackrabbitHierarchyNode orm = null;
+ try {
+ orm = fileHelper.getRepositoryContent(contentPath);
+ } catch (ClassCastException e1) {
+ Debug.logError(e1, module);
+ request.setAttribute("_ERROR_MESSAGE_", e1.getMessage());
+ return "error";
+ } catch (PathNotFoundException e1) {
+ Debug.logError(e1, module);
+ request.setAttribute("_ERROR_MESSAGE_", e1.getMessage());
+ return "error";
+ }
if (fileHelper.isFileContent()) {
JackrabbitFile file = (JackrabbitFile) orm;
@@ -388,7 +420,18 @@ public class JackrabbitEvents {
String contentPath = request.getParameter("path");
JcrFileHelper fileHelper = new JackrabbitFileHelper(userLogin);
- OfbizRepositoryMapping orm = fileHelper.getRepositoryContent(contentPath);
+ OfbizRepositoryMapping orm;
+ try {
+ orm = fileHelper.getRepositoryContent(contentPath);
+ } catch (ClassCastException e) {
+ Debug.logError(e, module);
+ request.setAttribute("_ERROR_MESSAGE_", e.getMessage());
+ return "error";
+ } catch (PathNotFoundException e) {
+ Debug.logError(e, module);
+ request.setAttribute("_ERROR_MESSAGE_", e.getMessage());
+ return "error";
+ }
// Here we can differentiate between a file or folder content
if (fileHelper.isFileContent()) {
Modified: ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/api/JcrFileHelper.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/api/JcrFileHelper.java?rev=1213638&r1=1213637&r2=1213638&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/api/JcrFileHelper.java (original)
+++ ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/api/JcrFileHelper.java Tue Dec 13 10:24:40 2011
@@ -2,6 +2,7 @@ package org.ofbiz.jcr.api;
import java.io.InputStream;
+import javax.jcr.PathNotFoundException;
import javax.jcr.RepositoryException;
import org.apache.jackrabbit.ocm.exception.ObjectContentManagerException;
@@ -15,9 +16,10 @@ public interface JcrFileHelper extends J
*
* @param contentPath
* @return
- * @throws
+ * @throws ClassCastException
+ * @throws PathNotFoundException
*/
- public abstract JackrabbitHierarchyNode getRepositoryContent(String contentPath) throws ClassCastException;
+ public abstract JackrabbitHierarchyNode getRepositoryContent(String contentPath) throws ClassCastException, PathNotFoundException;
/**
* Returns a content file object in the passed version from the repository.
@@ -26,9 +28,10 @@ public interface JcrFileHelper extends J
*
* @param contentPath
* @return
- * @throws
+ * @throws ClassCastException
+ * @throws PathNotFoundException
*/
- public abstract JackrabbitHierarchyNode getRepositoryContent(String contentPath, String version) throws ClassCastException;
+ public abstract JackrabbitHierarchyNode getRepositoryContent(String contentPath, String version) throws ClassCastException, PathNotFoundException;
/**
* Stores a new file content object in the repository.
Modified: ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/api/jackrabbit/JackrabbitFileHelper.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/api/jackrabbit/JackrabbitFileHelper.java?rev=1213638&r1=1213637&r2=1213638&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/api/jackrabbit/JackrabbitFileHelper.java (original)
+++ ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/api/jackrabbit/JackrabbitFileHelper.java Tue Dec 13 10:24:40 2011
@@ -5,6 +5,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.util.GregorianCalendar;
+import javax.jcr.PathNotFoundException;
import javax.jcr.RepositoryException;
import org.apache.jackrabbit.ocm.exception.ObjectContentManagerException;
@@ -53,7 +54,7 @@ public class JackrabbitFileHelper extend
* .String)
*/
@Override
- public JackrabbitHierarchyNode getRepositoryContent(String contentPath) throws ClassCastException {
+ public JackrabbitHierarchyNode getRepositoryContent(String contentPath) throws ClassCastException, PathNotFoundException {
return getRepositoryContent(contentPath, null);
}
@@ -65,7 +66,7 @@ public class JackrabbitFileHelper extend
* .String, java.lang.String)
*/
@Override
- public JackrabbitHierarchyNode getRepositoryContent(String contentPath, String version) throws ClassCastException {
+ public JackrabbitHierarchyNode getRepositoryContent(String contentPath, String version) throws ClassCastException, PathNotFoundException {
OfbizRepositoryMapping orm = null;
if (version != null) {
orm = super.access.getContentObject(contentPath, version);