diff --git a/java/src/jmri/server/json/JSON.java b/java/src/jmri/server/json/JSON.java index aa083ab7c51..13267896a7d 100644 --- a/java/src/jmri/server/json/JSON.java +++ b/java/src/jmri/server/json/JSON.java @@ -3,9 +3,9 @@ /** * Common and utility constants used in the JMRI JSON protocol. *

- * Note any documented use of a constant is not the exclusive or - * sole use of the constant. Review the JSON schemas for all uses of any given - * constant. + * Note any documented use of a constant is not the exclusive + * or sole use of the constant. Review the JSON schemas for all uses of any + * given constant. * * @author Randall Wood (C) 2013, 2014, 2016, 2018, 2019 */ @@ -644,8 +644,8 @@ public final class JSON { * {@value #UNKNOWN} *

* Note that this value deliberately differs from - * {@link jmri.NamedBean#UNKNOWN} so that JSON clients can treat - * all known states as true, and the unknown state as false. + * {@link jmri.NamedBean#UNKNOWN} so that JSON clients can treat all known + * states as true, and the unknown state as false. */ public static final int UNKNOWN = 0x00; diff --git a/java/src/jmri/server/json/JsonClientHandler.java b/java/src/jmri/server/json/JsonClientHandler.java index c137b2cd30f..21e729818b3 100644 --- a/java/src/jmri/server/json/JsonClientHandler.java +++ b/java/src/jmri/server/json/JsonClientHandler.java @@ -37,7 +37,7 @@ public class JsonClientHandler { * cause a {@value jmri.server.json.JSON#HELLO} message to be sent to the * client. */ - public static final String HELLO_MSG = "{\"" + JSON.TYPE + "\":\"" + JSON.HELLO + "\"}"; + public static final String HELLO_MSG = "{\"" + TYPE + "\":\"" + HELLO + "\"}"; private final JsonConnection connection; private final HashMap>> services = new HashMap<>(); private final JsonServerPreferences preferences = InstanceManager.getDefault(JsonServerPreferences.class); @@ -46,7 +46,7 @@ public class JsonClientHandler { public JsonClientHandler(JsonConnection connection) { this.connection = connection; - ServiceLoader.load(JsonServiceFactory.class).forEach((factory) -> { + ServiceLoader.load(JsonServiceFactory.class).forEach(factory -> { JsonSocketService service = factory.getSocketService(connection); for (String type : factory.getTypes()) { HashSet> set = this.services.get(type); @@ -68,11 +68,8 @@ public JsonClientHandler(JsonConnection connection) { } public void onClose() { - services.values().stream().forEach((set) -> { - set.stream().forEach((service) -> { - service.onClose(); - }); - }); + services.values().stream().forEach(set -> set.stream() + .forEach(service -> service.onClose())); services.clear(); } @@ -86,8 +83,9 @@ public void onClose() { * @see #onMessage(JsonNode) */ public void onMessage(String string) throws IOException { - if (string.equals("{\"type\":\"ping\"}")) { //turn down the noise when debugging - log.trace("Received from client: '{}'", string); + if (string.equals("{\"type\":\"ping\"}")) { + // turn down the noise when debugging + log.trace("Received from client: '{}'", string); } else { log.debug("Received from client: '{}'", string); } @@ -95,7 +93,8 @@ public void onMessage(String string) throws IOException { this.onMessage(this.connection.getObjectMapper().readTree(string)); } catch (JsonProcessingException pe) { log.warn("Exception processing \"{}\"\n{}", string, pe.getMessage()); - this.sendErrorMessage(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, Bundle.getMessage(this.connection.getLocale(), "ErrorProcessingJSON", pe.getLocalizedMessage()), 0); + this.sendErrorMessage(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, + Bundle.getMessage(this.connection.getLocale(), "ErrorProcessingJSON", pe.getLocalizedMessage()), 0); } } @@ -117,33 +116,32 @@ public void onMessage(JsonNode root) throws IOException { if (preferences.getValidateClientMessages()) { this.schemas.validateMessage(root, false, this.connection.getLocale(), id); } - if ((root.path(TYPE).isMissingNode() || type.equals(LIST)) - && root.path(LIST).isValueNode()) { + if ((root.path(TYPE).isMissingNode() || type.equals(LIST)) && root.path(LIST).isValueNode()) { type = root.path(LIST).asText(); method = LIST; } if (data.isMissingNode()) { - if ((type.equals(HELLO) || type.equals(PING) || type.equals(GOODBYE)) - || (method.equals(LIST) || method.equals(GET))) { + if ((type.equals(HELLO) || type.equals(PING) || type.equals(GOODBYE)) || + (method.equals(LIST) || method.equals(GET))) { // these messages are not required to have a data payload, // so create one if the message did not contain one to avoid // special casing later data = this.connection.getObjectMapper().createObjectNode(); } else { - this.sendErrorMessage(HttpServletResponse.SC_BAD_REQUEST, Bundle.getMessage(this.connection.getLocale(), "ErrorMissingData"), id); + this.sendErrorMessage(HttpServletResponse.SC_BAD_REQUEST, + Bundle.getMessage(this.connection.getLocale(), "ErrorMissingData"), id); return; } } - if (root.path(METHOD).isMissingNode()) { // method not explicitly set - if (data.path(METHOD).isValueNode()) { - // at one point, we used method within data, so check there also - method = data.path(METHOD).asText(JSON.GET); - } + // method not explicitly set in root, but set in data + if (root.path(METHOD).isMissingNode() && data.path(METHOD).isValueNode()) { + // at one point, we used method within data, so check there also + method = data.path(METHOD).asText(JSON.GET); } - if (type.equals(PING)) { //turn down the noise a bit + if (type.equals(PING)) { // turn down the noise a bit log.trace("Processing '{}' with '{}'", type, data); } else { - log.debug("Processing '{}' with '{}'", type, data); + log.debug("Processing '{}' with '{}'", type, data); } if (method.equals(LIST)) { if (this.services.get(type) != null) { @@ -153,7 +151,8 @@ public void onMessage(JsonNode root) throws IOException { return; } else { log.warn("Requested list type '{}' unknown.", type); - this.sendErrorMessage(HttpServletResponse.SC_NOT_FOUND, Bundle.getMessage(this.connection.getLocale(), "ErrorUnknownType", type), id); + this.sendErrorMessage(HttpServletResponse.SC_NOT_FOUND, + Bundle.getMessage(this.connection.getLocale(), JsonException.ERROR_UNKNOWN_TYPE, type), id); return; } } else if (!data.isMissingNode()) { @@ -169,17 +168,20 @@ public void onMessage(JsonNode root) throws IOException { } } else { log.warn("Requested type '{}' unknown.", type); - this.sendErrorMessage(HttpServletResponse.SC_NOT_FOUND, Bundle.getMessage(this.connection.getLocale(), "ErrorUnknownType", type), id); + this.sendErrorMessage(HttpServletResponse.SC_NOT_FOUND, + Bundle.getMessage(this.connection.getLocale(), JsonException.ERROR_UNKNOWN_TYPE, type), id); } } else { - this.sendErrorMessage(HttpServletResponse.SC_BAD_REQUEST, Bundle.getMessage(this.connection.getLocale(), "ErrorMissingData"), id); + this.sendErrorMessage(HttpServletResponse.SC_BAD_REQUEST, + Bundle.getMessage(this.connection.getLocale(), "ErrorMissingData"), id); } if (type.equals(GOODBYE)) { // close the connection if GOODBYE is received. this.connection.close(); } } catch (JmriException je) { - this.sendErrorMessage(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, Bundle.getMessage(this.connection.getLocale(), "ErrorUnsupportedOperation", je.getLocalizedMessage()), id); + this.sendErrorMessage(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, Bundle.getMessage( + this.connection.getLocale(), "ErrorUnsupportedOperation", je.getLocalizedMessage()), id); } catch (JsonException je) { this.sendErrorMessage(je); } diff --git a/java/src/jmri/server/json/JsonException.java b/java/src/jmri/server/json/JsonException.java index 971d9443e92..e7b3990f99f 100644 --- a/java/src/jmri/server/json/JsonException.java +++ b/java/src/jmri/server/json/JsonException.java @@ -11,6 +11,7 @@ */ public class JsonException extends Exception { + /* JSON protocol keys */ /** * {@value #ERROR} */ @@ -24,9 +25,42 @@ public class JsonException extends Exception { */ public static final String MESSAGE = "message"; // NOI18N + /* Error message localization keys */ + /** + * {@value #ERROR_BAD_PROPERTY_VALUE}, a key for localized error messages + * indicating the value for the given property is not valid. + */ + public static final String ERROR_BAD_PROPERTY_VALUE = "ErrorBadPropertyValue"; // NOI18N + /** + * {@value #ERROR_MISSING_PROPERTY_PUT}, a key for localized error messages + * indicating a property required to complete a PUT request is missing. + */ + public static final String ERROR_MISSING_PROPERTY_PUT = "ErrorMissingPropertyPut"; // NOI18N + /** + * {@value #ERROR_NOT_FOUND}, a key for localized error messages indicating + * a resource was not found. + */ + public static final String ERROR_NOT_FOUND = "ErrorNotFound"; // NOI18N + /** + * {@value #ERROR_OBJECT}, a key for localized error messages indicating + * an inability to get a requested object. + */ + public static final String ERROR_OBJECT = "ErrorObject"; // NOI18N + /** + * {@value #ERROR_UNKNOWN_TYPE}, a key for localized error messages + * indicating the requested type cannot be handled. + */ + public static final String ERROR_UNKNOWN_TYPE = "ErrorUnknownType"; // NOI18N + /** + * {@value #LOGGED_ERROR}, a key for localized error messages indicating + * that JMRI logs contain required information to resolve the error. + */ + public static final String LOGGED_ERROR = "LoggedError"; // NOI18N + + /* Internal objects */ private static final ObjectMapper MAPPER = new ObjectMapper(); - private final int code; - private final ObjectNode additionalData; + private final int errorCode; + private final transient ObjectNode additionalData; /** * Only access through {@link #getId()}, even when used within this class */ @@ -37,10 +71,10 @@ public class JsonException extends Exception { * * @param code the error code * @param message message, displayable to the user, in the client's - * preferred locale + * preferred locale * @param throwable the cause of the exception * @param id the message id passed by the client, or the additive - * inverse of that id + * inverse of that id */ public JsonException(int code, String message, Throwable throwable, int id) { this(code, message, throwable, null, id); @@ -51,15 +85,15 @@ public JsonException(int code, String message, Throwable throwable, int id) { * * @param code the error code * @param message message, displayable to the user, in the client's - * preferred locale + * preferred locale * @param throwable the cause of the exception * @param additionalData additional data to be passed to the client * @param id the message id passed by the client, or the - * additive inverse of that id + * additive inverse of that id */ public JsonException(int code, String message, Throwable throwable, ObjectNode additionalData, int id) { super(message, throwable); - this.code = code; + this.errorCode = code; this.additionalData = additionalData; this.id = id; } @@ -70,7 +104,7 @@ public JsonException(int code, String message, Throwable throwable, ObjectNode a * @param code the error code * @param throwable the cause of the exception * @param id the message id passed by the client, or the additive - * inverse of that id + * inverse of that id */ public JsonException(int code, Throwable throwable, int id) { this(code, throwable, null, id); @@ -83,11 +117,11 @@ public JsonException(int code, Throwable throwable, int id) { * @param throwable the cause of the exception * @param additionalData additional data to be passed to the client * @param id the message id passed by the client, or the - * additive inverse of that id + * additive inverse of that id */ public JsonException(int code, Throwable throwable, ObjectNode additionalData, int id) { super(throwable); - this.code = code; + this.errorCode = code; this.additionalData = additionalData; this.id = id; } @@ -97,9 +131,9 @@ public JsonException(int code, Throwable throwable, ObjectNode additionalData, i * * @param code the error code * @param message message, displayable to the user, in the client's - * preferred locale + * preferred locale * @param id the message id passed by the client, or the additive - * inverse of that id + * inverse of that id */ public JsonException(int code, String message, int id) { this(code, message, (ObjectNode) null, id); @@ -110,14 +144,14 @@ public JsonException(int code, String message, int id) { * * @param code the error code * @param message message, displayable to the user, in the client's - * preferred locale + * preferred locale * @param additionalData additional data to be passed to the client * @param id the message id passed by the client, or the - * additive inverse of that id + * additive inverse of that id */ public JsonException(int code, String message, ObjectNode additionalData, int id) { super(message); - this.code = code; + this.errorCode = code; this.additionalData = additionalData; this.id = id; } @@ -128,7 +162,7 @@ public JsonException(int code, String message, ObjectNode additionalData, int id * @return the code */ public int getCode() { - return this.code; + return this.errorCode; } /** diff --git a/java/src/jmri/server/json/JsonHttpService.java b/java/src/jmri/server/json/JsonHttpService.java index 9b064c7cd0d..9cda2feed34 100644 --- a/java/src/jmri/server/json/JsonHttpService.java +++ b/java/src/jmri/server/json/JsonHttpService.java @@ -183,7 +183,7 @@ public abstract JsonNode doGetList(@Nonnull String type, @Nonnull JsonNode data, * @throws JsonException if an error occurs preparing schema; if type is is * not a type handled by this service, this must * be thrown with an error code of 500 and the - * localized message "ErrorUnknownType" + * localized message ERROR_UNKNOWN_TYPE */ @Nonnull public abstract JsonNode doSchema(@Nonnull String type, boolean server, @Nonnull Locale locale, int id) diff --git a/java/src/jmri/server/json/JsonNamedBeanHttpService.java b/java/src/jmri/server/json/JsonNamedBeanHttpService.java index 689c7afd71a..5022655adcf 100644 --- a/java/src/jmri/server/json/JsonNamedBeanHttpService.java +++ b/java/src/jmri/server/json/JsonNamedBeanHttpService.java @@ -41,7 +41,7 @@ public final JsonNode doGet(@Nonnull String type, @Nonnull String name, @Nonnull @Nonnull Locale locale, int id) throws JsonException { if (!type.equals(getType())) { throw new JsonException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, - Bundle.getMessage(locale, "LoggedError"), id); + Bundle.getMessage(locale, JsonException.LOGGED_ERROR), id); } // NOTE: although allowing a user name to be used, a system name is recommended as it is // less likely to suffer errors in translation between the allowed name and URL conversion @@ -56,7 +56,7 @@ public final JsonNode doGet(@Nonnull String type, @Nonnull String name, @Nonnull public final JsonNode doPost(@Nonnull String type, @Nonnull String name, @Nonnull JsonNode data, @Nonnull Locale locale, int id) throws JsonException { if (!type.equals(getType())) { throw new JsonException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, - Bundle.getMessage(locale, "LoggedError"), id); + Bundle.getMessage(locale, JsonException.LOGGED_ERROR), id); } // NOTE: although allowing a user name to be used, a system name is recommended as it is // less likely to suffer errors in translation between the allowed name and URL conversion @@ -102,7 +102,7 @@ public final JsonNode doGetList(String type, JsonNode data, Locale locale, int i public void doDelete(String type, String name, JsonNode data, Locale locale, int id) throws JsonException { if (!type.equals(getType())) { throw new JsonException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, - Bundle.getMessage(locale, "LoggedError"), id); + Bundle.getMessage(locale, JsonException.LOGGED_ERROR), id); } // NOTE: although allowing a user name to be used, a system name is recommended as it is // less likely to suffer errors in translation between the allowed name and URL conversion @@ -184,14 +184,12 @@ protected void doDelete(@CheckForNull T bean, @Nonnull String name, @Nonnull Str protected final void deleteBean(@CheckForNull T bean, @Nonnull String name, @Nonnull String type, @Nonnull JsonNode data, @Nonnull Locale locale, int id) throws JsonException { if (bean == null) { throw new JsonException(HttpServletResponse.SC_NOT_FOUND, - Bundle.getMessage(locale, "ErrorNotFound", type, name), id); + Bundle.getMessage(locale, JsonException.ERROR_NOT_FOUND, type, name), id); } List listeners = bean.getListenerRefs(); - if (listeners.size() > 0 && !acceptForceDeleteToken(type, name, data.path(JSON.FORCE_DELETE).asText())) { + if (!listeners.isEmpty() && !acceptForceDeleteToken(type, name, data.path(JSON.FORCE_DELETE).asText())) { ArrayNode conflicts = mapper.createArrayNode(); - listeners.forEach((listener) -> { - conflicts.add(listener); - }); + listeners.forEach(conflicts::add); throwDeleteConflictException(type, name, conflicts, locale, id); } else { getManager().deregister(bean); diff --git a/java/src/jmri/server/json/JsonNonProvidedNamedBeanHttpService.java b/java/src/jmri/server/json/JsonNonProvidedNamedBeanHttpService.java index c3eddee6567..d2e56b54b01 100644 --- a/java/src/jmri/server/json/JsonNonProvidedNamedBeanHttpService.java +++ b/java/src/jmri/server/json/JsonNonProvidedNamedBeanHttpService.java @@ -92,14 +92,14 @@ protected abstract ObjectNode doGet(T bean, @Nonnull String name, @Nonnull Strin protected ObjectNode getNamedBean(T bean, @Nonnull String name, @Nonnull String type, @Nonnull Locale locale, int id) throws JsonException { if (bean == null) { - throw new JsonException(404, Bundle.getMessage(locale, "ErrorNotFound", type, name), id); + throw new JsonException(404, Bundle.getMessage(locale, JsonException.ERROR_NOT_FOUND, type, name), id); } ObjectNode data = mapper.createObjectNode(); data.put(JSON.NAME, bean.getSystemName()); data.put(JSON.USERNAME, bean.getUserName()); data.put(JSON.COMMENT, bean.getComment()); ArrayNode properties = data.putArray(JSON.PROPERTIES); - bean.getPropertyKeys().stream().forEach((key) -> { + bean.getPropertyKeys().stream().forEach(key -> { Object value = bean.getProperty(key); if (value != null) { properties.add(mapper.createObjectNode().put(key, value.toString())); @@ -130,7 +130,7 @@ protected ObjectNode getNamedBean(T bean, @Nonnull String name, @Nonnull String protected T postNamedBean(T bean, @Nonnull JsonNode data, @Nonnull String name, @Nonnull String type, @Nonnull Locale locale, int id) throws JsonException { if (bean == null) { - throw new JsonException(404, Bundle.getMessage(locale, "ErrorNotFound", type, name), id); + throw new JsonException(404, Bundle.getMessage(locale, JsonException.ERROR_NOT_FOUND, type, name), id); } if (data.path(JSON.USERNAME).isTextual()) { bean.setUserName(data.path(JSON.USERNAME).asText()); diff --git a/java/src/jmri/server/json/block/JsonBlockHttpService.java b/java/src/jmri/server/json/block/JsonBlockHttpService.java index 69385e8612b..010f964d527 100644 --- a/java/src/jmri/server/json/block/JsonBlockHttpService.java +++ b/java/src/jmri/server/json/block/JsonBlockHttpService.java @@ -57,9 +57,7 @@ public ObjectNode doGet(Block block, String name, String type, Locale locale, in data.put(JsonBlock.PERMISSIVE, block.getPermissiveWorking()); data.put(JsonBlock.SPEED_LIMIT, block.getSpeedLimit()); ArrayNode array = data.putArray(JsonBlock.DENIED); - block.getDeniedBlocks().forEach((denied) -> { - array.add(denied); - }); + block.getDeniedBlocks().forEach(array::add); return root; } @@ -97,7 +95,7 @@ public ObjectNode doPost(Block block, String name, String type, JsonNode data, L block.setSensor(sensor.getSystemName()); } else { throw new JsonException(404, - Bundle.getMessage(locale, "ErrorNotFound", JsonSensor.SENSOR, node.asText()), id); + Bundle.getMessage(locale, JsonException.ERROR_NOT_FOUND, JsonSensor.SENSOR, node.asText()), id); } } } @@ -111,7 +109,7 @@ public ObjectNode doPost(Block block, String name, String type, JsonNode data, L block.setReporter(reporter); } else { throw new JsonException(404, - Bundle.getMessage(locale, "ErrorNotFound", JsonReporter.REPORTER, node.asText()), id); + Bundle.getMessage(locale, JsonException.ERROR_NOT_FOUND, JsonReporter.REPORTER, node.asText()), id); } } } @@ -119,11 +117,13 @@ public ObjectNode doPost(Block block, String name, String type, JsonNode data, L try { block.setBlockSpeed(text); } catch (JmriException ex) { - throw new JsonException(HttpServletResponse.SC_BAD_REQUEST, Bundle.getMessage(locale, "ErrorBadPropertyValue", text, JSON.SPEED, type), id); + throw new JsonException(HttpServletResponse.SC_BAD_REQUEST, Bundle.getMessage(locale, JsonException.ERROR_BAD_PROPERTY_VALUE, text, JSON.SPEED, type), id); } block.setCurvature(data.path(JsonBlock.CURVATURE).asInt(block.getCurvature())); block.setDirection(data.path(JSON.DIRECTION).asInt(block.getDirection())); - block.setLength(Double.valueOf(data.path(JSON.LENGTH).asDouble(block.getLengthMm())).floatValue()); + if (data.path(JSON.LENGTH).isNumber()) { + block.setLength(data.path(JSON.LENGTH).floatValue()); + } block.setPermissiveWorking(data.path(JsonBlock.PERMISSIVE).asBoolean(block.getPermissiveWorking())); return this.doGet(block, name, type, locale, id); } @@ -145,7 +145,7 @@ public JsonNode doSchema(String type, boolean server, Locale locale, int id) thr "jmri/server/json/block/block-client.json", id); default: - throw new JsonException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, Bundle.getMessage(locale, "ErrorUnknownType", type), id); + throw new JsonException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, Bundle.getMessage(locale, JsonException.ERROR_UNKNOWN_TYPE, type), id); } } @@ -155,7 +155,7 @@ protected String getType() { } @Override - protected ProvidingManager getManager() throws UnsupportedOperationException { + protected ProvidingManager getManager() { return InstanceManager.getDefault(BlockManager.class); } } diff --git a/java/src/jmri/server/json/consist/JsonConsist.java b/java/src/jmri/server/json/consist/JsonConsist.java index ab2407cfb50..f6e1c211ad9 100644 --- a/java/src/jmri/server/json/consist/JsonConsist.java +++ b/java/src/jmri/server/json/consist/JsonConsist.java @@ -15,6 +15,12 @@ public class JsonConsist { * {@value #CONSISTS} */ public static final String CONSISTS = "consists"; // NOI18N + /** + * {@value #ERROR_NO_CONSIST_MANAGER}, a key for localized error messages + * indicating that no consist manager is available. + */ + public static final String ERROR_NO_CONSIST_MANAGER = "ErrorNoConsistManager"; // NOI18N + /** * Prevent instantiation, since this class only contains static values */ diff --git a/java/src/jmri/server/json/consist/JsonConsistHttpService.java b/java/src/jmri/server/json/consist/JsonConsistHttpService.java index 345dffdbabb..d9e70ee37a1 100644 --- a/java/src/jmri/server/json/consist/JsonConsistHttpService.java +++ b/java/src/jmri/server/json/consist/JsonConsistHttpService.java @@ -29,7 +29,6 @@ import jmri.server.json.util.JsonUtilHttpService; /** - * * @author Randall Wood Copyright 2016, 2018 */ public class JsonConsistHttpService extends JsonHttpService { @@ -38,27 +37,23 @@ public class JsonConsistHttpService extends JsonHttpService { public JsonConsistHttpService(ObjectMapper mapper) { super(mapper); - this.manager = InstanceManager.getOptionalDefault(JsonConsistManager.class).orElseGet(() -> { - return InstanceManager.setDefault(JsonConsistManager.class, new JsonConsistManager()); - }); + this.manager = InstanceManager.getOptionalDefault(JsonConsistManager.class) + .orElseGet(() -> InstanceManager.setDefault(JsonConsistManager.class, new JsonConsistManager())); } @Override public JsonNode doGet(String type, String name, JsonNode data, Locale locale, int id) throws JsonException { if (!this.manager.isConsistManager()) { - throw new JsonException(503, Bundle.getMessage(locale, "ErrorNoConsistManager"), id); // NOI18N + throw new JsonException(503, Bundle.getMessage(locale, JsonConsist.ERROR_NO_CONSIST_MANAGER), id); // NOI18N } return this.getConsist(locale, JsonUtilHttpService.addressForString(name), id); } /** - * Change the properties and locomotives of a consist. - * - * This method takes as input the JSON representation of a consist as - * provided by {@link #getConsist(Locale, jmri.LocoAddress, int) }. - * - * If present in the JSON, this method sets the following consist - * properties: + * Change the properties and locomotives of a consist. This method takes as + * input the JSON representation of a consist as provided by + * {@link #getConsist(Locale, jmri.LocoAddress, int) }. If present in the + * JSON, this method sets the following consist properties: *