Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby-openssl
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: dc28d09acd91
Choose a base ref
...
head repository: jruby/jruby-openssl
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 916ef9ba5798
Choose a head ref
  • 3 commits
  • 4 files changed
  • 1 contributor

Commits on Mar 30, 2016

  1. Verified

    This commit was signed with the committer’s verified signature.
    makenowjust Hiroya Fujinami
    Copy the full SHA
    226a278 View commit details
  2. Copy the full SHA
    122c03d View commit details
  3. code-style

    kares committed Mar 30, 2016
    Copy the full SHA
    916ef9b View commit details
Showing with 24 additions and 11 deletions.
  1. +1 −1 lib/jopenssl/version.rb
  2. +1 −1 pom.xml
  3. +2 −5 src/main/java/org/jruby/ext/openssl/OpenSSL.java
  4. +20 −4 src/main/java/org/jruby/ext/openssl/SSLSession.java
2 changes: 1 addition & 1 deletion lib/jopenssl/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Jopenssl
VERSION = '0.9.17'
VERSION = '0.9.17.dev'
BOUNCY_CASTLE_VERSION = '1.54'
# @deprecated
module Version
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@ DO NOT MODIFIY - GENERATED CODE
<modelVersion>4.0.0</modelVersion>
<groupId>rubygems</groupId>
<artifactId>jruby-openssl</artifactId>
<version>0.9.17</version>
<version>0.9.17.dev-SNAPSHOT</version>
<packaging>gem</packaging>
<name>JRuby OpenSSL</name>
<description>JRuby-OpenSSL is an add-on gem for JRuby that emulates the Ruby OpenSSL native library.</description>
7 changes: 2 additions & 5 deletions src/main/java/org/jruby/ext/openssl/OpenSSL.java
Original file line number Diff line number Diff line change
@@ -236,11 +236,8 @@ static void warn(final ThreadContext context, final IRubyObject msg) {
private static String javaVersion(final String def) {
final String javaVersionProperty =
SafePropertyAccessor.getProperty("java.version", def);
if (javaVersionProperty == "0") { // Android
return "1.7.0";
} else {
return javaVersionProperty;
}
if ( javaVersionProperty == "0" ) return "1.7.0"; // Android
return javaVersionProperty;
}

static boolean javaVersion7(final boolean atLeast) {
24 changes: 20 additions & 4 deletions src/main/java/org/jruby/ext/openssl/SSLSession.java
Original file line number Diff line number Diff line change
@@ -28,7 +28,9 @@

import org.jruby.Ruby;
import org.jruby.RubyClass;
import org.jruby.RubyFixnum;
import org.jruby.RubyModule;
import org.jruby.RubyNumeric;
import org.jruby.RubyObject;
import org.jruby.RubyString;
import org.jruby.RubyTime;
@@ -96,15 +98,30 @@ final javax.net.ssl.SSLSession sslSession() {

@JRubyMethod(name = "==")
public IRubyObject op_eqq(final ThreadContext context, final IRubyObject other) {
return context.runtime.newBoolean( equals(other) );
}

@Override
public boolean equals(final Object other) {
if ( other instanceof SSLSession ) {
final SSLSession that = (SSLSession) other;
if ( this.sslSession.getProtocol().equals( that.sslSession.getProtocol() ) ) {
if ( Arrays.equals( this.sslSession.getId(), that.sslSession.getId() ) ) {
return context.runtime.getTrue();
return true;
}
}
}
return context.runtime.getFalse();
return false;
}

@Override
public final int hashCode() {
return 17 * sslSession.hashCode();
}

@Override
public RubyFixnum hash() {
return getRuntime().newFixnum(hashCode());
}

@JRubyMethod(name = "id")
@@ -146,8 +163,7 @@ public IRubyObject set_timeout(final ThreadContext context, IRubyObject timeout)
warn(context, "WARNING: can not set Session#timeout=("+ timeout +") no session context");
return context.nil;
}
final long t = timeout.convertToInteger().getLongValue();
sessionContext.setSessionTimeout((int) t); // in seconds as well
sessionContext.setSessionTimeout(RubyNumeric.fix2int(timeout)); // in seconds as well
return timeout;
}