You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by an...@apache.org on 2015/07/30 14:17:28 UTC
jena git commit: JENA-869 : 409 error, not 500,
when configuration file exists.
Repository: jena
Updated Branches:
refs/heads/master 290c66394 -> b71df5200
JENA-869 : 409 error, not 500, when configuration file exists.
Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/b71df520
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/b71df520
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/b71df520
Branch: refs/heads/master
Commit: b71df52006e5c9ff7b56a9f86652c1ce0023637a
Parents: 290c663
Author: Andy Seaborne <an...@apache.org>
Authored: Thu Jul 30 13:17:18 2015 +0100
Committer: Andy Seaborne <an...@apache.org>
Committed: Thu Jul 30 13:17:18 2015 +0100
----------------------------------------------------------------------
.../java/org/apache/jena/fuseki/mgt/ActionDatasets.java | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jena/blob/b71df520/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/mgt/ActionDatasets.java
----------------------------------------------------------------------
diff --git a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/mgt/ActionDatasets.java b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/mgt/ActionDatasets.java
index cb6f9cf..00c4f12 100644
--- a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/mgt/ActionDatasets.java
+++ b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/mgt/ActionDatasets.java
@@ -133,13 +133,16 @@ public class ActionDatasets extends ActionContainerItem {
else
assemblerFromBody(action, dest) ;
- // Keep a persistent copy imediately. This is not used for
+ // ----
+ // Keep a persistent copy immediately. This is not used for
// anything other than being "for the record".
filename1 = FusekiServer.dirFileArea.resolve(uuid.asString()).toString() ;
try ( OutputStream outCopy = IO.openOutputFile(filename1) ) {
RDFDataMgr.write(outCopy, model, Lang.TURTLE) ;
}
+ // ----
+ // Process configuration.
Statement stmt = getOne(model, null, pServiceName, null) ;
if ( stmt == null ) {
StmtIterator sIter = model.listStatements(null, pServiceName, (RDFNode)null ) ;
@@ -164,6 +167,7 @@ public class ActionDatasets extends ActionContainerItem {
String datasetPath = DataAccessPoint.canonical(datasetName) ;
action.log.info(format("[%d] Create database : name = %s", action.id, datasetPath)) ;
+ // ---- Check whether ti already exists
if ( DataAccessPointRegistry.get().isRegistered(datasetPath) )
// And abort.
ServletOps.error(HttpSC.CONFLICT_409, "Name already registered "+datasetPath) ;
@@ -171,9 +175,12 @@ public class ActionDatasets extends ActionContainerItem {
// Copy to the configuration directory for server start up next time.
filename2 = datasetPath.substring(1) ; // Without "/"
filename2 = FusekiServer.dirConfiguration.resolve(filename2).toString()+".ttl" ;
+ // If the file theer is a file already in the configuratin area even though
+ // not currently in the DataAccessPointRegistry
if ( FileOps.exists(filename2) )
- ServletOps.error(HttpSC.INTERNAL_SERVER_ERROR_500, "Configuration file of that name already exists "+filename2) ;
+ ServletOps.error(HttpSC.CONFLICT_409, "Configuration file of that name already exists "+filename2) ;
+ // Write to configuration directory.
try ( OutputStream outCopy = IO.openOutputFile(filename2) ) {
RDFDataMgr.write(outCopy, model, Lang.TURTLE) ;
}