[zb4osgi-changeset] [scm] ZigBee 4 OSGi repository change: r511 - /projects/zb4osgi/trunk/zigbee.tester/src/main/java/org/persona/zigbee/tester/gui/AttributeActionPanel.java
scm-notify at zb4osgi.aaloa.org
scm-notify at zb4osgi.aaloa.org
Mon Oct 15 12:52:38 CEST 2012
Author: stefano.lenzi
Date: Mon Oct 15 12:52:38 2012
New Revision: 511
Log:
Catching NumberFormatException and in case using default values for Minimum, Maximum, and Delta: fixes #126
Modified:
projects/zb4osgi/trunk/zigbee.tester/src/main/java/org/persona/zigbee/tester/gui/AttributeActionPanel.java
Modified: projects/zb4osgi/trunk/zigbee.tester/src/main/java/org/persona/zigbee/tester/gui/AttributeActionPanel.java
==============================================================================
--- projects/zb4osgi/trunk/zigbee.tester/src/main/java/org/persona/zigbee/tester/gui/AttributeActionPanel.java (original)
+++ projects/zb4osgi/trunk/zigbee.tester/src/main/java/org/persona/zigbee/tester/gui/AttributeActionPanel.java Mon Oct 15 12:52:38 2012
@@ -155,12 +155,36 @@
public void doSubscribe(ReportListener listener) {
final Subscription sub = attribute.getSubscription();
- sub.setMaximumReportingInterval( Integer.parseInt( maxText.getText() ) );
- sub.setMinimumReportingInterval( Integer.parseInt( minText.getText() ) );
+ try{
+ sub.setMaximumReportingInterval( Integer.parseInt( maxText.getText() ) );
+ }catch(NumberFormatException ex){
+ LogPanel.log(
+ "The value '"+maxText.getText()+"' typed in the Maximum field is not a number" +
+ "Using default value 60, that means report the value at least once per minute"
+ );
+ sub.setMaximumReportingInterval( 60 );
+ }
+ try{
+ sub.setMinimumReportingInterval( Integer.parseInt( minText.getText() ) );
+ }catch(NumberFormatException ex){
+ LogPanel.log(
+ "The value '"+minText.getText()+"' typed in the Minimum field is not a number." +
+ "Using default value 0, that means reports every time the value of the attribute changes"
+ );
+ sub.setMinimumReportingInterval( 0 );
+ }
if ( sub instanceof AnalogSubscription ) {
AnalogSubscription asub = (AnalogSubscription) sub;
- final ZigBeeType type = attribute.getZigBeeType();
- asub.setReportableChange( Converter.fromString( changeText.getText(), type ) );
+ final ZigBeeType type = attribute.getZigBeeType();
+ try{
+ asub.setReportableChange( Converter.fromString( changeText.getText(), type ) );
+ }catch(NumberFormatException ex){
+ LogPanel.log(
+ "The value '"+changeText.getText()+"' typed in the Delta field is not a number." +
+ "Using default value 0, that means reports every changes of the Analog attribute"
+ );
+ asub.setReportableChange( Converter.fromString( "0", type ) );
+ }
}
if ( attribute.getSubscription().addReportListner(listener) ) {
More information about the Commit
mailing list