View | Details | Raw Unified | Return to bug 40852
Collapse All | Expand All

(-)Javadoc.java.orig (+60 lines)
Lines 1870-1876 public class Javadoc extends Task { Link Here
1870
        }
1870
        }
1871
1871
1872
        File tmpList = null;
1872
        File tmpList = null;
1873
        File optionsTmpList = null;
1873
        PrintWriter srcListWriter = null;
1874
        PrintWriter srcListWriter = null;
1875
        PrintWriter optionsListWriter = null;
1874
        try {
1876
        try {
1875
1877
1876
            /**
1878
            /**
Lines 1878-1883 public class Javadoc extends Task { Link Here
1878
             * if requested.
1880
             * if requested.
1879
             */
1881
             */
1880
            if (useExternalFile) {
1882
            if (useExternalFile) {
1883
                /**
1884
                 * Write all options, except sourcefiles and packages name to a temporary
1885
                 * file if requested
1886
                 * Works only for JDK1.4+ as javadoc from JDK1.3 handles only file or package names
1887
                 * http://java.sun.com/j2se/1.3/docs/tooldocs/solaris/javadoc.html#argumentfile
1888
                 */
1889
                if ((optionsTmpList == null) && javadoc4) {
1890
                    optionsTmpList = fileUtils.createTempFile("javadocOptions", "", null);
1891
                    optionsTmpList.deleteOnExit();
1892
                    
1893
                    String[] listOpt = toExecute.getArguments();
1894
                    toExecute.clearArgs();
1895
                    toExecute.createArgument()
1896
                        .setValue("@" + optionsTmpList.getAbsolutePath());
1897
                    
1898
                    optionsListWriter = new PrintWriter(
1899
                            new FileWriter(optionsTmpList.getAbsolutePath(),
1900
                                           true));
1901
                    
1902
                    // Treat all options
1903
                    for (int i = 0; i < listOpt.length; i++) {
1904
                        String string = listOpt[i];
1905
                        
1906
                        // Avoid -J option
1907
                        // http://java.sun.com/j2se/1.4.2/docs/tooldocs/solaris/javadoc.html#argumentfiles
1908
                        if (string.startsWith("-J-")) {
1909
                            toExecute.createArgument().setValue(string);
1910
                        } else  {
1911
                            if (string.startsWith("-")) {
1912
                                optionsListWriter.println();
1913
                                optionsListWriter.print(string);
1914
                            } else {
1915
                                // Handle spaces in directory names
1916
                                if (string.indexOf(' ') != -1
1917
                                        && string.indexOf('\'') == -1) {
1918
                                        optionsListWriter.print(
1919
                                            "'" + string.replace('\\', '/') + "'");
1920
                                    } else if (string.indexOf(' ') != -1) {
1921
                                        optionsListWriter.print(
1922
                                            "\"" + string.replace('\\', '/') + "\"");
1923
                                    } else {
1924
                                        optionsListWriter.print(string);
1925
                                    }
1926
                            }
1927
                            optionsListWriter.print(" ");
1928
                        }
1929
                    }                   
1930
                }
1931
                
1932
                /**
1933
                 * Write sourcefiles and package names to a temporary file
1934
                 * if requested.
1935
                 */
1881
                if (tmpList == null) {
1936
                if (tmpList == null) {
1882
                    tmpList = fileUtils.createTempFile("javadoc", "", null);
1937
                    tmpList = fileUtils.createTempFile("javadoc", "", null);
1883
                    tmpList.deleteOnExit();
1938
                    tmpList.deleteOnExit();
Lines 1925-1930 public class Javadoc extends Task { Link Here
1925
        } finally {
1980
        } finally {
1926
            if (srcListWriter != null) {
1981
            if (srcListWriter != null) {
1927
                srcListWriter.close();
1982
                srcListWriter.close();
1983
            }
1984
            
1985
            // Flush file
1986
            if (optionsListWriter != null) {
1987
                optionsListWriter.close();
1928
            }
1988
            }
1929
        }
1989
        }
1930
1990

Return to bug 40852