You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2017/01/31 15:15:43 UTC

svn commit: r1781102 - in /tomcat: native/trunk/native/src/file.c native/trunk/xdocs/miscellaneous/changelog.xml trunk/java/org/apache/tomcat/jni/File.java

Author: markt
Date: Tue Jan 31 15:15:43 2017
New Revision: 1781102

URL: http://svn.apache.org/viewvc?rev=1781102&view=rev
Log:
Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=55938
Resolve remaining issues
Note that the use of -1 to indicate the full array in File.(read|write)[Full] has been removed since it was only partially implemented and the implementation was faulty.

Modified:
    tomcat/native/trunk/native/src/file.c
    tomcat/native/trunk/xdocs/miscellaneous/changelog.xml
    tomcat/trunk/java/org/apache/tomcat/jni/File.java

Modified: tomcat/native/trunk/native/src/file.c
URL: http://svn.apache.org/viewvc/tomcat/native/trunk/native/src/file.c?rev=1781102&r1=1781101&r2=1781102&view=diff
==============================================================================
--- tomcat/native/trunk/native/src/file.c (original)
+++ tomcat/native/trunk/native/src/file.c Tue Jan 31 15:15:43 2017
@@ -286,8 +286,6 @@ TCN_IMPLEMENT_CALL(jint, File, write)(TC
     apr_status_t ss;
 
     UNREFERENCED(o);
-    if (towrite < 0)
-        towrite = (*e)->GetArrayLength(e, buf);
     ss = apr_file_write(f, bytes + offset, &nbytes);
 
     (*e)->ReleasePrimitiveArrayCritical(e, buf, bytes, JNI_ABORT);
@@ -325,8 +323,6 @@ TCN_IMPLEMENT_CALL(jint, File, writeFull
     jbyte *bytes = (*e)->GetByteArrayElements(e, buf, NULL);
 
     UNREFERENCED(o);
-    if (towrite < 0)
-        towrite = (*e)->GetArrayLength(e, buf);
     ss = apr_file_write_full(f, bytes + offset, nbytes, &written);
 
     (*e)->ReleaseByteArrayElements(e, buf, bytes, JNI_ABORT);

Modified: tomcat/native/trunk/xdocs/miscellaneous/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/native/trunk/xdocs/miscellaneous/changelog.xml?rev=1781102&r1=1781101&r2=1781102&view=diff
==============================================================================
--- tomcat/native/trunk/xdocs/miscellaneous/changelog.xml (original)
+++ tomcat/native/trunk/xdocs/miscellaneous/changelog.xml Tue Jan 31 15:15:43 2017
@@ -41,6 +41,12 @@
       and expand the instructions for building for Windows platforms. (markt)
     </fix>
     <fix>
+      <bug>55938</bug>: Resolve remaining clang-analyzer warnings. Note that the
+      use of <code>-1</code> to indicate the full array in
+      <code>File.(read|write)[Full]</code> has been removed since it was only
+      partially implemented and the implementation was faulty. (markt)
+    </fix>
+    <fix>
       <bug>58082</bug>: Update unit tests to use JUnit 4. Refactor unit tests
       into separate tests and use an external to reference them in the same way
       an external is used to reference the main code. (markt)

Modified: tomcat/trunk/java/org/apache/tomcat/jni/File.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/jni/File.java?rev=1781102&r1=1781101&r2=1781102&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/jni/File.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/jni/File.java Tue Jan 31 15:15:43 2017
@@ -359,7 +359,7 @@ public class File {
      * @param thefile The file descriptor to write to.
      * @param buf The buffer which contains the data.
      * @param offset Start offset in buf
-     * @param nbytes The number of bytes to write; (-1) for full array.
+     * @param nbytes The number of bytes to write
      * @return The number of bytes written.
      */
     public static native int write(long thefile, byte[] buf, int offset, int nbytes);
@@ -400,7 +400,7 @@ public class File {
      * @param thefile The file descriptor to write to.
      * @param buf The buffer which contains the data.
      * @param offset Start offset in buf
-     * @param nbytes The number of bytes to write; (-1) for full array.
+     * @param nbytes The number of bytes to write
      * @return The number of bytes written.
      */
     public static native int writeFull(long thefile, byte[] buf, int offset, int nbytes);
@@ -469,7 +469,7 @@ public class File {
      * @param thefile The file descriptor to read from.
      * @param buf The buffer to store the data to.
      * @param offset Start offset in buf
-     * @param nbytes The number of bytes to read (-1) for full array.
+     * @param nbytes The number of bytes to read
      * @return the number of bytes read.
      */
     public static native int read(long thefile, byte[] buf,  int offset, int nbytes);
@@ -512,7 +512,7 @@ public class File {
      * @param thefile The file descriptor to read from.
      * @param buf The buffer to store the data to.
      * @param offset Start offset in buf
-     * @param nbytes The number of bytes to read (-1) for full array.
+     * @param nbytes The number of bytes to read
      * @return the number of bytes read.
      */
     public static native int readFull(long thefile, byte[] buf,  int offset, int nbytes);



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org