public List<ValidationError> validate() { List<ValidationError> errors = new ArrayList<>(); if (getUpc() != null) { // This is broken in more than half of the devices I've tested, so let's not even bother with a warning if (getUpc().length() != 12) { log.fine("UPnP specification violation, UPC must be 12 digits: " + getUpc()); } else { try { Long.parseLong(getUpc()); } catch (NumberFormatException ex) { log.fine("UPnP specification violation, UPC must be 12 digits all-numeric: " + getUpc()); } } } return errors; } }
public List<ValidationError> validate() { List<ValidationError> errors = new ArrayList(); if (getUpc() != null) { // This is broken in more than half of the devices I've tested, so let's not even bother with a warning if (getUpc().length() != 12) { log.fine("UPnP specification violation, UPC must be 12 digits: " + getUpc()); } else { try { Long.parseLong(getUpc()); } catch (NumberFormatException ex) { log.fine("UPnP specification violation, UPC must be 12 digits all-numeric: " + getUpc()); } } } return errors; } }
addIfNotNull(deviceNode, "Model URL/URI: ", device.getDetails().getModelDetails().getModelURI(), device); addIfNotNull(deviceNode, "Serial #: ", device.getDetails().getSerialNumber()); addIfNotNull(deviceNode, "Universal Product Code: ", device.getDetails().getUpc()); addIfNotNull(deviceNode, "Presentation URI: ", device.getDetails().getPresentationURI(), device);
appendNewElementIfNotNull( descriptor, deviceElement, ELEMENT.UPC, deviceModelDetails.getUpc() );
public List<ValidationError> validate() { List<ValidationError> errors = new ArrayList<>(); if (getUpc() != null) { // This is broken in more than half of the devices I've tested, so let's not even bother with a warning if (getUpc().length() != 12) { log.fine("UPnP specification violation, UPC must be 12 digits: " + getUpc()); } else { try { Long.parseLong(getUpc()); } catch (NumberFormatException ex) { log.fine("UPnP specification violation, UPC must be 12 digits all-numeric: " + getUpc()); } } } return errors; } }
appendNewElementIfNotNull( descriptor, deviceElement, ELEMENT.UPC, deviceModelDetails.getUpc() );
log.info(">>>> sec product caps: {}", details.getSecProductCaps()); log.info(">>>> serial number: {}", details.getSerialNumber()); log.info(">>>> UPC: {}", details.getUpc());
appendNewElementIfNotNull( descriptor, deviceElement, ELEMENT.UPC, deviceModelDetails.getUpc() );