Skip to content

Error in File.stat #2424

@n-nishizawa

Description

@n-nishizawa

I'm using jruby 1.7.17

$ jruby -v
jruby 1.7.17 (1.9.3p392) 2014-12-09 fafd1a7 on Java HotSpot(TM) 64-Bit Server VM 1.7.0_07-b10 +jit [Windows 7-amd64]

I tested this code on windows 7.

# coding: utf-8

path = 'てすと.txt'
puts "FileTest.readable?: #{FileTest.readable?(path)}"
puts File.stat(path)

And I got an error when I set java default encoding utf-8.

>jruby -J-Dfile.encoding=utf-8 stat.rb
FileTest.readable?: true
Errno::ENOENT: No such file or directory - 縺ヲ縺吶→.txt
    stat at org/jruby/RubyFile.java:848
  (root) at stat.rb:5

The file specified by the variable path exists.
In fact, FileTest.readable? returns true.
And I can also read data from the file.
But File.stat throws an exception.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions