Skip to content

Commit 84bc523

Browse files
committed
Merge with jruby-1_7
2 parents 254c148 + 2c6af6d commit 84bc523

File tree

5 files changed

+35
-6
lines changed

5 files changed

+35
-6
lines changed

core/src/main/java/org/jruby/RubyClassPathVariable.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,15 @@ public IRubyObject append(ThreadContext context, IRubyObject obj) {
6666
paths = context.runtime.newArray(obj).toJavaArray();
6767
}
6868

69+
boolean is1_8 = context.getRuntime().is1_8();
6970
for (IRubyObject path: paths) {
70-
String ss = path.convertToString().toString();
7171
try {
72-
URL url = getURL(ss);
72+
URL url = getURL(path.convertToString().toString());
73+
if (url.getProtocol().equals("file")) {
74+
path = is1_8 ? RubyFile.expand_path(context, null, new IRubyObject[]{ path })
75+
: RubyFile.expand_path19(context, null, new IRubyObject[]{ path });
76+
url = getURL(path.convertToString().toString());
77+
}
7378
getRuntime().getJRubyClassLoader().addURL(url);
7479
} catch (MalformedURLException mue) {
7580
throw getRuntime().newArgumentError(mue.getLocalizedMessage());

core/src/main/java/org/jruby/ast/DXStrNode.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
***** END LICENSE BLOCK *****/
3232
package org.jruby.ast;
3333

34+
import org.jcodings.Encoding;
3435
import org.jruby.ast.types.ILiteralNode;
3536
import org.jruby.ast.visitor.NodeVisitor;
3637
import org.jruby.lexer.yacc.ISourcePosition;
@@ -44,6 +45,10 @@ public DXStrNode(ISourcePosition position, DStrNode node) {
4445
super(position);
4546
addAll(node);
4647
}
48+
49+
public DXStrNode(ISourcePosition position, Encoding encoding) {
50+
super(position, encoding);
51+
}
4752

4853
public DXStrNode(ISourcePosition position) {
4954
super(position);

core/src/main/java/org/jruby/parser/Ruby19.java

Whitespace-only changes.

spec/java_integration/globals/classpath_spec.rb

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,14 @@
44
describe "<<" do
55
it "accepts an object" do
66
$CLASSPATH << "file"
7-
$CLASSPATH.to_a.include?("file:file").should == true
7+
$CLASSPATH.to_a.include?("file:#{File.expand_path('file')}").should == true
88
end
99

1010
it "accepts an array" do
1111
Dir.chdir(File.join(File.dirname(__FILE__), '..', '..', '..', 'lib')) do
1212
$CLASSPATH << Dir.glob("*.jar")
13-
($CLASSPATH.to_a.include?("file:jruby.jar") ||
14-
$CLASSPATH.to_a.include?("file:jruby-complete.jar") ).should == true
13+
($CLASSPATH.to_a.include?("file:#{File.expand_path('jruby.jar')}")).should == true
1514
end
1615
end
1716
end
18-
end
17+
end
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
require 'rspec'
2+
require 'fileutils'
3+
4+
describe 'GH-2264: Illegal hex characters in escape pattern' do
5+
let(:dir_name) { 'test_dir!' }
6+
let(:file_name) { 'test_file%' }
7+
8+
before :each do
9+
FileUtils.mkdir(dir_name)
10+
FileUtils.touch("#{dir_name}/#{file_name}")
11+
end
12+
13+
after :each do
14+
FileUtils.rm_r(dir_name) if Dir.exist?(dir_name)
15+
end
16+
17+
it 'can glob directories' do
18+
Dir.glob("#{dir_name}/**/*").size.should eq 1
19+
end
20+
end

0 commit comments

Comments
 (0)