Repository: incubator-ignite Updated Branches: refs/heads/ignite-471 9678493bf -> 764ba71e3
ignite-471: fix of affinity tests Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/764ba71e Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/764ba71e Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/764ba71e Branch: refs/heads/ignite-471 Commit: 764ba71e3fb76d4013ff5e9361c9fa09c17969e3 Parents: 9678493 Author: Denis Magda <dma...@gridgain.com> Authored: Wed May 6 10:13:43 2015 +0300 Committer: Denis Magda <dma...@gridgain.com> Committed: Wed May 6 10:13:43 2015 +0300 ---------------------------------------------------------------------- .../internal/MarshallerContextAdapter.java | 8 ++- .../processors/cache/GridCacheContext.java | 6 +- .../processors/rest/GridRestProcessor.java | 8 +-- .../security/GridSecurityProcessor.java | 6 +- .../security/os/GridOsSecurityProcessor.java | 4 +- .../ignite/marshaller/MarshallerException.java | 57 ++++++++++++++++++ .../security/IgniteSecurityException.java | 61 ++++++++++++++++++++ .../plugin/security/SecurityException.java | 61 -------------------- .../resources/META-INF/classnames.properties | 2 +- .../uri/GridUriDeploymentJarVerifier.java | 2 +- 10 files changed, 139 insertions(+), 76 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/764ba71e/modules/core/src/main/java/org/apache/ignite/internal/MarshallerContextAdapter.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/MarshallerContextAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/MarshallerContextAdapter.java index 3d532e2..71d8a8c 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/MarshallerContextAdapter.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/MarshallerContextAdapter.java @@ -86,7 +86,13 @@ public abstract class MarshallerContextAdapter implements MarshallerContext { String clsName = line.trim(); - map.put(idMapper0.typeId(clsName), clsName); + int typeId = idMapper0.typeId(clsName); + + String oldClsName; + + if ((oldClsName = map.put(typeId, clsName)) != null) + throw new MarshallerException("Duplicate type ID [id=" + typeId + ", clsName=" + clsName + + ", oldClsName=" + oldClsName + ']'); } } } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/764ba71e/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java index e6f1a50..e256b46 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java @@ -55,7 +55,7 @@ import org.apache.ignite.internal.util.typedef.internal.*; import org.apache.ignite.lang.*; import org.apache.ignite.marshaller.*; import org.apache.ignite.plugin.security.*; -import org.apache.ignite.plugin.security.SecurityException; +import org.apache.ignite.plugin.security.IgniteSecurityException; import org.jetbrains.annotations.*; import javax.cache.*; @@ -671,9 +671,9 @@ public class GridCacheContext<K, V> implements Externalizable { /** * @param op Operation to check. - * @throws SecurityException If security check failed. + * @throws IgniteSecurityException If security check failed. */ - public void checkSecurity(SecurityPermission op) throws SecurityException { + public void checkSecurity(SecurityPermission op) throws IgniteSecurityException { if (CU.isSystemCache(name())) return; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/764ba71e/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java index 52ca610..41de68b 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java @@ -38,7 +38,7 @@ import org.apache.ignite.internal.util.typedef.internal.*; import org.apache.ignite.internal.util.worker.*; import org.apache.ignite.lang.*; import org.apache.ignite.plugin.security.*; -import org.apache.ignite.plugin.security.SecurityException; +import org.apache.ignite.plugin.security.IgniteSecurityException; import org.jsr166.*; import java.lang.reflect.*; @@ -179,7 +179,7 @@ public class GridRestProcessor extends GridProcessorAdapter { authorize(req, subjCtx); } - catch (SecurityException e) { + catch (IgniteSecurityException e) { assert subjCtx != null; GridRestResponse res = new GridRestResponse(STATUS_SECURITY_CHECK_FAILED, e.getMessage()); @@ -517,9 +517,9 @@ public class GridRestProcessor extends GridProcessorAdapter { /** * @param req REST request. * @param sCtx Security context. - * @throws SecurityException If authorization failed. + * @throws IgniteSecurityException If authorization failed. */ - private void authorize(GridRestRequest req, SecurityContext sCtx) throws SecurityException { + private void authorize(GridRestRequest req, SecurityContext sCtx) throws IgniteSecurityException { SecurityPermission perm = null; String name = null; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/764ba71e/modules/core/src/main/java/org/apache/ignite/internal/processors/security/GridSecurityProcessor.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/security/GridSecurityProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/security/GridSecurityProcessor.java index 1a32f56..43243da 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/security/GridSecurityProcessor.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/security/GridSecurityProcessor.java @@ -21,7 +21,7 @@ import org.apache.ignite.*; import org.apache.ignite.cluster.*; import org.apache.ignite.internal.processors.*; import org.apache.ignite.plugin.security.*; -import org.apache.ignite.plugin.security.SecurityException; +import org.apache.ignite.plugin.security.IgniteSecurityException; import org.jetbrains.annotations.*; import java.util.*; @@ -79,10 +79,10 @@ public interface GridSecurityProcessor extends GridProcessor { * @param name Cache name or task class name. * @param perm Permission to authorize. * @param securityCtx Optional security context. - * @throws SecurityException If security check failed. + * @throws IgniteSecurityException If security check failed. */ public void authorize(String name, SecurityPermission perm, @Nullable SecurityContext securityCtx) - throws SecurityException; + throws IgniteSecurityException; /** * Callback invoked when subject session got expired. http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/764ba71e/modules/core/src/main/java/org/apache/ignite/internal/processors/security/os/GridOsSecurityProcessor.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/security/os/GridOsSecurityProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/security/os/GridOsSecurityProcessor.java index 4b81041..dd17e33 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/security/os/GridOsSecurityProcessor.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/security/os/GridOsSecurityProcessor.java @@ -23,7 +23,7 @@ import org.apache.ignite.internal.*; import org.apache.ignite.internal.processors.*; import org.apache.ignite.internal.processors.security.*; import org.apache.ignite.plugin.security.*; -import org.apache.ignite.plugin.security.SecurityException; +import org.apache.ignite.plugin.security.IgniteSecurityException; import org.jetbrains.annotations.*; import java.util.*; @@ -67,7 +67,7 @@ public class GridOsSecurityProcessor extends GridProcessorAdapter implements Gri /** {@inheritDoc} */ @Override public void authorize(String name, SecurityPermission perm, @Nullable SecurityContext securityCtx) - throws SecurityException { + throws IgniteSecurityException { // No-op. } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/764ba71e/modules/core/src/main/java/org/apache/ignite/marshaller/MarshallerException.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/marshaller/MarshallerException.java b/modules/core/src/main/java/org/apache/ignite/marshaller/MarshallerException.java new file mode 100644 index 0000000..25f832a --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/marshaller/MarshallerException.java @@ -0,0 +1,57 @@ +/* + * 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.ignite.marshaller; + +import org.apache.ignite.*; +import org.jetbrains.annotations.*; + +/** + * Exception indicating marshalling or unmarshalling error. + */ +public class MarshallerException extends IgniteException { + /** */ + private static final long serialVersionUID = 0L; + + /** + * Creates marshaller's exception with error message. + * + * @param msg Error message. + */ + public MarshallerException(String msg) { + super(msg); + } + + /** + * Creates marshaller's exception with {@link Throwable} as a cause. + * + * @param cause Cause. + */ + public MarshallerException(Throwable cause) { + super(cause); + } + + /** + * Creates marshaller's exception with error message and {@link Throwable} as a cause. + * + * @param msg Error message. + * @param cause Cause. + */ + public MarshallerException(String msg, @Nullable Throwable cause) { + super(msg, cause); + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/764ba71e/modules/core/src/main/java/org/apache/ignite/plugin/security/IgniteSecurityException.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/plugin/security/IgniteSecurityException.java b/modules/core/src/main/java/org/apache/ignite/plugin/security/IgniteSecurityException.java new file mode 100644 index 0000000..7606225 --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/plugin/security/IgniteSecurityException.java @@ -0,0 +1,61 @@ +/* + * 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.ignite.plugin.security; + +import org.apache.ignite.*; +import org.jetbrains.annotations.*; + +/** + * Common security exception for the grid. + */ +public class IgniteSecurityException extends IgniteException { + /** */ + private static final long serialVersionUID = 0L; + + /** + * Constructs security grid exception with given message and cause. + * + * @param msg Exception message. + * @param cause Exception cause. + */ + public IgniteSecurityException( + String msg, + @Nullable Throwable cause + ) { + super(msg, cause); + } + + /** + * Creates new security grid exception given throwable as a cause and + * source of error message. + * + * @param cause Non-null throwable cause. + */ + public IgniteSecurityException(Throwable cause) { + this(cause.getMessage(), cause); + } + + /** + * Constructs security grid exception with given message. + * + * @param msg Exception message. + */ + public IgniteSecurityException(String msg) { + super(msg); + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/764ba71e/modules/core/src/main/java/org/apache/ignite/plugin/security/SecurityException.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/plugin/security/SecurityException.java b/modules/core/src/main/java/org/apache/ignite/plugin/security/SecurityException.java deleted file mode 100644 index 84fa5a4..0000000 --- a/modules/core/src/main/java/org/apache/ignite/plugin/security/SecurityException.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * 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.ignite.plugin.security; - -import org.apache.ignite.*; -import org.jetbrains.annotations.*; - -/** - * Common security exception for the grid. - */ -public class SecurityException extends IgniteException { - /** */ - private static final long serialVersionUID = 0L; - - /** - * Constructs security grid exception with given message and cause. - * - * @param msg Exception message. - * @param cause Exception cause. - */ - public SecurityException( - String msg, - @Nullable Throwable cause - ) { - super(msg, cause); - } - - /** - * Creates new security grid exception given throwable as a cause and - * source of error message. - * - * @param cause Non-null throwable cause. - */ - public SecurityException(Throwable cause) { - this(cause.getMessage(), cause); - } - - /** - * Constructs security grid exception with given message. - * - * @param msg Exception message. - */ - public SecurityException(String msg) { - super(msg); - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/764ba71e/modules/core/src/main/resources/META-INF/classnames.properties ---------------------------------------------------------------------- diff --git a/modules/core/src/main/resources/META-INF/classnames.properties b/modules/core/src/main/resources/META-INF/classnames.properties index a79d5b8..016fc0f 100644 --- a/modules/core/src/main/resources/META-INF/classnames.properties +++ b/modules/core/src/main/resources/META-INF/classnames.properties @@ -1518,7 +1518,7 @@ org.apache.ignite.plugin.PluginValidationException org.apache.ignite.plugin.extensions.communication.Message org.apache.ignite.plugin.extensions.communication.MessageCollectionItemType org.apache.ignite.plugin.security.SecurityCredentials -org.apache.ignite.plugin.security.SecurityException +org.apache.ignite.plugin.security.IgniteSecurityException org.apache.ignite.plugin.security.SecurityPermission org.apache.ignite.plugin.security.SecurityPermissionSet org.apache.ignite.plugin.security.SecuritySubject http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/764ba71e/modules/urideploy/src/main/java/org/apache/ignite/spi/deployment/uri/GridUriDeploymentJarVerifier.java ---------------------------------------------------------------------- diff --git a/modules/urideploy/src/main/java/org/apache/ignite/spi/deployment/uri/GridUriDeploymentJarVerifier.java b/modules/urideploy/src/main/java/org/apache/ignite/spi/deployment/uri/GridUriDeploymentJarVerifier.java index 5105b46..826ecb5 100644 --- a/modules/urideploy/src/main/java/org/apache/ignite/spi/deployment/uri/GridUriDeploymentJarVerifier.java +++ b/modules/urideploy/src/main/java/org/apache/ignite/spi/deployment/uri/GridUriDeploymentJarVerifier.java @@ -302,7 +302,7 @@ final class GridUriDeploymentJarVerifier { byte[] buffer = new byte[BUF_SIZE]; while (in.read(buffer, 0, buffer.length) != -1) { - // Just read the entry. Will throw a SecurityException if signature + // Just read the entry. Will throw a IgniteSecurityException if signature // or digest check fails. Since we instantiated JarFile with parameter // true, that tells it to verify that the files match the digests // and haven't been changed.