You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2021/02/19 13:22:06 UTC

[GitHub] [pulsar] congbobo184 opened a new pull request #9630: [Pulsar client] Enable spotbugs in module pulsar-client.

congbobo184 opened a new pull request #9630:
URL: https://github.com/apache/pulsar/pull/9630


   ## Motivation
   Enable spotbugs in module pulsar-client.
   
   Does this pull request potentially affect one of the following parts:
   If yes was chosen, please highlight the changes
   
   Dependencies (does it add or upgrade a dependency): (no)
   The public API: (no)
   The schema: (no)
   The default values of configurations: (no)
   The wire protocol: (no)
   The rest endpoints: (no)
   The admin cli options: (no)
   Anything that affects deployment: (no)
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] congbobo184 commented on pull request #9630: [Pulsar client] Enable spotbugs in module pulsar-client.

Posted by GitBox <gi...@apache.org>.
congbobo184 commented on pull request #9630:
URL: https://github.com/apache/pulsar/pull/9630#issuecomment-782834399


   /pulsarbot run-failure-checks


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] congbobo184 commented on a change in pull request #9630: [Pulsar client] Enable spotbugs in module pulsar-client.

Posted by GitBox <gi...@apache.org>.
congbobo184 commented on a change in pull request #9630:
URL: https://github.com/apache/pulsar/pull/9630#discussion_r579634218



##########
File path: pulsar-client/src/main/java/org/apache/pulsar/client/impl/schema/generic/GenericAvroReader.java
##########
@@ -66,7 +66,7 @@ public GenericAvroReader(Schema writerSchema, Schema readerSchema, byte[] schema
             this.reader = new GenericDatumReader<>(writerSchema, readerSchema);
         }
         this.byteArrayOutputStream = new ByteArrayOutputStream();
-        this.encoder = EncoderFactory.get().binaryEncoder(this.byteArrayOutputStream, encoder);
+        this.encoder = EncoderFactory.get().binaryEncoder(this.byteArrayOutputStream, null);

Review comment:
       It doesn't make any sense, the encoder in this time is always null. same below.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] codelipenghui commented on a change in pull request #9630: [Pulsar client] Enable spotbugs in module pulsar-client.

Posted by GitBox <gi...@apache.org>.
codelipenghui commented on a change in pull request #9630:
URL: https://github.com/apache/pulsar/pull/9630#discussion_r579319787



##########
File path: pulsar-client/src/main/java/org/apache/pulsar/client/impl/ProducerImpl.java
##########
@@ -1129,8 +1129,7 @@ protected boolean verifyLocalBufferIsNotCorrupted(OpSendMsg op) {
             }
             return true;
         } else {
-            log.warn("[{}] Failed while casting {} into ByteBufPair", producerName,
-                    (op.cmd == null ? null : op.cmd.getClass().getName()));
+            log.warn("[{}] Failed while casting {} into ByteBufPair", producerName, null);

Review comment:
       This will cause the log always print casting null?

##########
File path: pulsar-client/src/main/java/org/apache/pulsar/client/impl/conf/ClientConfigurationData.java
##########
@@ -49,7 +49,7 @@
     private transient ServiceUrlProvider serviceUrlProvider;
 
     @JsonIgnore
-    private Authentication authentication = AuthenticationDisabled.INSTANCE;
+    private Authentication authentication;

Review comment:
       Why need to remove the default value?

##########
File path: pulsar-client/src/main/java/org/apache/pulsar/client/impl/schema/generic/GenericAvroReader.java
##########
@@ -66,7 +66,7 @@ public GenericAvroReader(Schema writerSchema, Schema readerSchema, byte[] schema
             this.reader = new GenericDatumReader<>(writerSchema, readerSchema);
         }
         this.byteArrayOutputStream = new ByteArrayOutputStream();
-        this.encoder = EncoderFactory.get().binaryEncoder(this.byteArrayOutputStream, encoder);
+        this.encoder = EncoderFactory.get().binaryEncoder(this.byteArrayOutputStream, null);

Review comment:
       Use null will avoid reusing the encode?

##########
File path: pulsar-client/src/main/java/org/apache/pulsar/client/impl/schema/generic/GenericAvroWriter.java
##########
@@ -37,7 +37,7 @@
     public GenericAvroWriter(Schema schema) {
         this.writer = new GenericDatumWriter<>(schema);
         this.byteArrayOutputStream = new ByteArrayOutputStream();
-        this.encoder = EncoderFactory.get().binaryEncoder(this.byteArrayOutputStream, encoder);
+        this.encoder = EncoderFactory.get().binaryEncoder(this.byteArrayOutputStream, null);

Review comment:
       Same as the above comment.

##########
File path: pulsar-client/src/main/java/org/apache/pulsar/client/impl/schema/writer/AvroWriter.java
##########
@@ -40,7 +40,7 @@ public AvroWriter(Schema schema) {
 
     public AvroWriter(Schema schema, boolean jsr310ConversionEnabled) {
         this.byteArrayOutputStream = new ByteArrayOutputStream();
-        this.encoder = EncoderFactory.get().binaryEncoder(this.byteArrayOutputStream, this.encoder);
+        this.encoder = EncoderFactory.get().binaryEncoder(this.byteArrayOutputStream, null);

Review comment:
       Same as the above comment




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] congbobo184 commented on pull request #9630: [Pulsar client] Enable spotbugs in module pulsar-client.

Posted by GitBox <gi...@apache.org>.
congbobo184 commented on pull request #9630:
URL: https://github.com/apache/pulsar/pull/9630#issuecomment-782975939


   /pulsarbot run-failure-checks


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] congbobo184 commented on a change in pull request #9630: [Pulsar client] Enable spotbugs in module pulsar-client.

Posted by GitBox <gi...@apache.org>.
congbobo184 commented on a change in pull request #9630:
URL: https://github.com/apache/pulsar/pull/9630#discussion_r579633373



##########
File path: pulsar-client/src/main/java/org/apache/pulsar/client/impl/ProducerImpl.java
##########
@@ -1129,8 +1129,7 @@ protected boolean verifyLocalBufferIsNotCorrupted(OpSendMsg op) {
             }
             return true;
         } else {
-            log.warn("[{}] Failed while casting {} into ByteBufPair", producerName,
-                    (op.cmd == null ? null : op.cmd.getClass().getName()));
+            log.warn("[{}] Failed while casting {} into ByteBufPair", producerName, null);

Review comment:
       the op.cmd is always null, i will delete print it .




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] congbobo184 commented on a change in pull request #9630: [Pulsar client] Enable spotbugs in module pulsar-client.

Posted by GitBox <gi...@apache.org>.
congbobo184 commented on a change in pull request #9630:
URL: https://github.com/apache/pulsar/pull/9630#discussion_r579634009



##########
File path: pulsar-client/src/main/java/org/apache/pulsar/client/impl/conf/ClientConfigurationData.java
##########
@@ -49,7 +49,7 @@
     private transient ServiceUrlProvider serviceUrlProvider;
 
     @JsonIgnore
-    private Authentication authentication = AuthenticationDisabled.INSTANCE;
+    private Authentication authentication;

Review comment:
       it has no any meaning.
   
   ```
       public Authentication getAuthentication() {
           if (authentication == null) {
               this.authentication = new AuthenticationDisabled();
           }
           return authentication;
       }
   ```




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] codelipenghui merged pull request #9630: [Pulsar client] Enable spotbugs in module pulsar-client.

Posted by GitBox <gi...@apache.org>.
codelipenghui merged pull request #9630:
URL: https://github.com/apache/pulsar/pull/9630


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org