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

(-)java/org/apache/catalina/servlets/CGIServlet.java (-4 / +2 lines)
Lines 1080-1087 Link Here
1080
             * Servlet API spec.
1080
             * Servlet API spec.
1081
             */
1081
             */
1082
            int contentLength = req.getContentLength();
1082
            int contentLength = req.getContentLength();
1083
            String sContentLength = (contentLength <= 0 ? "" :
1083
            String sContentLength = contentLength <= 0 ? "" :
1084
                (Integer.valueOf(contentLength)).toString());
1084
                Integer.toString(contentLength);
1085
            envp.put("CONTENT_LENGTH", sContentLength);
1085
            envp.put("CONTENT_LENGTH", sContentLength);
1086
1086
1087
1087
Lines 1911-1918 Link Here
1911
                // LF
1911
                // LF
1912
                switch(state) {
1912
                switch(state) {
1913
                    case STATE_CHARACTER:
1913
                    case STATE_CHARACTER:
1914
                        state = STATE_FIRST_LF;
1915
                        break;
1916
                    case STATE_FIRST_CR:
1914
                    case STATE_FIRST_CR:
1917
                        state = STATE_FIRST_LF;
1915
                        state = STATE_FIRST_LF;
1918
                        break;
1916
                        break;
(-)java/org/apache/catalina/servlets/WebdavServlet.java (-16 / +14 lines)
Lines 875-895 Link Here
875
        if (lockDurationStr == null) {
875
        if (lockDurationStr == null) {
876
            lockDuration = DEFAULT_TIMEOUT;
876
            lockDuration = DEFAULT_TIMEOUT;
877
        } else {
877
        } else {
878
            int commaPos = lockDurationStr.indexOf(",");
878
            int commaPos = lockDurationStr.indexOf(',');
879
            // If multiple timeouts, just use the first
879
            // If multiple timeouts, just use the first
880
            if (commaPos != -1) {
880
            if (commaPos != -1) {
881
                lockDurationStr = lockDurationStr.substring(0,commaPos);
881
                lockDurationStr = lockDurationStr.substring(0,commaPos);
882
            }
882
            }
883
            if (lockDurationStr.startsWith("Second-")) {
883
            if (lockDurationStr.startsWith("Second-")) {
884
                lockDuration =
884
                lockDuration = Integer.parseInt(lockDurationStr.substring(7));
885
                    (new Integer(lockDurationStr.substring(7))).intValue();
886
            } else {
885
            } else {
887
                if (lockDurationStr.equalsIgnoreCase("infinity")) {
886
                if (lockDurationStr.equalsIgnoreCase("infinity")) {
888
                    lockDuration = MAX_TIMEOUT;
887
                    lockDuration = MAX_TIMEOUT;
889
                } else {
888
                } else {
890
                    try {
889
                    try {
891
                        lockDuration =
890
                        lockDuration = Integer.parseInt(lockDurationStr);
892
                            (new Integer(lockDurationStr)).intValue();
893
                    } catch (NumberFormatException e) {
891
                    } catch (NumberFormatException e) {
894
                        lockDuration = MAX_TIMEOUT;
892
                        lockDuration = MAX_TIMEOUT;
895
                    }
893
                    }
Lines 1493-1499 Link Here
1493
            // if the Destination URL contains the protocol, we can safely
1491
            // if the Destination URL contains the protocol, we can safely
1494
            // trim everything upto the first "/" character after "://"
1492
            // trim everything upto the first "/" character after "://"
1495
            int firstSeparator =
1493
            int firstSeparator =
1496
                destinationPath.indexOf("/", protocolIndex + 4);
1494
                destinationPath.indexOf('/', protocolIndex + 4);
1497
            if (firstSeparator < 0) {
1495
            if (firstSeparator < 0) {
1498
                destinationPath = "/";
1496
                destinationPath = "/";
1499
            } else {
1497
            } else {
Lines 1505-1517 Link Here
1505
                destinationPath = destinationPath.substring(hostName.length());
1503
                destinationPath = destinationPath.substring(hostName.length());
1506
            }
1504
            }
1507
1505
1508
            int portIndex = destinationPath.indexOf(":");
1506
            int portIndex = destinationPath.indexOf(':');
1509
            if (portIndex >= 0) {
1507
            if (portIndex >= 0) {
1510
                destinationPath = destinationPath.substring(portIndex);
1508
                destinationPath = destinationPath.substring(portIndex);
1511
            }
1509
            }
1512
1510
1513
            if (destinationPath.startsWith(":")) {
1511
            if (destinationPath.startsWith(":")) {
1514
                int firstSeparator = destinationPath.indexOf("/");
1512
                int firstSeparator = destinationPath.indexOf('/');
1515
                if (firstSeparator < 0) {
1513
                if (firstSeparator < 0) {
1516
                    destinationPath = "/";
1514
                    destinationPath = "/";
1517
                } else {
1515
                } else {
Lines 1640-1646 Link Here
1640
            if (!resources.mkdir(dest)) {
1638
            if (!resources.mkdir(dest)) {
1641
                WebResource destResource = resources.getResource(dest);
1639
                WebResource destResource = resources.getResource(dest);
1642
                if (!destResource.isDirectory()) {
1640
                if (!destResource.isDirectory()) {
1643
                    errorList.put(dest, new Integer(WebdavStatus.SC_CONFLICT));
1641
                    errorList.put(dest, Integer.valueOf(WebdavStatus.SC_CONFLICT));
1644
                    return false;
1642
                    return false;
1645
                }
1643
                }
1646
            }
1644
            }
Lines 1667-1673 Link Here
1667
                    String parent = destResource.getWebappPath().substring(0, lastSlash);
1665
                    String parent = destResource.getWebappPath().substring(0, lastSlash);
1668
                    WebResource parentResource = resources.getResource(parent);
1666
                    WebResource parentResource = resources.getResource(parent);
1669
                    if (!parentResource.isDirectory()) {
1667
                    if (!parentResource.isDirectory()) {
1670
                        errorList.put(source, new Integer(WebdavStatus.SC_CONFLICT));
1668
                        errorList.put(source, Integer.valueOf(WebdavStatus.SC_CONFLICT));
1671
                        return false;
1669
                        return false;
1672
                    }
1670
                    }
1673
                }
1671
                }
Lines 1675-1686 Link Here
1675
            if (!resources.write(dest, sourceResource.getInputStream(),
1673
            if (!resources.write(dest, sourceResource.getInputStream(),
1676
                    false)) {
1674
                    false)) {
1677
                errorList.put(source,
1675
                errorList.put(source,
1678
                        new Integer(WebdavStatus.SC_INTERNAL_SERVER_ERROR));
1676
                        Integer.valueOf(WebdavStatus.SC_INTERNAL_SERVER_ERROR));
1679
                return false;
1677
                return false;
1680
            }
1678
            }
1681
        } else {
1679
        } else {
1682
            errorList.put(source,
1680
            errorList.put(source,
1683
                    new Integer(WebdavStatus.SC_INTERNAL_SERVER_ERROR));
1681
                    Integer.valueOf(WebdavStatus.SC_INTERNAL_SERVER_ERROR));
1684
            return false;
1682
            return false;
1685
        }
1683
        }
1686
        return true;
1684
        return true;
Lines 1749-1755 Link Here
1749
1747
1750
            deleteCollection(req, path, errorList);
1748
            deleteCollection(req, path, errorList);
1751
            if (!resource.delete()) {
1749
            if (!resource.delete()) {
1752
                errorList.put(path, new Integer
1750
                errorList.put(path, Integer.valueOf
1753
                    (WebdavStatus.SC_INTERNAL_SERVER_ERROR));
1751
                    (WebdavStatus.SC_INTERNAL_SERVER_ERROR));
1754
            }
1752
            }
1755
1753
Lines 1780-1786 Link Here
1780
1778
1781
        // Prevent deletion of special subdirectories
1779
        // Prevent deletion of special subdirectories
1782
        if (isSpecialPath(path)) {
1780
        if (isSpecialPath(path)) {
1783
            errorList.put(path, new Integer(WebdavStatus.SC_FORBIDDEN));
1781
            errorList.put(path, Integer.valueOf(WebdavStatus.SC_FORBIDDEN));
1784
            return;
1782
            return;
1785
        }
1783
        }
1786
1784
Lines 1802-1808 Link Here
1802
1800
1803
            if (isLocked(childName, ifHeader + lockTokenHeader)) {
1801
            if (isLocked(childName, ifHeader + lockTokenHeader)) {
1804
1802
1805
                errorList.put(childName, new Integer(WebdavStatus.SC_LOCKED));
1803
                errorList.put(childName, Integer.valueOf(WebdavStatus.SC_LOCKED));
1806
1804
1807
            } else {
1805
            } else {
1808
                WebResource childResource = resources.getResource(childName);
1806
                WebResource childResource = resources.getResource(childName);
Lines 1814-1820 Link Here
1814
                    if (!childResource.isDirectory()) {
1812
                    if (!childResource.isDirectory()) {
1815
                        // If it's not a collection, then it's an unknown
1813
                        // If it's not a collection, then it's an unknown
1816
                        // error
1814
                        // error
1817
                        errorList.put(childName, new Integer(
1815
                        errorList.put(childName, Integer.valueOf(
1818
                                WebdavStatus.SC_INTERNAL_SERVER_ERROR));
1816
                                WebdavStatus.SC_INTERNAL_SERVER_ERROR));
1819
                    }
1817
                    }
1820
                }
1818
                }

Return to bug 58541