Repository: phoenix Updated Branches: refs/heads/4.x-HBase-1.1 21296955c -> 01467bde8
PHOENIX-4150 nit: adding license and reformating comments Signed-off-by: Thomas D'Silva <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/01467bde Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/01467bde Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/01467bde Branch: refs/heads/4.x-HBase-1.1 Commit: 01467bde83cf00dde745e82f2f8158937c9f2f91 Parents: 2129695 Author: aertoria <[email protected]> Authored: Fri Sep 8 13:25:28 2017 -0700 Committer: Thomas D'Silva <[email protected]> Committed: Fri Sep 8 15:38:21 2017 -0700 ---------------------------------------------------------------------- .../query/PropertyNotAllowedException.java | 16 +++++++++++ .../apache/phoenix/query/PropertyPolicy.java | 6 ++-- .../phoenix/query/TestPropertyPolicy.java | 29 ++++++++++++++------ .../org.apache.phoenix.query.PropertyPolicy | 15 ++++++++++ 4 files changed, 56 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/phoenix/blob/01467bde/phoenix-core/src/main/java/org/apache/phoenix/query/PropertyNotAllowedException.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/query/PropertyNotAllowedException.java b/phoenix-core/src/main/java/org/apache/phoenix/query/PropertyNotAllowedException.java index ed0e23e..9d9eaf9 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/query/PropertyNotAllowedException.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/query/PropertyNotAllowedException.java @@ -1,3 +1,19 @@ +/* + * 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.phoenix.query; import java.sql.SQLException; http://git-wip-us.apache.org/repos/asf/phoenix/blob/01467bde/phoenix-core/src/main/java/org/apache/phoenix/query/PropertyPolicy.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/query/PropertyPolicy.java b/phoenix-core/src/main/java/org/apache/phoenix/query/PropertyPolicy.java index 3314a13..a59f912 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/query/PropertyPolicy.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/query/PropertyPolicy.java @@ -36,10 +36,12 @@ import java.util.Properties; * final Set<String> offendingProperties = new HashSet<>(); * * for(Object k:properties.keySet()){ - * if (propertiesKeyDisAllowed.contains(k)) offendingProperties.put((String)k,properties.getProperty((String)k)); + * if (propertiesKeyDisAllowed.contains(k)) offendingProperties + * .put((String)k,properties.getProperty((String)k)); * } * - * if (offendingProperties.size()>0) throw new IllegalArgumentException("properties not allowed. offending properties" + offendingProperties); + * if (offendingProperties.size()>0) throw new IllegalArgumentException( + * "properties not allowed. offending properties" + offendingProperties); * } *} *</code> http://git-wip-us.apache.org/repos/asf/phoenix/blob/01467bde/phoenix-core/src/test/java/org/apache/phoenix/query/TestPropertyPolicy.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/test/java/org/apache/phoenix/query/TestPropertyPolicy.java b/phoenix-core/src/test/java/org/apache/phoenix/query/TestPropertyPolicy.java index ddc452c..8573bff 100644 --- a/phoenix-core/src/test/java/org/apache/phoenix/query/TestPropertyPolicy.java +++ b/phoenix-core/src/test/java/org/apache/phoenix/query/TestPropertyPolicy.java @@ -1,7 +1,19 @@ /* - * Copyright, 1999-2013, SALESFORCE.com - * All Rights Reserved - * Company Confidential + * 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.phoenix.query; @@ -19,16 +31,17 @@ import static java.util.Arrays.asList; * configuration settings. */ public class TestPropertyPolicy implements PropertyPolicy { - final static Set<String> propertiesKeyDisAllowed = Collections.unmodifiableSet( - new HashSet<>(asList("DisallowedProperty"))); + final static Set<String> propertiesKeyDisAllowed = + Collections.unmodifiableSet(new HashSet<>(asList("DisallowedProperty"))); @Override public void evaluate(Properties properties) throws PropertyNotAllowedException { final Properties offendingProperties = new Properties(); - for(Object k:properties.keySet()){ - if (propertiesKeyDisAllowed.contains(k)) offendingProperties.put((String)k,properties.getProperty((String)k)); + for (Object k : properties.keySet()) { + if (propertiesKeyDisAllowed.contains(k)) + offendingProperties.put((String) k, properties.getProperty((String) k)); } - if (offendingProperties.size()>0) throw new PropertyNotAllowedException(offendingProperties); + if (offendingProperties.size() > 0) throw new PropertyNotAllowedException(offendingProperties); } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/phoenix/blob/01467bde/phoenix-core/src/test/resources/META-INF/services/org.apache.phoenix.query.PropertyPolicy ---------------------------------------------------------------------- diff --git a/phoenix-core/src/test/resources/META-INF/services/org.apache.phoenix.query.PropertyPolicy b/phoenix-core/src/test/resources/META-INF/services/org.apache.phoenix.query.PropertyPolicy index 07960b6..9347fd3 100644 --- a/phoenix-core/src/test/resources/META-INF/services/org.apache.phoenix.query.PropertyPolicy +++ b/phoenix-core/src/test/resources/META-INF/services/org.apache.phoenix.query.PropertyPolicy @@ -1 +1,16 @@ +# 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. org.apache.phoenix.query.TestPropertyPolicy \ No newline at end of file
