Skip to content

Commit

Permalink
Temporary/interim fix for JRUBY-1424.
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.codehaus.org/jruby/trunk/jruby@4793 961051c9-f516-0410-bf72-c9f7e237a7b7
  • Loading branch information
headius committed Oct 30, 2007
1 parent 7705491 commit 607b3c3
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/org/jruby/util/ZlibInflate.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,21 @@ public IRubyObject inflate(ByteList str) throws DataFormatException {
byte[] outp = new byte[1024];
ByteList buf = collected;
collected = new ByteList(BASE_SIZE);
flater.setInput(buf.bytes, buf.begin, buf.realSize);
int resultLength = -1;
while (!flater.finished() && resultLength != 0) {
resultLength = flater.inflate(outp);
result.append(outp, 0, resultLength);
try {
flater.setInput(buf.bytes, buf.begin, buf.realSize);
while (!flater.finished() && resultLength != 0) {
resultLength = flater.inflate(outp);
result.append(outp, 0, resultLength);
}
} catch (DataFormatException e) {
flater = new Inflater(true);
flater.setInput(buf.bytes, buf.begin, buf.realSize);
while (!flater.finished() && resultLength != 0) {
resultLength = flater.inflate(outp);
result.append(outp, 0, resultLength);
}
flater = new Inflater(false);
}
return RubyString.newString(runtime, result);
}
Expand Down

0 comments on commit 607b3c3

Please sign in to comment.