Coverage Report - org.crosswire.common.xml.XalanProcess
 
Classes in this File Line Coverage Branch Coverage Complexity
XalanProcess
0%
0/32
0%
0/2
6.5
 
 1  
 /**
 2  
  * Distribution License:
 3  
  * JSword is free software; you can redistribute it and/or modify it under
 4  
  * the terms of the GNU Lesser General Public License, version 2.1 or later
 5  
  * as published by the Free Software Foundation. This program is distributed
 6  
  * in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
 7  
  * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 8  
  * See the GNU Lesser General Public License for more details.
 9  
  *
 10  
  * The License is available on the internet at:
 11  
  *      http://www.gnu.org/copyleft/lgpl.html
 12  
  * or by writing to:
 13  
  *      Free Software Foundation, Inc.
 14  
  *      59 Temple Place - Suite 330
 15  
  *      Boston, MA 02111-1307, USA
 16  
  *
 17  
  * © CrossWire Bible Society, 2005 - 2016
 18  
  *
 19  
  */
 20  
 package org.crosswire.common.xml;
 21  
 
 22  
 import java.lang.reflect.InvocationTargetException;
 23  
 import java.lang.reflect.Method;
 24  
 
 25  
 import org.crosswire.common.util.ClassUtil;
 26  
 
 27  
 /**
 28  
  * Allows xalan's xslt process class to be invoked as a command line
 29  
  * application. Java 5 has renamed the main routine to _main. This class
 30  
  * normalizes the difference between Java 1.4 and 1.5 (aka 5).
 31  
  * 
 32  
  * @see gnu.lgpl.License The GNU Lesser General Public License for details.
 33  
  * @author DM Smith
 34  
  */
 35  
 public final class XalanProcess {
 36  
     /**
 37  
      * This is a utility class so the constructor is hidden.
 38  
      */
 39  0
     private XalanProcess() {
 40  0
     }
 41  
 
 42  
     /**
 43  
      * Run xalan's xslt process main.
 44  
      * 
 45  
      * @param args the arguments for the xslt process
 46  
      */
 47  
     public static void main(String[] args) {
 48  0
         Class<?> clazz = null;
 49  0
         Method main = null;
 50  
         try {
 51  
             // Try for 1.5.x
 52  0
             clazz = ClassUtil.forName("com.sun.org.apache.xalan.internal.xslt.Process");
 53  0
             main = clazz.getMethod("_main", new Class[] { String[].class});
 54  0
         } catch (ClassNotFoundException e) {
 55  
             try {
 56  
                 // Try for 1.4.x
 57  0
                 clazz = ClassUtil.forName("org.apache.xalan.xslt.Process");
 58  0
                 main = clazz.getMethod("main", new Class[] { String[].class});
 59  0
             } catch (ClassNotFoundException ex) {
 60  0
                 ex.printStackTrace(System.err);
 61  0
             } catch (SecurityException ex) {
 62  0
                 ex.printStackTrace(System.err);
 63  0
             } catch (NoSuchMethodException ex) {
 64  0
                 ex.printStackTrace(System.err);
 65  0
             }
 66  0
         } catch (SecurityException ex) {
 67  0
             ex.printStackTrace(System.err);
 68  0
         } catch (NoSuchMethodException ex) {
 69  0
             ex.printStackTrace(System.err);
 70  0
             return;
 71  0
         }
 72  
 
 73  
         try {
 74  0
             if (main != null) {
 75  0
                 main.invoke(null, (Object[]) args);
 76  
             }
 77  0
         } catch (IllegalArgumentException ex) {
 78  0
             ex.printStackTrace(System.err);
 79  0
         } catch (IllegalAccessException ex) {
 80  0
             ex.printStackTrace(System.err);
 81  0
         } catch (InvocationTargetException ex) {
 82  0
             ex.printStackTrace(System.err);
 83  0
         }
 84  0
     }
 85  
 }