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

Commits on May 23, 2017

  1. We need to be like we were before in making a string from a bytelist …

    …in the helper. Note: Once we switch to bytelist this method will never be called again.
    enebo committed May 23, 2017
    Copy the full SHA
    699b97b View commit details
  2. Copy the full SHA
    078d23e View commit details
Showing with 10 additions and 2 deletions.
  1. +2 −1 core/src/main/java/org/jruby/lexer/yacc/RubyLexer.java
  2. +8 −1 core/src/main/java/org/jruby/util/StringSupport.java
3 changes: 2 additions & 1 deletion core/src/main/java/org/jruby/lexer/yacc/RubyLexer.java
Original file line number Diff line number Diff line change
@@ -1354,7 +1354,8 @@ private int dollar() throws IOException {
} while (Character.isDigit(c));
pushback(c);
if (isLexState(last_state, EXPR_FNAME)) {
yaccValue = createTokenString().intern();
createTokenString().intern();
yaccValue = getIdentifier();
return Tokens.tGVAR;
}

9 changes: 8 additions & 1 deletion core/src/main/java/org/jruby/util/StringSupport.java
Original file line number Diff line number Diff line change
@@ -49,6 +49,8 @@
import org.jruby.util.io.EncodingUtils;
import sun.misc.Unsafe;

import java.nio.charset.Charset;
import java.nio.charset.UnsupportedCharsetException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
@@ -2467,6 +2469,11 @@ public static ByteList[] stringsAsByteLists(String[] strings) {
}

public static String byteListAsString(ByteList bytes) {
return new String(bytes.unsafeBytes(), bytes.begin(), bytes.realSize(), bytes.getEncoding().getCharset());
try {
Charset charset = bytes.getEncoding().getCharset();
if (charset != null) return new String(bytes.unsafeBytes(), bytes.begin(), bytes.realSize(), charset);
} catch (UnsupportedCharsetException e) {}

return new String(bytes.unsafeBytes(), bytes.begin(), bytes.realSize());
}
}