You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flume.apache.org by rg...@apache.org on 2022/07/31 00:09:13 UTC

[flume] branch trunk updated (bfbfcbb1 -> b17bea64)

This is an automated email from the ASF dual-hosted git repository.

rgoers pushed a change to branch trunk
in repository https://gitbox.apache.org/repos/asf/flume.git


    from bfbfcbb1 FLUME-3427 - Add automatic module names
     new 7fe9af49 FLUME-3428 - Validate the parameter
     new b17bea64 Changes for release

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 CHANGELOG                                                 |  7 +++++++
 RELEASE-NOTES                                             |  6 +++---
 .../org/apache/flume/source/jms/JMSMessageConsumer.java   | 15 +++++++++++++++
 .../flume/source/jms/JMSMessageConsumerTestBase.java      |  8 +++++++-
 .../apache/flume/source/jms/TestJMSMessageConsumer.java   |  6 ++++++
 5 files changed, 38 insertions(+), 4 deletions(-)


[flume] 02/02: Changes for release

Posted by rg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rgoers pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/flume.git

commit b17bea649ba95cb54184301142e6edd070bf3f82
Author: Ralph Goers <rg...@apache.org>
AuthorDate: Sat Jul 30 17:09:03 2022 -0700

    Changes for release
---
 CHANGELOG     | 7 +++++++
 RELEASE-NOTES | 6 +++---
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index af5302dc..1206ecdd 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,10 @@
+Release Notes - Flume - Version 1.10.1
+
+** Bug
+    * [FLUME-3428] - Need better parameter validation
+
+** Improvement
+    * [FLUME-3427] - Add support for JPMS
 
 Release Notes - Flume - Version 1.10.0
 
diff --git a/RELEASE-NOTES b/RELEASE-NOTES
index abdbe16c..6380b4d2 100644
--- a/RELEASE-NOTES
+++ b/RELEASE-NOTES
@@ -1,4 +1,4 @@
-Apache Flume 1.10.0
+Apache Flume 1.10.1
 
 CONTENTS
 1. What is Apache Flume
@@ -17,8 +17,8 @@ simple, extensible data model that allows for online analytic
 application.
 
 2. Status of this release
-Apache Flume 1.10.0 is the 12th release of Flume as an Apache top-level
-project (TLP). Apache Flume 1.10.0 is production-ready software.
+Apache Flume 1.10.1 is the next GA release of Flume as an Apache top-level
+project (TLP). Apache Flume 1.10.1 is production-ready software.
 
 3. Major changes in this Release
 For a detailed list of changes, please see the CHANGELOG file included


[flume] 01/02: FLUME-3428 - Validate the parameter

Posted by rg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rgoers pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/flume.git

commit 7fe9af49c485756e1b618493a5bc00b70d7fbd2d
Author: Ralph Goers <rg...@apache.org>
AuthorDate: Sat Jul 30 01:16:17 2022 -0700

    FLUME-3428 - Validate the parameter
---
 .../org/apache/flume/source/jms/JMSMessageConsumer.java   | 15 +++++++++++++++
 .../flume/source/jms/JMSMessageConsumerTestBase.java      |  8 +++++++-
 .../apache/flume/source/jms/TestJMSMessageConsumer.java   |  6 ++++++
 3 files changed, 28 insertions(+), 1 deletion(-)

diff --git a/flume-ng-sources/flume-jms-source/src/main/java/org/apache/flume/source/jms/JMSMessageConsumer.java b/flume-ng-sources/flume-jms-source/src/main/java/org/apache/flume/source/jms/JMSMessageConsumer.java
index 645cbcce..5375bd03 100644
--- a/flume-ng-sources/flume-jms-source/src/main/java/org/apache/flume/source/jms/JMSMessageConsumer.java
+++ b/flume-ng-sources/flume-jms-source/src/main/java/org/apache/flume/source/jms/JMSMessageConsumer.java
@@ -35,11 +35,14 @@ import javax.jms.Session;
 import javax.jms.Topic;
 import javax.naming.InitialContext;
 import javax.naming.NamingException;
+import java.net.URI;
+import java.net.URISyntaxException;
 import java.util.ArrayList;
 import java.util.List;
 
 class JMSMessageConsumer {
   private static final Logger logger = LoggerFactory.getLogger(JMSMessageConsumer.class);
+  private static final String JAVA_SCHEME = "java";
 
   private final int batchSize;
   private final long pollTimeout;
@@ -99,6 +102,14 @@ class JMSMessageConsumer {
               throw new IllegalStateException(String.valueOf(destinationType));
           }
         } else {
+          try {
+            URI uri = new URI(destinationName);
+            String scheme = uri.getScheme();
+            assertTrue(scheme == null || scheme.equals(JAVA_SCHEME),
+                "Unsupported JNDI URI: " + destinationName);
+          } catch (URISyntaxException ex) {
+            logger.warn("Invalid JNDI URI - {}", destinationName);
+          }
           destination = (Destination) initialContext.lookup(destinationName);
         }
       } catch (JMSException e) {
@@ -209,4 +220,8 @@ class JMSMessageConsumer {
       logger.error("Could not destroy connection", e);
     }
   }
+
+  private void assertTrue(boolean arg, String msg) {
+    Preconditions.checkArgument(arg, msg);
+  }
 }
diff --git a/flume-ng-sources/flume-jms-source/src/test/java/org/apache/flume/source/jms/JMSMessageConsumerTestBase.java b/flume-ng-sources/flume-jms-source/src/test/java/org/apache/flume/source/jms/JMSMessageConsumerTestBase.java
index b3bce784..aa964584 100644
--- a/flume-ng-sources/flume-jms-source/src/test/java/org/apache/flume/source/jms/JMSMessageConsumerTestBase.java
+++ b/flume-ng-sources/flume-jms-source/src/test/java/org/apache/flume/source/jms/JMSMessageConsumerTestBase.java
@@ -129,11 +129,17 @@ public abstract class JMSMessageConsumerTestBase {
     }
   }
 
-  JMSMessageConsumer create() {
+  JMSMessageConsumer create(JMSDestinationType destinationType,
+      JMSDestinationLocator destinationLocator, String destinationName) {
     return new JMSMessageConsumer(WONT_USE, connectionFactory, destinationName,
         destinationLocator, destinationType, messageSelector, batchSize,
         pollTimeout, converter, userName, password, Optional.<String>absent(), false, "");
   }
+
+  JMSMessageConsumer create() {
+    return create(this.destinationType, this.destinationLocator, this.destinationName);
+  }
+
   @After
   public void tearDown() throws Exception {
     beforeTearDown();
diff --git a/flume-ng-sources/flume-jms-source/src/test/java/org/apache/flume/source/jms/TestJMSMessageConsumer.java b/flume-ng-sources/flume-jms-source/src/test/java/org/apache/flume/source/jms/TestJMSMessageConsumer.java
index e7c5f290..636ffc32 100644
--- a/flume-ng-sources/flume-jms-source/src/test/java/org/apache/flume/source/jms/TestJMSMessageConsumer.java
+++ b/flume-ng-sources/flume-jms-source/src/test/java/org/apache/flume/source/jms/TestJMSMessageConsumer.java
@@ -93,6 +93,12 @@ public class TestJMSMessageConsumer extends JMSMessageConsumerTestBase {
       verify(connection).close();
     }
   }
+
+  @Test(expected = IllegalArgumentException.class)
+  public void testInvalidDestination() throws Exception {
+    create(null, JMSDestinationLocator.JNDI, "ldap://localhost:389/test");
+  }
+
   @Test(expected = IllegalArgumentException.class)
   public void testInvalidBatchSizeZero() throws Exception {
     batchSize = 0;