Skip to content

Commit

Permalink
Merge with jruby-1_7
Browse files Browse the repository at this point in the history
  • Loading branch information
enebo committed Dec 3, 2014
2 parents 254c148 + 2c6af6d commit 84bc523
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 6 deletions.
9 changes: 7 additions & 2 deletions core/src/main/java/org/jruby/RubyClassPathVariable.java
Expand Up @@ -66,10 +66,15 @@ public IRubyObject append(ThreadContext context, IRubyObject obj) {
paths = context.runtime.newArray(obj).toJavaArray();
}

boolean is1_8 = context.getRuntime().is1_8();
for (IRubyObject path: paths) {
String ss = path.convertToString().toString();
try {
URL url = getURL(ss);
URL url = getURL(path.convertToString().toString());
if (url.getProtocol().equals("file")) {
path = is1_8 ? RubyFile.expand_path(context, null, new IRubyObject[]{ path })
: RubyFile.expand_path19(context, null, new IRubyObject[]{ path });
url = getURL(path.convertToString().toString());
}
getRuntime().getJRubyClassLoader().addURL(url);
} catch (MalformedURLException mue) {
throw getRuntime().newArgumentError(mue.getLocalizedMessage());
Expand Down
5 changes: 5 additions & 0 deletions core/src/main/java/org/jruby/ast/DXStrNode.java
Expand Up @@ -31,6 +31,7 @@
***** END LICENSE BLOCK *****/
package org.jruby.ast;

import org.jcodings.Encoding;
import org.jruby.ast.types.ILiteralNode;
import org.jruby.ast.visitor.NodeVisitor;
import org.jruby.lexer.yacc.ISourcePosition;
Expand All @@ -44,6 +45,10 @@ public DXStrNode(ISourcePosition position, DStrNode node) {
super(position);
addAll(node);
}

public DXStrNode(ISourcePosition position, Encoding encoding) {
super(position, encoding);
}

public DXStrNode(ISourcePosition position) {
super(position);
Expand Down
Empty file.
7 changes: 3 additions & 4 deletions spec/java_integration/globals/classpath_spec.rb
Expand Up @@ -4,15 +4,14 @@
describe "<<" do
it "accepts an object" do
$CLASSPATH << "file"
$CLASSPATH.to_a.include?("file:file").should == true
$CLASSPATH.to_a.include?("file:#{File.expand_path('file')}").should == true
end

it "accepts an array" do
Dir.chdir(File.join(File.dirname(__FILE__), '..', '..', '..', 'lib')) do
$CLASSPATH << Dir.glob("*.jar")
($CLASSPATH.to_a.include?("file:jruby.jar") ||
$CLASSPATH.to_a.include?("file:jruby-complete.jar") ).should == true
($CLASSPATH.to_a.include?("file:#{File.expand_path('jruby.jar')}")).should == true
end
end
end
end
end
@@ -0,0 +1,20 @@
require 'rspec'
require 'fileutils'

describe 'GH-2264: Illegal hex characters in escape pattern' do
let(:dir_name) { 'test_dir!' }
let(:file_name) { 'test_file%' }

before :each do
FileUtils.mkdir(dir_name)
FileUtils.touch("#{dir_name}/#{file_name}")
end

after :each do
FileUtils.rm_r(dir_name) if Dir.exist?(dir_name)
end

it 'can glob directories' do
Dir.glob("#{dir_name}/**/*").size.should eq 1
end
end

0 comments on commit 84bc523

Please sign in to comment.