[dna-issues] [JBoss JIRA] Commented: (DNA-465) NullPointerException occurs when reading a FileSystemSource repository through JCR using FederatedSource
Luiz Fernando Teston (JIRA)
jira-events at lists.jboss.org
Fri Jun 19 19:41:56 EDT 2009
[ https://jira.jboss.org/jira/browse/DNA-465?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12473105#action_12473105 ]
Luiz Fernando Teston commented on DNA-465:
------------------------------------------
After the comment on the issue DNA-466 at the time 19/Jun/09 06:55 PM, updated the sources and I repeated the test obtaining a new exception. This exception was thrown by the same line that before throws a NPE. I know that the issue DNA-466 is not close, but as I'm using the repository only as a read only repository, I thought that it should work now.
shouldAccessFileSystemByFederatedJcr(org.openspotligth.federation.configuration.DNAConfigFromFileTest) Time elapsed: 0.792 sec <<< FAILURE!
java.lang.AssertionError
at org.jboss.dna.jcr.cache.ChildNode.<init>(ChildNode.java:53)
at org.jboss.dna.jcr.cache.ImmutableChildren.<init>(ImmutableChildren.java:57)
at org.jboss.dna.jcr.SessionCache.createNodeInfoFrom(SessionCache.java:2467)
at org.jboss.dna.jcr.SessionCache.findNodeInfo(SessionCache.java:2054)
at org.jboss.dna.jcr.SessionCache.findJcrItem(SessionCache.java:934)
at org.jboss.dna.jcr.AbstractJcrNode.getNode(AbstractJcrNode.java:542)
at org.openspotligth.federation.configuration.DNAConfigFromFileTest.shouldAccessFileSystemByFederatedJcr(DNAConfigFromFileTest.java:133)
> NullPointerException occurs when reading a FileSystemSource repository through JCR using FederatedSource
> --------------------------------------------------------------------------------------------------------
>
> Key: DNA-465
> URL: https://jira.jboss.org/jira/browse/DNA-465
> Project: DNA
> Issue Type: Bug
> Components: Connectors, Federation, JCR
> Affects Versions: 0.5
> Environment: Mac OS 10.5 with java 1.6 and maven 2.1
> Reporter: Luiz Fernando Teston
>
> When reading a node from a federated filesystem connector using the JCR API it throws a NullPointerException. This node represents a file and it could be read normally by the graph api.
> -- test method to be used inside the docs/gettingstarted/repository source --
> @Test
> public void shouldAccessFileSystemByFederatedJcr()
> throws Exception {
> JcrConfiguration configuration = new JcrConfiguration();
> URL url = Thread
> .currentThread()
> .getContextClassLoader()
> .getResource(
> "config/repository-federated-with-filesystem-connector-config.xml");
> assertNotNull(url);
> configuration.loadFrom(url);
> JcrEngine engine = configuration.build();
> engine.start();
>
> org.jboss.dna.graph.Node nodeFromGraph = engine.getGraph("Vehicles").getNodeAt("/Vehicles/FileSystem/FileThatExists");
>
> assertThat(nodeFromGraph, is(notNullValue()));
>
> Session session = engine.getRepository("Vehicles").login();
>
> Node nodeFromJcr = session.getRootNode().getNode("Vehicles/FileSystem/FileThatExists"); // here I got a NPE
>
> assertThat(nodeFromJcr, is(notNullValue()));
>
> engine.shutdown();
> }
> -- configuration file to be used on this test --
> <?xml version="1.0" encoding="UTF-8"?>
> <!--
> ~ JBoss DNA (http://www.jboss.org/dna)
> ~
> ~ See the COPYRIGHT.txt file distributed with this work for information
> ~ regarding copyright ownership. Some portions may be licensed
> ~ to Red Hat, Inc. under one or more contributor license agreements.
> ~ See the AUTHORS.txt file in the distribution for a full listing of
> ~ individual contributors.
> ~
> ~ JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
> ~ is licensed to you under the terms of the GNU Lesser General Public License as
> ~ published by the Free Software Foundation; either version 2.1 of
> ~ the License, or (at your option) any later version.
> ~
> ~ JBoss DNA is distributed in the hope that it will be useful,
> ~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
> ~ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
> ~ for more details.
> ~
> ~ You should have received a copy of the GNU Lesser General Public License
> ~ along with this distribution; if not, write to:
> ~ Free Software Foundation, Inc.
> ~ 51 Franklin Street, Fifth Floor
> ~ Boston, MA 02110-1301 USA
> -->
> <configuration xmlns:dna="http://www.jboss.org/dna/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0">
> <!--
> Define the sources for the content. These sources are directly accessible using the DNA-specific Graph API.
> In fact, this is how the DNA JCR implementation works. You can think of these as being similar to
> JDBC DataSource objects, except that they expose graph content via the Graph API instead of records via SQL or JDBC.
> -->
> <dna:sources jcr:primaryType="nt:unstructured">
> <!--
> The 'Cars' repository is an in-memory source with a single default workspace (though others could be created, too).
> -->
> <dna:source jcr:name="Cars" dna:classname="org.jboss.dna.graph.connector.inmemory.InMemoryRepositorySource" dna:retryLimit="3" dna:defaultWorkspaceName="workspace1"/>
> <dna:source jcr:name="FileSystem" dna:classname="org.jboss.dna.connector.filesystem.FileSystemSource">
> <creatingWorkspacesAllowed>false</creatingWorkspacesAllowed>
> <directoryForDefaultWorkspace>/tmp</directoryForDefaultWorkspace>
> </dna:source>
> <!--
> The 'Aircraft' repository is also an in-memory source with a single default workspace.
> By defining a default workspace, the clients using the Graph API will by default use that workspace,
> but can easily say to use other workspaces (or create, clone, or destroy workspaces).
> -->
> <dna:source jcr:name="Aircraft" dna:classname="org.jboss.dna.graph.connector.inmemory.InMemoryRepositorySource">
> <!-- Define the name of the workspace used by default. Optional, but convenient.
> -->
> <defaultWorkspaceName>workspace</defaultWorkspaceName>
> </dna:source>
> <!--
> The 'Vehicles' repository is a federated source that owns none of its own content, but instead
> projects (in this case) all of the content from the 'Cars' source as if it appears
> under '/Vehicles/Cars', while all the 'Aircraft' content appears under '/Vehicles/Aircraft'.
> -->
> <dna:source jcr:name="Vehicles">
> <dna:classname>org.jboss.dna.graph.connector.federation.FederatedRepositorySource</dna:classname>
> <dna:workspaces>
> <!--
> Unlike some other repository sources, federated sources have to define all of their workspaces,
> including how and where the content is projected. So, we only need a single workspace,
> but we could actually define additional workspaces that expose various combinations or portions
> of 'Cars' and/or 'Aircraft' content.
> -->
> <dna:workspace jcr:name="workspace">
> <dna:projections>
> <!-- Project the 'Cars' content, starting with the '/Cars' node. -->
> <dna:projection jcr:name="Cars projection" dna:source="Cars" dna:workspaceName="workspace">
> <dna:projectionRules>/Vehicles/Cars => /Cars</dna:projectionRules>
> </dna:projection>
> <dna:projection jcr:name="TempFiles projection" dna:source="FileSystem" dna:workspaceName="/tmp">
> <dna:projectionRules>/Vehicles/FileSystem => /</dna:projectionRules>
> </dna:projection>
> <!-- Project the 'Aicraft' content, starting with the '/Aircraft' node.
> -->
> <dna:projection jcr:name="Aircarft projection" dna:source="Aircraft" dna:workspaceName="workspace">
> <dna:projectionRules>/Vehicles/Aircraft => /Aircraft</dna:projectionRules>
> </dna:projection>
> <!-- Project the 'System' content. Only needed when this source is accessed through JCR.
> -->
> <dna:projection jcr:name="System projection" dna:source="System" dna:workspaceName="default">
> <dna:projectionRules>/jcr:system => /</dna:projectionRules>
> </dna:projection>
> </dna:projections>
> </dna:workspace>
> </dna:workspaces>
>
> <retryLimit>20</retryLimit>
>
> </dna:source>
> <!--
> A 'System' source needed for the '/jcr:system' branch of the Vehicles source when it is access through JCR.
> -->
> <dna:source jcr:name="System" dna:classname="org.jboss.dna.graph.connector.inmemory.InMemoryRepositorySource" dna:retryLimit="3" dna:defaultWorkspaceName="default"/>
> </dna:sources>
>
> <!--
> Define the JCR repositories
> -->
> <dna:repositories>
> <!--
> Define a JCR repository that accesses the 'Cars' source directly.
> This of course is optional, since we could access the same content through 'vehicles'.
> -->
> <dna:repository jcr:name="Cars">
> <!-- Specify the source that should be used for the repository -->
> <dna:source>Cars</dna:source>
> <!-- Define the options for the JCR repository, using camelcase version of JcrRepository.Option names
> -->
> <dna:options jcr:primaryType="dna:options">
> <jaasLoginConfigName jcr:primaryType="dna:option" dna:value="dna-jcr"/>
> </dna:options>
> <!-- Define any custom node types. Importing CND files via JcrConfiguration is equivalent to specifying here.
> -->
> <dna:nodeTypes jcr:primaryType="dna:nodeTypes"/>
> <!-- Define any namespaces for this repository, other than those already defined by JCR or DNA
> -->
> <namespaces jcr:primaryType="dna:namespaces">
> <car jcr:primaryType="dna:namespace" dna:uri="http://jboss.org/dna/examples/cars/1.0"/>
> </namespaces>
> </dna:repository>
> <!--
> Define a JCR repository that accesses the 'Aircraft' source directly.
> This of course isn't really necessary for this example, since we could access the same content through 'vehicles'.
> -->
> <dna:repository jcr:name="Aircraft">
> <!-- Specify the source that should be used for the repository -->
> <dna:source>Aircraft</dna:source>
> <!-- Define the options for the JCR repository, using camelcase version of JcrRepository.Option names
> -->
> <dna:options jcr:primaryType="dna:options">
> <jaasLoginConfigName jcr:primaryType="dna:option" dna:value="dna-jcr"/>
> </dna:options>
> </dna:repository>
> <dna:repository jcr:name="Vehicles">
> <!-- Specify the source that should be used for the repository -->
> <dna:source>Vehicles</dna:source>
> <!-- Define the options for the JCR repository, using camelcase version of JcrRepository.Option names
> -->
> <dna:options jcr:primaryType="dna:options">
> <jaasLoginConfigName jcr:primaryType="dna:option" dna:value="dna-jcr"/>
> </dna:options>
> </dna:repository>
>
> </dna:repositories>
> </configuration>
> --- exception thrown by this test method ---
> java.lang.NullPointerException
> at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:173)
> at com.google.common.collect.ReferenceMap$ReferenceStrategy$1.getDummyFor(ReferenceMap.java:475)
> at com.google.common.collect.ReferenceMap.get(ReferenceMap.java:168)
> at org.jboss.dna.jcr.SessionCache.findJcrNode(SessionCache.java:817)
> at org.jboss.dna.jcr.SessionCache.findJcrItem(SessionCache.java:941)
> at org.jboss.dna.jcr.AbstractJcrNode.getNode(AbstractJcrNode.java:542)
> at org.openspotligth.federation.configuration.DNAConfigFromFileTest.shouldAccessFileSystemByFederatedJcr(DNAConfigFromFileTest.java:116)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:585)
> at org.junit.internal.runners.TestMethod.invoke(TestMethod.java:59)
> at org.junit.internal.runners.MethodRoadie.runTestMethod(MethodRoadie.java:98)
> at org.junit.internal.runners.MethodRoadie$2.run(MethodRoadie.java:79)
> at org.junit.internal.runners.MethodRoadie.runBeforesThenTestThenAfters(MethodRoadie.java:87)
> at org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:77)
> at org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:42)
> at org.junit.internal.runners.JUnit4ClassRunner.invokeTestMethod(JUnit4ClassRunner.java:88)
> at org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:51)
> at org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:44)
> at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27)
> at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37)
> at org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42)
> at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:45)
> at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
>
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the dna-issues
mailing list