1
1
/*
2
- * Copyright 2002-2023 the original author or authors.
2
+ * Copyright 2002-2024 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
62
62
*/
63
63
public abstract class DataBufferUtils {
64
64
65
- private final static Log logger = LogFactory .getLog (DataBufferUtils .class );
65
+ private static final Log logger = LogFactory .getLog (DataBufferUtils .class );
66
66
67
67
private static final Consumer <DataBuffer > RELEASE_CONSUMER = DataBufferUtils ::release ;
68
68
@@ -745,7 +745,7 @@ private interface NestedMatcher extends Matcher {
745
745
*/
746
746
private static class SingleByteMatcher implements NestedMatcher {
747
747
748
- static SingleByteMatcher NEWLINE_MATCHER = new SingleByteMatcher (new byte [] {10 });
748
+ static final SingleByteMatcher NEWLINE_MATCHER = new SingleByteMatcher (new byte [] {10 });
749
749
750
750
private final byte [] delimiter ;
751
751
@@ -784,7 +784,7 @@ public void reset() {
784
784
/**
785
785
* Base class for a {@link NestedMatcher}.
786
786
*/
787
- private static abstract class AbstractNestedMatcher implements NestedMatcher {
787
+ private abstract static class AbstractNestedMatcher implements NestedMatcher {
788
788
789
789
private final byte [] delimiter ;
790
790
@@ -990,7 +990,7 @@ private void read() {
990
990
DataBuffer .ByteBufferIterator iterator = dataBuffer .writableByteBuffers ();
991
991
Assert .state (iterator .hasNext (), "No ByteBuffer available" );
992
992
ByteBuffer byteBuffer = iterator .next ();
993
- Attachment attachment = new Attachment (dataBuffer , iterator );
993
+ Attachment attachment = new Attachment (dataBuffer , iterator );
994
994
this .channel .read (byteBuffer , this .position .get (), attachment , this );
995
995
}
996
996
@@ -999,7 +999,7 @@ public void completed(Integer read, Attachment attachment) {
999
999
attachment .iterator ().close ();
1000
1000
DataBuffer dataBuffer = attachment .dataBuffer ();
1001
1001
1002
- if (this .state .get (). equals ( State .DISPOSED ) ) {
1002
+ if (this .state .get () == State .DISPOSED ) {
1003
1003
release (dataBuffer );
1004
1004
closeChannel (this .channel );
1005
1005
return ;
@@ -1030,13 +1030,13 @@ public void completed(Integer read, Attachment attachment) {
1030
1030
}
1031
1031
1032
1032
@ Override
1033
- public void failed (Throwable exc , Attachment attachment ) {
1033
+ public void failed (Throwable ex , Attachment attachment ) {
1034
1034
attachment .iterator ().close ();
1035
1035
release (attachment .dataBuffer ());
1036
1036
1037
1037
closeChannel (this .channel );
1038
1038
this .state .set (State .DISPOSED );
1039
- this .sink .error (exc );
1039
+ this .sink .error (ex );
1040
1040
}
1041
1041
1042
1042
private enum State {
@@ -1095,7 +1095,6 @@ protected void hookOnComplete() {
1095
1095
public Context currentContext () {
1096
1096
return Context .of (this .sink .contextView ());
1097
1097
}
1098
-
1099
1098
}
1100
1099
1101
1100
@@ -1190,13 +1189,13 @@ else if (this.completed.get()) {
1190
1189
}
1191
1190
1192
1191
@ Override
1193
- public void failed (Throwable exc , Attachment attachment ) {
1192
+ public void failed (Throwable ex , Attachment attachment ) {
1194
1193
attachment .iterator ().close ();
1195
1194
1196
1195
this .sink .next (attachment .dataBuffer ());
1197
1196
this .writing .set (false );
1198
1197
1199
- this .sink .error (exc );
1198
+ this .sink .error (ex );
1200
1199
}
1201
1200
1202
1201
@ Override
@@ -1205,9 +1204,6 @@ public Context currentContext() {
1205
1204
}
1206
1205
1207
1206
private record Attachment (ByteBuffer byteBuffer , DataBuffer dataBuffer , DataBuffer .ByteBufferIterator iterator ) {}
1208
-
1209
-
1210
1207
}
1211
1208
1212
-
1213
1209
}
0 commit comments