File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed
src/main/java/com/rabbitmq/stream/impl Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change 21
21
import com .rabbitmq .stream .StreamException ;
22
22
import com .rabbitmq .stream .compression .Compression ;
23
23
import java .lang .reflect .Field ;
24
+ import java .lang .reflect .Modifier ;
24
25
import java .time .Duration ;
25
26
import java .util .function .Function ;
26
27
import java .util .function .ToIntFunction ;
@@ -242,11 +243,13 @@ public Producer build() {
242
243
StreamProducerBuilder duplicate () {
243
244
StreamProducerBuilder duplicate = new StreamProducerBuilder (this .environment );
244
245
for (Field field : StreamProducerBuilder .class .getDeclaredFields ()) {
245
- field .setAccessible (true );
246
- try {
247
- field .set (duplicate , field .get (this ));
248
- } catch (IllegalAccessException e ) {
249
- throw new StreamException ("Error while duplicating stream producer builder" , e );
246
+ if (!Modifier .isStatic (field .getModifiers ())) {
247
+ field .setAccessible (true );
248
+ try {
249
+ field .set (duplicate , field .get (this ));
250
+ } catch (IllegalAccessException e ) {
251
+ throw new StreamException ("Error while duplicating stream producer builder" , e );
252
+ }
250
253
}
251
254
}
252
255
return duplicate ;
You can’t perform that action at this time.
0 commit comments