Skip to main content
summaryrefslogtreecommitdiffstats
blob: 4b1e16dd5ab499420b12717dfe23ee8671b231d0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/*******************************************************************************
 * 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.io.PrintWriter;

/**
 * An exception handler that prints the exceptions to the configured
 * {@link PrintWriter}.
 */
public class PrintWriterExceptionHandler
	extends ExceptionHandlerAdapter
{
	private final PrintWriter printWriter;

	/**
	 * Construct an exception handler that prints any exceptions
	 * to the specified print writer.
	 */
	public PrintWriterExceptionHandler(PrintWriter printWriter) {
		super();
		if (printWriter == null) {
			throw new NullPointerException();
		}
		this.printWriter = printWriter;
	}

	@Override
	public void handleException(Throwable t) {
		t.printStackTrace(this.printWriter);
	}
}

Back to the top