]> git.mxchange.org Git - pizzaservice-war.git/blobdiff - src/java/org/mxchange/pizzaapplication/converter/country/PizzaCountryConverter.java
Please cherry-pick:
[pizzaservice-war.git] / src / java / org / mxchange / pizzaapplication / converter / country / PizzaCountryConverter.java
index 5b3571fdc5a41268fc8dd445b14cbeb7d44a6580..c5cec81137126e2d8158c487ef9babc84c5084a2 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016 Roland Haeder
+ * Copyright (C) 2016 Roland Häder
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU Affero General Public License as
@@ -22,19 +22,18 @@ import java.util.Objects;
 import javax.faces.component.UIComponent;
 import javax.faces.context.FacesContext;
 import javax.faces.convert.Converter;
+import javax.faces.convert.ConverterException;
 import javax.faces.convert.FacesConverter;
 import javax.naming.Context;
 import javax.naming.InitialContext;
 import javax.naming.NamingException;
-import org.mxchange.jcoreeelogger.beans.local.logger.Log;
-import org.mxchange.jcoreeelogger.beans.local.logger.LoggerBeanLocal;
 import org.mxchange.jcountry.data.Country;
 import org.mxchange.jcountry.data.CountrySingletonBeanRemote;
 
 /**
  * Converter for country instance
  * <p>
- * @author Roland Haeder<roland@mxchange.org>
+ * @author Roland Häder<roland@mxchange.org>
  */
 @FacesConverter (value = "CountryConverter")
 public class PizzaCountryConverter implements Converter {
@@ -44,12 +43,6 @@ public class PizzaCountryConverter implements Converter {
         */
        private CountrySingletonBeanRemote countryBean;
 
-       /**
-        * Logger instance
-        */
-       @Log
-       private LoggerBeanLocal loggerBeanLocal;
-
        /**
         * Initialization of this converter
         */
@@ -59,14 +52,11 @@ public class PizzaCountryConverter implements Converter {
                        // Get initial context
                        Context context = new InitialContext();
 
-                       // Lookup logger
-                       this.loggerBeanLocal = (LoggerBeanLocal) context.lookup("java:global/jcore-logger-ejb/logger!org.mxchange.jcoreeelogger.beans.local.logger.LoggerBeanLocal"); //NOI18N
-
                        // ... and country bean
                        this.countryBean = (CountrySingletonBeanRemote) context.lookup("java:global/pizzaservice-ejb/country!org.mxchange.jcountry.data.CountrySingletonBeanRemote"); //NOI18N
                } catch (final NamingException ex) {
                        // Continue to throw it
-                       throw new RuntimeException(MessageFormat.format("context.lookup() failed: {0}", ex.getMessage()), ex); //NOI18N
+                       throw new ConverterException(MessageFormat.format("context.lookup() failed: {0}", ex.getMessage()), ex); //NOI18N
                }
        }
 
@@ -78,7 +68,7 @@ public class PizzaCountryConverter implements Converter {
                // Is the value null or empty?
                if ((null == submittedValue) || (submittedValue.trim().isEmpty())) {
                        // Warning message
-                       this.loggerBeanLocal.logWarning(MessageFormat.format("{0}.getAsObject(): submittedValue is null or empty - EXIT!", this.getClass().getSimpleName())); //NOI18N
+                       // @TODO Not working with JNDI (no remote interface) this.loggerBeanLocal.logWarning(MessageFormat.format("{0}.getAsObject(): submittedValue is null or empty - EXIT!", this.getClass().getSimpleName())); //NOI18N
 
                        // Return null
                        return null;
@@ -111,8 +101,8 @@ public class PizzaCountryConverter implements Converter {
                                }
                        }
                } catch (final NumberFormatException ex) {
-                       // Log exception (maybe to much?)
-                       this.loggerBeanLocal.logException(ex);
+                       // Throw again
+                       throw new ConverterException(ex);
                }
 
                // Trace message