Info Call to command execution API

Description

List of all command execution API calls

Recommendation

This entry is informative, no recommendations applicable.

Technical details

Method org.apache.commons.io.FileSystemUtils.openProcess() calling method java.lang.Runtime.exec()


    Process openProcess(String[] p2)
    {
        return Runtime.getRuntime().exec(p2);
    }

Method org.apache.xmlbeans.impl.tool.CodeGenUtil.externalCompile() calling method java.lang.Runtime.exec()


    public static boolean externalCompile(java.util.List p20, java.io.File p21, java.io.File[] p22, boolean p23, String p24, String p25, String p26, String p27, boolean p28, boolean p29)
    {
        java.util.ArrayList v3_1 = new java.util.ArrayList();
        if (p24 == null) {
            p24 = org.apache.xmlbeans.impl.tool.CodeGenUtil.DEFAULT_COMPILER;
        }
        java.io.File v11 = org.apache.xmlbeans.impl.tool.CodeGenUtil.findJavaTool(p24);
        if ((org.apache.xmlbeans.impl.tool.CodeGenUtil.$assertionsDisabled) || (v11.exists())) {
            v3_1.add(v11.getAbsolutePath());
            if (p21 != null) {
                v3_1.add("-d");
                v3_1.add(org.apache.xmlbeans.impl.tool.CodeGenUtil.quoteAndEscapeFilename(p21.getAbsolutePath()));
            } else {
                p21 = new java.io.File;
                p21(".");
            }
            if (p22 == null) {
                p22 = org.apache.xmlbeans.impl.tool.CodeGenUtil.systemClasspath();
            }
            if (p22.length > 0) {
                StringBuffer v5_1 = new StringBuffer();
                v5_1.append(p21.getAbsolutePath());
                int v10_1 = 0;
                while (v10_1 < p22.length) {
                    v5_1.append(java.io.File.pathSeparator);
                    v5_1.append(p22[v10_1].getAbsolutePath());
                    v10_1++;
                }
                v3_1.add("-classpath");
                v3_1.add(org.apache.xmlbeans.impl.tool.CodeGenUtil.quoteAndEscapeFilename(v5_1.toString()));
            }
            if (p25 == null) {
                p25 = "1.4";
            }
            int v17_60;
            v3_1.add("-source");
            v3_1.add(p25);
            v3_1.add("-target");
            v3_1.add(p25);
            if (!p23) {
                v17_60 = "-g:none";
            } else {
                v17_60 = "-g";
            }
            v3_1.add(v17_60);
            if (p29) {
                v3_1.add("-verbose");
            }
            org.apache.xmlbeans.impl.tool.CodeGenUtil.addAllJavaFiles(p20, v3_1);
            try {
                java.io.File v4 = java.io.File.createTempFile("javac", "");
                java.io.FileWriter v9_1 = new java.io.FileWriter(v4);
                int v10_2 = v3_1.iterator();
                v10_2.next();
            } catch (Throwable v6) {
                System.err.println("Could not create command-line file for javac");
                try {
                    String v0_8 = new String[v3_1.size()];
                    String[] v16_1 = ((String[]) v3_1.toArray(v0_8));
                } catch (Throwable v6) {
                    System.err.println(v6.toString());
                    System.err.println(v6.getCause());
                    v6.printStackTrace(System.err);
                    int v17_41 = 0;
                    return v17_41;
                }
                if (p29) {
                    System.out.print("compile command:");
                    int v10_0 = 0;
                    while (v10_0 < v16_1.length) {
                        System.out.print(new StringBuffer().append(" ").append(v16_1[v10_0]).toString());
                        v10_0++;
                    }
                    System.out.println();
                }
                Process v15 = Runtime.getRuntime().exec(v16_1);
                StringBuffer v8_1 = new StringBuffer();
                StringBuffer v14_1 = new StringBuffer();
                new org.apache.xmlbeans.impl.tool.CodeGenUtil$ThreadedReader(v15.getInputStream(), v14_1);
                new org.apache.xmlbeans.impl.tool.CodeGenUtil$ThreadedReader(v15.getErrorStream(), v8_1);
                v15.waitFor();
                if ((p29) || (v15.exitValue() != 0)) {
                    if (v14_1.length() > 0) {
                        System.out.println(v14_1.toString());
                        System.out.flush();
                    }
                    if (v8_1.length() > 0) {
                        System.err.println(v8_1.toString());
                        System.err.flush();
                    }
                    if (v15.exitValue() != 0) {
                        v17_41 = 0;
                        return v17_41;
                    }
                }
                if (v4 != null) {
                    v4.delete();
                }
                v17_41 = 1;
                return v17_41;
            }
            while (v10_2.hasNext()) {
                v9_1.write(((String) v10_2.next()));
                v9_1.write(10);
            }
            v9_1.close();
            java.util.ArrayList v12_1 = new java.util.ArrayList();
            v12_1.add(v3_1.get(0));
            if ((p26 != null) && (p26.length() != 0)) {
                v12_1.add(new StringBuffer().append("-J-Xms").append(p26).toString());
            }
            if ((p27 != null) && (p27.length() != 0)) {
                v12_1.add(new StringBuffer().append("-J-Xmx").append(p27).toString());
            }
            v12_1.add(new StringBuffer().append("@").append(v4.getAbsolutePath()).toString());
            v3_1 = v12_1;
        } else {
            throw new AssertionError(new StringBuffer().append("compiler not found ").append(v11).toString());
        }
    }

Method org.apache.xmlbeans.impl.tool.CodeGenUtil.externalJar() calling method java.lang.Runtime.exec()


    public static boolean externalJar(java.io.File p13, java.io.File p14, String p15, boolean p16, boolean p17)
    {
        java.util.ArrayList v0_1 = new java.util.ArrayList();
        if (p15 == null) {
            p15 = org.apache.xmlbeans.impl.tool.CodeGenUtil.DEFAULT_JAR;
        }
        java.io.File v5 = org.apache.xmlbeans.impl.tool.CodeGenUtil.findJavaTool(p15);
        if ((org.apache.xmlbeans.impl.tool.CodeGenUtil.$assertionsDisabled) || (v5.exists())) {
            v0_1.add(v5.getAbsolutePath());
            v0_1.add("cf");
            v0_1.add(org.apache.xmlbeans.impl.tool.CodeGenUtil.quoteNoEscapeFilename(p14.getAbsolutePath()));
            v0_1.add("-C");
            v0_1.add(org.apache.xmlbeans.impl.tool.CodeGenUtil.quoteNoEscapeFilename(p13.getAbsolutePath()));
            v0_1.add(".");
            try {
                int v10_13 = new String[v0_1.size()];
                String[] v9_1 = ((String[]) v0_1.toArray(v10_13));
            } catch (Throwable v1) {
                v1.printStackTrace(System.err);
                int v10_1 = 0;
                return v10_1;
            }
            if (p17) {
                System.out.print("jar command:");
                int v4 = 0;
                while (v4 < v9_1.length) {
                    System.out.print(new StringBuffer().append(" ").append(v9_1[v4]).toString());
                    v4++;
                }
                System.out.println();
            }
            Process v8 = Runtime.getRuntime().exec(v9_1);
            StringBuffer v3_1 = new StringBuffer();
            StringBuffer v7_1 = new StringBuffer();
            new org.apache.xmlbeans.impl.tool.CodeGenUtil$ThreadedReader(v8.getInputStream(), v7_1);
            new org.apache.xmlbeans.impl.tool.CodeGenUtil$ThreadedReader(v8.getErrorStream(), v3_1);
            v8.waitFor();
            if ((p17) || (v8.exitValue() != 0)) {
                if (v7_1.length() > 0) {
                    System.out.println(v7_1.toString());
                    System.out.flush();
                }
                if (v3_1.length() > 0) {
                    System.err.println(v3_1.toString());
                    System.err.flush();
                }
                if (v8.exitValue() != 0) {
                    v10_1 = 0;
                    return v10_1;
                }
            }
            v10_1 = 1;
            return v10_1;
        } else {
            throw new AssertionError(new StringBuffer().append("jar not found ").append(v5).toString());
        }
    }

Method org.apache.xmlbeans.impl.tool.XSTCTester.main() calling method java.lang.Runtime.exec()


    public static void main(String[] p34)
    {
        java.util.HashSet v12_1 = new java.util.HashSet();
        v12_1.add("h");
        v12_1.add("help");
        v12_1.add("usage");
        v12_1.add("version");
        v12_1.add("showpass");
        v12_1.add("errcode");
        long v24 = System.currentTimeMillis();
        org.apache.xmlbeans.impl.tool.CommandLine v7_1 = new org.apache.xmlbeans.impl.tool.CommandLine(p34, v12_1, java.util.Collections.EMPTY_SET);
        if ((v7_1.getOpt("h") == null) && ((v7_1.getOpt("help") == null) && (v7_1.getOpt("usage") == null))) {
            if (v7_1.getOpt("version") == null) {
                String[] v5 = v7_1.getBadOpts();
                if (v5.length <= 0) {
                    if (v7_1.args().length != 0) {
                        int v22;
                        if (v7_1.getOpt("showpass") == null) {
                            v22 = 0;
                        } else {
                            v22 = 1;
                        }
                        int v8;
                        if (v7_1.getOpt("errcode") == null) {
                            v8 = 0;
                        } else {
                            v8 = 1;
                        }
                        java.io.File[] v4 = v7_1.getFiles();
                        java.util.ArrayList v18_1 = new java.util.ArrayList();
                        org.apache.xmlbeans.impl.tool.XMLBeanXSTCHarness v13_1 = new org.apache.xmlbeans.impl.tool.XMLBeanXSTCHarness();
                        int v14_1 = 0;
                        while (v14_1 < v4.length) {
                            if (v4[v14_1].getName().indexOf("LTG") >= 0) {
                                v18_1.add(v4[v14_1]);
                            }
                            v14_1++;
                        }
                        java.io.File v21 = new java.io.File;
                        v21("out.html");
                        org.apache.xmlbeans.impl.tool.XSTCTester$TestCaseResult v27_99 = new java.io.FileWriter;
                        v27_99(v21);
                        java.io.PrintWriter v26_1 = new java.io.PrintWriter(v27_99);
                        v26_1.println("<html>");
                        v26_1.println("<style>td {border-bottom: 1px solid black} xmp {white-space: normal; word-wrap: break-word; word-break: break-all} </style>");
                        v26_1.println("<body>");
                        v26_1.println("<script language=\'JavaScript\' type=\'text/javascript\'>");
                        v26_1.println("var w;");
                        v26_1.println("function openWindow(schema, instance) {");
                        v26_1.println("  if (w == null) {");
                        v26_1.println("    w = window.open(\'about:blank\', \'xstc\');");
                        v26_1.println("  }");
                        v26_1.println("  if (w.closed) {");
                        v26_1.println("    w = window.open(\'about:blank\', \'xstc\');");
                        v26_1.println("  }");
                        v26_1.println("  w.document.open();");
                        v26_1.println("  w.document.write(\"<frameset rows=*,*><frame src=\'\" + schema + \"\'><frame src=\'\" + instance + \"\'></frameset>\");");
                        v26_1.println("  w.document.close();");
                        v26_1.println("  w.focus();");
                        v26_1.println("}");
                        v26_1.println("</script>");
                        v26_1.println("<h1>XML Schema Test Collection Results</h1>");
                        v26_1.println(new StringBuffer().append("<p>Run on ").append(new org.apache.xmlbeans.XmlCalendar(new java.util.Date())).append("</p>").toString());
                        v26_1.println("<p>Values in schema or instance valid columns are results from compiling or validating respectively.");
                        v26_1.println("Red or orange background mean the test failed.</p>");
                        v26_1.println("<table style=\'border: 1px solid black\' cellpadding=0 cellspacing=0>");
                        v26_1.println("<tr><td witdh=10%>id</td><td width=70%>Description</td><td width=10%>sch v</td><td width=10%>ins v</td></tr>");
                        int v9 = 0;
                        int v6 = 0;
                        int v14_0 = v18_1.iterator();
                        while (v14_0.hasNext()) {
                            java.io.File v17_1 = ((java.io.File) v14_0.next());
                            System.out.println(new StringBuffer().append("Processing test cases in ").append(v17_1).toString());
                            java.util.ArrayList v16_1 = new java.util.ArrayList();
                            org.apache.xmlbeans.impl.tool.XSTCTester$TestCase[] v23 = org.apache.xmlbeans.impl.tool.XSTCTester.parseLTGFile(v17_1, v16_1);
                            java.util.ArrayList v20_1 = new java.util.ArrayList();
                            if (v23 != null) {
                                int v15_0 = 0;
                                while (v15_0 < v23.length) {
                                    org.apache.xmlbeans.impl.tool.XSTCTester$TestCaseResult v19_1 = new org.apache.xmlbeans.impl.tool.XSTCTester$TestCaseResult();
                                    org.apache.xmlbeans.impl.tool.XSTCTester$TestCaseResult.access$002(v19_1, v23[v15_0]);
                                    v13_1.runTestCase(v19_1);
                                    v6++;
                                    if (v19_1.succeeded(v8)) {
                                        if (v22 != 0) {
                                            v20_1.add(v19_1);
                                        }
                                    } else {
                                        v9++;
                                    }
                                    v15_0++;
                                }
                            }
                            v26_1.println(new StringBuffer().append("<tr><td colspan=4 bgcolor=skyblue>").append(v17_1).append("</td></tr>").toString());
                            if (v16_1.isEmpty()) {
                                if (v20_1.size() == 0) {
                                    v26_1.println("<tr><td colspan=4 bgcolor=green>Nothing to report</td></tr>");
                                }
                            } else {
                                v26_1.println("<tr><td>Errors within the LTG file:");
                                v26_1.println("<xmp>");
                                int v15_1 = v16_1.iterator();
                                while (v15_1.hasNext()) {
                                    v26_1.println(v15_1.next());
                                }
                                v26_1.println("</xmp>");
                                v26_1.println("</td></tr>");
                            }
                            if (v20_1 != null) {
                                int v15_2 = v20_1.iterator();
                                while (v15_2.hasNext()) {
                                    org.apache.xmlbeans.impl.tool.XSTCTester.summarizeResultAsHTMLTableRows(((org.apache.xmlbeans.impl.tool.XSTCTester$TestCaseResult) v15_2.next()), v26_1, v8);
                                }
                            }
                        }
                        v26_1.println(new StringBuffer().append("<tr><td colspan=4>Summary: ").append(v9).append(" failures out of ").append(v6).append(" cases run.</td></tr>").toString());
                        v26_1.println("</table>");
                        v26_1.close();
                        System.out.println(new StringBuffer().append("Time run tests: ").append((((double) (System.currentTimeMillis() - v24)) / 1000.0)).append(" seconds").toString());
                        System.out.println(new StringBuffer().append("Results output to ").append(v21).toString());
                        if (org.apache.xmlbeans.SystemProperties.getProperty("os.name").toLowerCase().indexOf("windows") < 0) {
                            Runtime.getRuntime().exec(new StringBuffer().append("mozilla file://").append(v21.getAbsolutePath()).toString());
                        } else {
                            Runtime.getRuntime().exec(new StringBuffer().append("cmd /c start iexplore \"").append(v21.getAbsolutePath()).append("\"").toString());
                        }
                    } else {
                        org.apache.xmlbeans.impl.tool.XSTCTester.printUsage();
                    }
                } else {
                    int v14_2 = 0;
                    while (v14_2 < v5.length) {
                        System.out.println(new StringBuffer().append("Unrecognized option: ").append(v5[v14_2]).toString());
                        v14_2++;
                    }
                    org.apache.xmlbeans.impl.tool.XSTCTester.printUsage();
                    System.exit(0);
                }
            } else {
                org.apache.xmlbeans.impl.tool.CommandLine.printVersion();
                System.exit(0);
            }
        } else {
            org.apache.xmlbeans.impl.tool.XSTCTester.printUsage();
            System.exit(0);
        }
        return;
    }