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
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 482c35a362fe
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 9b3a6bb760a6
Choose a head ref
  • 6 commits
  • 4 files changed
  • 1 contributor

Commits on Feb 16, 2016

  1. none throws IOException here

    kares committed Feb 16, 2016
    Copy the full SHA
    6c01511 View commit details
  2. untag passing require tests

    kares committed Feb 16, 2016
    Copy the full SHA
    b4ed241 View commit details
  3. Copy the full SHA
    bdd6868 View commit details
  4. Copy the full SHA
    caacd95 View commit details
  5. Copy the full SHA
    6a78582 View commit details

Commits on Feb 17, 2016

  1. Copy the full SHA
    9b3a6bb View commit details
4 changes: 1 addition & 3 deletions core/src/main/java/org/jruby/ext/zlib/ZlibLibrary.java
Original file line number Diff line number Diff line change
@@ -27,13 +27,11 @@
***** END LICENSE BLOCK *****/
package org.jruby.ext.zlib;

import java.io.IOException;

import org.jruby.Ruby;
import org.jruby.runtime.load.Library;

public class ZlibLibrary implements Library {
public void load(final Ruby runtime, boolean wrap) throws IOException {
public void load(final Ruby runtime, boolean wrap) {
RubyZlib.createZlibModule(runtime);
}
}
38 changes: 15 additions & 23 deletions core/src/main/java/org/jruby/runtime/load/LoadService.java
Original file line number Diff line number Diff line change
@@ -398,7 +398,7 @@ public boolean autoloadRequire(String requireName) {

private enum RequireState {
LOADED, ALREADY_LOADED, CIRCULAR
};
}

private RequireState requireCommon(String file, boolean circularRequireWarning) {
checkEmptyLoad(file);
@@ -431,11 +431,11 @@ private RequireState requireCommon(String file, boolean circularRequireWarning)
private static final class RequireLocks {
private final ConcurrentHashMap<String, ReentrantLock> pool;
// global lock for require must be fair
private final ReentrantLock globalLock;
//private final ReentrantLock globalLock;

private RequireLocks() {
this.pool = new ConcurrentHashMap<>(8, 0.75f, 2);
this.globalLock = new ReentrantLock(true);
//this.globalLock = new ReentrantLock(true);
}

/**
@@ -554,22 +554,25 @@ private static class LoadTimer {
public void endLoad(String file, long startTime) {}
}

private static class TracingLoadTimer extends LoadTimer {
private static final class TracingLoadTimer extends LoadTimer {
private final AtomicInteger indent = new AtomicInteger(0);
private String getIndentString() {
StringBuilder buf = new StringBuilder();
int i = indent.get();

private StringBuilder getIndentString() {
final int i = indent.get();
StringBuilder buf = new StringBuilder(i * 2);
for (int j = 0; j < i; j++) {
buf.append(" ");
buf.append(' ').append(' ');
}
return buf.toString();
return buf;
}

@Override
public long startLoad(String file) {
indent.incrementAndGet();
LOG.info(getIndentString() + "-> " + file);
return System.currentTimeMillis();
}

@Override
public void endLoad(String file, long startTime) {
LOG.info(getIndentString() + "<- " + file + " - "
@@ -797,9 +800,9 @@ public boolean trySearch(SearchState state) throws RaiseException {
int lastSlashIndex = className.lastIndexOf('/');
if (lastSlashIndex > -1 && lastSlashIndex < className.length() - 1 && !Character.isJavaIdentifierStart(className.charAt(lastSlashIndex + 1))) {
if (lastSlashIndex == -1) {
className = "_" + className;
className = '_' + className;
} else {
className = className.substring(0, lastSlashIndex + 1) + "_" + className.substring(lastSlashIndex + 1);
className = className.substring(0, lastSlashIndex + 1) + '_' + className.substring(lastSlashIndex + 1);
}
}
className = className.replace('/', '.');
@@ -922,18 +925,7 @@ private static RaiseException newLoadErrorFromThrowable(Ruby runtime, String fil
return runtime.newLoadError(String.format("load error: %s -- %s: %s", file, t.getClass().getName(), t.getMessage()), file);
}

// Using the BailoutSearch twice, once only for source files and once for state suffixes,
// in order to adhere to Rubyspec
protected final List<LoadSearcher> searchers = new ArrayList<LoadSearcher>();
{
searchers.add(new SourceBailoutSearcher());
searchers.add(new NormalSearcher());
searchers.add(new ClassLoaderSearcher());
searchers.add(new BailoutSearcher());
searchers.add(new ExtensionSearcher());
searchers.add(new ScriptClassSearcher());
}

@Deprecated // no longer used
protected String buildClassName(String className) {
// Remove any relative prefix, e.g. "./foo/bar" becomes "foo/bar".
className = className.replaceFirst("^\\.\\/", "");
15 changes: 9 additions & 6 deletions spec/regression/GH-1371_gzip_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
require 'zlib'

class IoLikeObject
attr_reader :body
@@ -12,9 +11,9 @@ def write(str)
end
end

describe Zlib::GzipWriter do
GZIP_MAGIC_1 = 0x1F
GZIP_MAGIC_2 = 0X8B
describe 'Zlib::GzipWriter' do

before(:all) { require 'zlib' }

it "doesn't corrupt the output" do
io_like_object = IoLikeObject.new
@@ -31,11 +30,15 @@ def write(str)
gzip.flush

# first chunk should still be intact (specifically: it should not be overwritten with the second)
first_chunk.should == io_like_object.body[0]
expect( first_chunk ).to eql io_like_object.body[0]

gzip.close

gzip_magic_1 = 0x1F
gzip_magic_2 = 0X8B

# extra sanity check of the gzip "magic bytes"
io_like_object.body[0].bytes.to_a[0..1].should == [GZIP_MAGIC_1, GZIP_MAGIC_2]
expect( io_like_object.body[0].bytes.to_a[0..1] ).to eql [gzip_magic_1, gzip_magic_2]
end

end
7 changes: 2 additions & 5 deletions test/mri/excludes/TestRequire.rb
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
exclude :test_define_class, "needs investigation"
exclude :test_frozen_loaded_features, "needs investigation"
exclude :test_define_class, "an MRI inconsistency - NameError when class BasicSocket already defined!"
exclude :test_frozen_loaded_features, "error message does not match"
exclude :test_load2, "needs investigation"
exclude :test_race_exception, "needs investigation"
exclude :test_relative_symlink, "needs investigation"
exclude :test_require_changed_home, "needs investigation"
exclude :test_require_nonascii, "needs investigation"
exclude :test_require_nonascii_path_shift_jis, "needs investigation"
exclude :test_require_path_home_1, "needs investigation"
exclude :test_require_path_home_2, "needs investigation"
exclude :test_require_path_home_3, "needs investigation"
exclude :test_require_to_path_redefined_in_load_path, "needs investigation"
exclude :test_require_to_str_redefined_in_load_path, "needs investigation"
exclude :test_require_too_long_filename, "needs investigation"
exclude :test_tainted_loadpath, "needs investigation"