EMMA Coverage Report (generated Sun Apr 20 22:38:01 CEST 2008)
[all classes][net.sf.jomic.tools]

COVERAGE SUMMARY FOR SOURCE FILE [ImagingExceptionThrowingImagingListener.java]

nameclass, %method, %block, %line, %
ImagingExceptionThrowingImagingListener.java100% (1/1)100% (2/2)97%  (35/36)99%  (5.9/6)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ImagingExceptionThrowingImagingListener100% (1/1)100% (2/2)97%  (35/36)99%  (5.9/6)
ImagingExceptionThrowingImagingListener (): void 100% (1/1)93%  (13/14)98%  (2.9/3)
errorOccurred (String, Throwable, Object, boolean): boolean 100% (1/1)100% (22/22)100% (3/3)

1// Jomic - a viewer for comic book archives.
2// Copyright (C) 2004-2008 Thomas Aglassinger
3//
4// This program is free software: you can redistribute it and/or modify
5// it under the terms of the GNU General Public License as published by
6// the Free Software Foundation, either version 3 of the License, or
7// (at your option) any later version.
8//
9// This program is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12// GNU General Public License for more details.
13//
14// You should have received a copy of the GNU General Public License
15// along with this program.  If not, see <http://www.gnu.org/licenses/>.
16package net.sf.jomic.tools;
17 
18 
19import javax.media.jai.util.ImagingException;
20import javax.media.jai.util.ImagingListener;
21 
22import net.sf.wraplog.Logger;
23 
24/**
25 *  ImagingListener to prevent JAI from dumping internal exceptions to <code>System.err</code>.
26 *  Instead, the exceptions are logged, but only if the logger related to this class is set to
27 *  <code>DEBUG</code>.
28 *
29 * @see       net.sf.wraplog.Logger#isDebugEnabled()
30 * @see       System#err
31 * @author    Thomas Aglassinger
32 */
33public class ImagingExceptionThrowingImagingListener implements ImagingListener
34{
35    private Logger logger;
36 
37    public ImagingExceptionThrowingImagingListener() {
38        logger = Logger.getLogger(ImagingExceptionThrowingImagingListener.class);
39    }
40 
41    public boolean errorOccurred(String message, Throwable error, Object where, boolean isRetryable) {
42        if (logger.isDebugEnabled()) {
43            logger.debug("JAI detected an error: " + message, error);
44        }
45        throw new ImagingException(message, error);
46    }
47}

[all classes][net.sf.jomic.tools]
EMMA 2.0.4217 (C) Vladimir Roubtsov