Source Code Cross Referenced for EnvironmentCheck.java in  » XML » xalan » org » apache » xalan » xslt » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » XML » xalan » org.apache.xalan.xslt 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


0001:        /*
0002:         * Copyright 2001-2004 The Apache Software Foundation.
0003:         *
0004:         * Licensed under the Apache License, Version 2.0 (the "License");
0005:         * you may not use this file except in compliance with the License.
0006:         * You may obtain a copy of the License at
0007:         *
0008:         *     http://www.apache.org/licenses/LICENSE-2.0
0009:         *
0010:         * Unless required by applicable law or agreed to in writing, software
0011:         * distributed under the License is distributed on an "AS IS" BASIS,
0012:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0013:         * See the License for the specific language governing permissions and
0014:         * limitations under the License.
0015:         */
0016:        /*
0017:         * $Id: EnvironmentCheck.java,v 1.29 2005/07/27 19:21:04 mcnamara Exp $
0018:         */
0019:        package org.apache.xalan.xslt;
0020:
0021:        import java.io.File;
0022:        import java.io.FileWriter;
0023:        import java.io.PrintWriter;
0024:        import java.lang.reflect.Field;
0025:        import java.lang.reflect.Method;
0026:        import java.util.Enumeration;
0027:        import java.util.Hashtable;
0028:        import java.util.StringTokenizer;
0029:        import java.util.Vector;
0030:
0031:        import org.w3c.dom.Document;
0032:        import org.w3c.dom.Element;
0033:        import org.w3c.dom.Node;
0034:
0035:        /**
0036:         * Utility class to report simple information about the environment.
0037:         * Simplistic reporting about certain classes found in your JVM may 
0038:         * help answer some FAQs for simple problems.
0039:         *
0040:         * <p>Usage-command line:  
0041:         * <code>
0042:         * java org.apache.xalan.xslt.EnvironmentCheck [-out outFile]
0043:         * </code></p>
0044:         * 
0045:         * <p>Usage-from program:  
0046:         * <code>
0047:         * boolean environmentOK = 
0048:         * (new EnvironmentCheck()).checkEnvironment(yourPrintWriter);
0049:         * </code></p>
0050:         *
0051:         * <p>Usage-from stylesheet:  
0052:         * <code><pre>
0053:         *    &lt;?xml version="1.0"?&gt;
0054:         *    &lt;xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
0055:         *        xmlns:xalan="http://xml.apache.org/xalan"
0056:         *        exclude-result-prefixes="xalan"&gt;
0057:         *    &lt;xsl:output indent="yes"/&gt;
0058:         *    &lt;xsl:template match="/"&gt;
0059:         *      &lt;xsl:copy-of select="xalan:checkEnvironment()"/&gt;
0060:         *    &lt;/xsl:template&gt;
0061:         *    &lt;/xsl:stylesheet&gt;
0062:         * </pre></code></p>
0063:         *  
0064:         * <p>Xalan users reporting problems are encouraged to use this class 
0065:         * to see if there are potential problems with their actual 
0066:         * Java environment <b>before</b> reporting a bug.  Note that you 
0067:         * should both check from the JVM/JRE's command line as well as 
0068:         * temporarily calling checkEnvironment() directly from your code, 
0069:         * since the classpath may differ (especially for servlets, etc).</p>
0070:         *
0071:         * <p>Also see http://xml.apache.org/xalan-j/faq.html</p>
0072:         *
0073:         * <p>Note: This class is pretty simplistic: 
0074:         * results are not necessarily definitive nor will it find all 
0075:         * problems related to environment setup.  Also, you should avoid 
0076:         * calling this in deployed production code, both because it is 
0077:         * quite slow and because it forces classes to get loaded.</p>
0078:         *
0079:         * <p>Note: This class explicitly has very limited compile-time 
0080:         * dependencies to enable easy compilation and usage even when 
0081:         * Xalan, DOM/SAX/JAXP, etc. are not present.</p>
0082:         * 
0083:         * <p>Note: for an improved version of this utility, please see 
0084:         * the xml-commons' project Which utility which does the same kind 
0085:         * of thing but in a much simpler manner.</p>
0086:         *
0087:         * @author Shane_Curcuru@us.ibm.com
0088:         * @version $Id: EnvironmentCheck.java,v 1.29 2005/07/27 19:21:04 mcnamara Exp $
0089:         */
0090:        public class EnvironmentCheck {
0091:
0092:            /**
0093:             * Command line runnability: checks for [-out outFilename] arg.
0094:             * <p>Command line entrypoint; Sets output and calls 
0095:             * {@link #checkEnvironment(PrintWriter)}.</p>
0096:             * @param args command line args
0097:             */
0098:            public static void main(String[] args) {
0099:                // Default to System.out, autoflushing
0100:                PrintWriter sendOutputTo = new PrintWriter(System.out, true);
0101:
0102:                // Read our simplistic input args, if supplied
0103:                for (int i = 0; i < args.length; i++) {
0104:                    if ("-out".equalsIgnoreCase(args[i])) {
0105:                        i++;
0106:
0107:                        if (i < args.length) {
0108:                            try {
0109:                                sendOutputTo = new PrintWriter(new FileWriter(
0110:                                        args[i], true));
0111:                            } catch (Exception e) {
0112:                                System.err.println("# WARNING: -out " + args[i]
0113:                                        + " threw " + e.toString());
0114:                            }
0115:                        } else {
0116:                            System.err
0117:                                    .println("# WARNING: -out argument should have a filename, output sent to console");
0118:                        }
0119:                    }
0120:                }
0121:
0122:                EnvironmentCheck app = new EnvironmentCheck();
0123:                app.checkEnvironment(sendOutputTo);
0124:            }
0125:
0126:            /**
0127:             * Programmatic entrypoint: Report on basic Java environment 
0128:             * and CLASSPATH settings that affect Xalan.
0129:             *
0130:             * <p>Note that this class is not advanced enough to tell you 
0131:             * everything about the environment that affects Xalan, and 
0132:             * sometimes reports errors that will not actually affect 
0133:             * Xalan's behavior.  Currently, it very simplistically 
0134:             * checks the JVM's environment for some basic properties and 
0135:             * logs them out; it will report a problem if it finds a setting 
0136:             * or .jar file that is <i>likely</i> to cause problems.</p>
0137:             *
0138:             * <p>Advanced users can peruse the code herein to help them 
0139:             * investigate potential environment problems found; other users 
0140:             * may simply send the output from this tool along with any bugs 
0141:             * they submit to help us in the debugging process.</p>
0142:             *
0143:             * @param pw PrintWriter to send output to; can be sent to a 
0144:             * file that will look similar to a Properties file; defaults 
0145:             * to System.out if null
0146:             * @return true if your environment appears to have no major 
0147:             * problems; false if potential environment problems found
0148:             * @see #getEnvironmentHash()
0149:             */
0150:            public boolean checkEnvironment(PrintWriter pw) {
0151:
0152:                // Use user-specified output writer if non-null
0153:                if (null != pw)
0154:                    outWriter = pw;
0155:
0156:                // Setup a hash to store various environment information in
0157:                Hashtable hash = getEnvironmentHash();
0158:
0159:                // Check for ERROR keys in the hashtable, and print report
0160:                boolean environmentHasErrors = writeEnvironmentReport(hash);
0161:
0162:                if (environmentHasErrors) {
0163:                    // Note: many logMsg calls have # at the start to 
0164:                    //  fake a property-file like output
0165:                    logMsg("# WARNING: Potential problems found in your environment!");
0166:                    logMsg("#    Check any 'ERROR' items above against the Xalan FAQs");
0167:                    logMsg("#    to correct potential problems with your classes/jars");
0168:                    logMsg("#    http://xml.apache.org/xalan-j/faq.html");
0169:                    if (null != outWriter)
0170:                        outWriter.flush();
0171:                    return false;
0172:                } else {
0173:                    logMsg("# YAHOO! Your environment seems to be OK.");
0174:                    if (null != outWriter)
0175:                        outWriter.flush();
0176:                    return true;
0177:                }
0178:            }
0179:
0180:            /**
0181:             * Fill a hash with basic environment settings that affect Xalan.
0182:             *
0183:             * <p>Worker method called from various places.</p>
0184:             * <p>Various system and CLASSPATH, etc. properties are put into 
0185:             * the hash as keys with a brief description of the current state 
0186:             * of that item as the value.  Any serious problems will be put in 
0187:             * with a key that is prefixed with {@link #ERROR 'ERROR.'} so it
0188:             * stands out in any resulting report; also a key with just that 
0189:             * constant will be set as well for any error.</p>
0190:             * <p>Note that some legitimate cases are flaged as potential 
0191:             * errors - namely when a developer recompiles xalan.jar on their 
0192:             * own - and even a non-error state doesn't guaruntee that 
0193:             * everything in the environment is correct.  But this will help 
0194:             * point out the most common classpath and system property
0195:             * problems that we've seen.</p>   
0196:             *
0197:             * @return Hashtable full of useful environment info about Xalan 
0198:             * and related system properties, etc.
0199:             */
0200:            public Hashtable getEnvironmentHash() {
0201:                // Setup a hash to store various environment information in
0202:                Hashtable hash = new Hashtable();
0203:
0204:                // Call various worker methods to fill in the hash
0205:                //  These are explicitly separate for maintenance and so 
0206:                //  advanced users could call them standalone
0207:                checkJAXPVersion(hash);
0208:                checkProcessorVersion(hash);
0209:                checkParserVersion(hash);
0210:                checkAntVersion(hash);
0211:                checkDOMVersion(hash);
0212:                checkSAXVersion(hash);
0213:                checkSystemProperties(hash);
0214:
0215:                return hash;
0216:            }
0217:
0218:            /**
0219:             * Dump a basic Xalan environment report to outWriter.  
0220:             *
0221:             * <p>This dumps a simple header and then each of the entries in 
0222:             * the Hashtable to our PrintWriter; it does special processing 
0223:             * for entries that are .jars found in the classpath.</p>
0224:             *
0225:             * @param h Hashtable of items to report on; presumably
0226:             * filled in by our various check*() methods
0227:             * @return true if your environment appears to have no major 
0228:             * problems; false if potential environment problems found
0229:             * @see #appendEnvironmentReport(Node, Document, Hashtable)
0230:             * for an equivalent that appends to a Node instead
0231:             */
0232:            protected boolean writeEnvironmentReport(Hashtable h) {
0233:
0234:                if (null == h) {
0235:                    logMsg("# ERROR: writeEnvironmentReport called with null Hashtable");
0236:                    return false;
0237:                }
0238:
0239:                boolean errors = false;
0240:
0241:                logMsg("#---- BEGIN writeEnvironmentReport($Revision: 1.29 $): Useful stuff found: ----");
0242:
0243:                // Fake the Properties-like output
0244:                for (Enumeration keys = h.keys(); keys.hasMoreElements();
0245:                /* no increment portion */
0246:                ) {
0247:                    Object key = keys.nextElement();
0248:                    String keyStr = (String) key;
0249:                    try {
0250:                        // Special processing for classes found..
0251:                        if (keyStr.startsWith(FOUNDCLASSES)) {
0252:                            Vector v = (Vector) h.get(keyStr);
0253:                            errors |= logFoundJars(v, keyStr);
0254:                        }
0255:                        // ..normal processing for all other entries
0256:                        else {
0257:                            // Note: we could just check for the ERROR key by itself, 
0258:                            //    since we now set that, but since we have to go 
0259:                            //    through the whole hash anyway, do it this way,
0260:                            //    which is safer for maintenance
0261:                            if (keyStr.startsWith(ERROR)) {
0262:                                errors = true;
0263:                            }
0264:                            logMsg(keyStr + "=" + h.get(keyStr));
0265:                        }
0266:                    } catch (Exception e) {
0267:                        logMsg("Reading-" + key + "= threw: " + e.toString());
0268:                    }
0269:                }
0270:
0271:                logMsg("#----- END writeEnvironmentReport: Useful properties found: -----");
0272:
0273:                return errors;
0274:            }
0275:
0276:            /** Prefixed to hash keys that signify serious problems.  */
0277:            public static final String ERROR = "ERROR.";
0278:
0279:            /** Added to descriptions that signify potential problems.  */
0280:            public static final String WARNING = "WARNING.";
0281:
0282:            /** Value for any error found.  */
0283:            public static final String ERROR_FOUND = "At least one error was found!";
0284:
0285:            /** Prefixed to hash keys that signify version numbers.  */
0286:            public static final String VERSION = "version.";
0287:
0288:            /** Prefixed to hash keys that signify .jars found in classpath.  */
0289:            public static final String FOUNDCLASSES = "foundclasses.";
0290:
0291:            /** Marker that a class or .jar was found.  */
0292:            public static final String CLASS_PRESENT = "present-unknown-version";
0293:
0294:            /** Marker that a class or .jar was not found.  */
0295:            public static final String CLASS_NOTPRESENT = "not-present";
0296:
0297:            /** Listing of common .jar files that include Xalan-related classes.  */
0298:            public String[] jarNames = {
0299:                    "xalan.jar",
0300:                    "xalansamples.jar",
0301:                    "xalanj1compat.jar",
0302:                    "xalanservlet.jar",
0303:                    "serializer.jar", // Serializer (shared between Xalan & Xerces)
0304:                    "xerces.jar", // Xerces-J 1.x
0305:                    "xercesImpl.jar", // Xerces-J 2.x
0306:                    "testxsl.jar", "crimson.jar", "lotusxsl.jar", "jaxp.jar",
0307:                    "parser.jar", "dom.jar", "sax.jar", "xml.jar",
0308:                    "xml-apis.jar", "xsltc.jar" };
0309:
0310:            /**
0311:             * Print out report of .jars found in a classpath. 
0312:             *
0313:             * Takes the information encoded from a checkPathForJars() 
0314:             * call and dumps it out to our PrintWriter.
0315:             *
0316:             * @param v Vector of Hashtables of .jar file info
0317:             * @param desc description to print out in header
0318:             *
0319:             * @return false if OK, true if any .jars were reported 
0320:             * as having errors
0321:             * @see #checkPathForJars(String, String[])
0322:             */
0323:            protected boolean logFoundJars(Vector v, String desc) {
0324:
0325:                if ((null == v) || (v.size() < 1))
0326:                    return false;
0327:
0328:                boolean errors = false;
0329:
0330:                logMsg("#---- BEGIN Listing XML-related jars in: " + desc
0331:                        + " ----");
0332:
0333:                for (int i = 0; i < v.size(); i++) {
0334:                    Hashtable subhash = (Hashtable) v.elementAt(i);
0335:
0336:                    for (Enumeration keys = subhash.keys(); keys
0337:                            .hasMoreElements();
0338:                    /* no increment portion */
0339:                    ) {
0340:                        Object key = keys.nextElement();
0341:                        String keyStr = (String) key;
0342:                        try {
0343:                            if (keyStr.startsWith(ERROR)) {
0344:                                errors = true;
0345:                            }
0346:                            logMsg(keyStr + "=" + subhash.get(keyStr));
0347:
0348:                        } catch (Exception e) {
0349:                            errors = true;
0350:                            logMsg("Reading-" + key + "= threw: "
0351:                                    + e.toString());
0352:                        }
0353:                    }
0354:                }
0355:
0356:                logMsg("#----- END Listing XML-related jars in: " + desc
0357:                        + " -----");
0358:
0359:                return errors;
0360:            }
0361:
0362:            /**
0363:             * Stylesheet extension entrypoint: Dump a basic Xalan 
0364:             * environment report from getEnvironmentHash() to a Node.  
0365:             * 
0366:             * <p>Copy of writeEnvironmentReport that creates a Node suitable 
0367:             * for other processing instead of a properties-like text output.
0368:             * </p>
0369:             * @param container Node to append our report to
0370:             * @param factory Document providing createElement, etc. services
0371:             * @param h Hash presumably from {@link #getEnvironmentHash()}
0372:             * @see #writeEnvironmentReport(Hashtable)
0373:             * for an equivalent that writes to a PrintWriter instead
0374:             */
0375:            public void appendEnvironmentReport(Node container,
0376:                    Document factory, Hashtable h) {
0377:                if ((null == container) || (null == factory)) {
0378:                    return;
0379:                }
0380:
0381:                try {
0382:                    Element envCheckNode = factory
0383:                            .createElement("EnvironmentCheck");
0384:                    envCheckNode.setAttribute("version", "$Revision: 1.29 $");
0385:                    container.appendChild(envCheckNode);
0386:
0387:                    if (null == h) {
0388:                        Element statusNode = factory.createElement("status");
0389:                        statusNode.setAttribute("result", "ERROR");
0390:                        statusNode
0391:                                .appendChild(factory
0392:                                        .createTextNode("appendEnvironmentReport called with null Hashtable!"));
0393:                        envCheckNode.appendChild(statusNode);
0394:                        return;
0395:                    }
0396:
0397:                    boolean errors = false;
0398:
0399:                    Element hashNode = factory.createElement("environment");
0400:                    envCheckNode.appendChild(hashNode);
0401:
0402:                    for (Enumeration keys = h.keys(); keys.hasMoreElements();
0403:                    /* no increment portion */
0404:                    ) {
0405:                        Object key = keys.nextElement();
0406:                        String keyStr = (String) key;
0407:                        try {
0408:                            // Special processing for classes found..
0409:                            if (keyStr.startsWith(FOUNDCLASSES)) {
0410:                                Vector v = (Vector) h.get(keyStr);
0411:                                // errors |= logFoundJars(v, keyStr);
0412:                                errors |= appendFoundJars(hashNode, factory, v,
0413:                                        keyStr);
0414:                            }
0415:                            // ..normal processing for all other entries
0416:                            else {
0417:                                // Note: we could just check for the ERROR key by itself, 
0418:                                //    since we now set that, but since we have to go 
0419:                                //    through the whole hash anyway, do it this way,
0420:                                //    which is safer for maintenance
0421:                                if (keyStr.startsWith(ERROR)) {
0422:                                    errors = true;
0423:                                }
0424:                                Element node = factory.createElement("item");
0425:                                node.setAttribute("key", keyStr);
0426:                                node
0427:                                        .appendChild(factory
0428:                                                .createTextNode((String) h
0429:                                                        .get(keyStr)));
0430:                                hashNode.appendChild(node);
0431:                            }
0432:                        } catch (Exception e) {
0433:                            errors = true;
0434:                            Element node = factory.createElement("item");
0435:                            node.setAttribute("key", keyStr);
0436:                            node.appendChild(factory.createTextNode(ERROR
0437:                                    + " Reading " + key + " threw: "
0438:                                    + e.toString()));
0439:                            hashNode.appendChild(node);
0440:                        }
0441:                    } // end of for...
0442:
0443:                    Element statusNode = factory.createElement("status");
0444:                    statusNode
0445:                            .setAttribute("result", (errors ? "ERROR" : "OK"));
0446:                    envCheckNode.appendChild(statusNode);
0447:                } catch (Exception e2) {
0448:                    System.err.println("appendEnvironmentReport threw: "
0449:                            + e2.toString());
0450:                    e2.printStackTrace();
0451:                }
0452:            }
0453:
0454:            /**
0455:             * Print out report of .jars found in a classpath. 
0456:             *
0457:             * Takes the information encoded from a checkPathForJars() 
0458:             * call and dumps it out to our PrintWriter.
0459:             *
0460:             * @param container Node to append our report to
0461:             * @param factory Document providing createElement, etc. services
0462:             * @param v Vector of Hashtables of .jar file info
0463:             * @param desc description to print out in header
0464:             *
0465:             * @return false if OK, true if any .jars were reported 
0466:             * as having errors
0467:             * @see #checkPathForJars(String, String[])
0468:             */
0469:            protected boolean appendFoundJars(Node container, Document factory,
0470:                    Vector v, String desc) {
0471:
0472:                if ((null == v) || (v.size() < 1))
0473:                    return false;
0474:
0475:                boolean errors = false;
0476:
0477:                for (int i = 0; i < v.size(); i++) {
0478:                    Hashtable subhash = (Hashtable) v.elementAt(i);
0479:
0480:                    for (Enumeration keys = subhash.keys(); keys
0481:                            .hasMoreElements();
0482:                    /* no increment portion */
0483:                    ) {
0484:                        Object key = keys.nextElement();
0485:                        try {
0486:                            String keyStr = (String) key;
0487:                            if (keyStr.startsWith(ERROR)) {
0488:                                errors = true;
0489:                            }
0490:                            Element node = factory.createElement("foundJar");
0491:                            node.setAttribute("name", keyStr.substring(0,
0492:                                    keyStr.indexOf("-")));
0493:                            node.setAttribute("desc", keyStr.substring(keyStr
0494:                                    .indexOf("-") + 1));
0495:                            node.appendChild(factory
0496:                                    .createTextNode((String) subhash
0497:                                            .get(keyStr)));
0498:                            container.appendChild(node);
0499:                        } catch (Exception e) {
0500:                            errors = true;
0501:                            Element node = factory.createElement("foundJar");
0502:                            node.appendChild(factory.createTextNode(ERROR
0503:                                    + " Reading " + key + " threw: "
0504:                                    + e.toString()));
0505:                            container.appendChild(node);
0506:                        }
0507:                    }
0508:                }
0509:                return errors;
0510:            }
0511:
0512:            /**
0513:             * Fillin hash with info about SystemProperties.  
0514:             *
0515:             * Logs java.class.path and other likely paths; then attempts 
0516:             * to search those paths for .jar files with Xalan-related classes.
0517:             *
0518:             * //@todo NOTE: We don't actually search java.ext.dirs for 
0519:             * //  *.jar files therein! This should be updated
0520:             *
0521:             * @param h Hashtable to put information in
0522:             * @see #jarNames
0523:             * @see #checkPathForJars(String, String[])
0524:             */
0525:            protected void checkSystemProperties(Hashtable h) {
0526:
0527:                if (null == h)
0528:                    h = new Hashtable();
0529:
0530:                // Grab java version for later use
0531:                try {
0532:                    String javaVersion = System.getProperty("java.version");
0533:
0534:                    h.put("java.version", javaVersion);
0535:                } catch (SecurityException se) {
0536:
0537:                    // For applet context, etc.
0538:                    h
0539:                            .put("java.version",
0540:                                    "WARNING: SecurityException thrown accessing system version properties");
0541:                }
0542:
0543:                // Printout jar files on classpath(s) that may affect operation
0544:                //  Do this in order
0545:                try {
0546:
0547:                    // This is present in all JVM's
0548:                    String cp = System.getProperty("java.class.path");
0549:
0550:                    h.put("java.class.path", cp);
0551:
0552:                    Vector classpathJars = checkPathForJars(cp, jarNames);
0553:
0554:                    if (null != classpathJars)
0555:                        h.put(FOUNDCLASSES + "java.class.path", classpathJars);
0556:
0557:                    // Also check for JDK 1.2+ type classpaths
0558:                    String othercp = System.getProperty("sun.boot.class.path");
0559:
0560:                    if (null != othercp) {
0561:                        h.put("sun.boot.class.path", othercp);
0562:
0563:                        classpathJars = checkPathForJars(othercp, jarNames);
0564:
0565:                        if (null != classpathJars)
0566:                            h.put(FOUNDCLASSES + "sun.boot.class.path",
0567:                                    classpathJars);
0568:                    }
0569:
0570:                    //@todo NOTE: We don't actually search java.ext.dirs for 
0571:                    //  *.jar files therein! This should be updated
0572:                    othercp = System.getProperty("java.ext.dirs");
0573:
0574:                    if (null != othercp) {
0575:                        h.put("java.ext.dirs", othercp);
0576:
0577:                        classpathJars = checkPathForJars(othercp, jarNames);
0578:
0579:                        if (null != classpathJars)
0580:                            h
0581:                                    .put(FOUNDCLASSES + "java.ext.dirs",
0582:                                            classpathJars);
0583:                    }
0584:
0585:                    //@todo also check other System properties' paths?
0586:                    //  v2 = checkPathForJars(System.getProperty("sun.boot.library.path"), jarNames);   // ?? may not be needed
0587:                    //  v3 = checkPathForJars(System.getProperty("java.library.path"), jarNames);   // ?? may not be needed
0588:                } catch (SecurityException se2) {
0589:                    // For applet context, etc.
0590:                    h
0591:                            .put("java.class.path",
0592:                                    "WARNING: SecurityException thrown accessing system classpath properties");
0593:                }
0594:            }
0595:
0596:            /**
0597:             * Cheap-o listing of specified .jars found in the classpath. 
0598:             *
0599:             * cp should be separated by the usual File.pathSeparator.  We 
0600:             * then do a simplistic search of the path for any requested 
0601:             * .jar filenames, and return a listing of their names and 
0602:             * where (apparently) they came from.
0603:             *
0604:             * @param cp classpath to search
0605:             * @param jars array of .jar base filenames to look for
0606:             *
0607:             * @return Vector of Hashtables filled with info about found .jars
0608:             * @see #jarNames
0609:             * @see #logFoundJars(Vector, String)
0610:             * @see #appendFoundJars(Node, Document, Vector, String )
0611:             * @see #getApparentVersion(String, long)
0612:             */
0613:            protected Vector checkPathForJars(String cp, String[] jars) {
0614:
0615:                if ((null == cp) || (null == jars) || (0 == cp.length())
0616:                        || (0 == jars.length))
0617:                    return null;
0618:
0619:                Vector v = new Vector();
0620:                StringTokenizer st = new StringTokenizer(cp, File.pathSeparator);
0621:
0622:                while (st.hasMoreTokens()) {
0623:
0624:                    // Look at each classpath entry for each of our requested jarNames
0625:                    String filename = st.nextToken();
0626:
0627:                    for (int i = 0; i < jars.length; i++) {
0628:                        if (filename.indexOf(jars[i]) > -1) {
0629:                            File f = new File(filename);
0630:
0631:                            if (f.exists()) {
0632:
0633:                                // If any requested jarName exists, report on 
0634:                                //  the details of that .jar file
0635:                                try {
0636:                                    Hashtable h = new Hashtable(2);
0637:                                    // Note "-" char is looked for in appendFoundJars
0638:                                    h.put(jars[i] + "-path", f
0639:                                            .getAbsolutePath());
0640:
0641:                                    // We won't bother reporting on the xalan.jar apparent version
0642:                                    // since this requires knowing the jar size of the xalan.jar
0643:                                    // before we build it. 
0644:                                    // For other jars, eg. xml-apis.jar and xercesImpl.jar, we 
0645:                                    // report the apparent version of the file we've found
0646:                                    if (!("xalan.jar".equalsIgnoreCase(jars[i]))) {
0647:                                        h.put(jars[i] + "-apparent.version",
0648:                                                getApparentVersion(jars[i], f
0649:                                                        .length()));
0650:                                    }
0651:                                    v.addElement(h);
0652:                                } catch (Exception e) {
0653:
0654:                                    /* no-op, don't add it  */
0655:                                }
0656:                            } else {
0657:                                Hashtable h = new Hashtable(2);
0658:                                // Note "-" char is looked for in appendFoundJars
0659:                                h.put(jars[i] + "-path", WARNING
0660:                                        + " Classpath entry: " + filename
0661:                                        + " does not exist");
0662:                                h.put(jars[i] + "-apparent.version",
0663:                                        CLASS_NOTPRESENT);
0664:                                v.addElement(h);
0665:                            }
0666:                        }
0667:                    }
0668:                }
0669:
0670:                return v;
0671:            }
0672:
0673:            /**
0674:             * Cheap-o method to determine the product version of a .jar.   
0675:             *
0676:             * Currently does a lookup into a local table of some recent 
0677:             * shipped Xalan builds to determine where the .jar probably 
0678:             * came from.  Note that if you recompile Xalan or Xerces 
0679:             * yourself this will likely report a potential error, since 
0680:             * we can't certify builds other than the ones we ship.
0681:             * Only reports against selected posted Xalan-J builds.
0682:             *
0683:             * //@todo actually look up version info in manifests
0684:             *
0685:             * @param jarName base filename of the .jarfile
0686:             * @param jarSize size of the .jarfile
0687:             *
0688:             * @return String describing where the .jar file probably 
0689:             * came from
0690:             */
0691:            protected String getApparentVersion(String jarName, long jarSize) {
0692:                // If we found a matching size and it's for our 
0693:                //  jar, then return it's description
0694:                // Lookup in static jarVersions Hashtable
0695:                String foundSize = (String) jarVersions.get(new Long(jarSize));
0696:
0697:                if ((null != foundSize) && (foundSize.startsWith(jarName))) {
0698:                    return foundSize;
0699:                } else {
0700:                    if ("xerces.jar".equalsIgnoreCase(jarName)
0701:                            || "xercesImpl.jar".equalsIgnoreCase(jarName))
0702:                    //              || "xalan.jar".equalsIgnoreCase(jarName))
0703:                    {
0704:
0705:                        // For xalan.jar and xerces.jar/xercesImpl.jar, which we ship together:
0706:                        // The jar is not from a shipped copy of xalan-j, so 
0707:                        //  it's up to the user to ensure that it's compatible
0708:                        return jarName + " " + WARNING + CLASS_PRESENT;
0709:                    } else {
0710:
0711:                        // Otherwise, it's just a jar we don't have the version info calculated for
0712:                        return jarName + " " + CLASS_PRESENT;
0713:                    }
0714:                }
0715:            }
0716:
0717:            /**
0718:             * Report version information about JAXP interfaces.
0719:             *
0720:             * Currently distinguishes between JAXP 1.0.1 and JAXP 1.1, 
0721:             * and not found; only tests the interfaces, and does not 
0722:             * check for reference implementation versions.
0723:             *
0724:             * @param h Hashtable to put information in
0725:             */
0726:            protected void checkJAXPVersion(Hashtable h) {
0727:
0728:                if (null == h)
0729:                    h = new Hashtable();
0730:
0731:                final Class noArgs[] = new Class[0];
0732:                Class clazz = null;
0733:
0734:                try {
0735:                    final String JAXP1_CLASS = "javax.xml.parsers.DocumentBuilder";
0736:                    final String JAXP11_METHOD = "getDOMImplementation";
0737:
0738:                    clazz = ObjectFactory.findProviderClass(JAXP1_CLASS,
0739:                            ObjectFactory.findClassLoader(), true);
0740:
0741:                    Method method = clazz.getMethod(JAXP11_METHOD, noArgs);
0742:
0743:                    // If we succeeded, we at least have JAXP 1.1 available
0744:                    h.put(VERSION + "JAXP", "1.1 or higher");
0745:                } catch (Exception e) {
0746:                    if (null != clazz) {
0747:
0748:                        // We must have found the class itself, just not the 
0749:                        //  method, so we (probably) have JAXP 1.0.1
0750:                        h.put(ERROR + VERSION + "JAXP", "1.0.1");
0751:                        h.put(ERROR, ERROR_FOUND);
0752:                    } else {
0753:                        // We couldn't even find the class, and don't have 
0754:                        //  any JAXP support at all, or only have the 
0755:                        //  transform half of it
0756:                        h.put(ERROR + VERSION + "JAXP", CLASS_NOTPRESENT);
0757:                        h.put(ERROR, ERROR_FOUND);
0758:                    }
0759:                }
0760:            }
0761:
0762:            /**
0763:             * Report product version information from Xalan-J.
0764:             *
0765:             * Looks for version info in xalan.jar from Xalan-J products.
0766:             *
0767:             * @param h Hashtable to put information in
0768:             */
0769:            protected void checkProcessorVersion(Hashtable h) {
0770:
0771:                if (null == h)
0772:                    h = new Hashtable();
0773:
0774:                try {
0775:                    final String XALAN1_VERSION_CLASS = "org.apache.xalan.xslt.XSLProcessorVersion";
0776:
0777:                    Class clazz = ObjectFactory.findProviderClass(
0778:                            XALAN1_VERSION_CLASS, ObjectFactory
0779:                                    .findClassLoader(), true);
0780:
0781:                    // Found Xalan-J 1.x, grab it's version fields
0782:                    StringBuffer buf = new StringBuffer();
0783:                    Field f = clazz.getField("PRODUCT");
0784:
0785:                    buf.append(f.get(null));
0786:                    buf.append(';');
0787:
0788:                    f = clazz.getField("LANGUAGE");
0789:
0790:                    buf.append(f.get(null));
0791:                    buf.append(';');
0792:
0793:                    f = clazz.getField("S_VERSION");
0794:
0795:                    buf.append(f.get(null));
0796:                    buf.append(';');
0797:                    h.put(VERSION + "xalan1", buf.toString());
0798:                } catch (Exception e1) {
0799:                    h.put(VERSION + "xalan1", CLASS_NOTPRESENT);
0800:                }
0801:
0802:                try {
0803:                    // NOTE: This is the old Xalan 2.0, 2.1, 2.2 version class, 
0804:                    //    is being replaced by class below
0805:                    final String XALAN2_VERSION_CLASS = "org.apache.xalan.processor.XSLProcessorVersion";
0806:
0807:                    Class clazz = ObjectFactory.findProviderClass(
0808:                            XALAN2_VERSION_CLASS, ObjectFactory
0809:                                    .findClassLoader(), true);
0810:
0811:                    // Found Xalan-J 2.x, grab it's version fields
0812:                    StringBuffer buf = new StringBuffer();
0813:                    Field f = clazz.getField("S_VERSION");
0814:                    buf.append(f.get(null));
0815:
0816:                    h.put(VERSION + "xalan2x", buf.toString());
0817:                } catch (Exception e2) {
0818:                    h.put(VERSION + "xalan2x", CLASS_NOTPRESENT);
0819:                }
0820:                try {
0821:                    // NOTE: This is the new Xalan 2.2+ version class
0822:                    final String XALAN2_2_VERSION_CLASS = "org.apache.xalan.Version";
0823:                    final String XALAN2_2_VERSION_METHOD = "getVersion";
0824:                    final Class noArgs[] = new Class[0];
0825:
0826:                    Class clazz = ObjectFactory.findProviderClass(
0827:                            XALAN2_2_VERSION_CLASS, ObjectFactory
0828:                                    .findClassLoader(), true);
0829:
0830:                    Method method = clazz.getMethod(XALAN2_2_VERSION_METHOD,
0831:                            noArgs);
0832:                    Object returnValue = method.invoke(null, new Object[0]);
0833:
0834:                    h.put(VERSION + "xalan2_2", (String) returnValue);
0835:                } catch (Exception e2) {
0836:                    h.put(VERSION + "xalan2_2", CLASS_NOTPRESENT);
0837:                }
0838:            }
0839:
0840:            /**
0841:             * Report product version information from common parsers.
0842:             *
0843:             * Looks for version info in xerces.jar/xercesImpl.jar/crimson.jar.
0844:             *
0845:             * //@todo actually look up version info in crimson manifest
0846:             *
0847:             * @param h Hashtable to put information in
0848:             */
0849:            protected void checkParserVersion(Hashtable h) {
0850:
0851:                if (null == h)
0852:                    h = new Hashtable();
0853:
0854:                try {
0855:                    final String XERCES1_VERSION_CLASS = "org.apache.xerces.framework.Version";
0856:
0857:                    Class clazz = ObjectFactory.findProviderClass(
0858:                            XERCES1_VERSION_CLASS, ObjectFactory
0859:                                    .findClassLoader(), true);
0860:
0861:                    // Found Xerces-J 1.x, grab it's version fields
0862:                    Field f = clazz.getField("fVersion");
0863:                    String parserVersion = (String) f.get(null);
0864:
0865:                    h.put(VERSION + "xerces1", parserVersion);
0866:                } catch (Exception e) {
0867:                    h.put(VERSION + "xerces1", CLASS_NOTPRESENT);
0868:                }
0869:
0870:                // Look for xerces1 and xerces2 parsers separately
0871:                try {
0872:                    final String XERCES2_VERSION_CLASS = "org.apache.xerces.impl.Version";
0873:
0874:                    Class clazz = ObjectFactory.findProviderClass(
0875:                            XERCES2_VERSION_CLASS, ObjectFactory
0876:                                    .findClassLoader(), true);
0877:
0878:                    // Found Xerces-J 2.x, grab it's version fields
0879:                    Field f = clazz.getField("fVersion");
0880:                    String parserVersion = (String) f.get(null);
0881:
0882:                    h.put(VERSION + "xerces2", parserVersion);
0883:                } catch (Exception e) {
0884:                    h.put(VERSION + "xerces2", CLASS_NOTPRESENT);
0885:                }
0886:
0887:                try {
0888:                    final String CRIMSON_CLASS = "org.apache.crimson.parser.Parser2";
0889:
0890:                    Class clazz = ObjectFactory.findProviderClass(
0891:                            CRIMSON_CLASS, ObjectFactory.findClassLoader(),
0892:                            true);
0893:
0894:                    //@todo determine specific crimson version
0895:                    h.put(VERSION + "crimson", CLASS_PRESENT);
0896:                } catch (Exception e) {
0897:                    h.put(VERSION + "crimson", CLASS_NOTPRESENT);
0898:                }
0899:            }
0900:
0901:            /**
0902:             * Report product version information from Ant.
0903:             *
0904:             * @param h Hashtable to put information in
0905:             */
0906:            protected void checkAntVersion(Hashtable h) {
0907:
0908:                if (null == h)
0909:                    h = new Hashtable();
0910:
0911:                try {
0912:                    final String ANT_VERSION_CLASS = "org.apache.tools.ant.Main";
0913:                    final String ANT_VERSION_METHOD = "getAntVersion"; // noArgs
0914:                    final Class noArgs[] = new Class[0];
0915:
0916:                    Class clazz = ObjectFactory.findProviderClass(
0917:                            ANT_VERSION_CLASS, ObjectFactory.findClassLoader(),
0918:                            true);
0919:
0920:                    Method method = clazz.getMethod(ANT_VERSION_METHOD, noArgs);
0921:                    Object returnValue = method.invoke(null, new Object[0]);
0922:
0923:                    h.put(VERSION + "ant", (String) returnValue);
0924:                } catch (Exception e) {
0925:                    h.put(VERSION + "ant", CLASS_NOTPRESENT);
0926:                }
0927:            }
0928:
0929:            /**
0930:             * Report version info from DOM interfaces. 
0931:             *
0932:             * Currently distinguishes between pre-DOM level 2, the DOM 
0933:             * level 2 working draft, the DOM level 2 final draft, 
0934:             * and not found.
0935:             *
0936:             * @param h Hashtable to put information in
0937:             */
0938:            protected void checkDOMVersion(Hashtable h) {
0939:
0940:                if (null == h)
0941:                    h = new Hashtable();
0942:
0943:                final String DOM_LEVEL2_CLASS = "org.w3c.dom.Document";
0944:                final String DOM_LEVEL2_METHOD = "createElementNS"; // String, String
0945:                final String DOM_LEVEL2WD_CLASS = "org.w3c.dom.Node";
0946:                final String DOM_LEVEL2WD_METHOD = "supported"; // String, String
0947:                final String DOM_LEVEL2FD_CLASS = "org.w3c.dom.Node";
0948:                final String DOM_LEVEL2FD_METHOD = "isSupported"; // String, String
0949:                final Class twoStringArgs[] = { java.lang.String.class,
0950:                        java.lang.String.class };
0951:
0952:                try {
0953:                    Class clazz = ObjectFactory.findProviderClass(
0954:                            DOM_LEVEL2_CLASS, ObjectFactory.findClassLoader(),
0955:                            true);
0956:
0957:                    Method method = clazz.getMethod(DOM_LEVEL2_METHOD,
0958:                            twoStringArgs);
0959:
0960:                    // If we succeeded, we have loaded interfaces from a 
0961:                    //  level 2 DOM somewhere
0962:                    h.put(VERSION + "DOM", "2.0");
0963:
0964:                    try {
0965:                        // Check for the working draft version, which is 
0966:                        //  commonly found, but won't work anymore
0967:                        clazz = ObjectFactory.findProviderClass(
0968:                                DOM_LEVEL2WD_CLASS, ObjectFactory
0969:                                        .findClassLoader(), true);
0970:
0971:                        method = clazz.getMethod(DOM_LEVEL2WD_METHOD,
0972:                                twoStringArgs);
0973:
0974:                        h.put(ERROR + VERSION + "DOM.draftlevel", "2.0wd");
0975:                        h.put(ERROR, ERROR_FOUND);
0976:                    } catch (Exception e2) {
0977:                        try {
0978:                            // Check for the final draft version as well
0979:                            clazz = ObjectFactory.findProviderClass(
0980:                                    DOM_LEVEL2FD_CLASS, ObjectFactory
0981:                                            .findClassLoader(), true);
0982:
0983:                            method = clazz.getMethod(DOM_LEVEL2FD_METHOD,
0984:                                    twoStringArgs);
0985:
0986:                            h.put(VERSION + "DOM.draftlevel", "2.0fd");
0987:                        } catch (Exception e3) {
0988:                            h.put(ERROR + VERSION + "DOM.draftlevel",
0989:                                    "2.0unknown");
0990:                            h.put(ERROR, ERROR_FOUND);
0991:                        }
0992:                    }
0993:                } catch (Exception e) {
0994:                    h.put(ERROR + VERSION + "DOM",
0995:                            "ERROR attempting to load DOM level 2 class: "
0996:                                    + e.toString());
0997:                    h.put(ERROR, ERROR_FOUND);
0998:                }
0999:
1000:                //@todo load an actual DOM implmementation and query it as well
1001:                //@todo load an actual DOM implmementation and check if 
1002:                //  isNamespaceAware() == true, which is needed to parse 
1003:                //  xsl stylesheet files into a DOM
1004:            }
1005:
1006:            /**
1007:             * Report version info from SAX interfaces. 
1008:             *
1009:             * Currently distinguishes between SAX 2, SAX 2.0beta2, 
1010:             * SAX1, and not found.
1011:             *
1012:             * @param h Hashtable to put information in
1013:             */
1014:            protected void checkSAXVersion(Hashtable h) {
1015:
1016:                if (null == h)
1017:                    h = new Hashtable();
1018:
1019:                final String SAX_VERSION1_CLASS = "org.xml.sax.Parser";
1020:                final String SAX_VERSION1_METHOD = "parse"; // String
1021:                final String SAX_VERSION2_CLASS = "org.xml.sax.XMLReader";
1022:                final String SAX_VERSION2_METHOD = "parse"; // String
1023:                final String SAX_VERSION2BETA_CLASSNF = "org.xml.sax.helpers.AttributesImpl";
1024:                final String SAX_VERSION2BETA_METHODNF = "setAttributes"; // Attributes
1025:                final Class oneStringArg[] = { java.lang.String.class };
1026:                // Note this introduces a minor compile dependency on SAX...
1027:                final Class attributesArg[] = { org.xml.sax.Attributes.class };
1028:
1029:                try {
1030:                    // This method was only added in the final SAX 2.0 release; 
1031:                    //  see changes.html "Changes from SAX 2.0beta2 to SAX 2.0prerelease"
1032:                    Class clazz = ObjectFactory.findProviderClass(
1033:                            SAX_VERSION2BETA_CLASSNF, ObjectFactory
1034:                                    .findClassLoader(), true);
1035:
1036:                    Method method = clazz.getMethod(SAX_VERSION2BETA_METHODNF,
1037:                            attributesArg);
1038:
1039:                    // If we succeeded, we have loaded interfaces from a 
1040:                    //  real, final SAX version 2.0 somewhere
1041:                    h.put(VERSION + "SAX", "2.0");
1042:                } catch (Exception e) {
1043:                    // If we didn't find the SAX 2.0 class, look for a 2.0beta2
1044:                    h.put(ERROR + VERSION + "SAX",
1045:                            "ERROR attempting to load SAX version 2 class: "
1046:                                    + e.toString());
1047:                    h.put(ERROR, ERROR_FOUND);
1048:
1049:                    try {
1050:                        Class clazz = ObjectFactory.findProviderClass(
1051:                                SAX_VERSION2_CLASS, ObjectFactory
1052:                                        .findClassLoader(), true);
1053:
1054:                        Method method = clazz.getMethod(SAX_VERSION2_METHOD,
1055:                                oneStringArg);
1056:
1057:                        // If we succeeded, we have loaded interfaces from a 
1058:                        //  SAX version 2.0beta2 or earlier; these might work but 
1059:                        //  you should really have the final SAX 2.0 
1060:                        h.put(VERSION + "SAX-backlevel", "2.0beta2-or-earlier");
1061:                    } catch (Exception e2) {
1062:                        // If we didn't find the SAX 2.0beta2 class, look for a 1.0 one
1063:                        h.put(ERROR + VERSION + "SAX",
1064:                                "ERROR attempting to load SAX version 2 class: "
1065:                                        + e.toString());
1066:                        h.put(ERROR, ERROR_FOUND);
1067:
1068:                        try {
1069:                            Class clazz = ObjectFactory.findProviderClass(
1070:                                    SAX_VERSION1_CLASS, ObjectFactory
1071:                                            .findClassLoader(), true);
1072:
1073:                            Method method = clazz.getMethod(
1074:                                    SAX_VERSION1_METHOD, oneStringArg);
1075:
1076:                            // If we succeeded, we have loaded interfaces from a 
1077:                            //  SAX version 1.0 somewhere; which won't work very 
1078:                            //  well for JAXP 1.1 or beyond!
1079:                            h.put(VERSION + "SAX-backlevel", "1.0");
1080:                        } catch (Exception e3) {
1081:                            // If we didn't find the SAX 2.0 class, look for a 1.0 one
1082:                            // Note that either 1.0 or no SAX are both errors
1083:                            h.put(ERROR + VERSION + "SAX-backlevel",
1084:                                    "ERROR attempting to load SAX version 1 class: "
1085:                                            + e3.toString());
1086:
1087:                        }
1088:                    }
1089:                }
1090:            }
1091:
1092:            /** 
1093:             * Manual table of known .jar sizes.  
1094:             * Only includes shipped versions of certain projects.
1095:             * key=jarsize, value=jarname ' from ' distro name
1096:             * Note assumption: two jars cannot have the same size!
1097:             *
1098:             * @see #getApparentVersion(String, long)
1099:             */
1100:            private static Hashtable jarVersions = new Hashtable();
1101:
1102:            /** 
1103:             * Static initializer for jarVersions table.  
1104:             * Doing this just once saves time and space.
1105:             *
1106:             * @see #getApparentVersion(String, long)
1107:             */
1108:            static {
1109:                // Note: hackish Hashtable, this could use improvement
1110:                jarVersions.put(new Long(857192), "xalan.jar from xalan-j_1_1");
1111:                jarVersions.put(new Long(440237), "xalan.jar from xalan-j_1_2");
1112:                jarVersions.put(new Long(436094),
1113:                        "xalan.jar from xalan-j_1_2_1");
1114:                jarVersions.put(new Long(426249),
1115:                        "xalan.jar from xalan-j_1_2_2");
1116:                jarVersions.put(new Long(702536),
1117:                        "xalan.jar from xalan-j_2_0_0");
1118:                jarVersions.put(new Long(720930),
1119:                        "xalan.jar from xalan-j_2_0_1");
1120:                jarVersions.put(new Long(732330),
1121:                        "xalan.jar from xalan-j_2_1_0");
1122:                jarVersions.put(new Long(872241),
1123:                        "xalan.jar from xalan-j_2_2_D10");
1124:                jarVersions.put(new Long(882739),
1125:                        "xalan.jar from xalan-j_2_2_D11");
1126:                jarVersions.put(new Long(923866),
1127:                        "xalan.jar from xalan-j_2_2_0");
1128:                jarVersions.put(new Long(905872),
1129:                        "xalan.jar from xalan-j_2_3_D1");
1130:                jarVersions.put(new Long(906122),
1131:                        "xalan.jar from xalan-j_2_3_0");
1132:                jarVersions.put(new Long(906248),
1133:                        "xalan.jar from xalan-j_2_3_1");
1134:                jarVersions.put(new Long(983377),
1135:                        "xalan.jar from xalan-j_2_4_D1");
1136:                jarVersions.put(new Long(997276),
1137:                        "xalan.jar from xalan-j_2_4_0");
1138:                jarVersions.put(new Long(1031036),
1139:                        "xalan.jar from xalan-j_2_4_1");
1140:                // Stop recording xalan.jar sizes as of Xalan Java 2.5.0    
1141:
1142:                jarVersions.put(new Long(596540),
1143:                        "xsltc.jar from xalan-j_2_2_0");
1144:                jarVersions.put(new Long(590247),
1145:                        "xsltc.jar from xalan-j_2_3_D1");
1146:                jarVersions.put(new Long(589914),
1147:                        "xsltc.jar from xalan-j_2_3_0");
1148:                jarVersions.put(new Long(589915),
1149:                        "xsltc.jar from xalan-j_2_3_1");
1150:                jarVersions.put(new Long(1306667),
1151:                        "xsltc.jar from xalan-j_2_4_D1");
1152:                jarVersions.put(new Long(1328227),
1153:                        "xsltc.jar from xalan-j_2_4_0");
1154:                jarVersions.put(new Long(1344009),
1155:                        "xsltc.jar from xalan-j_2_4_1");
1156:                jarVersions.put(new Long(1348361),
1157:                        "xsltc.jar from xalan-j_2_5_D1");
1158:                // Stop recording xsltc.jar sizes as of Xalan Java 2.5.0
1159:
1160:                jarVersions.put(new Long(1268634),
1161:                        "xsltc.jar-bundled from xalan-j_2_3_0");
1162:
1163:                jarVersions.put(new Long(100196),
1164:                        "xml-apis.jar from xalan-j_2_2_0 or xalan-j_2_3_D1");
1165:                jarVersions
1166:                        .put(new Long(108484),
1167:                                "xml-apis.jar from xalan-j_2_3_0, or xalan-j_2_3_1 from xml-commons-1.0.b2");
1168:                jarVersions
1169:                        .put(new Long(109049),
1170:                                "xml-apis.jar from xalan-j_2_4_0 from xml-commons RIVERCOURT1 branch");
1171:                jarVersions
1172:                        .put(
1173:                                new Long(113749),
1174:                                "xml-apis.jar from xalan-j_2_4_1 from factoryfinder-build of xml-commons RIVERCOURT1");
1175:                jarVersions
1176:                        .put(new Long(124704),
1177:                                "xml-apis.jar from tck-jaxp-1_2_0 branch of xml-commons");
1178:                jarVersions
1179:                        .put(
1180:                                new Long(124724),
1181:                                "xml-apis.jar from tck-jaxp-1_2_0 branch of xml-commons, tag: xml-commons-external_1_2_01");
1182:                jarVersions
1183:                        .put(
1184:                                new Long(194205),
1185:                                "xml-apis.jar from head branch of xml-commons, tag: xml-commons-external_1_3_02");
1186:
1187:                // If the below were more common I would update it to report 
1188:                //  errors better; but this is so old hardly anyone has it
1189:                jarVersions
1190:                        .put(new Long(424490),
1191:                                "xalan.jar from Xerces Tools releases - ERROR:DO NOT USE!");
1192:
1193:                jarVersions.put(new Long(1591855),
1194:                        "xerces.jar from xalan-j_1_1 from xerces-1...");
1195:                jarVersions.put(new Long(1498679),
1196:                        "xerces.jar from xalan-j_1_2 from xerces-1_2_0.bin");
1197:                jarVersions.put(new Long(1484896),
1198:                        "xerces.jar from xalan-j_1_2_1 from xerces-1_2_1.bin");
1199:                jarVersions.put(new Long(804460),
1200:                        "xerces.jar from xalan-j_1_2_2 from xerces-1_2_2.bin");
1201:                jarVersions.put(new Long(1499244),
1202:                        "xerces.jar from xalan-j_2_0_0 from xerces-1_2_3.bin");
1203:                jarVersions.put(new Long(1605266),
1204:                        "xerces.jar from xalan-j_2_0_1 from xerces-1_3_0.bin");
1205:                jarVersions.put(new Long(904030),
1206:                        "xerces.jar from xalan-j_2_1_0 from xerces-1_4.bin");
1207:                jarVersions.put(new Long(904030),
1208:                        "xerces.jar from xerces-1_4_0.bin");
1209:                jarVersions.put(new Long(1802885),
1210:                        "xerces.jar from xerces-1_4_2.bin");
1211:                jarVersions.put(new Long(1734594),
1212:                        "xerces.jar from Xerces-J-bin.2.0.0.beta3");
1213:                jarVersions
1214:                        .put(new Long(1808883),
1215:                                "xerces.jar from xalan-j_2_2_D10,D11,D12 or xerces-1_4_3.bin");
1216:                jarVersions.put(new Long(1812019),
1217:                        "xerces.jar from xalan-j_2_2_0");
1218:                jarVersions.put(new Long(1720292),
1219:                        "xercesImpl.jar from xalan-j_2_3_D1");
1220:                jarVersions
1221:                        .put(new Long(1730053),
1222:                                "xercesImpl.jar from xalan-j_2_3_0 or xalan-j_2_3_1 from xerces-2_0_0");
1223:                jarVersions.put(new Long(1728861),
1224:                        "xercesImpl.jar from xalan-j_2_4_D1 from xerces-2_0_1");
1225:                jarVersions.put(new Long(972027),
1226:                        "xercesImpl.jar from xalan-j_2_4_0 from xerces-2_1");
1227:                jarVersions.put(new Long(831587),
1228:                        "xercesImpl.jar from xalan-j_2_4_1 from xerces-2_2");
1229:                jarVersions.put(new Long(891817),
1230:                        "xercesImpl.jar from xalan-j_2_5_D1 from xerces-2_3");
1231:                jarVersions.put(new Long(895924),
1232:                        "xercesImpl.jar from xerces-2_4");
1233:                jarVersions.put(new Long(1010806),
1234:                        "xercesImpl.jar from Xerces-J-bin.2.6.2");
1235:                jarVersions.put(new Long(1203860),
1236:                        "xercesImpl.jar from Xerces-J-bin.2.7.1");
1237:
1238:                jarVersions.put(new Long(37485),
1239:                        "xalanj1compat.jar from xalan-j_2_0_0");
1240:                jarVersions.put(new Long(38100),
1241:                        "xalanj1compat.jar from xalan-j_2_0_1");
1242:
1243:                jarVersions.put(new Long(18779),
1244:                        "xalanservlet.jar from xalan-j_2_0_0");
1245:                jarVersions.put(new Long(21453),
1246:                        "xalanservlet.jar from xalan-j_2_0_1");
1247:                jarVersions.put(new Long(24826),
1248:                        "xalanservlet.jar from xalan-j_2_3_1 or xalan-j_2_4_1");
1249:                jarVersions.put(new Long(24831),
1250:                        "xalanservlet.jar from xalan-j_2_4_1");
1251:                // Stop recording xalanservlet.jar sizes as of Xalan Java 2.5.0; now a .war file
1252:
1253:                // For those who've downloaded JAXP from sun
1254:                jarVersions.put(new Long(5618), "jaxp.jar from jaxp1.0.1");
1255:                jarVersions.put(new Long(136133), "parser.jar from jaxp1.0.1");
1256:                jarVersions.put(new Long(28404), "jaxp.jar from jaxp-1.1");
1257:                jarVersions.put(new Long(187162), "crimson.jar from jaxp-1.1");
1258:                jarVersions.put(new Long(801714), "xalan.jar from jaxp-1.1");
1259:                jarVersions.put(new Long(196399),
1260:                        "crimson.jar from crimson-1.1.1");
1261:                jarVersions.put(new Long(33323),
1262:                        "jaxp.jar from crimson-1.1.1 or jakarta-ant-1.4.1b1");
1263:                jarVersions.put(new Long(152717),
1264:                        "crimson.jar from crimson-1.1.2beta2");
1265:                jarVersions.put(new Long(88143),
1266:                        "xml-apis.jar from crimson-1.1.2beta2");
1267:                jarVersions
1268:                        .put(new Long(206384),
1269:                                "crimson.jar from crimson-1.1.3 or jakarta-ant-1.4.1b1");
1270:
1271:                // jakarta-ant: since many people use ant these days
1272:                jarVersions.put(new Long(136198),
1273:                        "parser.jar from jakarta-ant-1.3 or 1.2");
1274:                jarVersions.put(new Long(5537),
1275:                        "jaxp.jar from jakarta-ant-1.3 or 1.2");
1276:            }
1277:
1278:            /** Simple PrintWriter we send output to; defaults to System.out.  */
1279:            protected PrintWriter outWriter = new PrintWriter(System.out, true);
1280:
1281:            /**
1282:             * Bottleneck output: calls outWriter.println(s).  
1283:             * @param s String to print
1284:             */
1285:            protected void logMsg(String s) {
1286:                outWriter.println(s);
1287:            }
1288:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.