Skip to content

Commit

Permalink
fix findbugs in ksql-common (#415)
Browse files Browse the repository at this point in the history
  • Loading branch information
dguy authored Oct 26, 2017
1 parent 0454344 commit d6c7a43
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
18 changes: 10 additions & 8 deletions ksql-common/src/main/java/io/confluent/ksql/util/KsqlConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import java.util.Map;
import java.util.Set;

public class KsqlConfig extends AbstractConfig {
public class KsqlConfig extends AbstractConfig implements Cloneable {

public static final String KSQL_CONFIG_PREPERTY_PREFIX = "ksql.";

Expand Down Expand Up @@ -157,13 +157,15 @@ public KsqlConfig(Map<?, ?> props) {
StreamsConfig.CACHE_MAX_BYTES_BUFFERING_CONFIG, defaultCacheMaxBytesBufferingConfig);
ksqlStreamConfigProps.put(StreamsConfig.NUM_STREAM_THREADS_CONFIG, defaultNumberOfStreamsThreads);

for (Object propKey: props.keySet()) {
if (propKey.toString().toLowerCase().startsWith(KSQL_CONFIG_PREPERTY_PREFIX)) {
ksqlConfigProps.put(propKey.toString(), props.get(propKey));
for (Map.Entry<?, ?> entry : props.entrySet()) {
final String key = entry.getKey().toString();
if (key.toLowerCase().startsWith(KSQL_CONFIG_PREPERTY_PREFIX)) {
ksqlConfigProps.put(key, entry.getValue());
} else {
ksqlStreamConfigProps.put(propKey.toString(), props.get(propKey));
ksqlStreamConfigProps.put(key, entry.getValue());
}
}

final Object fail = props.get(FAIL_ON_DESERIALIZATION_ERROR_CONFIG);
if (fail == null || !Boolean.parseBoolean(fail.toString())) {
ksqlStreamConfigProps.put(StreamsConfig.DEFAULT_DESERIALIZATION_EXCEPTION_HANDLER_CLASS_CONFIG, LogAndContinueExceptionHandler.class);
Expand All @@ -181,9 +183,9 @@ public Map<String, Object> getKsqlStreamConfigProps() {
public Map<String, Object> getKsqlAdminClientConfigProps() {
Set<String> adminClientConfigProperties = AdminClientConfig.configNames();
Map<String, Object> adminClientConfigs = new HashMap<>();
for (String propertyName: ksqlStreamConfigProps.keySet()) {
if (adminClientConfigProperties.contains(propertyName)) {
adminClientConfigs.put(propertyName, ksqlStreamConfigProps.get(propertyName));
for (Map.Entry<String, Object> entry: ksqlStreamConfigProps.entrySet()) {
if (adminClientConfigProperties.contains(entry.getKey())) {
adminClientConfigs.put(entry.getKey(), entry.getValue());
}
}
return adminClientConfigs;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public static Class getJavaType(final Schema schema) {
Class elementClass = getJavaType(schema.valueSchema());
return java.lang.reflect.Array.newInstance(elementClass, 0).getClass();
case MAP:
return (new HashMap<>()).getClass();
return HashMap.class;
default:
throw new KsqlException("Type is not supported: " + schema.type());
}
Expand Down

0 comments on commit d6c7a43

Please sign in to comment.