Dmitry Ratnikov
2014-02-19 22:53:55 UTC
Hey all,
This in regards of replacing NonExistentFile.NOT_EXIST check with a special
EmptyFileResource (or NotExistsFileResource, if you strongly prefer):
https://github.com/jruby/jruby/blob/jruby-1_7/core/src/main/java/org/jruby/util/JRubyFile.java#L67
What I realized is that some of the filestat methods (e.g. size,
lastModified and others) should raise ErrorNoENOENTError like MRI does, but
I don't have a reference to Ruby object to raise it from. Technically, I
can probably get away with throwing some sort of RTE (e.g.
OperationUnsupportedException) since I'm pretty sure FileTest checks for
existence and raises "Not found" error for me, but that sounds ugly.
Before I make JRubyFile.createResource(Ruby, String) method mandatory, kill
createResource(String, String) and will have to rewrite most of
org.jruby.util.Dir to conform to the new interface, maybe you have some
other suggestions?
Thanks!
This in regards of replacing NonExistentFile.NOT_EXIST check with a special
EmptyFileResource (or NotExistsFileResource, if you strongly prefer):
https://github.com/jruby/jruby/blob/jruby-1_7/core/src/main/java/org/jruby/util/JRubyFile.java#L67
What I realized is that some of the filestat methods (e.g. size,
lastModified and others) should raise ErrorNoENOENTError like MRI does, but
I don't have a reference to Ruby object to raise it from. Technically, I
can probably get away with throwing some sort of RTE (e.g.
OperationUnsupportedException) since I'm pretty sure FileTest checks for
existence and raises "Not found" error for me, but that sounds ugly.
Before I make JRubyFile.createResource(Ruby, String) method mandatory, kill
createResource(String, String) and will have to rewrite most of
org.jruby.util.Dir to conform to the new interface, maybe you have some
other suggestions?
Thanks!