Title: [1144] trunk/jopenssl/src/java/org/jruby/ext/openssl/Cipher.java: Choose location of CipherError based on compat version.
Revision
1144
Author
headius
Date
2009-02-12 11:17:06 -0500 (Thu, 12 Feb 2009)

Log Message

Choose location of CipherError based on compat version. Also added a spec. JRUBY-3163.

Modified Paths

Diff

Modified: trunk/jopenssl/src/java/org/jruby/ext/openssl/Cipher.java (1143 => 1144)


--- trunk/jopenssl/src/java/org/jruby/ext/openssl/Cipher.java	2009-02-12 09:26:03 UTC (rev 1143)
+++ trunk/jopenssl/src/java/org/jruby/ext/openssl/Cipher.java	2009-02-12 16:17:06 UTC (rev 1144)
@@ -37,6 +37,7 @@
 
 import javax.crypto.spec.IvParameterSpec;
 
+import org.jruby.CompatVersion;
 import org.jruby.Ruby;
 import org.jruby.RubyClass;
 import org.jruby.RubyModule;
@@ -48,7 +49,6 @@
 import org.jruby.anno.JRubyMethod;
 import org.jruby.anno.JRubyModule;
 import org.jruby.exceptions.RaiseException;
-import org.jruby.runtime.Block;
 import org.jruby.runtime.ObjectAllocator;
 import org.jruby.runtime.builtin.IRubyObject;
 import org.jruby.util.ByteList;
@@ -70,7 +70,11 @@
         RubyClass cCipher = mCipher.defineClassUnder("Cipher",runtime.getObject(), CIPHER_ALLOCATOR);
 
         RubyClass openSSLError = ossl.getClass("OpenSSLError");
-        ossl.defineClassUnder("CipherError",openSSLError,openSSLError.getAllocator());
+        if (runtime.getInstanceConfig().getCompatVersion() == CompatVersion.RUBY1_9) {
+            mCipher.defineClassUnder("CipherError",openSSLError,openSSLError.getAllocator());
+        } else {
+            ossl.defineClassUnder("CipherError",openSSLError,openSSLError.getAllocator());
+        }
 
         cCipher.defineAnnotatedMethods(Cipher.class);
         mCipher.defineAnnotatedMethods(CipherModule.class);
_______________________________________________
Jruby-extras-devel mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/jruby-extras-devel

Reply via email to