Commit 7d23e49c authored by René Schöne's avatar René Schöne
Browse files

Fix duplicate variable declaration for two active protocols.

parent 2ae8767e
...@@ -7,33 +7,32 @@ public boolean {{parentTypeName}}.{{connectMethod}}(String {{connectParameterNam ...@@ -7,33 +7,32 @@ public boolean {{parentTypeName}}.{{connectMethod}}(String {{connectParameterNam
{{/loggingEnabledForReads}} {{/loggingEnabledForReads}}
set{{tokenName}}({{lastResult}}); set{{tokenName}}({{lastResult}});
}; };
ConnectToken connectToken;
switch (scheme) { switch (scheme) {
{{#usesMqtt}} {{#usesMqtt}}
case "mqtt": case "mqtt":
ConnectToken connectToken = {{mqttHandlerAttribute}}().newConnection(uri, consumer); connectToken = {{mqttHandlerAttribute}}().newConnection(uri, consumer);
if (connectToken == null) { if (connectToken == null) {
return false; return false;
} }
connectTokens.computeIfAbsent(this, astNode -> new java.util.HashMap<java.net.URI, ConnectToken>())
.put(uri, connectToken);
break; break;
{{/usesMqtt}} {{/usesMqtt}}
{{#usesRest}} {{#usesRest}}
case "rest": case "rest":
ConnectToken connectToken = {{restHandlerAttribute}}().newPUTConnection(uri, input -> { connectToken = {{restHandlerAttribute}}().newPUTConnection(uri, input -> {
consumer.accept(input.getBytes()); consumer.accept(input.getBytes());
}); });
if (connectToken == null) { if (connectToken == null) {
return false; return false;
} }
connectTokens.computeIfAbsent(this, astNode -> new java.util.HashMap<java.net.URI, ConnectToken>())
.put(uri, connectToken);
break; break;
{{/usesRest}} {{/usesRest}}
default: default:
System.err.println("Unknown protocol '" + scheme + "'."); System.err.println("Unknown protocol '" + scheme + "'.");
return false; return false;
} }
connectTokens.computeIfAbsent(this, astNode -> new java.util.HashMap<java.net.URI, ConnectToken>())
.put(uri, connectToken);
return true; return true;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment