X-Git-Url: https://git.argeo.org/?a=blobdiff_plain;ds=sidebyside;f=base%2Fruntime%2Forg.argeo.eclipse.ui.jcr%2Fsrc%2Fmain%2Fjava%2Forg%2Fargeo%2Feclipse%2Fui%2Fjcr%2Futils%2FJcrFileProvider.java;fp=base%2Fruntime%2Forg.argeo.eclipse.ui.jcr%2Fsrc%2Fmain%2Fjava%2Forg%2Fargeo%2Feclipse%2Fui%2Fjcr%2Futils%2FJcrFileProvider.java;h=47cab6d6affd5279ae4d09196c0cc9087a4d914a;hb=e0bd01316e348b9b3d1fcab627f8cd7c72a0a467;hp=5a0854e60e4ef0c7a3409396bcc0bf1a39a910c9;hpb=7527a16c8574cc8ea53197460e1ba73495bd8b05;p=lgpl%2Fargeo-commons.git diff --git a/base/runtime/org.argeo.eclipse.ui.jcr/src/main/java/org/argeo/eclipse/ui/jcr/utils/JcrFileProvider.java b/base/runtime/org.argeo.eclipse.ui.jcr/src/main/java/org/argeo/eclipse/ui/jcr/utils/JcrFileProvider.java index 5a0854e60..47cab6d6a 100644 --- a/base/runtime/org.argeo.eclipse.ui.jcr/src/main/java/org/argeo/eclipse/ui/jcr/utils/JcrFileProvider.java +++ b/base/runtime/org.argeo.eclipse.ui.jcr/src/main/java/org/argeo/eclipse/ui/jcr/utils/JcrFileProvider.java @@ -149,19 +149,27 @@ public class JcrFileProvider implements FileProvider { if (result == null) throw new ArgeoException("File node not found for ID" + fileId); - // Ensure that the node have the correct type. - if (!result.isNodeType(NodeType.NT_FILE)) + Node child = null; + + boolean isValid = true; + if (!result.isNodeType(NodeType.NT_FILE)) + // useless: mandatory child node + // || !result.hasNode(Property.JCR_CONTENT)) + isValid = false; + else { + child = result.getNode(Property.JCR_CONTENT); + if (!(child.isNodeType(NodeType.NT_RESOURCE) || child + .hasProperty(Property.JCR_DATA))) + isValid = false; + } + + if (!isValid) throw new ArgeoException( - "Cannot open file children Node that are not of '" - + NodeType.NT_RESOURCE + "' type."); - - // Get the usefull part of the Node - Node child = result.getNodes().nextNode(); - if (child == null || !child.isNodeType(NodeType.NT_RESOURCE)) - throw new ArgeoException( - "ERROR: IN the current implemented model, '" + "ERROR: In the current implemented model, '" + NodeType.NT_FILE - + "' file node must have one and only one child of the nt:ressource, where actual data is stored"); + + "' file node must have a child node named jcr:content " + + "that has a BINARY Property named jcr:data " + + "where the actual data is stored"); return child; } catch (RepositoryException re) {