Skip to content

Commit 2bbb856

Browse files
committed
Don't require the string be modifiable to seek
seek only modifies the StringIO pos, and should work when the underlying String is frozen. Fixes #119
1 parent 3f56884 commit 2bbb856

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

ext/java/org/jruby/ext/stringio/StringIO.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1356,8 +1356,6 @@ public IRubyObject seek(ThreadContext context, IRubyObject arg0, IRubyObject arg
13561356
}
13571357

13581358
private RubyFixnum seekCommon(ThreadContext context, int argc, IRubyObject arg0, IRubyObject arg1) {
1359-
checkModifiable();
1360-
13611359
Ruby runtime = context.runtime;
13621360

13631361
IRubyObject whence = context.nil;
@@ -1367,10 +1365,10 @@ private RubyFixnum seekCommon(ThreadContext context, int argc, IRubyObject arg0,
13671365
whence = arg1;
13681366
}
13691367

1370-
checkOpen();
1371-
13721368
StringIOData ptr = this.getPtr();
13731369

1370+
checkOpen();
1371+
13741372
boolean locked = lock(context, ptr);
13751373
try {
13761374
switch (whence.isNil() ? 0 : RubyNumeric.num2int(whence)) {

0 commit comments

Comments
 (0)