Skip to content

Commit

Permalink
[JENKINS-15382] removed Java 1.6 dependency
Browse files Browse the repository at this point in the history
(cherry picked from commit 8240440)
  • Loading branch information
kohsuke authored and olivergondza committed Sep 17, 2013
1 parent bcf9a84 commit 36ef7c6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion core/src/main/java/hudson/util/TextFile.java
Expand Up @@ -34,6 +34,7 @@
import java.io.RandomAccessFile;
import java.io.Reader;
import java.io.StringWriter;
import java.nio.*;
import java.nio.charset.Charset;

/**
Expand Down Expand Up @@ -154,7 +155,7 @@ public void write(String text) throws IOException {
byte[] tail = new byte[(int) (len-pos)];
raf.readFully(tail);

String tails = new String(tail,cs);
String tails = cs.decode(java.nio.ByteBuffer.wrap(tail)).toString();

return new String(tails.substring(Math.max(0,tails.length()-numChars))); // trim the baggage of substring by allocating a new String
} finally {
Expand Down

0 comments on commit 36ef7c6

Please sign in to comment.