final String name = XmlPullParserFactory.PROPERTY_NAME; final String oldValue = System.getProperty(name);
final String FACTORY_PROPERTY = XmlPullParserFactory.PROPERTY_NAME; final String DEFAULT_FACTORY_PROPERTY = System.getProperty(FACTORY_PROPERTY);
    public static void main (String[] args) {        final PackageTests driver = new PackageTests();        final ResultPrinter resultPrinter = new ResultPrinter(System.err);        driver.setPrinter(resultPrinter);        final String listOfTests = System.getProperty("org.xmlpull.v1.tests");        final String name = XmlPullParserFactory.PROPERTY_NAME;        final String oldValue = System.getProperty(name);        runAll = true;        if(listOfTests != null) {            int pos = 0;            while (pos < listOfTests.length()) {                int cut = listOfTests.indexOf(':', pos);                if (cut == -1) cut = listOfTests.length();                String testFactoryName = listOfTests.substring(pos, cut);                if("DEFAULT".equals(testFactoryName)) {                    if(oldValue != null) {                        System.setProperty(name, oldValue);                    } else {                        // overcoming limitation of System.setProperty not allowing                        //  null or empty values (who knows how to unset property ?!)                        System.setProperty(name, "DEFAULT");                    }                } else {                    System.setProperty(name, testFactoryName);                }                driver.runPackageTests(testFactoryName);                pos = cut + 1;            }            driver.printFinalReport();        } else {            driver.runPackageTests(null);        }        System.exit(0);    }