subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r1456328 - in /subversion/trunk/subversion/bindings/javahl: native/DiffOptions.cpp native/DiffOptions.h src/org/apache/subversion/javahl/types/DiffOptions.java tests/org/apache/subversion/javahl/BasicTests.java
Date Thu, 14 Mar 2013 05:30:04 GMT
Author: brane
Date: Thu Mar 14 05:30:04 2013
New Revision: 1456328

URL: http://svn.apache.org/r1456328
Log:
Fix a silly bug in the JavaHL native implementation of DiffOptions.

[in subversion/bindings/javahl/native]
* DiffOptions.cpp (get_diff_options_flags): Actually store the retreived
   field ID of the DiffOptions.flags Java class member.
   Don't make assumptions about types -- use jint instead of int.

* DiffOptions.h, DiffOptions.cpp (DiffOptions):
   Don't make assumptions about types -- use jint instead of int.

[in subversion/bindings/javahl/tests/org/apache/subversion/javahl]
* BasicTests.java (BasicTests.testDiffOptions):
   Enable a previoiusly failing hunk of test.

[in subversion/bindings/javahl/src/org/apache/subversion/javahl]
* types/DiffOptions.java: Add missing trailing newline.

Modified:
    subversion/trunk/subversion/bindings/javahl/native/DiffOptions.cpp
    subversion/trunk/subversion/bindings/javahl/native/DiffOptions.h
    subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/types/DiffOptions.java
    subversion/trunk/subversion/bindings/javahl/tests/org/apache/subversion/javahl/BasicTests.java

Modified: subversion/trunk/subversion/bindings/javahl/native/DiffOptions.cpp
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/DiffOptions.cpp?rev=1456328&r1=1456327&r2=1456328&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/DiffOptions.cpp (original)
+++ subversion/trunk/subversion/bindings/javahl/native/DiffOptions.cpp Thu Mar 14 05:30:04
2013
@@ -27,7 +27,7 @@
 #include "DiffOptions.h"
 
 namespace {
-static int get_diff_options_flags(jobject joptions)
+static jint get_diff_options_flags(jobject joptions)
 {
   if (!joptions)
     return 0;
@@ -37,12 +37,12 @@ static int get_diff_options_flags(jobjec
   static volatile jfieldID fid = 0;
   if (!fid)
     {
-      env->GetFieldID(env->GetObjectClass(joptions), "flags", "I");
+      fid = env->GetFieldID(env->GetObjectClass(joptions), "flags", "I");
       if (JNIUtil::isJavaExceptionThrown())
         return 0;
     }
 
-  const int flags = env->GetIntField(joptions, fid);
+  const jint flags = env->GetLongField(joptions, fid);
   if (JNIUtil::isJavaExceptionThrown())
     return 0;
   return flags;

Modified: subversion/trunk/subversion/bindings/javahl/native/DiffOptions.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/DiffOptions.h?rev=1456328&r1=1456327&r2=1456328&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/DiffOptions.h (original)
+++ subversion/trunk/subversion/bindings/javahl/native/DiffOptions.h Thu Mar 14 05:30:04 2013
@@ -45,13 +45,13 @@ class DiffOptions
   }
 
  private:
-  static const int IGNORE_ALL_SPACE    = 0x01;
-  static const int IGNORE_SPACE_CHANGE = 0x02;
-  static const int IGNORE_EOL_STYLE    = 0x04;
-  static const int SHOW_C_FUNCTION     = 0x08;
-  static const int USE_GIT_DIFF_FORMAT = 0x10;
+  static const jint IGNORE_ALL_SPACE    = 0x01;
+  static const jint IGNORE_SPACE_CHANGE = 0x02;
+  static const jint IGNORE_EOL_STYLE    = 0x04;
+  static const jint SHOW_C_FUNCTION     = 0x08;
+  static const jint USE_GIT_DIFF_FORMAT = 0x10;
 
-  const int flags;
+  const jint flags;
 };
 
 

Modified: subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/types/DiffOptions.java
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/types/DiffOptions.java?rev=1456328&r1=1456327&r2=1456328&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/types/DiffOptions.java
(original)
+++ subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/types/DiffOptions.java
Thu Mar 14 05:30:04 2013
@@ -98,4 +98,4 @@ public class DiffOptions
     }
 
     private final int flags;
-}
\ No newline at end of file
+}

Modified: subversion/trunk/subversion/bindings/javahl/tests/org/apache/subversion/javahl/BasicTests.java
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/tests/org/apache/subversion/javahl/BasicTests.java?rev=1456328&r1=1456327&r2=1456328&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/tests/org/apache/subversion/javahl/BasicTests.java
(original)
+++ subversion/trunk/subversion/bindings/javahl/tests/org/apache/subversion/javahl/BasicTests.java
Thu Mar 14 05:30:04 2013
@@ -3127,33 +3127,30 @@ public class BasicTests extends SVNTests
         writer.flush();
         writer.close();
 
-        // FIXME: Why is the actual diff output empty in this case?
-        //        It shouldn't be, since 'iota' -> 'io ta' is not
-        //        a change in existing whitespace.
-        //try
-        //{
-        //    final String expectedDiffOutput = expectedDiffHeader +
-        //        "@@ -1 +1 @@" + NL +
-        //        "-This is the file 'iota'." + NL +
-        //        "\\ No newline at end of file" + NL +
-        //        "+This is  the  file 'io ta'." + NL +
-        //        "\\ No newline at end of file" + NL;
-        //
-        //    client.diff(iotaPath, Revision.BASE, iotaPath, Revision.WORKING,
-        //                wcPath, diffOutput.getPath(), Depth.infinity, null,
-        //                false, false, false, false, false, false,
-        //                new DiffOptions(DiffOptions.Flag.IgnoreSpaceChange));
-        //    assertFileContentsEquals(
-        //        "Unexpected diff output with Flag.IgnoreSpaceChange in file '" +
-        //        diffOutput.getPath() + '\'',
-        //        expectedDiffOutput, diffOutput);
-        //    diffOutput.delete();
-        //}
-        //catch (ClientException e)
-        //{
-        //    fail("Using Flag.IgnoreSpaceChange: "
-        //         + e.getMessage());
-        //}
+        try
+        {
+            final String expectedDiffOutput = expectedDiffHeader +
+                "@@ -1 +1 @@" + NL +
+                "-This is the file 'iota'." + NL +
+                "\\ No newline at end of file" + NL +
+                "+This is  the  file 'io ta'." + NL +
+                "\\ No newline at end of file" + NL;
+
+            client.diff(iotaPath, Revision.BASE, iotaPath, Revision.WORKING,
+                        wcPath, diffOutput.getPath(), Depth.infinity, null,
+                        false, false, false, false, false, false,
+                        new DiffOptions(DiffOptions.Flag.IgnoreSpaceChange));
+            assertFileContentsEquals(
+                "Unexpected diff output with Flag.IgnoreSpaceChange in file '" +
+                diffOutput.getPath() + '\'',
+                expectedDiffOutput, diffOutput);
+            diffOutput.delete();
+        }
+        catch (ClientException e)
+        {
+            fail("Using Flag.IgnoreSpaceChange: "
+                 + e.getMessage());
+        }
     }
 
 



Mime
View raw message