You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by ki...@apache.org on 2015/12/15 09:05:04 UTC

jena git commit: JENA-1088 trim and validate dataset name, both client and server side

Repository: jena
Updated Branches:
  refs/heads/master b95483226 -> cfbc49188


JENA-1088 trim and validate dataset name, both client and server side


Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/cfbc4918
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/cfbc4918
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/cfbc4918

Branch: refs/heads/master
Commit: cfbc491883beafa8dd9f289aec653e482412d187
Parents: b954832
Author: Bruno P. Kinoshita <br...@yahoo.com.br>
Authored: Tue Dec 15 21:03:02 2015 +1300
Committer: Bruno P. Kinoshita <br...@yahoo.com.br>
Committed: Tue Dec 15 21:03:02 2015 +1300

----------------------------------------------------------------------
 .../src/main/java/org/apache/jena/fuseki/mgt/ActionDatasets.java  | 3 ++-
 .../src/main/webapp/js/app/views/dataset-simple-create.js         | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jena/blob/cfbc4918/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 1e7222f..12a930e 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
@@ -29,6 +29,7 @@ import java.util.* ;
 import javax.servlet.ServletOutputStream ;
 import javax.servlet.http.HttpServletRequest ;
 
+import org.apache.commons.lang3.StringUtils;
 import org.apache.jena.atlas.io.IO ;
 import org.apache.jena.atlas.json.JsonBuilder ;
 import org.apache.jena.atlas.json.JsonValue ;
@@ -262,7 +263,7 @@ public class ActionDatasets extends ActionContainerItem {
     private void assemblerFromForm(HttpAction action, StreamRDF dest) {
         String dbType = action.getRequest().getParameter(paramDatasetType) ;
         String dbName = action.getRequest().getParameter(paramDatasetName) ;
-        if ( dbType == null || dbName == null )
+        if ( StringUtils.isBlank(dbType) || StringUtils.isBlank(dbName) )
             ServletOps.errorBadRequest("Required parameters: dbName and dbType");
         
         Map<String, String> params = new HashMap<>() ;

http://git-wip-us.apache.org/repos/asf/jena/blob/cfbc4918/jena-fuseki2/jena-fuseki-core/src/main/webapp/js/app/views/dataset-simple-create.js
----------------------------------------------------------------------
diff --git a/jena-fuseki2/jena-fuseki-core/src/main/webapp/js/app/views/dataset-simple-create.js b/jena-fuseki2/jena-fuseki-core/src/main/webapp/js/app/views/dataset-simple-create.js
index dd189c1..69ffbbb 100644
--- a/jena-fuseki2/jena-fuseki-core/src/main/webapp/js/app/views/dataset-simple-create.js
+++ b/jena-fuseki2/jena-fuseki-core/src/main/webapp/js/app/views/dataset-simple-create.js
@@ -77,7 +77,7 @@ define(
       validateSimpleForm: function() {
         this.clearValidation();
 
-        if (! $("input[name=dbName]").val()) {
+        if (! $("input[name=dbName]").val() || 0 === $("input[name=dbName]").val().trim().length) {
           $(".dbNameValidation").removeClass("hidden")
                                 .parents(".form-group" )
                                 .addClass( "has-error" );