ASF Bugzilla – Attachment 33213 Details for
Bug 58541
CGIServlet and WebdavServlet code improvements
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Code improvements to two Servlet classes
CatalinaServlets.patch (text/plain), 6.40 KB, created by
Anthony Whitford
on 2015-10-25 22:29:17 UTC
(
hide
)
Description:
Code improvements to two Servlet classes
Filename:
MIME Type:
Creator:
Anthony Whitford
Created:
2015-10-25 22:29:17 UTC
Size:
6.40 KB
patch
obsolete
>Index: java/org/apache/catalina/servlets/CGIServlet.java >=================================================================== >--- java/org/apache/catalina/servlets/CGIServlet.java (revision 1710467) >+++ java/org/apache/catalina/servlets/CGIServlet.java (working copy) >@@ -1080,8 +1080,8 @@ > * Servlet API spec. > */ > int contentLength = req.getContentLength(); >- String sContentLength = (contentLength <= 0 ? "" : >- (Integer.valueOf(contentLength)).toString()); >+ String sContentLength = contentLength <= 0 ? "" : >+ Integer.toString(contentLength); > envp.put("CONTENT_LENGTH", sContentLength); > > >@@ -1911,8 +1911,6 @@ > // LF > switch(state) { > case STATE_CHARACTER: >- state = STATE_FIRST_LF; >- break; > case STATE_FIRST_CR: > state = STATE_FIRST_LF; > break; >Index: java/org/apache/catalina/servlets/WebdavServlet.java >=================================================================== >--- java/org/apache/catalina/servlets/WebdavServlet.java (revision 1710467) >+++ java/org/apache/catalina/servlets/WebdavServlet.java (working copy) >@@ -875,21 +875,19 @@ > if (lockDurationStr == null) { > lockDuration = DEFAULT_TIMEOUT; > } else { >- int commaPos = lockDurationStr.indexOf(","); >+ int commaPos = lockDurationStr.indexOf(','); > // If multiple timeouts, just use the first > if (commaPos != -1) { > lockDurationStr = lockDurationStr.substring(0,commaPos); > } > if (lockDurationStr.startsWith("Second-")) { >- lockDuration = >- (new Integer(lockDurationStr.substring(7))).intValue(); >+ lockDuration = Integer.parseInt(lockDurationStr.substring(7)); > } else { > if (lockDurationStr.equalsIgnoreCase("infinity")) { > lockDuration = MAX_TIMEOUT; > } else { > try { >- lockDuration = >- (new Integer(lockDurationStr)).intValue(); >+ lockDuration = Integer.parseInt(lockDurationStr); > } catch (NumberFormatException e) { > lockDuration = MAX_TIMEOUT; > } >@@ -1493,7 +1491,7 @@ > // if the Destination URL contains the protocol, we can safely > // trim everything upto the first "/" character after "://" > int firstSeparator = >- destinationPath.indexOf("/", protocolIndex + 4); >+ destinationPath.indexOf('/', protocolIndex + 4); > if (firstSeparator < 0) { > destinationPath = "/"; > } else { >@@ -1505,13 +1503,13 @@ > destinationPath = destinationPath.substring(hostName.length()); > } > >- int portIndex = destinationPath.indexOf(":"); >+ int portIndex = destinationPath.indexOf(':'); > if (portIndex >= 0) { > destinationPath = destinationPath.substring(portIndex); > } > > if (destinationPath.startsWith(":")) { >- int firstSeparator = destinationPath.indexOf("/"); >+ int firstSeparator = destinationPath.indexOf('/'); > if (firstSeparator < 0) { > destinationPath = "/"; > } else { >@@ -1640,7 +1638,7 @@ > if (!resources.mkdir(dest)) { > WebResource destResource = resources.getResource(dest); > if (!destResource.isDirectory()) { >- errorList.put(dest, new Integer(WebdavStatus.SC_CONFLICT)); >+ errorList.put(dest, Integer.valueOf(WebdavStatus.SC_CONFLICT)); > return false; > } > } >@@ -1667,7 +1665,7 @@ > String parent = destResource.getWebappPath().substring(0, lastSlash); > WebResource parentResource = resources.getResource(parent); > if (!parentResource.isDirectory()) { >- errorList.put(source, new Integer(WebdavStatus.SC_CONFLICT)); >+ errorList.put(source, Integer.valueOf(WebdavStatus.SC_CONFLICT)); > return false; > } > } >@@ -1675,12 +1673,12 @@ > if (!resources.write(dest, sourceResource.getInputStream(), > false)) { > errorList.put(source, >- new Integer(WebdavStatus.SC_INTERNAL_SERVER_ERROR)); >+ Integer.valueOf(WebdavStatus.SC_INTERNAL_SERVER_ERROR)); > return false; > } > } else { > errorList.put(source, >- new Integer(WebdavStatus.SC_INTERNAL_SERVER_ERROR)); >+ Integer.valueOf(WebdavStatus.SC_INTERNAL_SERVER_ERROR)); > return false; > } > return true; >@@ -1749,7 +1747,7 @@ > > deleteCollection(req, path, errorList); > if (!resource.delete()) { >- errorList.put(path, new Integer >+ errorList.put(path, Integer.valueOf > (WebdavStatus.SC_INTERNAL_SERVER_ERROR)); > } > >@@ -1780,7 +1778,7 @@ > > // Prevent deletion of special subdirectories > if (isSpecialPath(path)) { >- errorList.put(path, new Integer(WebdavStatus.SC_FORBIDDEN)); >+ errorList.put(path, Integer.valueOf(WebdavStatus.SC_FORBIDDEN)); > return; > } > >@@ -1802,7 +1800,7 @@ > > if (isLocked(childName, ifHeader + lockTokenHeader)) { > >- errorList.put(childName, new Integer(WebdavStatus.SC_LOCKED)); >+ errorList.put(childName, Integer.valueOf(WebdavStatus.SC_LOCKED)); > > } else { > WebResource childResource = resources.getResource(childName); >@@ -1814,7 +1812,7 @@ > if (!childResource.isDirectory()) { > // If it's not a collection, then it's an unknown > // error >- errorList.put(childName, new Integer( >+ errorList.put(childName, Integer.valueOf( > WebdavStatus.SC_INTERNAL_SERVER_ERROR)); > } > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 58541
: 33213