You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ma...@apache.org on 2011/05/16 20:50:40 UTC

svn commit: r1103838 - in /subversion/trunk/subversion/bindings/javahl/native: Prompter.cpp Prompter.h

Author: markphip
Date: Mon May 16 18:50:40 2011
New Revision: 1103838

URL: http://svn.apache.org/viewvc?rev=1103838&view=rev
Log:
JavaHL: Fixed JNI code to look for the new UserPasswordCallback class
in place of the old PromptUserPasswordN classes.  Also removed/updated
code comments that referenced the old class.

Our test suite does not exercise this code unless you run the JavaHL
tests against https:// repository (which no one does).

[ in subversion/bindings/javahl/ ]

* native/Prompter.cpp
  Replaced references to PromptUserPasswordN with UserPasswordCallback.
  Also removed and updated stale comments.

* native/Prompter.h
  Removed stale comments.

Modified:
    subversion/trunk/subversion/bindings/javahl/native/Prompter.cpp
    subversion/trunk/subversion/bindings/javahl/native/Prompter.h

Modified: subversion/trunk/subversion/bindings/javahl/native/Prompter.cpp
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/Prompter.cpp?rev=1103838&r1=1103837&r2=1103838&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/Prompter.cpp (original)
+++ subversion/trunk/subversion/bindings/javahl/native/Prompter.cpp Mon May 16 18:50:40 2011
@@ -38,8 +38,6 @@
 /**
  * Constructor
  * @param jprompter     a global reference to the Java callback object
- * @param v2            the callback objects implements PromptUserPassword2
- * @param v3            the callback objects implements PromptUserPassword3
  */
 Prompter::Prompter(jobject jprompter)
 {
@@ -76,7 +74,7 @@ Prompter *Prompter::makeCPrompter(jobjec
   if (JNIUtil::isJavaExceptionThrown())
     return NULL;
 
-  // Sanity check that the Java object implements PromptUserPassword.
+  // Sanity check that the Java object implements UserPasswordCallback.
   jclass clazz = env->FindClass(JAVA_PACKAGE"/callback/UserPasswordCallback");
   if (JNIUtil::isJavaExceptionThrown())
     POP_AND_RETURN_NULL;
@@ -115,7 +113,7 @@ jstring Prompter::username()
 
   if (mid == 0)
     {
-      jclass clazz = env->FindClass(JAVA_PACKAGE"/PromptUserPassword");
+      jclass clazz = env->FindClass(JAVA_PACKAGE"/callback/UserPasswordCallback");
       if (JNIUtil::isJavaExceptionThrown())
         POP_AND_RETURN_NULL;
 
@@ -150,7 +148,7 @@ jstring Prompter::password()
 
   if (mid == 0)
     {
-      jclass clazz = env->FindClass(JAVA_PACKAGE"/PromptUserPassword");
+      jclass clazz = env->FindClass(JAVA_PACKAGE"/callback/UserPasswordCallback");
       if (JNIUtil::isJavaExceptionThrown())
         POP_AND_RETURN_NULL;
 
@@ -188,7 +186,7 @@ bool Prompter::askYesNo(const char *real
 
   if (mid == 0)
     {
-      jclass clazz = env->FindClass(JAVA_PACKAGE"/PromptUserPassword");
+      jclass clazz = env->FindClass(JAVA_PACKAGE"/callback/UserPasswordCallback");
       if (JNIUtil::isJavaExceptionThrown())
         POP_AND_RETURN(false);
 
@@ -231,7 +229,7 @@ const char *Prompter::askQuestion(const 
   static jmethodID mid2 = 0;
   if (mid == 0)
     {
-      jclass clazz = env->FindClass(JAVA_PACKAGE"/PromptUserPassword3");
+      jclass clazz = env->FindClass(JAVA_PACKAGE"/callback/UserPasswordCallback");
       if (JNIUtil::isJavaExceptionThrown())
         POP_AND_RETURN_NULL;
 
@@ -292,7 +290,7 @@ int Prompter::askTrust(const char *quest
 
    if (mid == 0)
      {
-       jclass clazz = env->FindClass(JAVA_PACKAGE"/PromptUserPassword2");
+       jclass clazz = env->FindClass(JAVA_PACKAGE"/callback/UserPasswordCallback");
        if (JNIUtil::isJavaExceptionThrown())
          POP_AND_RETURN(-1);
 
@@ -328,7 +326,7 @@ bool Prompter::prompt(const char *realm,
   static jmethodID mid2 = 0;
   if (mid == 0)
     {
-      jclass clazz = env->FindClass(JAVA_PACKAGE"/PromptUserPassword3");
+      jclass clazz = env->FindClass(JAVA_PACKAGE"/callback/UserPasswordCallback");
       if (JNIUtil::isJavaExceptionThrown())
         POP_AND_RETURN(false);
 

Modified: subversion/trunk/subversion/bindings/javahl/native/Prompter.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/Prompter.h?rev=1103838&r1=1103837&r2=1103838&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/Prompter.h (original)
+++ subversion/trunk/subversion/bindings/javahl/native/Prompter.h Mon May 16 18:50:40 2011
@@ -33,9 +33,7 @@
 
 /**
  * This class requests username/password and informations about
- * ssl-certificates from the user. There are 3 Java interfaces for that.
- * PromptUserPassword, PromptUserPassword2 and PromptUserPassword3
- * each following interface extends the previous interface.
+ * ssl-certificates from the user.
  */
 class Prompter
 {



Re: svn commit: r1103838 - in /subversion/trunk/subversion/bindings/javahl/native: Prompter.cpp Prompter.h

Posted by Hyrum K Wright <hy...@hyrumwright.org>.
On Mon, May 16, 2011 at 7:06 PM, Mark Phippard <ma...@gmail.com> wrote:
> On Mon, May 16, 2011 at 2:50 PM,  <ma...@apache.org> wrote:
>> Author: markphip
>> Date: Mon May 16 18:50:40 2011
>> New Revision: 1103838
>>
>> URL: http://svn.apache.org/viewvc?rev=1103838&view=rev
>> Log:
>> JavaHL: Fixed JNI code to look for the new UserPasswordCallback class
>> in place of the old PromptUserPasswordN classes.  Also removed/updated
>> code comments that referenced the old class.
>>
>> Our test suite does not exercise this code unless you run the JavaHL
>> tests against https:// repository (which no one does).
>>
>> [ in subversion/bindings/javahl/ ]
>>
>> * native/Prompter.cpp
>>  Replaced references to PromptUserPasswordN with UserPasswordCallback.
>>  Also removed and updated stale comments.
>>
>> * native/Prompter.h
>>  Removed stale comments.
>
> Hyrum,
>
> I did a simple audit of the JavaHL C++ code after this.  Basically I
> grepped for:
>
> "env->FindClass(JAVA_PACKAGE"
>
> These are the only two remaining suspicious items.  Could you take a look?
>
> Revision.cpp (line 161):
>
>  JNIEnv *env = JNIUtil::getEnv();
>  jclass clazz = env->FindClass(JAVA_PACKAGE "/Revision");
>  if (JNIUtil::isJavaExceptionThrown())
>    return NULL;
>
>
> And SVNRepos.cpp (line 638):
>
>  JNIEnv *env = JNIUtil::getEnv();
>  jclass clazz = env->FindClass(JAVA_PACKAGE"/Lock");
>  if (JNIUtil::isJavaExceptionThrown())
>    return NULL;
>
> In both cases, those items are now in the "types" package.  Attaching
> a patch to change those.

Thanks for the audit, it was needed.  The patch looks good and it
passes the tests locally.  +1 to commit (not that you need it...)

-Hyrum

Re: svn commit: r1103838 - in /subversion/trunk/subversion/bindings/javahl/native: Prompter.cpp Prompter.h

Posted by Mark Phippard <ma...@gmail.com>.
On Mon, May 16, 2011 at 2:50 PM,  <ma...@apache.org> wrote:
> Author: markphip
> Date: Mon May 16 18:50:40 2011
> New Revision: 1103838
>
> URL: http://svn.apache.org/viewvc?rev=1103838&view=rev
> Log:
> JavaHL: Fixed JNI code to look for the new UserPasswordCallback class
> in place of the old PromptUserPasswordN classes. �Also removed/updated
> code comments that referenced the old class.
>
> Our test suite does not exercise this code unless you run the JavaHL
> tests against https:// repository (which no one does).
>
> [ in subversion/bindings/javahl/ ]
>
> * native/Prompter.cpp
> �Replaced references to PromptUserPasswordN with UserPasswordCallback.
> �Also removed and updated stale comments.
>
> * native/Prompter.h
> �Removed stale comments.

Hyrum,

I did a simple audit of the JavaHL C++ code after this.  Basically I
grepped for:

"env->FindClass(JAVA_PACKAGE"

These are the only two remaining suspicious items.  Could you take a look?

Revision.cpp (line 161):

  JNIEnv *env = JNIUtil::getEnv();
  jclass clazz = env->FindClass(JAVA_PACKAGE "/Revision");
  if (JNIUtil::isJavaExceptionThrown())
    return NULL;


And SVNRepos.cpp (line 638):

  JNIEnv *env = JNIUtil::getEnv();
  jclass clazz = env->FindClass(JAVA_PACKAGE"/Lock");
  if (JNIUtil::isJavaExceptionThrown())
    return NULL;

In both cases, those items are now in the "types" package.  Attaching
a patch to change those.

-- 
Thanks

Mark Phippard
http://markphip.blogspot.com/