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: 3584f55f133c
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: bd3592803d6c
Choose a head ref
  • 3 commits
  • 5 files changed
  • 1 contributor

Commits on Aug 21, 2015

  1. Copy the full SHA
    dbe8640 View commit details
  2. Copy the full SHA
    003e871 View commit details
  3. Update to psych 2.0.15.

    headius committed Aug 21, 2015
    Copy the full SHA
    bd35928 View commit details
8 changes: 8 additions & 0 deletions core/src/main/java/org/jruby/util/io/EncodingUtils.java
Original file line number Diff line number Diff line change
@@ -1031,10 +1031,12 @@ public static RubyString strConvEncOpts(ThreadContext context, RubyString str, E
EConvResult ret;
int convertedOutput = 0;

// these are in the while clause in MRI
destbytes = newStr.getUnsafeBytes();
int dest = newStr.begin();
dp.p = dest + convertedOutput;
ret = ec.convert(sbytes, sp, start + len, destbytes, dp, dest + olen, 0);

while (ret == EConvResult.DestinationBufferFull) {
int convertedInput = sp.p - start;
int rest = len - convertedInput;
@@ -1048,6 +1050,12 @@ public static RubyString strConvEncOpts(ThreadContext context, RubyString str, E
}
olen += rest < 2 ? 2 : rest;
newStr.ensure(olen);

// these are the while clause in MRI
destbytes = newStr.getUnsafeBytes();
dest = newStr.begin();
dp.p = dest + convertedOutput;
ret = ec.convert(sbytes, sp, start + len, destbytes, dp, dest + olen, 0);
}
ec.close();

1 change: 1 addition & 0 deletions core/src/test/java/org/jruby/test/MainTestSuite.java
Original file line number Diff line number Diff line change
@@ -92,6 +92,7 @@ public static Test suite() throws Throwable {
suite.addTestSuite(ParameterizedWriterTest.class);
suite.addTestSuite(TestRubyRational.class);
suite.addTestSuite(TestRecursiveCheck.class);
suite.addTestSuite(TestEncodingAPI.class);
// Disabled test due to difficulty of making WeakRef logic deterministic
// suite.addTestSuite(TestRegexpCache.class);
return suite;
32 changes: 32 additions & 0 deletions core/src/test/java/org/jruby/test/TestEncodingAPI.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package org.jruby.test;

import junit.framework.TestCase;
import org.jcodings.specific.SJISEncoding;
import org.jcodings.specific.UTF8Encoding;
import org.jruby.CompatVersion;

import org.jruby.Ruby;
import org.jruby.RubyInstanceConfig;
import org.jruby.RubyString;
import org.jruby.util.io.EncodingUtils;

public class TestEncodingAPI extends TestCase {
private Ruby runtime;

public TestEncodingAPI(String name) {
super(name);
}

public void setUp() {
runtime = Ruby.newInstance();
}

public void testStrConvEncThatGrows() throws Exception {
String javaStr = "--- こんにちは!";
RubyString rubyStr = RubyString.newString(runtime, javaStr);
rubyStr = EncodingUtils.strConvEnc(runtime.getCurrentContext(), rubyStr, rubyStr.getEncoding(), SJISEncoding.INSTANCE);
assertEquals(rubyStr.getEncoding(), SJISEncoding.INSTANCE);
rubyStr = EncodingUtils.strConvEnc(runtime.getCurrentContext(), rubyStr, SJISEncoding.INSTANCE, UTF8Encoding.INSTANCE);
assertEquals(rubyStr.getEncoding(), UTF8Encoding.INSTANCE);
}
}
2 changes: 1 addition & 1 deletion lib/pom.rb
Original file line number Diff line number Diff line change
@@ -26,7 +26,7 @@ def version
ImportedGem.new( 'minitest', 'minitest.version', true ),
ImportedGem.new( 'test-unit', 'test-unit.version', true ),
ImportedGem.new( 'power_assert', 'power_assert.version', true ),
ImportedGem.new( 'psych', '2.0.14', true ),
ImportedGem.new( 'psych', '2.0.15', true ),
ImportedGem.new( 'json', 'json.version', true ),
ImportedGem.new( 'jar-dependencies', '0.1.15', true )
]
2 changes: 1 addition & 1 deletion lib/pom.xml
Original file line number Diff line number Diff line change
@@ -125,7 +125,7 @@ DO NOT MODIFIY - GENERATED CODE
<dependency>
<groupId>rubygems</groupId>
<artifactId>psych</artifactId>
<version>2.0.14</version>
<version>2.0.15</version>
<type>gem</type>
<scope>provided</scope>
<exclusions>