You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flume.apache.org by pr...@apache.org on 2011/12/19 20:46:00 UTC

svn commit: r1220918 - /incubator/flume/branches/flume-728/flume-ng-node/src/main/java/org/apache/flume/conf/properties/PropertiesFileConfigurationProvider.java

Author: prasadm
Date: Mon Dec 19 19:46:00 2011
New Revision: 1220918

URL: http://svn.apache.org/viewvc?rev=1220918&view=rev
Log:
FLUME-863: Use of unknown sink type leads to NullPointerException
add condition for testing null returned from calling getSinkFactory() and rising exception in case that it's really null.

(Jarek Jarcec Cecho via Prasad Mujumdar)

Modified:
    incubator/flume/branches/flume-728/flume-ng-node/src/main/java/org/apache/flume/conf/properties/PropertiesFileConfigurationProvider.java

Modified: incubator/flume/branches/flume-728/flume-ng-node/src/main/java/org/apache/flume/conf/properties/PropertiesFileConfigurationProvider.java
URL: http://svn.apache.org/viewvc/incubator/flume/branches/flume-728/flume-ng-node/src/main/java/org/apache/flume/conf/properties/PropertiesFileConfigurationProvider.java?rev=1220918&r1=1220917&r2=1220918&view=diff
==============================================================================
--- incubator/flume/branches/flume-728/flume-ng-node/src/main/java/org/apache/flume/conf/properties/PropertiesFileConfigurationProvider.java (original)
+++ incubator/flume/branches/flume-728/flume-ng-node/src/main/java/org/apache/flume/conf/properties/PropertiesFileConfigurationProvider.java Mon Dec 19 19:46:00 2011
@@ -262,7 +262,12 @@ public class PropertiesFileConfiguration
     for (ComponentConfiguration comp : agentConf.getSinks()) {
       Context context = new Context();
 
-      Sink sink = getSinkFactory().create(comp.getConfiguration().get("type"));
+      String type = comp.getConfiguration().get("type");
+      Sink sink = getSinkFactory().create(type);
+      if(sink == null) {
+        throw new InstantiationException("Can't instantiate sink with type " + type + " (it's probably " +
+          "unknown type)");
+      }
 
       for (Entry<String, String> entry : comp.getConfiguration().entrySet()) {
         context.put(entry.getKey(), entry.getValue());