From: Roland Haeder Date: Fri, 28 Aug 2015 11:18:25 +0000 (+0200) Subject: MessageFormat.format() used + ignored for internationalization X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=5d7824005eb0c22de3d11980a01ecacd37e2427a;p=pizzaservice-war.git MessageFormat.format() used + ignored for internationalization Signed-off-by:Roland Häder --- diff --git a/src/java/org/mxchange/pizzaapplication/tags/basket/MiniBasketTag.java b/src/java/org/mxchange/pizzaapplication/tags/basket/MiniBasketTag.java index a2b9440b..2acf5258 100644 --- a/src/java/org/mxchange/pizzaapplication/tags/basket/MiniBasketTag.java +++ b/src/java/org/mxchange/pizzaapplication/tags/basket/MiniBasketTag.java @@ -70,24 +70,24 @@ public class MiniBasketTag extends BodyTagSupport implements BasketTag { @Override public int doStartTag () throws JspException { // Trace message - this.LOG.trace("CALLED!"); + this.LOG.trace("CALLED!"); //NOI18N // Init output - StringBuilder out = new StringBuilder("
\n"); + StringBuilder out = new StringBuilder("
\n"); //NOI18N // basket should not be null if (this.getBasket() == null) { // Not set - throw new NullPointerException("basket instance is null"); + throw new NullPointerException("basket instance is null"); //NOI18N } try { // Some entries found? if (this.getBasket().isEmpty()) { // Empty basket - out.append("
\n"); - out.append(this.getBasket().getMessageStringFromKey("MiniBasketTag.basket_is_empty")).append("\n"); - out.append("
\n"); + out.append("
\n"); //NOI18N + out.append(this.getBasket().getMessageStringFromKey("MiniBasketTag.basket_is_empty")).append("\n"); //NOI18N + out.append("
\n"); //NOI18N } else { // Get all items AddableBasketItem item = this.getBasket().getLast(); @@ -95,45 +95,45 @@ public class MiniBasketTag extends BodyTagSupport implements BasketTag { // item cannot be null here if (null == item) { // Abort here - throw new NullPointerException("item is null"); + throw new NullPointerException("item is null"); //NOI18N } // Get application bean from session - PizzaBean bean = (PizzaBean) this.getBasket().getSession().getAttribute("controller"); + PizzaBean bean = (PizzaBean) this.getBasket().getSession().getAttribute("controller"); //NOI18N // Debug log - this.LOG.debug("bean=" + bean); + this.LOG.debug(MessageFormat.format("bean={0}", bean)); //NOI18N // Should not be null if (null == bean) { // Abort here - throw new NullPointerException("bean is null"); + throw new NullPointerException("bean is null"); //NOI18N } // Get product instance Product product = bean.getProduct(item); // Debug message - this.LOG.debug("product=" + product); + this.LOG.debug(MessageFormat.format("product={0}", product)); //NOI18N // Get last num rows int lastNumRows = this.getBasket().getLastNumRows(); // Debug message - this.LOG.debug("lastNumRows=" + lastNumRows); + this.LOG.debug(MessageFormat.format("lastNumRows={0}", lastNumRows)); //NOI18N // Output all - out.append("
\n"); - out.append("
\n"); - out.append(" ").append(MessageFormat.format(this.getBasket().getMessageStringFromKey("MiniBasketTag.last_item"), product.getTitle())); - out.append("
\n"); - out.append("
\n"); - out.append(" ").append(MessageFormat.format(this.getBasket().getMessageStringFromKey("MiniBasketTag.additional_items"), (lastNumRows - 1))); - out.append("
\n"); - out.append(" \n"); - out.append("
\n"); + out.append("
\n"); //NOI18N + out.append("
\n"); //NOI18N + out.append(" ").append(MessageFormat.format(this.getBasket().getMessageStringFromKey("MiniBasketTag.last_item"), product.getTitle())); //NOI18N + out.append("
\n"); //NOI18N + out.append("
\n"); //NOI18N + out.append(" ").append(MessageFormat.format(this.getBasket().getMessageStringFromKey("MiniBasketTag.additional_items"), (lastNumRows - 1))); //NOI18N + out.append("
\n"); //NOI18N + out.append("
\n"); //NOI18N + out.append(" ").append(this.getBasket().getMessageStringFromKey("MiniBasketTag.to_basket")).append("\n"); //NOI18N + out.append("
\n"); //NOI18N + out.append("
\n"); //NOI18N } } catch (final ServletException | IOException | SQLException | BadTokenException | CorruptedDatabaseFileException | NoSuchMethodException | IllegalAccessException | InvocationTargetException ex) { // Continue to throw @@ -141,7 +141,7 @@ public class MiniBasketTag extends BodyTagSupport implements BasketTag { } // Finish output - out.append("
\n"); + out.append("
\n"); //NOI18N try { // Get output instance and write it @@ -152,7 +152,7 @@ public class MiniBasketTag extends BodyTagSupport implements BasketTag { } // Trace message - this.LOG.trace("Returning " + SKIP_BODY + " ... - EXIT!"); + this.LOG.trace(MessageFormat.format("Returning {0} ... - EXIT!", SKIP_BODY)); //NOI18N // Don't process any body return SKIP_BODY;