Skip to content

Commit

Permalink
GH-2710 fix possible NPE in transaction handling, updated test setup
Browse files Browse the repository at this point in the history
  • Loading branch information
abrokenjester committed Jul 25, 2021
1 parent b55cdd0 commit 7deb0a7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,14 @@ private ModelAndView startTransaction(Repository repository, HttpServletRequest

// process legacy isolation level param for backward compatibility with older clients
final String isolationLevelString = request.getParameter(Protocol.ISOLATION_LEVEL_PARAM_NAME);
final IRI level = Values.iri(isolationLevelString);
if (isolationLevelString != null) {
final IRI level = Values.iri(isolationLevelString);

for (IsolationLevel standardLevel : IsolationLevels.values()) {
if (standardLevel.getName().equals(level.getLocalName())) {
isolationLevel[0] = standardLevel;
break;
for (IsolationLevel standardLevel : IsolationLevels.values()) {
if (standardLevel.getName().equals(level.getLocalName())) {
isolationLevel[0] = standardLevel;
break;
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
import org.eclipse.rdf4j.repository.RepositoryException;
import org.eclipse.rdf4j.repository.config.RepositoryConfig;
import org.eclipse.rdf4j.repository.config.RepositoryConfigException;
import org.eclipse.rdf4j.repository.config.RepositoryConfigUtil;
import org.eclipse.rdf4j.repository.http.HTTPRepository;
import org.eclipse.rdf4j.repository.manager.RemoteRepositoryManager;
import org.eclipse.rdf4j.repository.manager.SystemRepository;
import org.eclipse.rdf4j.repository.sail.config.SailRepositoryConfig;
import org.eclipse.rdf4j.sail.inferencer.fc.config.SchemaCachingRDFSInferencerConfig;
Expand Down Expand Up @@ -98,30 +98,25 @@ public void stop() throws Exception {
}

private void createTestRepositories() throws RepositoryException, RepositoryConfigException {
Repository systemRep = new HTTPRepository(Protocol.getRepositoryLocation(SERVER_URL, SystemRepository.ID));

RemoteRepositoryManager manager = RemoteRepositoryManager.getInstance(SERVER_URL);
// create a (non-inferencing) memory store
MemoryStoreConfig memStoreConfig = new MemoryStoreConfig();
SailRepositoryConfig sailRepConfig = new SailRepositoryConfig(memStoreConfig);
RepositoryConfig repConfig = new RepositoryConfig(TEST_REPO_ID, sailRepConfig);

RepositoryConfigUtil.updateRepositoryConfigs(systemRep, repConfig);
manager.addRepositoryConfig(repConfig);

// create an inferencing memory store
SchemaCachingRDFSInferencerConfig inferMemStoreConfig = new SchemaCachingRDFSInferencerConfig(
new MemoryStoreConfig());
sailRepConfig = new SailRepositoryConfig(inferMemStoreConfig);
repConfig = new RepositoryConfig(TEST_INFERENCE_REPO_ID, sailRepConfig);

RepositoryConfigUtil.updateRepositoryConfigs(systemRep, repConfig);
manager.addRepositoryConfig(repConfig);

// create memory store with shacl support
ShaclSailConfig shaclConfig = new ShaclSailConfig(new MemoryStoreConfig());
sailRepConfig = new SailRepositoryConfig(shaclConfig);
repConfig = new RepositoryConfig(TEST_SHACL_REPO_ID, sailRepConfig);

RepositoryConfigUtil.updateRepositoryConfigs(systemRep, repConfig);

manager.addRepositoryConfig(repConfig);
}

static class PropertiesReader {
Expand Down

0 comments on commit 7deb0a7

Please sign in to comment.