@@ -24,6 +24,7 @@ public void configure(ThreadContext tc, String encoding, SixModelObject config)
24
24
if (decoder == null ) {
25
25
charset = Charset .forName (encoding );
26
26
decoder = charset .newDecoder ();
27
+ decoded = new ArrayList <CharBuffer >();
27
28
lineSeps = new ArrayList <String >();
28
29
lineSeps .add ("\n " );
29
30
lineSeps .add ("\r \n " );
@@ -71,8 +72,6 @@ public String takeChars(ThreadContext tc, long chars) {
71
72
String result = normalized .substring (0 , (int )chars );
72
73
String remaining = normalized .substring ((int )chars , normalized .length ());
73
74
if (remaining .length () > 0 ) {
74
- if (decoded == null )
75
- decoded = new ArrayList <CharBuffer >();
76
75
decoded .add (CharBuffer .wrap (remaining ));
77
76
}
78
77
return result ;
@@ -152,8 +151,6 @@ public String takeLine(ThreadContext tc, boolean chomp, boolean eof) {
152
151
CharBuffer target = CharBuffer .allocate (decodee .limit ());
153
152
decoder .decode (decodee , target , eof && toDecode .size () == 1 );
154
153
target .rewind ();
155
- if (decoded == null )
156
- decoded = new ArrayList <CharBuffer >();
157
154
decoded .add (target );
158
155
toDecode .remove (0 );
159
156
}
@@ -284,8 +281,6 @@ private CharBuffer decodedBuffer(CharBuffer buf) {
284
281
}
285
282
286
283
private void forceDecodedBackToBytes () {
287
- if (decoded == null )
288
- return ;
289
284
for (int i = decoded .size () - 1 ; i >= 0 ; i --) {
290
285
toDecode .add (0 , charset .encode (decoded .get (i )));
291
286
decoded .remove (i );
0 commit comments