# IGNITE-70 Documentation links for Ignite lead to GridGain site.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/878a2890 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/878a2890 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/878a2890 Branch: refs/heads/ignite-160 Commit: 878a2890a2bb80d05cbb0ec42b82ac27f166a0d8 Parents: 8db2a83 Author: sevdokimov <sevdoki...@gridgain.com> Authored: Wed Feb 4 16:13:37 2015 +0300 Committer: sevdokimov <sevdoki...@gridgain.com> Committed: Wed Feb 4 16:16:03 2015 +0300 ---------------------------------------------------------------------- .../apache/ignite/IgniteCheckedException.java | 24 ----- .../java/org/apache/ignite/IgniteException.java | 26 +---- .../ignite/internal/util/IgniteUtils.java | 22 ---- .../apache/ignite/internal/util/typedef/X.java | 36 ------- .../IgniteExceptionHelpLinksSelfTest.java | 105 ------------------- .../ignite/testsuites/IgniteBasicTestSuite.java | 1 - 6 files changed, 1 insertion(+), 213 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/878a2890/modules/core/src/main/java/org/apache/ignite/IgniteCheckedException.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteCheckedException.java b/modules/core/src/main/java/org/apache/ignite/IgniteCheckedException.java index 399b067..79c116f 100644 --- a/modules/core/src/main/java/org/apache/ignite/IgniteCheckedException.java +++ b/modules/core/src/main/java/org/apache/ignite/IgniteCheckedException.java @@ -20,8 +20,6 @@ package org.apache.ignite; import org.apache.ignite.internal.util.typedef.*; import org.jetbrains.annotations.*; -import static org.apache.ignite.internal.util.IgniteUtils.*; - /** * General grid exception. This exception is used to indicate any error condition * within Grid. @@ -87,28 +85,6 @@ public class IgniteCheckedException extends Exception { return X.cause(this, cls); } - /** - * {@inheritDoc} - * <p> - * Adds troubleshooting links if they where not added by below in {@code cause} hierarchy. - */ - @Override public String getMessage() { - return X.hasCauseExcludeRoot(this, IgniteCheckedException.class, IgniteException.class) ? - super.getMessage() : errorMessageWithHelpUrls(super.getMessage()); - } - - /** - * Returns exception message. - * <p> - * Unlike {@link #getMessage()} this method never include troubleshooting links - * to the result string. - * - * @return Original message. - */ - public String getOriginalMessage() { - return super.getMessage(); - } - /** {@inheritDoc} */ @Override public String toString() { return getClass() + ": " + getMessage(); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/878a2890/modules/core/src/main/java/org/apache/ignite/IgniteException.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteException.java b/modules/core/src/main/java/org/apache/ignite/IgniteException.java index 0f89743..5c82f8e 100644 --- a/modules/core/src/main/java/org/apache/ignite/IgniteException.java +++ b/modules/core/src/main/java/org/apache/ignite/IgniteException.java @@ -20,8 +20,6 @@ package org.apache.ignite; import org.apache.ignite.internal.util.typedef.*; import org.jetbrains.annotations.*; -import static org.apache.ignite.internal.util.IgniteUtils.*; - /** * General grid exception. This exception is used to indicate any error condition * within Grid. @@ -34,7 +32,7 @@ public class IgniteException extends RuntimeException { * Create empty exception. */ public IgniteException() { - super(); + // No-op. } /** @@ -87,28 +85,6 @@ public class IgniteException extends RuntimeException { return X.cause(this, cls); } - /** - * {@inheritDoc} - * <p> - * Adds troubleshooting links if they where not added by below in {@code cause} hierarchy. - */ - @Override public String getMessage() { - return X.hasCauseExcludeRoot(this, IgniteException.class, IgniteCheckedException.class) ? - super.getMessage() : errorMessageWithHelpUrls(super.getMessage()); - } - - /** - * Returns exception message. - * <p> - * Unlike {@link #getMessage()} this method never include troubleshooting links - * to the result string. - * - * @return Original message. - */ - public String getOriginalMessage() { - return super.getMessage(); - } - /** {@inheritDoc} */ @Override public String toString() { return getClass() + ": " + getMessage(); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/878a2890/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java index 7538f12..2c6037c 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java @@ -283,11 +283,6 @@ public abstract class IgniteUtils { public static final String MAC_INVALID_ARG_MSG = "On MAC OS you may have too many file descriptors open " + "(simple restart usually solves the issue)"; - /** Default help pages. */ - public static final List<String> DFLT_HELP_LINKS = Arrays.asList( - "Troubleshooting: http://bit.ly/GridGain-Troubleshooting", - "Documentation Center: http://bit.ly/GridGain-Documentation"); - /** Portable classes. */ private static final Collection<Class<?>> PORTABLE_CLS = new HashSet<>(); @@ -8262,23 +8257,6 @@ public abstract class IgniteUtils { } /** - * Checks if exception has help URLs. - * - * @param msg Error message. - * @return Formatted error message. - */ - public static String errorMessageWithHelpUrls(String msg) { - StringBuilder sb = msg == null ? new StringBuilder() : new StringBuilder(msg); - - sb.append("\nFor more information see:\n"); - - for (String url : DFLT_HELP_LINKS) - sb.append(" ").append(url).append("\n"); - - return sb.toString(); - } - - /** * @param addrs Node's addresses. * @param port Port discovery number. * @return A string compatible with {@link org.apache.ignite.cluster.ClusterNode#consistentId()} requirements. http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/878a2890/modules/core/src/main/java/org/apache/ignite/internal/util/typedef/X.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/typedef/X.java b/modules/core/src/main/java/org/apache/ignite/internal/util/typedef/X.java index f5f3d9b..df411bf 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/typedef/X.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/util/typedef/X.java @@ -490,42 +490,6 @@ public final class X { } /** - * Checks if passed in {@code 'Throwable'} has given class in {@code 'cause'} hierarchy - * <b>excluding</b> that throwable itself. - * <p> - * Note that this method follows includes {@link Throwable#getSuppressed()} - * into check. - * - * @param t Throwable to check (if {@code null}, {@code false} is returned). - * @param cls Cause classes to check (if {@code null} or empty, {@code false} is returned). - * @return {@code True} if one of the causing exception is an instance of passed in classes, - * {@code false} otherwise. - */ - public static boolean hasCauseExcludeRoot(@Nullable Throwable t, @Nullable Class<? extends Throwable>... cls) { - if (t == null || F.isEmpty(cls)) - return false; - - assert cls != null; - - for (Throwable th = t.getCause(); th != null; th = th.getCause()) { - for (Class<? extends Throwable> c : cls) { - if (c.isAssignableFrom(th.getClass())) - return true; - } - - if (th.getCause() == th) - break; - } - - for (Throwable n : t.getSuppressed()) { - if (hasCause(n, cls)) - return true; - } - - return false; - } - - /** * Gets first cause if passed in {@code 'Throwable'} has given class in {@code 'cause'} hierarchy. * <p> * Note that this method follows includes {@link Throwable#getSuppressed()} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/878a2890/modules/core/src/test/java/org/apache/ignite/IgniteExceptionHelpLinksSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/IgniteExceptionHelpLinksSelfTest.java b/modules/core/src/test/java/org/apache/ignite/IgniteExceptionHelpLinksSelfTest.java deleted file mode 100644 index d555c41..0000000 --- a/modules/core/src/test/java/org/apache/ignite/IgniteExceptionHelpLinksSelfTest.java +++ /dev/null @@ -1,105 +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; - -import junit.framework.*; -import org.jetbrains.annotations.*; - -import java.util.*; - -import static org.apache.ignite.internal.util.IgniteUtils.*; - -/** - * Tests for proper link output in stack traces. - */ -public class IgniteExceptionHelpLinksSelfTest extends TestCase { - /** - * @throws Exception If failed. - */ - public void testDefaultLinks() throws Exception { - assertTrue(hasLinksInMessage(new IgniteCheckedException("test"), DFLT_HELP_LINKS)); - assertTrue(hasLinksInMessage(new IgniteCheckedException(new Exception()), DFLT_HELP_LINKS)); - assertTrue(hasLinksInMessage(new IgniteCheckedException("test", new Exception()), DFLT_HELP_LINKS)); - - assertTrue(hasLinksInMessage(new IgniteException("test"), DFLT_HELP_LINKS)); - assertTrue(hasLinksInMessage(new IgniteException(new Exception()), DFLT_HELP_LINKS)); - assertTrue(hasLinksInMessage(new IgniteException("test", new Exception()), DFLT_HELP_LINKS)); - } - - /** - * Tests default links suppression. - */ - public void testLinksUniqueness() { - assertLinksAppearOnce( - new IgniteCheckedException("test", - new IgniteCheckedException("test nested", - new IgniteCheckedException("last"))), - DFLT_HELP_LINKS); - - assertLinksAppearOnce( - new IgniteException("test", - new IgniteException("test nested", - new IgniteException("last"))), - DFLT_HELP_LINKS); - - assertLinksAppearOnce( - new IgniteCheckedException("test", - new IgniteException("test nested", - new IgniteCheckedException("last"))), - DFLT_HELP_LINKS); - - assertLinksAppearOnce( - new IgniteException("test", - new IgniteCheckedException("test nested", - new IgniteException("last"))), - DFLT_HELP_LINKS); - } - - /** - * @param e Root exception. - * @param links Set of links to ensure present only once in full stack trace. - */ - @SuppressWarnings("TypeMayBeWeakened") - private void assertLinksAppearOnce(Throwable e, List<String>... links) { - Set<List<String>> seen = new HashSet<>(); - - while (e != null) { - for (List<String> l : links) - if (hasLinksInMessage(e, l)) - assertTrue(seen.add(l)); - - e = e.getCause(); - } - } - - /** - * @param e Exception - * @param links List of links. - * @return Whether exception has all passed links in it's message. - */ - private boolean hasLinksInMessage(Throwable e, @Nullable Iterable<String> links) { - if (links == null) - return true; - - for (String link : links) - if (!e.getMessage().contains(link)) - return false; - - return true; - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/878a2890/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java index 0463e11..6399dad 100644 --- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java +++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java @@ -68,7 +68,6 @@ public class IgniteBasicTestSuite extends TestSuite { suite.addTestSuite(GridStopWithCancelSelfTest.class); suite.addTestSuite(GridReduceSelfTest.class); suite.addTestSuite(GridEventConsumeSelfTest.class); - suite.addTestSuite(IgniteExceptionHelpLinksSelfTest.class); suite.addTestSuite(GridSuppressedExceptionSelfTest.class); suite.addTestSuite(GridLifecycleAwareSelfTest.class); suite.addTestSuite(GridMessageListenSelfTest.class);