fixed toString() of BdaQuality to not throw exception if its bitstring value is empty

pull/3/head
Stefan Feuerhahn 8 years ago
parent 1da32db3d8
commit bda67ef556

@ -242,9 +242,4 @@ public final class BdaQuality extends BdaBitString {
} }
} }
@Override
public String toString() {
return getReference().toString() + ": " + String.format("0x%x, 0x%x", value[0], value[1]);
}
} }

@ -916,8 +916,13 @@ public final class ClientAssociation {
for (ModelNode logicalNode : logicalDevice.getChildren()) { for (ModelNode logicalNode : logicalDevice.getChildren()) {
for (ModelNode dataObject : logicalNode.getChildren()) { for (ModelNode dataObject : logicalNode.getChildren()) {
FcModelNode fcdo = (FcModelNode) dataObject; FcModelNode fcdo = (FcModelNode) dataObject;
if (fcdo.getFc() != Fc.CO) { if (fcdo.getFc() != Fc.CO && fcdo.getFc() != Fc.SE) {
try {
getDataValues(fcdo); getDataValues(fcdo);
} catch (ServiceError e) {
throw new ServiceError(e.getErrorCode(), "service error retrieving " + fcdo.getReference()
+ "[" + fcdo.getFc() + "]" + ", " + e.getMessage(), e);
}
} }
} }
} }

@ -41,12 +41,16 @@ public class ConsoleClient {
private static final String PRINT_MODEL_KEY = "m"; private static final String PRINT_MODEL_KEY = "m";
private static final String PRINT_MODEL_KEY_DESCRIPTION = "print model"; private static final String PRINT_MODEL_KEY_DESCRIPTION = "print model";
// private static final String PRINT_CAPABILITIES = "c";
// private static final String PRINT_CAPABILITIES_KEY_DESCRIPTION = "print server capabilities";
private static final String GET_DATA_VALUES_KEY = "g"; private static final String GET_DATA_VALUES_KEY = "g";
private static final String GET_DATA_VALUES_KEY_DESCRIPTION = "send GetDataValues request"; private static final String GET_DATA_VALUES_KEY_DESCRIPTION = "send GetDataValues request";
private static final String READ_ALL_DATA_KEY = "ga"; private static final String READ_ALL_DATA_KEY = "ga";
private static final String READ_ALL_DATA_KEY_DESCRIPTION = "update all data in the model"; private static final String READ_ALL_DATA_KEY_DESCRIPTION = "update all data in the model";
private static final String CREATE_DATA_SET_KEY = "ds"; private static final String CREATE_DATA_SET_KEY = "cds";
private static final String CREATE_DATA_SET_KEY_DESCRIPTION = "create data set"; private static final String CREATE_DATA_SET_KEY_DESCRIPTION = "create data set";
private static final String DELETE_DATA_SET_KEY = "dds";
private static final String DELETE_DATA_SET_KEY_DESCRIPTION = "delete data set";
private static final String REPORTING_KEY = "r"; private static final String REPORTING_KEY = "r";
private static final String REPORTING_KEY_DESCRIPTION = "configure reporting"; private static final String REPORTING_KEY_DESCRIPTION = "configure reporting";
@ -99,7 +103,11 @@ public class ConsoleClient {
break; break;
case READ_ALL_DATA_KEY: case READ_ALL_DATA_KEY:
System.out.print("Reading all data..."); System.out.print("Reading all data...");
try {
association.getAllDataValues(); association.getAllDataValues();
} catch (ServiceError e) {
System.err.println("Service error: " + e.getMessage());
}
System.out.println("done"); System.out.println("done");
break; break;
case GET_DATA_VALUES_KEY: { case GET_DATA_VALUES_KEY: {
@ -147,6 +155,21 @@ public class ConsoleClient {
break; break;
} }
case DELETE_DATA_SET_KEY: {
System.out.println("Enter the reference of the data set to delete (e.g. myld/MYLN0.dataset1): ");
String reference = actionProcessor.getReader().readLine();
DataSet dataSet = serverModel.getDataSet(reference);
if (dataSet == null) {
throw new ActionException("Unable to find data set with the given reference.");
}
System.out.print("Deleting data set..");
association.deleteDataSet(dataSet);
System.out.println("done");
break;
}
case REPORTING_KEY: { case REPORTING_KEY: {
System.out.println("Enter the URCB reference: "); System.out.println("Enter the URCB reference: ");
@ -207,6 +230,9 @@ public class ConsoleClient {
urcb.getDatSet().setValue(dataSetReference); urcb.getDatSet().setValue(dataSetReference);
List<ServiceError> serviceErrors = association.setRcbValues(urcb, false, true, false, List<ServiceError> serviceErrors = association.setRcbValues(urcb, false, true, false,
false, false, false, false, false); false, false, false, false, false);
if (serviceErrors.get(0) != null) {
throw serviceErrors.get(0);
}
break; break;
} }
case 6: { case 6: {
@ -222,6 +248,9 @@ public class ConsoleClient {
triggerOptions.setGeneralInterrogation(Boolean.parseBoolean(triggerOptionsStrings[4])); triggerOptions.setGeneralInterrogation(Boolean.parseBoolean(triggerOptionsStrings[4]));
List<ServiceError> serviceErrors = association.setRcbValues(urcb, false, false, false, List<ServiceError> serviceErrors = association.setRcbValues(urcb, false, false, false,
false, true, false, false, false); false, true, false, false, false);
if (serviceErrors.get(0) != null) {
throw serviceErrors.get(0);
}
break; break;
} }
case 7: { case 7: {
@ -230,6 +259,9 @@ public class ConsoleClient {
urcb.getIntgPd().setValue(Long.parseLong(integrityPeriodString)); urcb.getIntgPd().setValue(Long.parseLong(integrityPeriodString));
List<ServiceError> serviceErrors = association.setRcbValues(urcb, false, false, false, List<ServiceError> serviceErrors = association.setRcbValues(urcb, false, false, false,
false, false, true, false, false); false, false, true, false, false);
if (serviceErrors.get(0) != null) {
throw serviceErrors.get(0);
}
System.out.println("done"); System.out.println("done");
break; break;
} }
@ -254,7 +286,7 @@ public class ConsoleClient {
break; break;
} }
} catch (Exception e) { } catch (Exception e) {
throw new FatalActionException(e); throw new ActionException(e);
} }
} }

Loading…
Cancel
Save