Skip to content

Commit

Permalink
catch external URLs
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelwechner committed Jun 10, 2013
1 parent 484ebb8 commit 53cc379
Showing 1 changed file with 15 additions and 4 deletions.
Expand Up @@ -60,7 +60,9 @@
import org.wyona.yanel.core.workflow.Workflow;
import org.wyona.yanel.core.workflow.WorkflowException;
import org.wyona.yanel.core.workflow.WorkflowHelper;

import org.wyona.yarep.core.Node;
import org.wyona.yarep.core.NoSuchNodeException;
import org.wyona.yarep.core.Repository;
import org.wyona.yarep.core.Revision;

Expand Down Expand Up @@ -288,6 +290,9 @@ public Node getRepoNode() throws Exception {
if (path == null) {
path = getPath();
}
if (path.indexOf("http://") == 0) {
throw new NoSuchNodeException(path, getRealm().getRepository());
}
return getRealm().getRepository().getNode(path);
}

Expand All @@ -303,10 +308,16 @@ public boolean delete() throws Exception {
* @see org.wyona.yanel.core.api.attributes.VersionableV3#getRevisions(boolean)
*/
public java.util.Iterator<RevisionInformation> getRevisions(boolean reverse) throws Exception {
if (org.wyona.commons.clazz.ClazzUtil.implementsInterface(getRepoNode(), "org.wyona.yarep.core.attributes.VersionableV1")) {
org.wyona.yarep.core.attributes.VersionableV1 versionableNode = (org.wyona.yarep.core.attributes.VersionableV1) getRepoNode();
return new org.wyona.yanel.core.attributes.versionable.RevisionInformationIterator(versionableNode.getRevisions(reverse));
} else {
try {
Node node = getRepoNode();
if (org.wyona.commons.clazz.ClazzUtil.implementsInterface(node, "org.wyona.yarep.core.attributes.VersionableV1")) {
org.wyona.yarep.core.attributes.VersionableV1 versionableNode = (org.wyona.yarep.core.attributes.VersionableV1) getRepoNode();
return new org.wyona.yanel.core.attributes.versionable.RevisionInformationIterator(versionableNode.getRevisions(reverse));
} else {
return null;
}
} catch(NoSuchNodeException e) {
log.error(e, e);
return null;
}
}
Expand Down

0 comments on commit 53cc379

Please sign in to comment.