diff options
Diffstat (limited to 'common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/CollectingExceptionHandler.java')
-rw-r--r-- | common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/CollectingExceptionHandler.java | 54 |
1 files changed, 0 insertions, 54 deletions
diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/CollectingExceptionHandler.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/CollectingExceptionHandler.java deleted file mode 100644 index 93ac401f0a..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/CollectingExceptionHandler.java +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal; - -import java.util.Vector; -import org.eclipse.jpt.common.utility.ExceptionHandler; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable; -import org.eclipse.jpt.common.utility.internal.iterables.SnapshotCloneIterable; - -/** - * An exception handler that collects and hold the exceptions handed to it. - * They can be retrieved at a later time via calls to {@link #getExceptions()} - * and {{@link #clearExceptions()}. - */ -public class CollectingExceptionHandler - implements ExceptionHandler -{ - private final Vector<Throwable> exceptions = new Vector<Throwable>(); - - public void handleException(Throwable t) { - this.exceptions.add(t); - } - - /** - * Return the current list of exceptions handled by the handler so far. - */ - public Iterable<Throwable> getExceptions() { - return new LiveCloneIterable<Throwable>(this.exceptions); - } - - /** - * Clear and return the current list of exceptions handled by the handler - * so far. - */ - public Iterable<Throwable> clearExceptions() { - synchronized (this.exceptions) { - Iterable<Throwable> result = new SnapshotCloneIterable<Throwable>(this.exceptions); - this.exceptions.clear(); - return result; - } - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.exceptions); - } -} |