]> git.mxchange.org Git - pizzaservice-war.git/commitdiff
Replace multiple-added strings/objects into MessageFormat.format() call to reduce...
authorRoland Haeder <roland@mxchange.org>
Mon, 17 Aug 2015 07:30:17 +0000 (09:30 +0200)
committerRoland Haeder <roland@mxchange.org>
Mon, 17 Aug 2015 07:30:17 +0000 (09:30 +0200)
Signed-off-by:Roland Häder <roland@mxchange.org>

13 files changed:
src/java/org/mxchange/pizzaapplication/BasePizzaServiceSystem.java
src/java/org/mxchange/pizzaapplication/application/PizzaServiceApplication.java
src/java/org/mxchange/pizzaapplication/category/BaseCategory.java
src/java/org/mxchange/pizzaapplication/database/category/PizzaCategoryDatabaseConstants.java
src/java/org/mxchange/pizzaapplication/database/frontend/category/PizzaCategoryDatabaseFrontend.java
src/java/org/mxchange/pizzaapplication/database/frontend/product/PizzaProductDatabaseFrontend.java
src/java/org/mxchange/pizzaapplication/database/product/PizzaProductDatabaseConstants.java
src/java/org/mxchange/pizzaapplication/exceptions/CategoryTitleAlreadyUsedException.java
src/java/org/mxchange/pizzaapplication/exceptions/ProductTitleAlreadyUsedException.java
src/java/org/mxchange/pizzaapplication/filter/http/BaseServletFilter.java
src/java/org/mxchange/pizzaapplication/filter/http/utf8/Utf8HttpFilter.java
src/java/org/mxchange/pizzaapplication/product/BaseProduct.java
src/java/org/mxchange/pizzaapplication/product/pizza/PizzaProduct.java

index 031f2f92997823dd4d4470b6bef28abd46210933..27a3f099135eaa8a975b0edbd25b080c7c2d188b 100644 (file)
@@ -32,36 +32,36 @@ public class BasePizzaServiceSystem extends BaseFrameworkSystem {
         */
        protected void initProperties (final ServletContext context) {
                // Trace message
-               this.getLogger().trace(MessageFormat.format("context={0} - CALLED!", context));
+               this.getLogger().trace(MessageFormat.format("context={0} - CALLED!", context)); //NOI18N
 
                // We need some properties that needs to be set
                for (final String name : this.getPropertyNames()) {
                        // Debug log
-                       this.getLogger().debug(MessageFormat.format("name={0}", name));
+                       this.getLogger().debug(MessageFormat.format("name={0}", name)); //NOI18N
 
                        // Get value
                        String value = context.getInitParameter(name);
 
                        // Debug message
-                       this.getLogger().debug(MessageFormat.format("value={0}", value));
+                       this.getLogger().debug(MessageFormat.format("value={0}", value)); //NOI18N
 
                        // Is it null?
                        if (value == null) {
                                // Value is null
-                               throw new NullPointerException(MessageFormat.format("value for {0} is null, maybe invalid context parameter?", name));
-                       } else if (name.equals("database.backend.storagepath")) {
+                               throw new NullPointerException(MessageFormat.format("value for {0} is null, maybe invalid context parameter?", name)); //NOI18N
+                       } else if (name.equals("database.backend.storagepath")) { //NOI18N
                                // Need to expand this path
-                               value = context.getRealPath(String.format("../../%s", value.trim()));
+                               value = context.getRealPath(String.format("../../%s", value.trim())); //NOI18N
                        }
 
                        // Debug log
-                       this.getLogger().debug(MessageFormat.format("{0}={1}", name, value));
+                       this.getLogger().debug(MessageFormat.format("{0}={1}", name, value)); //NOI18N
 
                        // Set property
                        this.setProperty(name, value);
                }
 
                // Trace message
-               this.getLogger().trace("EXIT!");
+               this.getLogger().trace("EXIT!"); //NOI18N
        }
 }
index c74d2592255c9d2053d95ddbc95e20c8997e471c..41629a3e656015fb2107538e127bf417e1183657 100644 (file)
@@ -1302,7 +1302,7 @@ public class PizzaServiceApplication extends BasePizzaServiceSystem implements P
                String available = request.getParameter(PizzaProductDatabaseConstants.COLUMN_AVAILABLE);
 
                // Debug message
-               this.getLogger().debug(MessageFormat.format("title={0},price={1},category={2},available={3}", title, price, category, available));
+               this.getLogger().debug(MessageFormat.format("title={0},price={1},category={2},available={3}", title, price, category, available)); //NOI18N
 
                // Variables for converting
                Long id = null;
@@ -1407,12 +1407,12 @@ public class PizzaServiceApplication extends BasePizzaServiceSystem implements P
        @Override
        public String getPrintableProduktCategory (final Product product) throws ServletException {
                // Trace message
-               this.getLogger().trace("product=" + product + " - CALLED!");
+               this.getLogger().trace(MessageFormat.format("product={0} - CALLED!", product)); //NOI18N
 
                // product must not be null
                if (product == null) {
                        // Abort here
-                       throw new NullPointerException("product is null");
+                       throw new NullPointerException("product is null"); //NOI18N
                }
 
                // Declare category
@@ -1426,7 +1426,7 @@ public class PizzaServiceApplication extends BasePizzaServiceSystem implements P
                }
 
                // Debug message
-               this.getLogger().debug("category=" + category);
+               this.getLogger().debug(MessageFormat.format("category={0}", category)); //NOI18N
 
                String title = null;
                try {
@@ -1438,7 +1438,7 @@ public class PizzaServiceApplication extends BasePizzaServiceSystem implements P
                }
 
                // Trace message
-               this.getLogger().trace("title=" + title + " - EXIT!");
+               this.getLogger().trace(MessageFormat.format("title={0} - EXIT!", title)); //NOI18N
 
                // Return it
                return title;
@@ -1459,7 +1459,7 @@ public class PizzaServiceApplication extends BasePizzaServiceSystem implements P
         */
        private boolean isProductTitleUsed (final HttpServletRequest request) throws IOException, SQLException, BadTokenException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
                // Trace message
-               this.getLogger().trace("request=" + request + " - CALLED!");
+               this.getLogger().trace(MessageFormat.format("request={0} - CALLED!", request)); //NOI18N
 
                // Init title
                String title = request.getParameter(PizzaProductDatabaseConstants.COLUMN_TITLE);
@@ -1467,7 +1467,7 @@ public class PizzaServiceApplication extends BasePizzaServiceSystem implements P
                // request must not be null and "title" must be found and non-empty
                if (request == null) {
                        // Abort here
-                       throw new NullPointerException("request is null");
+                       throw new NullPointerException("request is null"); //NOI18N
                } else if (title == null) {
                        // title is not set
                        throw new IllegalArgumentException(MessageFormat.format("{0} is not set.", PizzaProductDatabaseConstants.COLUMN_TITLE)); //NOI18N
@@ -1480,7 +1480,7 @@ public class PizzaServiceApplication extends BasePizzaServiceSystem implements P
                boolean isUsed = this.isProductTitleUsed(title);
 
                // Trace message
-               this.getLogger().trace("isUsed=" + isUsed + " - EXIT!");
+               this.getLogger().trace(MessageFormat.format("isUsed={0} - EXIT!", isUsed)); //NOI18N
 
                // Return it
                return isUsed;
@@ -1495,15 +1495,15 @@ public class PizzaServiceApplication extends BasePizzaServiceSystem implements P
        @Override
        public void doAdminHandleProductForms (final HttpServletRequest request, final HttpServletResponse response) throws ServletException {
                // Trace message
-               this.getLogger().trace("request=" + request + ",response=" + response + " - CALLED!");
+               this.getLogger().trace(MessageFormat.format("request={0},response={1} - CALLED!", request, response)); //NOI18N
 
                // request and response must both be set
                if (request == null) {
                        // request is null
-                       throw new NullPointerException("request is null");
+                       throw new NullPointerException("request is null"); //NOI18N
                } else if (response == null) {
                        // response is null
-                       throw new NullPointerException("response is null");
+                       throw new NullPointerException("response is null"); //NOI18N
                }
 
                // Try this operations
@@ -1515,10 +1515,10 @@ public class PizzaServiceApplication extends BasePizzaServiceSystem implements P
                                        // Is it already added?
                                        if (this.isProductTitleUsed(request)) {
                                                // Debug message
-                                               this.getLogger().debug("Already used, redirecting ...");
+                                               this.getLogger().debug("Already used, redirecting ..."); //NOI18N
 
                                                // Already added, so redirect here, else a ServletException will be thrown
-                                               response.sendRedirect(request.getContextPath() + "/admin/product.jsp?already=1");
+                                               response.sendRedirect(String.format("%s/admin/product.jsp?already=1", request.getContextPath())); //NOI18N
                                        } else {
                                                // Add new product
                                                this.doAdminAddProduct(request);
@@ -1539,7 +1539,7 @@ public class PizzaServiceApplication extends BasePizzaServiceSystem implements P
                }
 
                // Trace message
-               this.getLogger().trace("EXIT!");
+               this.getLogger().trace("EXIT!"); //NOI18N
        }
 
        /**
@@ -1551,15 +1551,15 @@ public class PizzaServiceApplication extends BasePizzaServiceSystem implements P
        @Override
        public void doAdminHandleCategoryForms (final HttpServletRequest request, final HttpServletResponse response) throws ServletException {
                // Trace message
-               this.getLogger().trace("request=" + request + ",response=" + response + " - CALLED!");
+               this.getLogger().trace(MessageFormat.format("request={0},response={1} - CALLED!", request, response)); //NOI18N
 
                // request and response must both be set
                if (request == null) {
                        // request is null
-                       throw new NullPointerException("request is null");
+                       throw new NullPointerException("request is null"); //NOI18N
                } else if (response == null) {
                        // response is null
-                       throw new NullPointerException("response is null");
+                       throw new NullPointerException("response is null"); //NOI18N
                }
 
                // Try this operations
@@ -1571,10 +1571,10 @@ public class PizzaServiceApplication extends BasePizzaServiceSystem implements P
                                        // Is the category title already used?
                                        if (this.isCategoryTitleUsed(request)) {
                                                // Debug message
-                                               this.getLogger().debug("Already used, redirecting ...");
+                                               this.getLogger().debug("Already used, redirecting ..."); //NOI18N
 
                                                // Already added, so redirect here, else a ServletException will be thrown
-                                               response.sendRedirect(request.getContextPath() + "/admin/category.jsp?already=1");
+                                               response.sendRedirect(String.format("%s/admin/category.jsp?already=1", request.getContextPath())); //NOI18N
                                        } else {
                                                // Add new category
                                                this.doAdminAddCategory(request);
@@ -1595,7 +1595,7 @@ public class PizzaServiceApplication extends BasePizzaServiceSystem implements P
                }
 
                // Trace message
-               this.getLogger().trace("EXIT!");
+               this.getLogger().trace("EXIT!"); //NOI18N
        }
 
        /**
@@ -1613,7 +1613,7 @@ public class PizzaServiceApplication extends BasePizzaServiceSystem implements P
         */
        private boolean isCategoryTitleUsed (final HttpServletRequest request) throws IOException, SQLException, BadTokenException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
                // Trace message
-               this.getLogger().trace("request=" + request + " - CALLED!");
+               this.getLogger().trace(MessageFormat.format("request={0} - CALLED!", request)); //NOI18N
 
                // Init title
                String title = request.getParameter(PizzaCategoryDatabaseConstants.COLUMN_TITLE);
@@ -1621,7 +1621,7 @@ public class PizzaServiceApplication extends BasePizzaServiceSystem implements P
                // request must not be null and "title" must be found and non-empty
                if (request == null) {
                        // Abort here
-                       throw new NullPointerException("request is null");
+                       throw new NullPointerException("request is null"); //NOI18N
                } else if (title == null) {
                        // title is not set
                        throw new IllegalArgumentException(MessageFormat.format("{0} is not set.", PizzaCategoryDatabaseConstants.COLUMN_TITLE)); //NOI18N
@@ -1634,7 +1634,7 @@ public class PizzaServiceApplication extends BasePizzaServiceSystem implements P
                boolean isUsed = this.isCategoryTitleUsed(title);
 
                // Trace message
-               this.getLogger().trace("isUsed=" + isUsed + " - EXIT!");
+               this.getLogger().trace(MessageFormat.format("isUsed={0} - EXIT!", isUsed)); //NOI18N
 
                // Return it
                return isUsed;
index 8f40185a85595a14eb8b269efbc6d95e41c93cae..89c1db75ab747d595d992744621d0290363bf169 100644 (file)
@@ -71,15 +71,15 @@ public class BaseCategory extends BaseFrameworkSystem implements Category {
        @Override
        public int compareTo (final Category category) {
                // Trace message
-               this.getLogger().trace(MessageFormat.format("category={0} - CALLED!", category));
+               this.getLogger().trace(MessageFormat.format("category={0} - CALLED!", category)); //NOI18N
                
                // category should not be null
                if (category == null) {
-                       throw new NullPointerException("category is null");
+                       throw new NullPointerException("category is null"); //NOI18N
                }
 
                // Debug message
-               this.getLogger().debug(MessageFormat.format("this.id={0},category.id={1}", this.getId(), category.getId()));
+               this.getLogger().debug(MessageFormat.format("this.id={0},category.id={1}", this.getId(), category.getId())); //NOI18N
 
                // Is the id the same?
                if (Objects.equals(this.getId(), category.getId())) {
@@ -105,7 +105,7 @@ public class BaseCategory extends BaseFrameworkSystem implements Category {
                byte[] t = this.getTitle().getBytes();
                
                // Decode it
-               return new String(t, "UTF-8");
+               return new String(t, "UTF-8"); //NOI18N
        }
 
        /**
@@ -163,29 +163,29 @@ public class BaseCategory extends BaseFrameworkSystem implements Category {
        }
 
        @Override
-       public void setValueFromColumn (final String columnName, final Object value) throws NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
+       public Object getValueFromColumn (final String columnName) throws IllegalArgumentException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
                // Trace message
-               this.getLogger().trace(MessageFormat.format("columnName={0},value={1} - CALLED!", columnName, value));
+               this.getLogger().trace(MessageFormat.format("columnName={0} - CALLED!", columnName)); //NOI18N
 
                // Call super method
-               this.setValueInStoreableFromColumn(this, "BaseCategory", columnName, value);
+               Object value = this.getValueInStoreableFromColumn(this, "BaseCategory", columnName); //NOI18N
 
                // Trace message
-               this.getLogger().trace("EXIT!");
+               this.getLogger().trace(MessageFormat.format("value={0} - EXIT!", value)); //NOI18N
+
+               // Return value
+               return value;
        }
 
        @Override
-       public Object getValueFromColumn (final String columnName) throws IllegalArgumentException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
+       public void setValueFromColumn (final String columnName, final Object value) throws NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
                // Trace message
-               this.getLogger().trace(MessageFormat.format("columnName={0} - CALLED!", columnName));
-
+               this.getLogger().trace(MessageFormat.format("columnName={0},value={1} - CALLED!", columnName, value)); //NOI18N
+               
                // Call super method
-               Object value = this.getValueInStoreableFromColumn(this, "BaseCategory", columnName);
-
+               this.setValueInStoreableFromColumn(this, "BaseCategory", columnName, value); //NOI18N
+               
                // Trace message
-               this.getLogger().trace("value=" + value + " - EXIT!");
-
-               // Return value
-               return value;
+               this.getLogger().trace("EXIT!"); //NOI18N
        }
 }
index 7ccc897f17129f2f51a428d51a62f6edcd67ac4d..cab19857ebccd171ebfddc2156616f4ec465da8b 100644 (file)
@@ -25,17 +25,17 @@ public final class PizzaCategoryDatabaseConstants {
        /**
         * Column name for "id"
         */
-       public static final String COLUMN_ID = "id";
+       public static final String COLUMN_ID = "id"; //NOI18N
 
        /**
         * Column name for "parent"
         */
-       public static final String COLUMN_PARENT = "parent";
+       public static final String COLUMN_PARENT = "parent"; //NOI18N
 
        /**
         * Column name for "title"
         */
-       public static final String COLUMN_TITLE = "title";
+       public static final String COLUMN_TITLE = "title"; //NOI18N
 
        /**
         * No instance from this class
index 12e16b1d5ba4dbd8bd216a3ff48b838230d3e8f4..7824c3c9e915875dcdd31186df8708d3f574a2f0 100644 (file)
@@ -259,7 +259,7 @@ public class PizzaCategoryDatabaseFrontend extends BaseDatabaseFrontend implemen
        @Override
        public Storeable toStoreable (final Map<String, String> map) throws NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
                // Trace message
-               this.getLogger().trace("map=" + map + " - CALLED!");
+               this.getLogger().trace(MessageFormat.format("map={0} - CALLED!", map));
 
                // Is map null?
                if (map == null) {
@@ -271,7 +271,7 @@ public class PizzaCategoryDatabaseFrontend extends BaseDatabaseFrontend implemen
                }
 
                // Debug message
-               this.getLogger().debug("Has to handle " + map.size() + " entries");
+               this.getLogger().debug(MessageFormat.format("Has to handle {0} entries", map.size()));
 
                // Get iterator on all entries
                Iterator<Map.Entry<String, String>> iterator = map.entrySet().iterator();
@@ -285,14 +285,14 @@ public class PizzaCategoryDatabaseFrontend extends BaseDatabaseFrontend implemen
                        Map.Entry<String, String> entry = iterator.next();
 
                        // Debug message
-                       this.getLogger().debug("entry:" + entry.getKey() + "=" + entry.getValue());
+                       this.getLogger().debug(MessageFormat.format("entry:{0}={1}", entry.getKey(), entry.getValue()));
 
                        // Try to set value
                        instance.setValueFromColumn(entry.getKey(), entry.getValue());
                }
 
                // Trace message
-               this.getLogger().trace("instance=" + instance + " - EXIT!");
+               this.getLogger().trace(MessageFormat.format("instance={0} - EXIT!", instance));
 
                // Return it
                return instance;
@@ -307,7 +307,7 @@ public class PizzaCategoryDatabaseFrontend extends BaseDatabaseFrontend implemen
        @Override
        public Category getCategory (final Product product) throws IOException, BadTokenException, CorruptedDatabaseFileException, SQLException, NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
                // Trace message
-               this.getLogger().trace("product=" + product + " - CALLED!");
+               this.getLogger().trace(MessageFormat.format("product={0} - CALLED!", product));
 
                // product must not be null
                if (product == null) {
@@ -319,10 +319,10 @@ public class PizzaCategoryDatabaseFrontend extends BaseDatabaseFrontend implemen
                Long id = product.getCategory();
 
                // Debug message
-               this.getLogger().debug("id=" + id);
+               this.getLogger().debug(MessageFormat.format("id={0}", id));
 
                // It should be >0 here
-               assert(id > 0) : "id=" + id + " must be larger zero";
+               assert(id > 0) : MessageFormat.format("id={0} must be larger zero", id);
 
                // Then construct a search instance
                SearchableCriteria criteria = new SearchCriteria();
@@ -348,7 +348,7 @@ public class PizzaCategoryDatabaseFrontend extends BaseDatabaseFrontend implemen
                        Storeable storeable = result.next();
 
                        // Debug message
-                       this.getLogger().debug("storeable=" + storeable);
+                       this.getLogger().debug(MessageFormat.format("storeable={0}", storeable));
 
                        // Is it instance of Category?
                        if (storeable instanceof Category) {
@@ -358,7 +358,7 @@ public class PizzaCategoryDatabaseFrontend extends BaseDatabaseFrontend implemen
                }
 
                // Trace message
-               this.getLogger().trace("category=" + category + " - EXIT!");
+               this.getLogger().trace(MessageFormat.format("category={0} - EXIT!", category));
 
                // Return it
                return category;
index 91d5a9864f7919ce4735e3608dbeda8215b4e11f..452c0d52ada5b49938e543aa582fdba8af949aca 100644 (file)
@@ -87,20 +87,20 @@ public class PizzaProductDatabaseFrontend extends BaseDatabaseFrontend implement
        @Override
        public Object emptyStringToNull (final String key, final Object value) {
                // Trace message
-               this.getLogger().trace(MessageFormat.format("key={0},value={1} - CALLED!", key, value));
+               this.getLogger().trace(MessageFormat.format("key={0},value={1} - CALLED!", key, value)); //NOI18N
 
                // Copy value
                Object v = value;
 
                // Is the value empty?
-               if ((value instanceof String) && ("".equals(value))) {
+               if ((value instanceof String) && ("".equals(value))) { //NOI18N
                        // This value may need to be changed
                        switch (key) {
                        }
                }
 
                // Trace message
-               this.getLogger().trace(MessageFormat.format("v={0} - EXIT!", v));
+               this.getLogger().trace(MessageFormat.format("v={0} - EXIT!", v)); //NOI18N
 
                // Return it
                return v;
@@ -177,7 +177,7 @@ public class PizzaProductDatabaseFrontend extends BaseDatabaseFrontend implement
        @Override
        public Result<? extends Storeable> getResultFromSet (final ResultSet resultSet) throws SQLException {
                // Trace message
-               this.getLogger().trace(MessageFormat.format("resultSet={0} - CALLED!", resultSet));
+               this.getLogger().trace(MessageFormat.format("resultSet={0} - CALLED!", resultSet)); //NOI18N
 
                // Init result instance
                Result<? extends Storeable> result = new DatabaseResult();
@@ -195,20 +195,20 @@ public class PizzaProductDatabaseFrontend extends BaseDatabaseFrontend implement
                        Boolean available = resultSet.getBoolean(PizzaProductDatabaseConstants.COLUMN_AVAILABLE);
 
                        // Debug message
-                       this.getLogger().debug(MessageFormat.format("id={0},title={1},category={2},available={3}", id, title, category, available));
+                       this.getLogger().debug(MessageFormat.format("id={0},title={1},category={2},available={3}", id, title, category, available)); //NOI18N
 
                        // Instance new object
                        Product product = new PizzaProduct(id, title, price, category, available);
 
                        // Debug log
-                       this.getLogger().debug(MessageFormat.format("product={0}", product));
+                       this.getLogger().debug(MessageFormat.format("product={0}", product)); //NOI18N
 
                        // Add it to result
                        result.add(product);
                }
 
                // Trace message
-               this.getLogger().trace(MessageFormat.format("result({0})={1} - EXIT!", result.size(), result));
+               this.getLogger().trace(MessageFormat.format("result({0})={1} - EXIT!", result.size(), result)); //NOI18N
 
                // Return result
                return result;
@@ -226,7 +226,7 @@ public class PizzaProductDatabaseFrontend extends BaseDatabaseFrontend implement
        @Override
        public boolean isProductTitleUsed (String title) throws IOException, SQLException, BadTokenException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
                // Trace message
-               this.getLogger().trace(MessageFormat.format("title={0} - CALLED!", title));
+               this.getLogger().trace(MessageFormat.format("title={0} - CALLED!", title)); //NOI18N
                
                // Get search criteria
                SearchableCriteria criteria = new SearchCriteria();
@@ -241,13 +241,13 @@ public class PizzaProductDatabaseFrontend extends BaseDatabaseFrontend implement
                Result<? extends Storeable> result = this.getBackend().doSelectByCriteria(criteria);
                
                // Debug log
-               this.getLogger().debug(MessageFormat.format("result({0}={1}", result, result.size()));
+               this.getLogger().debug(MessageFormat.format("result({0}={1}", result, result.size())); //NOI18N
                
                // Now check size of the result
                boolean isFound = (result.size() == 1);
                
                // Trace message
-               this.getLogger().trace(MessageFormat.format("isFound={0} - EXIT!", isFound));
+               this.getLogger().trace(MessageFormat.format("isFound={0} - EXIT!", isFound)); //NOI18N
                
                // Return it
                return isFound;
@@ -264,21 +264,21 @@ public class PizzaProductDatabaseFrontend extends BaseDatabaseFrontend implement
        @Override
        public void addProduct (final String title, final Float price, final Long category, final Boolean available) throws SQLException, IOException {
                // Trace message
-               this.getLogger().trace(MessageFormat.format("title={0},price={1},category={2} - CALLED!", title, price, category));
+               this.getLogger().trace(MessageFormat.format("title={0},price={1},category={2} - CALLED!", title, price, category)); //NOI18N
 
                // Title should not be null
                if (title == null) {
                        // Abort here
-                       throw new NullPointerException("title is null");
+                       throw new NullPointerException("title is null"); //NOI18N
                } else if (price == null) {
                        // Abort here
-                       throw new NullPointerException("price is null");
+                       throw new NullPointerException("price is null"); //NOI18N
                } else if (category == null) {
                        // Abort here
-                       throw new NullPointerException("category is null");
+                       throw new NullPointerException("category is null"); //NOI18N
                } else if (available == null) {
                        // Abort here
-                       throw new NullPointerException("available is null");
+                       throw new NullPointerException("available is null"); //NOI18N
                }
 
                // Clear dataset from previous usage
@@ -294,10 +294,10 @@ public class PizzaProductDatabaseFrontend extends BaseDatabaseFrontend implement
                Result<? extends Storeable> result = this.doInsertDataSet();
 
                // Debug message
-               this.getLogger().debug(MessageFormat.format("result={0}", result));
+               this.getLogger().debug(MessageFormat.format("result={0}", result)); //NOI18N
 
                // Trace message
-               this.getLogger().trace("EXIT!");
+               this.getLogger().trace("EXIT!"); //NOI18N
        }
 
        /**
@@ -311,19 +311,19 @@ public class PizzaProductDatabaseFrontend extends BaseDatabaseFrontend implement
        @Override
        public Storeable toStoreable (final Map<String, String> map) throws NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
                // Trace message
-               this.getLogger().trace("map=" + map + " - CALLED!");
+               this.getLogger().trace(MessageFormat.format("map={0} - CALLED!", map)); //NOI18N
 
                // Is map null?
                if (map == null) {
                        // Is null
-                       throw new NullPointerException("map is null");
+                       throw new NullPointerException("map is null"); //NOI18N
                } else if (map.isEmpty()) {
                        // Map is empty
-                       throw new IllegalArgumentException("map is empty.");
+                       throw new IllegalArgumentException("map is empty."); //NOI18N
                }
 
                // Debug message
-               this.getLogger().debug("Has to handle " + map.size() + " entries");
+               this.getLogger().debug(MessageFormat.format("Has to handle {0} entries", map.size())); //NOI18N
 
                // Get iterator on all entries
                Iterator<Map.Entry<String, String>> iterator = map.entrySet().iterator();
@@ -337,14 +337,14 @@ public class PizzaProductDatabaseFrontend extends BaseDatabaseFrontend implement
                        Map.Entry<String, String> entry = iterator.next();
 
                        // Debug message
-                       this.getLogger().debug("entry:" + entry.getKey() + "=" + entry.getValue());
+                       this.getLogger().debug(MessageFormat.format("entry:{0}={1}", entry.getKey(), entry.getValue())); //NOI18N
 
                        // Try to set value
                        instance.setValueFromColumn(entry.getKey(), entry.getValue());
                }
 
                // Trace message
-               this.getLogger().trace("instance=" + instance + " - EXIT!");
+               this.getLogger().trace(MessageFormat.format("instance={0} - EXIT!", instance)); //NOI18N
 
                // Return it
                return instance;
index 4d698b11ee2790f7677c59e65f3566bf6d7a9505..97848c1d084f0a43447d4ff49be5a9090567f356 100644 (file)
@@ -25,27 +25,27 @@ public final class PizzaProductDatabaseConstants {
        /**
         * Column name for "available"
         */
-       public static final String COLUMN_AVAILABLE = "available";
+       public static final String COLUMN_AVAILABLE = "available"; //NOI18N
 
        /**
         * Column name for "category"
         */
-       public static final String COLUMN_CATEGORY = "category";
+       public static final String COLUMN_CATEGORY = "category"; //NOI18N
 
        /**
         * Column name for "id"
         */
-       public static final String COLUMN_ID = "id";
+       public static final String COLUMN_ID = "id"; //NOI18N
 
        /**
         * Column name for "price"
         */
-       public static final String COLUMN_PRICE = "price";
+       public static final String COLUMN_PRICE = "price"; //NOI18N
 
        /**
         * Column name for "title"
         */
-       public static final String COLUMN_TITLE = "title";
+       public static final String COLUMN_TITLE = "title"; //NOI18N
 
        /**
         * No instance from this class
index 7d6959273b3bdc0202d867b8f328860dde4054c5..08d4ceaa7f4740b654d1f3fcb45309d4d20d422b 100644 (file)
@@ -34,7 +34,7 @@ public class CategoryTitleAlreadyUsedException extends Exception {
         */
        public CategoryTitleAlreadyUsedException (final HttpServletRequest request) {
                // Call super constructor
-               super(MessageFormat.format("Title {0} is already used.", request.getParameter(PizzaCategoryDatabaseConstants.COLUMN_TITLE)));
+               super(MessageFormat.format("Title {0} is already used.", request.getParameter(PizzaCategoryDatabaseConstants.COLUMN_TITLE))); //NOI18N
        }
        
 }
index e65092481d88ce0060e75313a1533e69f37cf635..568ba3910458cf364b334a5b97a99ea0f12370dc 100644 (file)
@@ -34,7 +34,7 @@ public class ProductTitleAlreadyUsedException extends Exception {
         */
        public ProductTitleAlreadyUsedException (final HttpServletRequest request) {
                // Call super constructor
-               super(MessageFormat.format("Title {0} is already used.", request.getParameter(PizzaProductDatabaseConstants.COLUMN_TITLE)));
+               super(MessageFormat.format("Title {0} is already used.", request.getParameter(PizzaProductDatabaseConstants.COLUMN_TITLE))); //NOI18N
        }
        
 }
index 0e40f85f4bda51fd78f9226905caba1cb2c0dcc7..ba8f30b2004485e930fdbba0db8d7a417b483aec 100644 (file)
@@ -30,22 +30,6 @@ public class BaseServletFilter extends BaseFrameworkSystem {
         */
        private FilterConfig config;
 
-       /**
-        * Configuration instance
-        * @return the config
-        */
-       protected FilterConfig getConfig () {
-               return this.config;
-       }
-
-       /**
-        * Configuration instance
-        * @param config the config to set
-        */
-       protected void setConfig (final FilterConfig config) {
-               this.config = config;
-       }
-
        /**
         * Destroys this filter
         */
@@ -64,4 +48,20 @@ public class BaseServletFilter extends BaseFrameworkSystem {
                // Set config instance
                this.setConfig(filterConfig);
        }
+
+       /**
+        * Configuration instance
+        * @return the config
+        */
+       protected FilterConfig getConfig () {
+               return this.config;
+       }
+
+       /**
+        * Configuration instance
+        * @param config the config to set
+        */
+       protected void setConfig (final FilterConfig config) {
+               this.config = config;
+       }
 }
index 51585e3a09e301d8ceefffcbe4887c5022d1251f..9bdc862c44bbe580b4eb630307f61bfa157ff380 100644 (file)
@@ -45,7 +45,7 @@ public class Utf8HttpFilter extends BaseServletFilter implements Filter {
                chain.doFilter(request, response);
 
                // Set response/request both to UTF-8
-               request.setCharacterEncoding("UTF-8");
-               response.setCharacterEncoding("UTF-8");
+               request.setCharacterEncoding("UTF-8"); //NOI18N
+               response.setCharacterEncoding("UTF-8"); //NOI18N
        }
 }
index f3dbf3c4d87bacdeabf00cbed1ff821d256d35a1..744efd9a84924939ed0300e5be59e5700bfbbc57 100644 (file)
@@ -40,6 +40,38 @@ public class BaseProduct extends BaseFrameworkSystem implements Product {
         */
        private String title;
 
+       /**
+        * Compares two categories with each other
+        *
+        * @param product Product comparator
+        * @return Comparison value
+        */
+       @Override
+       public int compareTo (final Product product) {
+               // Trace message
+               this.getLogger().trace(MessageFormat.format("product={0} - CALLED!", product)); //NOI18N
+               
+               // category should not be null
+               if (product == null) {
+                       throw new NullPointerException("product is null"); //NOI18N
+               }
+               
+               // Debug message
+               this.getLogger().debug(MessageFormat.format("this.id={0},product.id={1}", this.getId(), product.getId())); //NOI18N
+               
+               // Is the id the same?
+               if (Objects.equals(this.getId(), product.getId())) {
+                       // Same id, means same category
+                       return 0;
+               } else if (this.getId() > product.getId()) {
+                       // This id is larger than compared to
+                       return 1;
+               }
+               
+               // The other id is larger
+               return -1;
+       }
+
        /**
         * Getter for product availability
         *
@@ -134,48 +166,16 @@ public class BaseProduct extends BaseFrameworkSystem implements Product {
                this.title = title;
        }
 
-       /**
-        * Compares two categories with each other
-        *
-        * @param product Product comparator
-        * @return Comparison value
-        */
-       @Override
-       public int compareTo (final Product product) {
-               // Trace message
-               this.getLogger().trace(MessageFormat.format("product={0} - CALLED!", product));
-               
-               // category should not be null
-               if (product == null) {
-                       throw new NullPointerException("product is null");
-               }
-
-               // Debug message
-               this.getLogger().debug(MessageFormat.format("this.id={0},product.id={1}", this.getId(), product.getId()));
-
-               // Is the id the same?
-               if (Objects.equals(this.getId(), product.getId())) {
-                       // Same id, means same category
-                       return 0;
-               } else if (this.getId() > product.getId()) {
-                       // This id is larger than compared to
-                       return 1;
-               }
-
-               // The other id is larger
-               return -1;
-       }
-
        @Override
        public Object getValueFromColumn (final String columnName) throws IllegalArgumentException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
                // Trace message
-               this.getLogger().trace(MessageFormat.format("columnName={0} - CALLED!", columnName));
+               this.getLogger().trace(MessageFormat.format("columnName={0} - CALLED!", columnName)); //NOI18N
 
                // Call super method
-               Object value = this.getValueInStoreableFromColumn(this, "BaseProduct", columnName);
+               Object value = this.getValueInStoreableFromColumn(this, "BaseProduct", columnName); //NOI18N
 
                // Trace message
-               this.getLogger().trace("value=" + value + " - EXIT!");
+               this.getLogger().trace(MessageFormat.format("value={0} - EXIT!", value)); //NOI18N
 
                // Return value
                return value;
@@ -184,12 +184,12 @@ public class BaseProduct extends BaseFrameworkSystem implements Product {
        @Override
        public void setValueFromColumn (final String columnName, final Object value) throws NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
                // Trace message
-               this.getLogger().trace(MessageFormat.format("columnName={0},value={1} - CALLED!", columnName, value));
+               this.getLogger().trace(MessageFormat.format("columnName={0},value={1} - CALLED!", columnName, value)); //NOI18N
 
                // Call super method
-               this.setValueInStoreableFromColumn(this, "BaseProduct", columnName, value);
+               this.setValueInStoreableFromColumn(this, "BaseProduct", columnName, value); //NOI18N
 
                // Trace message
-               this.getLogger().trace("EXIT!");
+               this.getLogger().trace("EXIT!"); //NOI18N
        }
 }
index 7070029d061ce5c62ca42c59d96c049ff0da5caf..ebc40b6e4c9024af6d00157e5f14e673ba4c522f 100644 (file)
@@ -16,6 +16,7 @@
  */
 package org.mxchange.pizzaapplication.product.pizza;
 
+import java.text.MessageFormat;
 import org.mxchange.pizzaapplication.product.BaseProduct;
 import org.mxchange.pizzaapplication.product.Product;
 
@@ -42,7 +43,7 @@ public class PizzaProduct extends BaseProduct implements Product {
         */
        public PizzaProduct (final Long id, final String title, final Float price, final Long category, final Boolean available) {
                // Trace message
-               this.getLogger().trace("id=" + id + ",title=" + title + ",price=" + price + ",category=" + category + ",available=" + available + " - CALLED!");
+               this.getLogger().trace(MessageFormat.format("id={0},title={1},price={2},category={3},available={4} - CALLED!", id, title, price, category, available)); //NOI18N
 
                // Set all here
                this.setId(id);