Skip to content

Commit

Permalink
Uncomment SSL option
Browse files Browse the repository at this point in the history
  • Loading branch information
daurnimator committed Apr 29, 2013
1 parent c85c80e commit 63c62b5
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/main/java/org/apache/flume/RabbitMQUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
import java.util.Date;
import java.util.Map;

import java.security.NoSuchAlgorithmException;
import java.security.KeyManagementException;
import javax.net.ssl.SSLContext;

import org.apache.commons.collections.map.CaseInsensitiveMap;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -80,7 +84,9 @@ public static String[] getTopics( Context context ) {
return null;
}

public static ConnectionFactory getFactory(Context context){
public static ConnectionFactory getFactory(Context context)
throws NoSuchAlgorithmException, KeyManagementException
{
Preconditions.checkArgument(context!=null, "context cannot be null.");
ConnectionFactory factory = new ConnectionFactory();

Expand Down Expand Up @@ -122,13 +128,11 @@ public static ConnectionFactory getFactory(Context context){
factory.setConnectionTimeout(connectionTimeout);
}

boolean useSSL = context.getBoolean("usessl", false);


// boolean useSSL = context.getBoolean("usessl", false);
// if(useSSL){
// factory.useSslProtocol();
// }

if(useSSL){
factory.useSslProtocol();
}

return factory;
}
Expand Down

1 comment on commit 63c62b5

@prime8
Copy link

@prime8 prime8 commented on 63c62b5 Apr 30, 2013

Choose a reason for hiding this comment

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

The exceptions that can now be thrown from getFactory() are not caught in either the source or sink. How about wrapping this line in a try/catch block? e.g.

try {
  factory.useSslProtocol();
} catch (Exception e) {
  throw new RuntimeException(e);
}

Please sign in to comment.