Skip to content

Commit

Permalink
avoid using JRuby IO APIs (will likely not work in 9k)
Browse files Browse the repository at this point in the history
  • Loading branch information
kares committed Jul 8, 2014
1 parent 9513115 commit f54b3bc
Showing 1 changed file with 1 addition and 20 deletions.
21 changes: 1 addition & 20 deletions src/main/java/org/jruby/ext/openssl/x509store/Lookup.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,6 @@

import org.jruby.Ruby;
import org.jruby.RubyHash;
import org.jruby.util.io.ChannelDescriptor;
import org.jruby.util.io.ChannelStream;
import org.jruby.util.io.FileExistsException;
import org.jruby.util.io.InvalidValueException;
import org.jruby.util.io.ModeFlags;

import org.jruby.ext.openssl.SecurityHelper;

Expand Down Expand Up @@ -294,21 +289,7 @@ public int loadDefaultJavaCACertsFile() throws Exception {
}

private InputStream wrapJRubyNormalizedInputStream(String file) throws IOException {
Ruby runtime = Ruby.getGlobalRuntime();
try {
ChannelDescriptor descriptor = ChannelDescriptor.open(runtime.getCurrentDirectory(), file, new ModeFlags(ModeFlags.RDONLY));
return ChannelStream.open(runtime, descriptor).newInputStream();
} catch (NoSuchMethodError nsme) {
return new BufferedInputStream(new FileInputStream(file));
} catch (FileExistsException fee) {
// should not happen because ModeFlag does not contain CREAT.
fee.printStackTrace(System.err);
throw new IllegalStateException(fee.getMessage(), fee);
} catch (InvalidValueException ive) {
// should not happen because ModeFlasg does not contain APPEND.
ive.printStackTrace(System.err);
throw new IllegalStateException(ive.getMessage(), ive);
}
return new BufferedInputStream(new FileInputStream(file));
}

/**
Expand Down

0 comments on commit f54b3bc

Please sign in to comment.