Skip to content

Commit

Permalink
Small adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianromero committed Oct 7, 2017
1 parent 1863472 commit 1b38984
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
12 changes: 6 additions & 6 deletions src/main/java/com/adr/helloiot/MQTTManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -256,25 +256,25 @@ public void publish(String topic, int qos, byte[] message, boolean isRetained) {
mm.setQos(qos < 0 ? defaultqos : qos);
mm.setRetained(isRetained);
if (topic.startsWith(LOCAL_PREFIX)) {
logger.log(Level.INFO, "Publishing message to local.");
logger.log(Level.INFO, "Publishing message to local. {0}", topic);
CompletableAsync.runAsync(() -> {
try {
if (isRetained) {
mapClient.put(topic, mm.getPayload());
}
messageArrived(topicprefix + topic, mm);
} catch (Exception ex) {
logger.log(Level.SEVERE, "Cannot publish locally.", ex);
logger.log(Level.SEVERE, "Cannot publish message to local. " + topic, ex);
}
});

} else {
logger.log(Level.INFO, "Publishing message to broker.");
logger.log(Level.INFO, "Publishing message to broker. {0}", topic);
try {
mqttClient.publish(topicprefix + topic, mm);
} catch (MqttException ex) {
// TODO: Review in cas of paho exception too much publications
logger.log(Level.WARNING, "Cannot publish message", ex);
// TODO: Review in case of paho exception too much publications
logger.log(Level.WARNING, "Cannot publish message to broker. " + topic, ex);
// throw new RuntimeException(ex);
}
}
Expand Down Expand Up @@ -322,7 +322,7 @@ public void messageArrived(String topic, MqttMessage mm) throws Exception {
} else if (topic.startsWith(SYS_PREFIX)) {
distributeMessage(topic, mm.getPayload());
} else {
throw new RuntimeException("Bad topic prefix.");
throw new RuntimeException("Bad topic prefix. " + topic);
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/adr/helloiot/MainApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ protected String getStyleName() {
// Locale.setDefault(Locale.forLanguageTag("en-US"));
// Main, dark or standard
// return "/com/adr/helloiot/styles/empty";
// return "/com/adr/helloiot/styles/main";
return "/com/adr/helloiot/styles/main-dark";
return "/com/adr/helloiot/styles/main";
// return "/com/adr/helloiot/styles/main-dark";
}

@Override
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/com/adr/helloiot/MainAppClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
//
package com.adr.helloiot;

import java.util.Locale;

public class MainAppClient extends MainApp {

@Override
Expand All @@ -34,6 +36,8 @@ protected MainManager createManager() {
* @param args the command line arguments
*/
public static void main(String[] args) {

Locale.setDefault(Locale.US);
launch(args);
}
}
2 changes: 1 addition & 1 deletion src/main/java/com/adr/helloiot/MainManagerClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ public void construct(StackPane root, Parameters params) {
this.configprops.load();
} catch (IOException ex) {
// No properties file found, then use defaults and continue
LOGGER.log(Level.WARNING, null, ex);
LOGGER.log(Level.WARNING, "No properties file found, then use defaults and continue.", ex);
}

showLogin();
Expand Down

0 comments on commit 1b38984

Please sign in to comment.