Title: [819] trunk/jopenssl:
Get failing x509 name test working due to missing default hash value
- Revision
- 819
- Author
- nicksieger
- Date
- 2007-11-29 16:54:28 -0500 (Thu, 29 Nov 2007)
Log Message
Get failing x509 name test working due to missing default hash value
Modified Paths
Diff
Modified: trunk/jopenssl/src/java/org/jruby/ext/openssl/ASN1.java (818 => 819)
--- trunk/jopenssl/src/java/org/jruby/ext/openssl/ASN1.java 2007-11-29 21:12:26 UTC (rev 818)
+++ trunk/jopenssl/src/java/org/jruby/ext/openssl/ASN1.java 2007-11-29 21:54:28 UTC (rev 819)
@@ -507,9 +507,11 @@
bString.callMethod(tc,"unused_bits=",asnM.getRuntime().newFixnum(((DERBitString)v).getPadBits()));
return bString;
} else if(v instanceof DERString) {
- String val = ((DERString)v).getString();
- if(v instanceof DERUTF8String) {
- val = new String(ByteList.plain(val.getBytes("UTF-8")));
+ ByteList val;
+ if (v instanceof DERUTF8String) {
+ val = new ByteList(((DERUTF8String) v).getString().getBytes("UTF-8"));
+ } else {
+ val = ByteList.create(((DERString)v).getString());
}
return c.callMethod(tc,"new",asnM.getRuntime().newString(val));
} else if(v instanceof ASN1Sequence) {
Modified: trunk/jopenssl/src/java/org/jruby/ext/openssl/X509Name.java (818 => 819)
--- trunk/jopenssl/src/java/org/jruby/ext/openssl/X509Name.java 2007-11-29 21:12:26 UTC (rev 818)
+++ trunk/jopenssl/src/java/org/jruby/ext/openssl/X509Name.java 2007-11-29 21:54:28 UTC (rev 819)
@@ -95,15 +95,15 @@
cX509Name.setConstant("DEFAULT_OBJECT_TYPE",runtime.newFixnum(DERTags.UTF8_STRING));
- Map val = new HashMap();
- val.put(runtime.newString("C"),runtime.newFixnum(DERTags.PRINTABLE_STRING));
- val.put(runtime.newString("countryName"),runtime.newFixnum(DERTags.PRINTABLE_STRING));
- val.put(runtime.newString("serialNumber"),runtime.newFixnum(DERTags.PRINTABLE_STRING));
- val.put(runtime.newString("dnQualifier"),runtime.newFixnum(DERTags.PRINTABLE_STRING));
- val.put(runtime.newString("DC"),runtime.newFixnum(DERTags.IA5_STRING));
- val.put(runtime.newString("domainComponent"),runtime.newFixnum(DERTags.IA5_STRING));
- val.put(runtime.newString("emailAddress"),runtime.newFixnum(DERTags.IA5_STRING));
- cX509Name.setConstant("OBJECT_TYPE_TEMPLATE",new RubyHash(runtime,val,runtime.newFixnum(DERTags.UTF8_STRING)));
+ RubyHash hash = new RubyHash(runtime, runtime.newFixnum(DERTags.UTF8_STRING));
+ hash.op_aset(runtime.newString("C"),runtime.newFixnum(DERTags.PRINTABLE_STRING));
+ hash.op_aset(runtime.newString("countryName"),runtime.newFixnum(DERTags.PRINTABLE_STRING));
+ hash.op_aset(runtime.newString("serialNumber"),runtime.newFixnum(DERTags.PRINTABLE_STRING));
+ hash.op_aset(runtime.newString("dnQualifier"),runtime.newFixnum(DERTags.PRINTABLE_STRING));
+ hash.op_aset(runtime.newString("DC"),runtime.newFixnum(DERTags.IA5_STRING));
+ hash.op_aset(runtime.newString("domainComponent"),runtime.newFixnum(DERTags.IA5_STRING));
+ hash.op_aset(runtime.newString("emailAddress"),runtime.newFixnum(DERTags.IA5_STRING));
+ cX509Name.setConstant("OBJECT_TYPE_TEMPLATE", hash);
}
public static final int COMPAT = 0;
Modified: trunk/jopenssl/test/test_openssl.rb (818 => 819)
--- trunk/jopenssl/test/test_openssl.rb 2007-11-29 21:12:26 UTC (rev 818)
+++ trunk/jopenssl/test/test_openssl.rb 2007-11-29 21:54:28 UTC (rev 819)
@@ -1,15 +1,18 @@
-require 'java'
-
-isFive = false
-begin
- java.lang.StringBuilder
- isFive = true
-rescue
- nil
+if RUBY_PLATFORM =~ /java/
+ require 'java'
+ runTests = false
+ begin
+ java.lang.StringBuilder
+ runTests = true
+ rescue
+ nil
+ end
+else
+ runTests = true
end
-if isFive
+if runTests
# won't work, since kill and pid is used.
# require 'test/openssl/test_ssl'
require 'test/openssl/test_asn1'
_______________________________________________
Jruby-extras-devel mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/jruby-extras-devel