You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by il...@apache.org on 2016/09/23 08:44:11 UTC

[1/2] syncope git commit: URL validator

Repository: syncope
Updated Branches:
  refs/heads/2_0_X ea4786ba4 -> 9a33bec5e
  refs/heads/master a9aafe2dc -> 4a079a639


URL validator


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

Branch: refs/heads/2_0_X
Commit: 9a33bec5e0c2af50d6e30833ba82f72bd28cb7ea
Parents: ea4786b
Author: Francesco Chicchiricc� <il...@apache.org>
Authored: Fri Sep 23 10:43:45 2016 +0200
Committer: Francesco Chicchiricc� <il...@apache.org>
Committed: Fri Sep 23 10:43:45 2016 +0200

----------------------------------------------------------------------
 .../jpa/attrvalue/validation/URLValidator.java  | 43 ++++++++++++++++++++
 1 file changed, 43 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/9a33bec5/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/attrvalue/validation/URLValidator.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/attrvalue/validation/URLValidator.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/attrvalue/validation/URLValidator.java
new file mode 100644
index 0000000..3138ca9
--- /dev/null
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/attrvalue/validation/URLValidator.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.core.persistence.jpa.attrvalue.validation;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import org.apache.syncope.core.persistence.api.attrvalue.validation.InvalidPlainAttrValueException;
+import org.apache.syncope.core.persistence.api.entity.PlainAttrValue;
+import org.apache.syncope.core.persistence.api.entity.PlainSchema;
+
+public class URLValidator extends AbstractValidator {
+
+    private static final long serialVersionUID = 792457177290331518L;
+
+    public URLValidator(final PlainSchema schema) {
+        super(schema);
+    }
+
+    @Override
+    protected void doValidate(final PlainAttrValue attrValue) {
+        try {
+            new URL(attrValue.getStringValue());
+        } catch (MalformedURLException e) {
+            throw new InvalidPlainAttrValueException("\"" + attrValue.getValue() + "\" is not a valid URL");
+        }
+    }
+}


[2/2] syncope git commit: URL validator

Posted by il...@apache.org.
URL validator


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

Branch: refs/heads/master
Commit: 4a079a639d9e0196cbfa256385fa765288159a2d
Parents: a9aafe2
Author: Francesco Chicchiricc� <il...@apache.org>
Authored: Fri Sep 23 10:43:45 2016 +0200
Committer: Francesco Chicchiricc� <il...@apache.org>
Committed: Fri Sep 23 10:43:58 2016 +0200

----------------------------------------------------------------------
 .../jpa/attrvalue/validation/URLValidator.java  | 43 ++++++++++++++++++++
 1 file changed, 43 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/4a079a63/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/attrvalue/validation/URLValidator.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/attrvalue/validation/URLValidator.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/attrvalue/validation/URLValidator.java
new file mode 100644
index 0000000..3138ca9
--- /dev/null
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/attrvalue/validation/URLValidator.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.core.persistence.jpa.attrvalue.validation;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import org.apache.syncope.core.persistence.api.attrvalue.validation.InvalidPlainAttrValueException;
+import org.apache.syncope.core.persistence.api.entity.PlainAttrValue;
+import org.apache.syncope.core.persistence.api.entity.PlainSchema;
+
+public class URLValidator extends AbstractValidator {
+
+    private static final long serialVersionUID = 792457177290331518L;
+
+    public URLValidator(final PlainSchema schema) {
+        super(schema);
+    }
+
+    @Override
+    protected void doValidate(final PlainAttrValue attrValue) {
+        try {
+            new URL(attrValue.getStringValue());
+        } catch (MalformedURLException e) {
+            throw new InvalidPlainAttrValueException("\"" + attrValue.getValue() + "\" is not a valid URL");
+        }
+    }
+}