Clover coverage report - QedeqKernelSe Coverage Report
Coverage timestamp: Sa Jan 26 2008 14:11:34 CET
file stats: LOC: 101   Methods: 2
NCLOC: 57   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
LoadXmlOperatorListUtility.java - 36,7% 50% 37,5%
coverage coverage
 1    /* $Id: LoadXmlOperatorListUtility.java,v 1.8 2008/01/26 12:39:10 m31 Exp $
 2    *
 3    * This file is part of the project "Hilbert II" - http://www.qedeq.org
 4    *
 5    * Copyright 2000-2007, Michael Meyling <mime@qedeq.org>.
 6    *
 7    * "Hilbert II" is free software; you can redistribute
 8    * it and/or modify it under the terms of the GNU General Public
 9    * License as published by the Free Software Foundation; either
 10    * version 2 of the License, or (at your option) any later version.
 11    *
 12    * This program is distributed in the hope that it will be useful,
 13    * but WITHOUT ANY WARRANTY; without even the implied warranty of
 14    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 15    * GNU General Public License for more details.
 16    */
 17   
 18    package org.qedeq.kernel.xml.handler.parser;
 19   
 20    import java.io.IOException;
 21    import java.net.URL;
 22    import java.util.List;
 23   
 24    import javax.xml.parsers.ParserConfigurationException;
 25   
 26    import org.qedeq.kernel.common.SourceFileExceptionList;
 27    import org.qedeq.kernel.trace.Trace;
 28    import org.qedeq.kernel.xml.parser.SaxDefaultHandler;
 29    import org.qedeq.kernel.xml.parser.SaxParser;
 30    import org.qedeq.kernel.xml.parser.DefaultSourceFileExceptionList;
 31    import org.xml.sax.SAXException;
 32    import org.xml.sax.SAXParseException;
 33   
 34   
 35    /**
 36    * Load operator list from an XML file.
 37    *
 38    * @version $Revision: 1.8 $
 39    * @author Michael Meyling
 40    */
 41    public final class LoadXmlOperatorListUtility {
 42   
 43    /** This class. */
 44    private static final Class CLASS = LoadXmlOperatorListUtility.class;
 45   
 46    /**
 47    * Constructor.
 48    */
 49  0 private LoadXmlOperatorListUtility() {
 50    // nothing to do
 51    }
 52   
 53    /**
 54    * Get operator list out of XML file.
 55    *
 56    * @param from Read this XML file.
 57    * @return Operator list.
 58    * @throws SourceFileExceptionList Loading failed.
 59    */
 60  94 public static List getOperatorList(final URL from) throws SourceFileExceptionList {
 61  94 final String method = "List getOperatorList(String)";
 62  94 try {
 63  94 Trace.begin(CLASS, method);
 64  94 Trace.param(CLASS, method, "from", from);
 65  94 SaxDefaultHandler handler = new SaxDefaultHandler();
 66  94 ParserHandler simple = new ParserHandler(handler);
 67  94 handler.setBasisDocumentHandler(simple);
 68  94 SaxParser parser = new SaxParser(handler);
 69  94 parser.parse(from, null);
 70  93 return simple.getOperators();
 71    } catch (RuntimeException e) {
 72  0 Trace.trace(CLASS, method, e);
 73  0 throw new DefaultSourceFileExceptionList(e);
 74    } catch (ParserConfigurationException e) {
 75  0 Trace.trace(CLASS, method, e);
 76  0 final DefaultSourceFileExceptionList list = new DefaultSourceFileExceptionList();
 77  0 list.add(e);
 78  0 throw list;
 79    } catch (final SAXParseException e) {
 80  0 Trace.trace(CLASS, method, e);
 81  0 final DefaultSourceFileExceptionList list = new DefaultSourceFileExceptionList();
 82  0 list.add(e);
 83  0 throw list;
 84    } catch (SAXException e) {
 85  0 Trace.trace(CLASS, method, e);
 86  0 final DefaultSourceFileExceptionList list = new DefaultSourceFileExceptionList();
 87  0 list.add(e);
 88  0 throw list;
 89    } catch (javax.xml.parsers.FactoryConfigurationError e) {
 90  0 Trace.trace(CLASS, method, e);
 91  0 final String msg = "SAX Parser not in classpath, "
 92    + "add for example \"xercesImpl.jar\" and \"xml-apis.jar\".";
 93  0 final DefaultSourceFileExceptionList list = new DefaultSourceFileExceptionList();
 94  0 list.add(new IOException(msg));
 95  0 throw list;
 96    } finally {
 97  94 Trace.end(CLASS, method);
 98    }
 99    }
 100   
 101    }