beam-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Work logged] (BEAM-4346) Enforce ErrorProne analysis in the jms IO project
Date Fri, 18 May 2018 15:12:00 GMT

     [ https://issues.apache.org/jira/browse/BEAM-4346?focusedWorklogId=103399&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-103399
]

ASF GitHub Bot logged work on BEAM-4346:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 18/May/18 15:11
            Start Date: 18/May/18 15:11
    Worklog Time Spent: 10m 
      Work Description: iemejia closed pull request #5423: [BEAM-4346] Enforce ErrorProne
analysis in JMS IO
URL: https://github.com/apache/beam/pull/5423
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/sdks/java/io/jms/build.gradle b/sdks/java/io/jms/build.gradle
index 717023446ab..b894c5d7e20 100644
--- a/sdks/java/io/jms/build.gradle
+++ b/sdks/java/io/jms/build.gradle
@@ -17,7 +17,7 @@
  */
 
 apply from: project(":").file("build_rules.gradle")
-applyJavaNature()
+applyJavaNature(failOnWarning: true)
 
 description = "Apache Beam :: SDKs :: Java :: IO :: JMS"
 ext.summary = """IO to read and write to JMS (Java Messaging Service)
@@ -25,6 +25,7 @@ destinations (queues and topics)."""
 
 dependencies {
   compile library.java.guava
+  compileOnly library.java.findbugs_annotations
   shadow project(path: ":beam-sdks-java-core", configuration: "shadow")
   shadow library.java.slf4j_api
   shadow library.java.joda_time
@@ -38,4 +39,5 @@ dependencies {
   testCompile library.java.junit
   testCompile library.java.hamcrest_core
   testCompile library.java.slf4j_jdk14
+  testCompileOnly library.java.findbugs_annotations
 }
diff --git a/sdks/java/io/jms/src/main/java/org/apache/beam/sdk/io/jms/JmsIO.java b/sdks/java/io/jms/src/main/java/org/apache/beam/sdk/io/jms/JmsIO.java
index ae88b41c1ba..874642b8b8e 100644
--- a/sdks/java/io/jms/src/main/java/org/apache/beam/sdk/io/jms/JmsIO.java
+++ b/sdks/java/io/jms/src/main/java/org/apache/beam/sdk/io/jms/JmsIO.java
@@ -297,7 +297,7 @@ public static Write write() {
      * @return The corresponding {@link JmsIO.Read}.
      */
     public Read<T> withMaxNumRecords(long maxNumRecords) {
-      checkArgument(maxNumRecords >= 0, "maxNumRecords must be > 0, but was: %d", maxNumRecords);
+      checkArgument(maxNumRecords >= 0, "maxNumRecords must be > 0, but was: %s", maxNumRecords);
       return builder().setMaxNumRecords(maxNumRecords).build();
     }
 
diff --git a/sdks/java/io/jms/src/test/java/org/apache/beam/sdk/io/jms/JmsIOTest.java b/sdks/java/io/jms/src/test/java/org/apache/beam/sdk/io/jms/JmsIOTest.java
index d74a1d80618..a17b8ec1d1d 100644
--- a/sdks/java/io/jms/src/test/java/org/apache/beam/sdk/io/jms/JmsIOTest.java
+++ b/sdks/java/io/jms/src/test/java/org/apache/beam/sdk/io/jms/JmsIOTest.java
@@ -25,6 +25,7 @@
 import static org.junit.Assert.fail;
 
 import com.google.common.base.Throwables;
+import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
 import java.util.Enumeration;
 import java.util.List;
@@ -187,7 +188,7 @@ public void testReadBytesMessages() throws Exception {
     Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
     MessageProducer producer = session.createProducer(session.createQueue(QUEUE));
     BytesMessage message = session.createBytesMessage();
-    message.writeBytes("This Is A Test".getBytes());
+    message.writeBytes("This Is A Test".getBytes(StandardCharsets.UTF_8));
     producer.send(message);
     producer.close();
     session.close();
@@ -354,7 +355,7 @@ private int count(String queue) throws Exception {
 
       byte[] bytes = new byte[(int) bytesMessage.getBodyLength()];
 
-      return new String(bytes);
+      return new String(bytes, StandardCharsets.UTF_8);
     }
   }
 


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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


Issue Time Tracking
-------------------

    Worklog Id:     (was: 103399)
    Time Spent: 20m  (was: 10m)

> Enforce ErrorProne analysis in the jms IO project
> -------------------------------------------------
>
>                 Key: BEAM-4346
>                 URL: https://issues.apache.org/jira/browse/BEAM-4346
>             Project: Beam
>          Issue Type: Improvement
>          Components: io-java-jms
>            Reporter: Scott Wegner
>            Assignee: Tim Robertson
>            Priority: Minor
>              Labels: errorprone, starter
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> Java ErrorProne static analysis was [recently enabled|https://github.com/apache/beam/pull/5161]
in the Gradle build process, but only as warnings. ErrorProne errors are generally useful
and easy to fix. Some work was done to [make sdks-java-core ErrorProne-clean|https://github.com/apache/beam/pull/5319]
and add enforcement. This task is clean ErrorProne warnings and add enforcement in {{beam-sdks-java-io-jms}}.
Additional context discussed on the [dev list|https://lists.apache.org/thread.html/95aae2785c3cd728c2d3378cbdff2a7ba19caffcd4faa2049d2e2f46@%3Cdev.beam.apache.org%3E].
> Fixing this issue will involve:
> # Follow instructions in the [Contribution Guide|https://beam.apache.org/contribute/]
to set up a {{beam}} development environment.
> # Run the following command to compile and run ErrorProne analysis on the project: {{./gradlew
:beam-sdks-java-io-jms:assemble}}
> # Fix each ErrorProne warning from the {{sdks/java/io/jms}} project.
> # In {{sdks/java/io/jms/build.gradle}}, add {{failOnWarning: true}} to the call the {{applyJavaNature()}}
([example|https://github.com/apache/beam/pull/5319/files#diff-9390c20635aed5f42f83b97506a87333R20]).
> This starter issue is sponsored by [~swegner]. Feel free to [reach out|https://beam.apache.org/community/contact-us/]
with questions or code review:
> * JIRA: [~swegner]
> * GitHub: [@swegner|https://github.com/swegner]
> * Slack: [@Scott Wegner|https://s.apache.org/beam-slack-channel]
> * Email: swegner at google dot com



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message