blob: d063a7c62f9acb4e0e3838e902426448b6ec236a [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2012, 2013 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0, which accompanies this distribution
* and is available at https://www.eclipse.org/legal/epl-2.0/.
*
* Contributors:
* Oracle - initial API and implementation
******************************************************************************/
package org.eclipse.jpt.common.utility.internal.exception;
import java.io.PrintStream;
/**
* An exception handler that prints the exceptions to the configured
* {@link PrintStream}.
*/
public class PrintStreamExceptionHandler
extends ExceptionHandlerAdapter
{
private final PrintStream printStream;
/**
* Construct an exception handler that prints any exceptions
* to the specified print stream.
*/
public PrintStreamExceptionHandler(PrintStream printStream) {
super();
if (printStream == null) {
throw new NullPointerException();
}
this.printStream = printStream;
}
@Override
public void handleException(Throwable t) {
t.printStackTrace(this.printStream);
}
}