Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Pulsar client] Enable spotbugs in module pulsar-client. #9630

Conversation

congbobo184
Copy link
Contributor

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)

@codelipenghui codelipenghui added this to the 2.8.0 milestone Feb 19, 2021
Comment on lines 1133 to 1132
(op.cmd == null ? null : op.cmd.getClass().getName()));
log.warn("[{}] Failed while casting {} into ByteBufPair", producerName, null);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will cause the log always print casting null?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@@ -49,7 +49,7 @@
private transient ServiceUrlProvider serviceUrlProvider;

@JsonIgnore
private Authentication authentication = AuthenticationDisabled.INSTANCE;
private Authentication authentication;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why need to remove the default value?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it has no any meaning.

    public Authentication getAuthentication() {
        if (authentication == null) {
            this.authentication = new AuthenticationDisabled();
        }
        return authentication;
    }

@@ -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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use null will avoid reusing the encode?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@@ -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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as the above comment.

@@ -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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as the above comment

@congbobo184
Copy link
Contributor Author

/pulsarbot run-failure-checks

1 similar comment
@congbobo184
Copy link
Contributor Author

/pulsarbot run-failure-checks

@codelipenghui codelipenghui merged commit 2a1828c into apache:master Feb 22, 2021
lhotari added a commit to lhotari/pulsar that referenced this pull request Feb 22, 2021
- apache#9630 and apache#9329 were merged concurrently which caused the master branch
  to break

- fixes SpotBugs error
"Medium: org.apache.pulsar.client.impl.ConsumerBase.NONE_KEY should be
package protected [org.apache.pulsar.client.impl.ConsumerBase]
At ConsumerBase.java:[line 887] MS_PKGPROTECT"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants