From: Roland Haeder Date: Tue, 11 Aug 2015 09:26:06 +0000 (+0200) Subject: toArray(T[]) must be used X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=ed11c5c08c79fd4c9a38eedbd0914e43957330ab;p=pizzaservice-war.git toArray(T[]) must be used Signed-off-by:Roland Häder --- diff --git a/src/java/org/mxchange/pizzaapplication/application/PizzaServiceApplication.java b/src/java/org/mxchange/pizzaapplication/application/PizzaServiceApplication.java index 647ab179..445228b4 100644 --- a/src/java/org/mxchange/pizzaapplication/application/PizzaServiceApplication.java +++ b/src/java/org/mxchange/pizzaapplication/application/PizzaServiceApplication.java @@ -352,7 +352,7 @@ public class PizzaServiceApplication extends BasePizzaServiceSystem implements P // Output it while (it.hasNext()) { Map.Entry entry = it.next(); - this.getLogger().debug(MessageFormat.format("entry {0}={1}", entry.getKey(), entry.getValue())); + this.getLogger().debug(MessageFormat.format("entry {0}={1}", entry.getKey(), entry.getValue())); //NOI18N } } @@ -977,25 +977,25 @@ public class PizzaServiceApplication extends BasePizzaServiceSystem implements P @Override public Object getPrintableValeFromSession (final HttpSession session, final String key) { // Trace message - this.getLogger().trace(MessageFormat.format("session={0},key={1} - CALLED", session, key)); + this.getLogger().trace(MessageFormat.format("session={0},key={1} - CALLED", session, key)); //NOI18N // Are both parameter not null? if (session == null) { // Abort here - throw new NullPointerException("session is null"); + throw new NullPointerException("session is null"); //NOI18N } else if (key == null) { // Abort here - throw new NullPointerException("key is null"); + throw new NullPointerException("key is null"); //NOI18N } // Now get it Object value = this.getValueFromSession(session, key); // Debug message - this.getLogger().debug(MessageFormat.format("value={0}", value)); + this.getLogger().debug(MessageFormat.format("value={0}", value)); //NOI18N // Trace message - this.getLogger().trace(MessageFormat.format("Calling this.convertNullToEmpty({0}) ... - EXIT!", value)); + this.getLogger().trace(MessageFormat.format("Calling this.convertNullToEmpty({0}) ... - EXIT!", value)); //NOI18N // Return actual value return this.convertNullToEmpty(value); @@ -1028,7 +1028,7 @@ public class PizzaServiceApplication extends BasePizzaServiceSystem implements P */ @Override public Product[] getProducts () { - return (Product[]) this.products.values().toArray(); + return this.products.values().toArray(new Product[this.products.size()]); } /** @@ -1053,7 +1053,7 @@ public class PizzaServiceApplication extends BasePizzaServiceSystem implements P // Mark it as ordered by setting flag this.getLogger().debug(MessageFormat.format("Marking product={0} as choosen.", product.getName())); //NOI18N - this.setValueInSession(product, session, HTTP_PARAM_CHOOSE, "1"); + this.setValueInSession(product, session, HTTP_PARAM_CHOOSE, "1"); //NOI18N // Trace message this.getLogger().trace("EXIT!"); //NOI18N diff --git a/web/index.jsp b/web/index.jsp index b72daf9a..ab34c085 100644 --- a/web/index.jsp +++ b/web/index.jsp @@ -58,7 +58,7 @@ <% - // Much smaller loop + // "Walk" through all products and unmark them as ordered for (final Product product : app.getUnmarkedProducts(session)) { %>