Random cleanups

- note one FIXME when server tries to used Jersey Client which is not on classpath
diff --git a/appserver/appclient/client/acc/src/main/java/org/glassfish/appclient/client/acc/AppClientContainer.java b/appserver/appclient/client/acc/src/main/java/org/glassfish/appclient/client/acc/AppClientContainer.java
index e860f2d..5456775 100644
--- a/appserver/appclient/client/acc/src/main/java/org/glassfish/appclient/client/acc/AppClientContainer.java
+++ b/appserver/appclient/client/acc/src/main/java/org/glassfish/appclient/client/acc/AppClientContainer.java
@@ -1,4 +1,5 @@
 /*
+ * Copyright (c) 2022 Contributors to the Eclipse Foundation
  * Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
  *
  * This program and the accompanying materials are made available under the
@@ -236,7 +237,7 @@
 
     private URLClassLoader classLoader = (URLClassLoader) Thread.currentThread().getContextClassLoader();
 
-    private Collection<EntityManagerFactory> emfs = null;
+    private final Collection<EntityManagerFactory> emfs = null;
 
 //    private boolean isJWS = false;
 
@@ -354,7 +355,7 @@
          * Allow pre-destroy handling to work on the main class during clean-up.
          */
         cleanup.setInjectionManager(injectionManager,
-                clientMainClassSetting.clientMainClass);
+                ClientMainClassSetting.clientMainClass);
 
         /*
          * If this app client contains persistence unit refs, then initialize
@@ -456,9 +457,10 @@
 
     private void cleanupWhenSafe() {
         if (isEDTRunning()) {
-            final AtomicReference<Thread> edt = new AtomicReference<Thread>();
+            final AtomicReference<Thread> edt = new AtomicReference<>();
             try {
                 SwingUtilities.invokeAndWait(new Runnable() {
+                    @Override
                     public void run() {
                         edt.set(Thread.currentThread());
                     }
@@ -495,7 +497,7 @@
         // String[] as the only argument
         Method result = null;
 
-        result = clientMainClassSetting.getClientMainClass(
+        result = ClientMainClassSetting.getClientMainClass(
                 classLoader,
                 injectionManager,
                 invocationManager,
@@ -726,14 +728,14 @@
      */
     public interface Builder {
 
-        public AppClientContainer newContainer(URI archiveURI) throws Exception, UserError;
+        AppClientContainer newContainer(URI archiveURI) throws Exception, UserError;
 
-        public AppClientContainer newContainer(URI archiveURI,
+        AppClientContainer newContainer(URI archiveURI,
                 CallbackHandler callbackHandler,
                 String mainClassName,
                 String appName) throws Exception, UserError;
 
-        public AppClientContainer newContainer(URI archiveURI,
+        AppClientContainer newContainer(URI archiveURI,
                 CallbackHandler callbackHandler,
                 String mainClassName,
                 String appName,
@@ -741,9 +743,9 @@
 
 
 
-        public AppClientContainer newContainer(Class mainClass) throws Exception, UserError;
+        AppClientContainer newContainer(Class mainClass) throws Exception, UserError;
 
-        public TargetServer[] getTargetServers();
+        TargetServer[] getTargetServers();
 
         /**
          * Adds an optional {@link MessageSecurityConfig} setting.
@@ -751,9 +753,9 @@
          * @param msConfig the new MessageSecurityConfig
          * @return the <code>Builder</code> instance
          */
-        public Builder addMessageSecurityConfig(final MessageSecurityConfig msConfig);
+        Builder addMessageSecurityConfig(final MessageSecurityConfig msConfig);
 
-        public List<MessageSecurityConfig> getMessageSecurityConfig();
+        List<MessageSecurityConfig> getMessageSecurityConfig();
 
        /**
          * Sets the optional authentication realm for the ACC.
@@ -764,9 +766,9 @@
          * @param className name of the class which implements the realm
          * @return the <code>Builder</code> instance
          */
-        public Builder authRealm(final String className);
+        Builder authRealm(final String className);
 
-        public AuthRealm getAuthRealm();
+        AuthRealm getAuthRealm();
 
 //        /**
 //         * Sets the callback handler the ACC will use when authentication is
@@ -799,9 +801,9 @@
          * @param password password valid in the default realm on the server for the username
          * @return the <code>Builder</code> instance
         */
-        public Builder clientCredentials(final String user, final char[] password);
+        Builder clientCredentials(final String user, final char[] password);
 
-        public ClientCredential getClientCredential();
+        ClientCredential getClientCredential();
 
         /**
          * Sets the optional client credentials and server-side realm to be used during
@@ -816,7 +818,7 @@
          * @param realmName name of the realm on the server within which the credentials are valid
          * @return the <code>Builder</code> instance
          */
-        public Builder clientCredentials(final String user, final char[] password, final String realm);
+        Builder clientCredentials(final String user, final char[] password, final String realm);
 
         /**
          * Sets the container-level Properties.
@@ -824,7 +826,7 @@
          * @param containerProperties
          * @return
          */
-        public Builder containerProperties(final Properties containerProperties);
+        Builder containerProperties(final Properties containerProperties);
 
         /**
          * Sets the container-level properties.
@@ -835,13 +837,13 @@
          * @param containerProperties Property objects to use in setting the properties
          * @return
          */
-        public Builder containerProperties(final List<Property> containerProperties);
+        Builder containerProperties(final List<Property> containerProperties);
 
         /**
          * Returns the container-level Properties.
          * @return container-level properties
          */
-        public Properties getContainerProperties();
+        Properties getContainerProperties();
 
         /**
          * Sets the logger which the ACC should use as it runs.
@@ -849,9 +851,9 @@
          * @param logger
          * @return
          */
-        public Builder logger(final Logger logger);
+        Builder logger(final Logger logger);
 
-        public Logger getLogger();
+        Logger getLogger();
 
         /**
          * Sets whether the ACC should send the password to the server during
@@ -860,9 +862,9 @@
          * @param sendPassword
          * @return
          */
-        public Builder sendPassword(final boolean sendPassword);
+        Builder sendPassword(final boolean sendPassword);
 
-        public boolean getSendPassword();
+        boolean getSendPassword();
 
     }
 
diff --git a/appserver/security/core-ee/src/main/java/com/sun/enterprise/security/jmac/config/GFServerConfigProvider.java b/appserver/security/core-ee/src/main/java/com/sun/enterprise/security/jmac/config/GFServerConfigProvider.java
index ea2ce8f..ca99577 100644
--- a/appserver/security/core-ee/src/main/java/com/sun/enterprise/security/jmac/config/GFServerConfigProvider.java
+++ b/appserver/security/core-ee/src/main/java/com/sun/enterprise/security/jmac/config/GFServerConfigProvider.java
@@ -1,4 +1,5 @@
 /*
+ * Copyright (c) 2022 Contributors to the Eclipse Foundation
  * Copyright (c) 1997, 2020 Oracle and/or its affiliates. All rights reserved.
  *
  * This program and the accompanying materials are made available under the
@@ -108,7 +109,7 @@
     protected AuthConfigFactory factory = null;
     private WebServicesDelegate wsdelegate = null;
 
-    public GFServerConfigProvider(Map properties, AuthConfigFactory factory) {
+    public GFServerConfigProvider(Map<String, String> properties, AuthConfigFactory factory) {
         this.factory = factory;
         initializeParser();
 
@@ -376,10 +377,10 @@
         private static final Class[] PARAMS = {};
         private static final Object[] ARGS = {};
 
-        private String moduleClassName;
-        private MessagePolicy requestPolicy;
-        private MessagePolicy responsePolicy;
-        private Map options;
+        private final String moduleClassName;
+        private final MessagePolicy requestPolicy;
+        private final MessagePolicy responsePolicy;
+        private final Map options;
 
         /**
          * Construct a ConfigFile entry.
@@ -488,11 +489,11 @@
      * parsed ID entry
      */
     public static class IDEntry {
-        private String type; // provider type (client, server, client-server)
-        private String moduleClassName;
-        private MessagePolicy requestPolicy;
-        private MessagePolicy responsePolicy;
-        private Map options;
+        private final String type; // provider type (client, server, client-server)
+        private final String moduleClassName;
+        private final MessagePolicy requestPolicy;
+        private final MessagePolicy responsePolicy;
+        private final Map options;
 
         public String getModuleClassName() {
             return moduleClassName;
@@ -527,8 +528,8 @@
      * A data object contains module object and the corresponding map.
      */
     protected static class ModuleInfo {
-        private Object module;
-        private Map map;
+        private final Object module;
+        private final Map map;
 
         ModuleInfo(Object module, Map map) {
             this.module = module;
@@ -940,11 +941,11 @@
 
     static protected class GFServerAuthContext implements ServerAuthContext {
 
-        private GFServerAuthConfig config;
-        private ServerAuthModule module;
-        private com.sun.enterprise.security.jauth.ServerAuthModule oldModule;
+        private final GFServerAuthConfig config;
+        private final ServerAuthModule module;
+        private final com.sun.enterprise.security.jauth.ServerAuthModule oldModule;
 
-        private Map map;
+        private final Map map;
         boolean managesSession = false;
 
         GFServerAuthContext(GFServerAuthConfig config, ServerAuthModule module, Map map) {
@@ -1068,9 +1069,9 @@
 
     static protected class GFClientAuthContext implements ClientAuthContext {
 
-        private GFClientAuthConfig config;
-        private ClientAuthModule module;
-        private com.sun.enterprise.security.jauth.ClientAuthModule oldModule;
+        private final GFClientAuthConfig config;
+        private final ClientAuthModule module;
+        private final com.sun.enterprise.security.jauth.ClientAuthModule oldModule;
         // private Map map;
 
         GFClientAuthContext(GFClientAuthConfig config, ClientAuthModule module, Map map) {
diff --git a/appserver/security/jaspic-provider-framework/src/main/java/com/sun/jaspic/config/jaas/JAASAuthConfigProvider.java b/appserver/security/jaspic-provider-framework/src/main/java/com/sun/jaspic/config/jaas/JAASAuthConfigProvider.java
index 29b74ce..59967f5 100644
--- a/appserver/security/jaspic-provider-framework/src/main/java/com/sun/jaspic/config/jaas/JAASAuthConfigProvider.java
+++ b/appserver/security/jaspic-provider-framework/src/main/java/com/sun/jaspic/config/jaas/JAASAuthConfigProvider.java
@@ -1,4 +1,5 @@
 /*
+ * Copyright (c) 2022 Contributors to the Eclipse Foundation
  * Copyright (c) 1997, 2020 Oracle and/or its affiliates. All rights reserved.
  *
  * This program and the accompanying materials are made available under the
@@ -36,13 +37,13 @@
     private static final String DEFAULT_JAAS_APP_NAME = "other";
     private static final String ALL_APPS = "*";
 
-    private String configFileName;
+    private final String configFileName;
     private ExtendedConfigFile jaasConfig;
 
-    private Map<String, ?> properties;
-    private AuthConfigFactory factory;
+    private final Map<String, String> properties;
+    private final AuthConfigFactory factory;
 
-    public JAASAuthConfigProvider(Map properties, AuthConfigFactory factory) {
+    public JAASAuthConfigProvider(Map<String, String> properties, AuthConfigFactory factory) {
         this.properties = properties;
         this.factory = factory;
 
@@ -62,11 +63,13 @@
        selfRegister();
     }
 
+    @Override
     public Map<String, ?> getProperties() {
         return properties;
     }
 
 
+    @Override
     public AuthConfigFactory getFactory() {
         return factory;
     }
@@ -85,24 +88,29 @@
 
             final String description = "JAAS AuthConfig: " + appContext;
 
+            @Override
             public String getMessageLayer() {
                 return layer;
             }
 
+            @Override
             public String getAppContext() {
                 return appContext;
             }
 
+            @Override
             public String getDescription() {
                 return description;
             }
 
+            @Override
             public boolean isPersistent() {
                 return false;
             }
         };
     }
 
+    @Override
     public AuthConfigFactory.RegistrationContext[] getSelfRegistrationContexts() {
         final String[] appContexts = jaasConfig.getAppNames(getModuleTypes());
         RegistrationContext[] rvalue = new RegistrationContext[appContexts.length];
@@ -112,6 +120,7 @@
         return rvalue;
     }
 
+    @Override
     public AuthContextHelper getAuthContextHelper(String appContext, boolean returnNullContexts)
             throws AuthException {
         return new JAASAuthContextHelper(getLoggerName(), returnNullContexts,
diff --git a/nucleus/admin/config-api/src/main/java/com/sun/enterprise/config/serverbeans/Domain.java b/nucleus/admin/config-api/src/main/java/com/sun/enterprise/config/serverbeans/Domain.java
index 8e6a5fe..7a50092 100644
--- a/nucleus/admin/config-api/src/main/java/com/sun/enterprise/config/serverbeans/Domain.java
+++ b/nucleus/admin/config-api/src/main/java/com/sun/enterprise/config/serverbeans/Domain.java
@@ -857,7 +857,7 @@
             }
 
             if (!StringUtils.ok(name)) { // we choose to make this not an error
-            	return sub;
+                return sub;
             }
 
             List<ReferenceContainer> all = getAllReferenceContainers(d);
diff --git a/nucleus/admin/rest/rest-client/src/main/java/org/glassfish/admin/rest/client/ClientWrapper.java b/nucleus/admin/rest/rest-client/src/main/java/org/glassfish/admin/rest/client/ClientWrapper.java
index d8ca29e..a4f7185 100644
--- a/nucleus/admin/rest/rest-client/src/main/java/org/glassfish/admin/rest/client/ClientWrapper.java
+++ b/nucleus/admin/rest/rest-client/src/main/java/org/glassfish/admin/rest/client/ClientWrapper.java
@@ -1,4 +1,5 @@
 /*
+ * Copyright (c) 2022 Contributors to the Eclipse Foundation
  * Copyright (c) 2012, 2018 Oracle and/or its affiliates. All rights reserved.
  *
  * This program and the accompanying materials are made available under the
@@ -16,12 +17,8 @@
 
 package org.glassfish.admin.rest.client;
 
-import java.io.IOException;
-import java.net.URI;
-import java.util.HashMap;
-import java.util.Map;
-
 import jakarta.ws.rs.client.Client;
+import jakarta.ws.rs.client.ClientBuilder;
 import jakarta.ws.rs.client.ClientRequestContext;
 import jakarta.ws.rs.client.ClientRequestFilter;
 import jakarta.ws.rs.client.Invocation.Builder;
@@ -30,10 +27,14 @@
 import jakarta.ws.rs.core.Link;
 import jakarta.ws.rs.core.UriBuilder;
 
+import java.io.IOException;
+import java.net.URI;
+import java.util.HashMap;
+import java.util.Map;
+
 import javax.net.ssl.HostnameVerifier;
 import javax.net.ssl.SSLContext;
 
-import org.glassfish.jersey.client.JerseyClientBuilder;
 import org.glassfish.jersey.client.authentication.HttpAuthenticationFeature;
 import org.glassfish.jersey.client.filter.CsrfProtectionFilter;
 import org.glassfish.jersey.jettison.JettisonFeature;
@@ -63,11 +64,11 @@
     }
 
     public ClientWrapper(final Map<String, String> headers, String userName, String password) {
-        realClient = JerseyClientBuilder.newClient();
+        realClient = ClientBuilder.newClient();
         realClient.register(new MultiPartFeature());
         realClient.register(new JettisonFeature());
         realClient.register(new CsrfProtectionFilter());
-        if ((userName != null) && (password != null)) {
+        if (userName != null && password != null) {
             realClient.register(HttpAuthenticationFeature.basic(userName, password));
         }
         realClient.register(new ClientRequestFilter() {
diff --git a/nucleus/admin/rest/rest-service/src/main/java/org/glassfish/admin/rest/Constants.java b/nucleus/admin/rest/rest-service/src/main/java/org/glassfish/admin/rest/Constants.java
index 677786b..956252f 100644
--- a/nucleus/admin/rest/rest-service/src/main/java/org/glassfish/admin/rest/Constants.java
+++ b/nucleus/admin/rest/rest-service/src/main/java/org/glassfish/admin/rest/Constants.java
@@ -1,4 +1,5 @@
 /*
+ * Copyright (c) 2022 Contributors to the Eclipse Foundation
  * Copyright (c) 2009, 2018 Oracle and/or its affiliates. All rights reserved.
  *
  * This program and the accompanying materials are made available under the
@@ -24,41 +25,41 @@
  * @author Rajeshwar Paitl
  */
 public interface Constants {
-    public static final String INDENT = "  ";
-    public static final String JAVA_STRING_TYPE = "java.lang.String";
-    public static final String JAVA_BOOLEAN_TYPE = "java.lang.Boolean";
-    public static final String JAVA_INT_TYPE = "java.lang.Integer";
-    public static final String JAVA_PROPERTIES_TYPE = "java.util.Properties";
-    public static final String XSD_STRING_TYPE = "string";
-    public static final String XSD_BOOLEAN_TYPE = "boolean";
-    public static final String XSD_INT_TYPE = "int";
-    public static final String XSD_PROPERTIES_TYPE = "string"; //?
-    public static final String TYPE = "type";
-    public static final String KEY = "key";
-    public static final String OPTIONAL = "optional";
-    public static final String DEFAULT_VALUE = "defaultValue";
-    public static final String ACCEPTABLE_VALUES = "acceptableValues";
-    public static final String DEPRECATED = "deprecated";
+    String INDENT = "  ";
+    String JAVA_STRING_TYPE = "java.lang.String";
+    String JAVA_BOOLEAN_TYPE = "java.lang.Boolean";
+    String JAVA_INT_TYPE = "java.lang.Integer";
+    String JAVA_PROPERTIES_TYPE = "java.util.Properties";
+    String XSD_STRING_TYPE = "string";
+    String XSD_BOOLEAN_TYPE = "boolean";
+    String XSD_INT_TYPE = "int";
+    String XSD_PROPERTIES_TYPE = "string"; //?
+    String TYPE = "type";
+    String KEY = "key";
+    String OPTIONAL = "optional";
+    String DEFAULT_VALUE = "defaultValue";
+    String ACCEPTABLE_VALUES = "acceptableValues";
+    String DEPRECATED = "deprecated";
 
-    public static final String VAR_PARENT = "$parent";
-    public static final String VAR_GRANDPARENT = "$grandparent";
+    String VAR_PARENT = "$parent";
+    String VAR_GRANDPARENT = "$grandparent";
 
-    public static final String ENCODING = "UTF-8";
+    String ENCODING = "UTF-8";
 
-    public static final String CLIENT_JAVA_PACKAGE = "org.glassfish.admin.rest.client";
-    public static final String CLIENT_JAVA_PACKAGE_DIR = CLIENT_JAVA_PACKAGE.replace(".", System.getProperty("file.separator"));
+    String CLIENT_JAVA_PACKAGE = "org.glassfish.admin.rest.client";
+    String CLIENT_JAVA_PACKAGE_DIR = CLIENT_JAVA_PACKAGE.replace(".", System.getProperty("file.separator"));
 
-    public static final String CLIENT_PYTHON_PACKAGE = "glassfih.rest";
-    public static final String CLIENT_PYTHON_PACKAGE_DIR = CLIENT_PYTHON_PACKAGE.replace(".", System.getProperty("file.separator"));
+    String CLIENT_PYTHON_PACKAGE = "glassfih.rest";
+    String CLIENT_PYTHON_PACKAGE_DIR = CLIENT_PYTHON_PACKAGE.replace(".", System.getProperty("file.separator"));
 
-    public static final String REQ_ATTR_SUBJECT = "SUBJECT";
+    String REQ_ATTR_SUBJECT = "SUBJECT";
 
-    public static final String HEADER_LEGACY_FORMAT = "X-GlassFish-3";
+    String HEADER_LEGACY_FORMAT = "X-GlassFish-3";
 
-    public static final String MEDIA_TYPE = "application";
-    public static final String MEDIA_SUB_TYPE = "vnd.oracle.glassfish";
-    public static final String MEDIA_TYPE_BASE = MEDIA_TYPE + "/" + MEDIA_SUB_TYPE;
-    public static final String MEDIA_TYPE_JSON = MEDIA_TYPE_BASE + "+json";
-    public static final MediaType MEDIA_TYPE_JSON_TYPE = new MediaType(MEDIA_TYPE, MEDIA_SUB_TYPE + "+json");
-    public static final String MEDIA_TYPE_SSE = MEDIA_TYPE_BASE + "+sse";
+    String MEDIA_TYPE = "application";
+    String MEDIA_SUB_TYPE = "vnd.oracle.glassfish";
+    String MEDIA_TYPE_BASE = MEDIA_TYPE + "/" + MEDIA_SUB_TYPE;
+    String MEDIA_TYPE_JSON = MEDIA_TYPE_BASE + "+json";
+    MediaType MEDIA_TYPE_JSON_TYPE = new MediaType(MEDIA_TYPE, MEDIA_SUB_TYPE + "+json");
+    String MEDIA_TYPE_SSE = MEDIA_TYPE_BASE + "+sse";
 }
diff --git a/nucleus/admin/rest/rest-service/src/main/java/org/glassfish/admin/rest/clientutils/.gitkeep_empty_dir b/nucleus/admin/rest/rest-service/src/main/java/org/glassfish/admin/rest/clientutils/.gitkeep_empty_dir
deleted file mode 100644
index e69de29..0000000
--- a/nucleus/admin/rest/rest-service/src/main/java/org/glassfish/admin/rest/clientutils/.gitkeep_empty_dir
+++ /dev/null
diff --git a/nucleus/admin/rest/rest-service/src/main/java/org/glassfish/admin/rest/readers/JsonPropertyListReader.java b/nucleus/admin/rest/rest-service/src/main/java/org/glassfish/admin/rest/readers/JsonPropertyListReader.java
index 76c0da9..95d3225 100644
--- a/nucleus/admin/rest/rest-service/src/main/java/org/glassfish/admin/rest/readers/JsonPropertyListReader.java
+++ b/nucleus/admin/rest/rest-service/src/main/java/org/glassfish/admin/rest/readers/JsonPropertyListReader.java
@@ -1,4 +1,5 @@
 /*
+ * Copyright (c) 2022 Contributors to the Eclipse Foundation
  * Copyright (c) 2010, 2018 Oracle and/or its affiliates. All rights reserved.
  *
  * This program and the accompanying materials are made available under the
@@ -16,15 +17,6 @@
 
 package org.glassfish.admin.rest.readers;
 
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.ParameterizedType;
-import java.lang.reflect.Type;
-import java.util.List;
-import java.util.Map;
 import jakarta.ws.rs.Consumes;
 import jakarta.ws.rs.WebApplicationException;
 import jakarta.ws.rs.core.MediaType;
@@ -32,6 +24,16 @@
 import jakarta.ws.rs.core.Response;
 import jakarta.ws.rs.ext.MessageBodyReader;
 import jakarta.ws.rs.ext.Provider;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.List;
+import java.util.Map;
+
 import org.glassfish.admin.rest.client.utils.MarshallingUtils;
 import org.glassfish.admin.rest.utils.Util;
 
@@ -51,17 +53,14 @@
     @Override
     public List<Map<String, String>> readFrom(Class<List<Map<String, String>>> type, Type genericType, Annotation[] annotations,
             MediaType mediaType, MultivaluedMap<String, String> headers, InputStream in) throws IOException {
-        try {
+        try (BufferedReader reader = new BufferedReader(new InputStreamReader(in))) {
             StringBuilder sb = new StringBuilder();
-            BufferedReader reader = new BufferedReader(new InputStreamReader(in));
             String line = reader.readLine();
             while (line != null) {
                 sb.append(line);
                 line = reader.readLine();
             }
-
             return MarshallingUtils.getPropertiesFromJson(sb.toString());
-
         } catch (Exception exception) {
             throw new WebApplicationException(exception, Response.Status.INTERNAL_SERVER_ERROR);
         }
diff --git a/nucleus/admin/rest/rest-service/src/main/java/org/glassfish/admin/rest/readers/XmlPropertyListReader.java b/nucleus/admin/rest/rest-service/src/main/java/org/glassfish/admin/rest/readers/XmlPropertyListReader.java
index 3f75fc2..d921aa3 100644
--- a/nucleus/admin/rest/rest-service/src/main/java/org/glassfish/admin/rest/readers/XmlPropertyListReader.java
+++ b/nucleus/admin/rest/rest-service/src/main/java/org/glassfish/admin/rest/readers/XmlPropertyListReader.java
@@ -1,4 +1,5 @@
 /*
+ * Copyright (c) 2022 Contributors to the Eclipse Foundation
  * Copyright (c) 2010, 2018 Oracle and/or its affiliates. All rights reserved.
  *
  * This program and the accompanying materials are made available under the
@@ -50,17 +51,14 @@
     @Override
     public List<Map<String, String>> readFrom(Class<List<Map<String, String>>> type, Type genericType, Annotation[] annotations,
             MediaType mediaType, MultivaluedMap<String, String> headers, InputStream in) throws IOException {
-        try {
+        try (BufferedReader reader = new BufferedReader(new InputStreamReader(in))) {
             StringBuilder sb = new StringBuilder();
-            BufferedReader reader = new BufferedReader(new InputStreamReader(in));
             String line = reader.readLine();
             while (line != null) {
                 sb.append(line);
                 line = reader.readLine();
             }
-
             return MarshallingUtils.getPropertiesFromXml(sb.toString());
-
         } catch (Exception exception) {
             throw new WebApplicationException(exception, Response.Status.INTERNAL_SERVER_ERROR);
         }
diff --git a/nucleus/admin/rest/rest-service/src/main/java/org/glassfish/admin/rest/resources/MonitoringResource.java b/nucleus/admin/rest/rest-service/src/main/java/org/glassfish/admin/rest/resources/MonitoringResource.java
index a81134b..bd7b6bc 100644
--- a/nucleus/admin/rest/rest-service/src/main/java/org/glassfish/admin/rest/resources/MonitoringResource.java
+++ b/nucleus/admin/rest/rest-service/src/main/java/org/glassfish/admin/rest/resources/MonitoringResource.java
@@ -1,4 +1,5 @@
 /*
+ * Copyright (c) 2022 Contributors to the Eclipse Foundation
  * Copyright (c) 2009, 2018 Oracle and/or its affiliates. All rights reserved.
  *
  * This program and the accompanying materials are made available under the
@@ -16,42 +17,44 @@
 
 package org.glassfish.admin.rest.resources;
 
-import org.glassfish.admin.rest.utils.Util;
-import org.glassfish.admin.rest.utils.ProxyImpl;
+import com.sun.enterprise.config.serverbeans.Domain;
+import com.sun.enterprise.config.serverbeans.Server;
 
+import jakarta.ws.rs.Consumes;
+import jakarta.ws.rs.GET;
+import jakarta.ws.rs.Path;
+import jakarta.ws.rs.PathParam;
+import jakarta.ws.rs.Produces;
+import jakarta.ws.rs.core.Context;
+import jakarta.ws.rs.core.MediaType;
 import jakarta.ws.rs.core.PathSegment;
 import jakarta.ws.rs.core.Response;
 import jakarta.ws.rs.core.UriBuilder;
 import jakarta.ws.rs.core.UriInfo;
-import jakarta.ws.rs.core.Context;
-import static jakarta.ws.rs.core.Response.Status.*;
+
 import java.net.URL;
-import java.util.Properties;
-import java.util.TreeMap;
-import jakarta.ws.rs.Consumes;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
-
-import jakarta.ws.rs.GET;
-import jakarta.ws.rs.core.MediaType;
-import jakarta.ws.rs.Path;
-import jakarta.ws.rs.Produces;
-import jakarta.ws.rs.PathParam;
-
-import com.sun.enterprise.config.serverbeans.Domain;
-import com.sun.enterprise.config.serverbeans.Server;
+import java.util.Properties;
+import java.util.TreeMap;
 
 import org.glassfish.admin.rest.adapter.LocatorBridge;
 import org.glassfish.admin.rest.results.ActionReportResult;
+import org.glassfish.admin.rest.utils.ProxyImpl;
+import org.glassfish.admin.rest.utils.Util;
 import org.glassfish.admin.rest.utils.xml.RestActionReporter;
 import org.glassfish.external.statistics.Statistic;
 import org.glassfish.external.statistics.Stats;
-
-import org.glassfish.flashlight.datatree.TreeNode;
 import org.glassfish.flashlight.MonitoringRuntimeDataRegistry;
+import org.glassfish.flashlight.datatree.TreeNode;
 
-import static org.glassfish.admin.rest.provider.ProviderUtil.*;
+import static jakarta.ws.rs.core.Response.Status.FORBIDDEN;
+import static jakarta.ws.rs.core.Response.Status.NOT_FOUND;
+import static jakarta.ws.rs.core.Response.Status.OK;
+import static org.glassfish.admin.rest.provider.ProviderUtil.getElementLink;
+import static org.glassfish.admin.rest.provider.ProviderUtil.getStatistic;
+import static org.glassfish.admin.rest.provider.ProviderUtil.jsonValue;
 
 /**
  * @author rajeshwar patil
@@ -88,28 +91,57 @@
         pathSegments = pathSegments.subList(1, pathSegments.size());
         if (!pathSegments.isEmpty()) {
             PathSegment lastSegment = pathSegments.get(pathSegments.size() - 1);
-            if (lastSegment.getPath().isEmpty()) { // if there is a trailing '/' (like monitoring/domain/), a spurious pathSegment is added. Discard it.
+            if (lastSegment.getPath().isEmpty()) {
+                // if there is a trailing '/' (like monitoring/domain/), a spurious pathSegment is added. Discard it.
                 pathSegments = pathSegments.subList(0, pathSegments.size() - 1);
             }
         }
 
-        if (!pathSegments.isEmpty()) {
+        if (pathSegments.isEmpty()) {
+            // Called for /monitoring/domain/
+            List<TreeNode> list = new ArrayList<>();
+            if (rootNode != null) {
+                //Add currentInstance to response
+                list.add(rootNode);
+            }
+            constructEntity(list, ar);
+
+            if (isRunningOnDAS) {
+                // Add links to instances from the cluster
+                Domain domain = habitat.getRemoteLocator().getService(Domain.class);
+                Map<String, String> links = (Map<String, String>) ar.getExtraProperties().get("childResources");
+                for (Server s : domain.getServers().getServer()) {
+                    if (!"server".equals(s.getName())) {
+                        // add all non 'server' instances
+                        links.put(s.getName(), getElementLink(uriInfo, s.getName()));
+                    }
+                }
+            }
+            responseBuilder.entity(new ActionReportResult(ar));
+        } else {
             String firstPathElement = pathSegments.get(0).getPath();
-            if (firstPathElement.equals(currentInstanceName)) { // Query for current instance. Execute it
+            if (firstPathElement.equals(currentInstanceName)) {
+                // Query for current instance. Execute it
                 //iterate over pathsegments and build a dotted name to look up in monitoring registry
                 StringBuilder pathInMonitoringRegistry = new StringBuilder();
                 for (PathSegment pathSegment : pathSegments.subList(1, pathSegments.size())) {
                     if (pathInMonitoringRegistry.length() > 0) {
                         pathInMonitoringRegistry.append('.');
                     }
-                    pathInMonitoringRegistry.append(pathSegment.getPath().replaceAll("\\.", "\\\\.")); // Need to escape '.' before passing it to monitoring code
+                    // Need to escape '.' before passing it to monitoring code
+                    pathInMonitoringRegistry.append(pathSegment.getPath().replaceAll("\\.", "\\\\."));
                 }
 
                 TreeNode resultNode = pathInMonitoringRegistry.length() > 0 && rootNode != null
                         ? rootNode.getNode(pathInMonitoringRegistry.toString())
                         : rootNode;
-                if (resultNode != null) {
-                    List<TreeNode> list = new ArrayList<TreeNode>();
+                if (resultNode == null) {
+                    //No monitoring data, so nothing to list
+                    responseBuilder.status(NOT_FOUND);
+                    ar.setFailure();
+                    responseBuilder.entity(new ActionReportResult(ar));
+                } else {
+                    List<TreeNode> list = new ArrayList<>();
                     if (resultNode.hasChildNodes()) {
                         list.addAll(resultNode.getEnabledChildNodes());
                     } else {
@@ -117,16 +149,13 @@
                     }
                     constructEntity(list, ar);
                     responseBuilder.entity(new ActionReportResult(ar));
-                } else {
-                    //No monitoring data, so nothing to list
-                    responseBuilder.status(NOT_FOUND);
-                    ar.setFailure();
-                    responseBuilder.entity(new ActionReportResult(ar));
                 }
 
             } else { //firstPathElement != currentInstanceName => A proxy request
                 if (isRunningOnDAS) { //Attempt to forward to instance if running on Das
                     //TODO validate that firstPathElement corresponds to a valid server name
+                    // FIXME: As of 03.04.2022 Utils.getJerseyClient here throws exception:
+                    // java.lang.ClassNotFoundException: Provider for jakarta.ws.rs.client.ClientBuilder cannot be found
                     Properties proxiedResponse = new MonitoringProxyImpl().proxyRequest(uriInfo, Util.getJerseyClient(),
                             habitat.getRemoteLocator());
                     ar.setExtraProperties(proxiedResponse);
@@ -135,31 +164,14 @@
                     return Response.status(FORBIDDEN).build();
                 }
             }
-        } else { // Called for /monitoring/domain/
-            List<TreeNode> list = new ArrayList<TreeNode>();
-            if (rootNode != null) {
-                list.add(rootNode); //Add currentInstance to response
-            }
-            constructEntity(list, ar);
-
-            if (isRunningOnDAS) { // Add links to instances from the cluster
-                Domain domain = habitat.getRemoteLocator().getService(Domain.class);
-                Map<String, String> links = (Map<String, String>) ar.getExtraProperties().get("childResources");
-                for (Server s : domain.getServers().getServer()) {
-                    if (!s.getName().equals("server")) {// add all non 'server' instances
-                        links.put(s.getName(), getElementLink(uriInfo, s.getName()));
-                    }
-                }
-            }
-            responseBuilder.entity(new ActionReportResult(ar));
         }
 
         return responseBuilder.build();
     }
 
     private void constructEntity(List<TreeNode> nodeList, RestActionReporter ar) {
-        Map<String, Object> entity = new TreeMap<String, Object>();
-        Map<String, String> links = new TreeMap<String, String>();
+        Map<String, Object> entity = new TreeMap<>();
+        Map<String, String> links = new TreeMap<>();
 
         for (TreeNode node : nodeList) {
             //process only the leaf nodes, if any
@@ -174,7 +186,7 @@
                             Statistic statisticObject = (Statistic) value;
                             entity.put(node.getName(), getStatistic(statisticObject));
                         } else if (value instanceof Stats) {
-                            Map<String, Map> subMap = new TreeMap<String, Map>();
+                            Map<String, Map> subMap = new TreeMap<>();
                             for (Statistic statistic : ((Stats) value).getStatistics()) {
                                 subMap.put(statistic.getName(), getStatistic(statistic));
                             }
diff --git a/nucleus/cluster/admin/src/main/java/com/sun/enterprise/v3/admin/cluster/DeleteNodeConfigCommand.java b/nucleus/cluster/admin/src/main/java/com/sun/enterprise/v3/admin/cluster/DeleteNodeConfigCommand.java
index 425ce46..8358051 100644
--- a/nucleus/cluster/admin/src/main/java/com/sun/enterprise/v3/admin/cluster/DeleteNodeConfigCommand.java
+++ b/nucleus/cluster/admin/src/main/java/com/sun/enterprise/v3/admin/cluster/DeleteNodeConfigCommand.java
@@ -1,4 +1,5 @@
 /*
+ * Copyright (c) 2022 Contributors to the Eclipse Foundation
  * Copyright (c) 2010, 2018 Oracle and/or its affiliates. All rights reserved.
  *
  * This program and the accompanying materials are made available under the
@@ -16,28 +17,34 @@
 
 package com.sun.enterprise.v3.admin.cluster;
 
-import com.sun.enterprise.config.serverbeans.*;
-import com.sun.enterprise.util.SystemPropertyConstants;
-import com.sun.enterprise.util.StringUtils;
+import com.sun.enterprise.config.serverbeans.Node;
+import com.sun.enterprise.config.serverbeans.Nodes;
+
+import jakarta.inject.Inject;
+
+import java.util.logging.Logger;
+
 import org.glassfish.api.ActionReport;
 import org.glassfish.api.I18n;
 import org.glassfish.api.Param;
-import org.glassfish.api.admin.*;
+import org.glassfish.api.admin.AdminCommand;
+import org.glassfish.api.admin.AdminCommandContext;
+import org.glassfish.api.admin.CommandRunner;
 import org.glassfish.api.admin.CommandRunner.CommandInvocation;
-import jakarta.inject.Inject;
-
+import org.glassfish.api.admin.ExecuteOn;
+import org.glassfish.api.admin.ParameterMap;
+import org.glassfish.api.admin.RestEndpoint;
+import org.glassfish.api.admin.RestEndpoints;
+import org.glassfish.api.admin.RuntimeType;
 import org.glassfish.hk2.api.IterableProvider;
 import org.glassfish.hk2.api.PerLookup;
 import org.glassfish.hk2.api.ServiceLocator;
-
 import org.jvnet.hk2.annotations.Service;
-import org.jvnet.hk2.component.*;
-import java.util.logging.Logger;
 
 
 /**
  * Remote AdminCommand to create a config node.  This command is run only on DAS.
- *  Register the config node on DAS
+ * Register the config node on DAS
  *
  * @author Carla Mott
  */
diff --git a/nucleus/hk2/hk2-config/src/main/java/org/jvnet/hk2/config/WriteableView.java b/nucleus/hk2/hk2-config/src/main/java/org/jvnet/hk2/config/WriteableView.java
index 4b09ea1..cb10c38 100644
--- a/nucleus/hk2/hk2-config/src/main/java/org/jvnet/hk2/config/WriteableView.java
+++ b/nucleus/hk2/hk2-config/src/main/java/org/jvnet/hk2/config/WriteableView.java
@@ -1,4 +1,5 @@
 /*
+ * Copyright (c) 2022 Contributors to the Eclipse Foundation
  * Copyright (c) 2007, 2020 Oracle and/or its affiliates. All rights reserved.
  *
  * This program and the accompanying materials are made available under the
@@ -16,23 +17,43 @@
 
 package org.jvnet.hk2.config;
 
-import java.lang.reflect.ParameterizedType;
-import java.lang.reflect.Proxy;
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
-import java.lang.reflect.Type;
+import jakarta.validation.ConstraintViolation;
+import jakarta.validation.ConstraintViolationException;
+import jakarta.validation.ElementKind;
+import jakarta.validation.Path;
+import jakarta.validation.TraversableResolver;
+import jakarta.validation.Validation;
+import jakarta.validation.Validator;
+import jakarta.validation.ValidatorContext;
+import jakarta.validation.ValidatorFactory;
+import jakarta.validation.metadata.ConstraintDescriptor;
+
 import java.beans.PropertyChangeEvent;
 import java.beans.PropertyVetoException;
 import java.lang.annotation.ElementType;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Proxy;
+import java.lang.reflect.Type;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
 import java.text.MessageFormat;
-import java.util.*;
-import java.util.concurrent.locks.Lock;
+import java.util.AbstractList;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.ResourceBundle;
+import java.util.Set;
+import java.util.StringTokenizer;
 
-import jakarta.validation.*;
-import jakarta.validation.metadata.ConstraintDescriptor;
-
+import org.hibernate.validator.HibernateValidator;
+import org.jvnet.hk2.config.ConfigModel.AttributeLeaf;
 import org.jvnet.hk2.config.ConfigModel.Property;
 
 /**
@@ -42,17 +63,19 @@
  * @author Jerome Dochez
  */
 public class WriteableView implements InvocationHandler, Transactor, ConfigView {
+
     private static final TraversableResolver TRAVERSABLE_RESOLVER = new TraversableResolver() {
-        public boolean isReachable(Object traversableObject,
-                Path.Node traversableProperty, Class<?> rootBeanType,
-                Path pathToTraversableObject, ElementType elementType) {
-                    return true;
+
+        @Override
+        public boolean isReachable(Object traversableObject, Path.Node traversableProperty, Class<?> rootBeanType,
+            Path pathToTraversableObject, ElementType elementType) {
+            return true;
         }
 
-        public boolean isCascadable(Object traversableObject,
-                Path.Node traversableProperty, Class<?> rootBeanType,
-                Path pathToTraversableObject, ElementType elementType) {
-                    return true;
+        @Override
+        public boolean isCascadable(Object traversableObject, Path.Node traversableProperty, Class<?> rootBeanType,
+            Path pathToTraversableObject, ElementType elementType) {
+            return true;
         }
 
     };
@@ -60,22 +83,22 @@
     private final static Validator beanValidator;
 
     static {
-        ClassLoader cl = System.getSecurityManager()==null?Thread.currentThread().getContextClassLoader():
-            AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
-               @Override
-               public ClassLoader run() {
-                   return Thread.currentThread().getContextClassLoader();
-               }
+        ClassLoader cl = System.getSecurityManager() == null
+            ? Thread.currentThread().getContextClassLoader()
+            : AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
+
+                @Override
+                public ClassLoader run() {
+                    return Thread.currentThread().getContextClassLoader();
+                }
             });
 
        try {
-           Thread.currentThread().setContextClassLoader(org.hibernate.validator.HibernateValidator.class.getClassLoader());
-
+           Thread.currentThread().setContextClassLoader(HibernateValidator.class.getClassLoader());
            ValidatorFactory validatorFactory = Validation.buildDefaultValidatorFactory();
            ValidatorContext validatorContext = validatorFactory.usingContext();
            validatorContext.messageInterpolator(new MessageInterpolatorImpl());
-           beanValidator = validatorContext.traversableResolver(
-                       TRAVERSABLE_RESOLVER).getValidator();
+           beanValidator = validatorContext.traversableResolver(TRAVERSABLE_RESOLVER).getValidator();
        } finally {
            Thread.currentThread().setContextClassLoader(cl);
        }
@@ -97,85 +120,80 @@
     public WriteableView(ConfigBeanProxy readView) {
         this.bean = (ConfigBean) ((ConfigView) Proxy.getInvocationHandler(readView)).getMasterView();
         this.defaultView = bean.createProxy();
-        changedAttributes = new HashMap<String, PropertyChangeEvent>();
-        changedCollections = new HashMap<String, ProtectedList>();
+        changedAttributes = new HashMap<>();
+        changedCollections = new HashMap<>();
     }
 
+    @Override
     public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
-
-        if (method.getName().equals("hashCode"))
+        if (method.getName().equals("hashCode")) {
             return super.hashCode();
+        }
 
-        if (method.getName().equals("equals"))
+        if (method.getName().equals("equals")) {
             return super.equals(args[0]);
+        }
 
-        if(method.getAnnotation(DuckTyped.class)!=null) {
+        if (method.getAnnotation(DuckTyped.class) != null) {
             return bean.invokeDuckMethod(method,proxy,args);
         }
 
         ConfigModel.Property property = bean.model.toProperty(method);
+        if (property == null) {
+            throw new IllegalArgumentException("No corresponding property found for method: " + method);
+        }
 
-        if(property==null)
-             throw new IllegalArgumentException(
-                "No corresponding property found for method: "+method);
-
-        if(args==null || args.length==0) {
+        if (args == null || args.length == 0) {
             // getter, maybe one of our changed properties
             if (changedAttributes.containsKey(property.xmlName())) {
                 // serve masked changes.
                 Object changedValue = changedAttributes.get(property.xmlName()).getNewValue();
                 if (changedValue instanceof Dom) {
                     return ((Dom) changedValue).createProxy();
-                } else {
-                    return changedValue;
                 }
-            } else {
-                // pass through.
-                return getter(property, method.getGenericReturnType());
+                return changedValue;
             }
-        } else {
-            setter(property, args[0], method.getGenericParameterTypes()[0]);
-            return null;
+            // pass through.
+            return getter(property, method.getGenericReturnType());
         }
-    }
-
-    public String getPropertyValue(String propertyName) {
-
-        ConfigModel.Property prop = this.getProperty(propertyName);
-        if (prop!=null) {
-            if (changedAttributes.containsKey(prop.xmlName())) {
-                // serve masked changes.
-                return (String) changedAttributes.get(prop.xmlName()).getNewValue();
-            } else {
-                return (String) getter(prop, String.class);
-            }
-        }
+        setter(property, args[0], method.getGenericParameterTypes()[0]);
         return null;
     }
 
-    public synchronized Object getter(ConfigModel.Property property, java.lang.reflect.Type t) {
+    public String getPropertyValue(String propertyName) {
+        ConfigModel.Property prop = this.getProperty(propertyName);
+        if (prop == null) {
+            return null;
+        }
+        if (changedAttributes.containsKey(prop.xmlName())) {
+            // serve masked changes.
+            return (String) changedAttributes.get(prop.xmlName()).getNewValue();
+        }
+        return (String) getter(prop, String.class);
+    }
+
+    public synchronized Object getter(ConfigModel.Property property, Type t) {
         Object value =  bean._getter(property, t);
         if (value instanceof List) {
             if (!changedCollections.containsKey(property.xmlName())) {
                 // wrap collections so we can record events on that collection mutation.
                 changedCollections.put(property.xmlName(),
-                        new ProtectedList(List.class.cast(value), defaultView, property.xmlName()));
+                    new ProtectedList(List.class.cast(value), defaultView, property.xmlName()));
             }
             return changedCollections.get(property.xmlName());
         }
         return value;
     }
 
-    public synchronized void setter(ConfigModel.Property property,
-        Object newValue, java.lang.reflect.Type t)  {
-
+    public synchronized void setter(ConfigModel.Property property, Object newValue, Type t) {
         // are we still in a transaction
-        if (currentTx==null) {
+        if (currentTx == null) {
             throw new IllegalStateException("Not part of a transaction");
         }
         try {
-            if (newValue != null)
+            if (newValue != null) {
                 handleValidation(property, newValue);
+            }
         } catch(Exception v) {
             bean.getLock().unlock();
             throw new RuntimeException(v);
@@ -211,14 +229,14 @@
                 // Resources
                 List<Dom> siblings = parent != null
                         ? parent.domNodeByTypeElements(thisview.getProxyType())
-                        : new ArrayList<Dom>();
+                        : new ArrayList<>();
 
                 // Iterate through each sibling element and see if anyone has
                 // same key. If true throw an exception after unlocking this
                 // element
                 for (Dom sibling : siblings) {
                     String siblingKey = sibling.getKey();
-                    if (newValue.equals(siblingKey)) {
+                    if (siblingKey.equals(newValue)) {
                         bean.getLock().unlock();
                         throw new IllegalArgumentException(
                             "Keys cannot be duplicate. Old value of this key " +
@@ -231,14 +249,13 @@
         // setter
         Object oldValue = bean.getter(property, t);
         if (newValue instanceof ConfigBeanProxy) {
-            ConfigView bean = (ConfigView)
-                Proxy.getInvocationHandler((ConfigBeanProxy) newValue);
-            newValue = bean.getMasterView();
+            ConfigView view = (ConfigView) Proxy.getInvocationHandler(newValue);
+            newValue = view.getMasterView();
         }
         PropertyChangeEvent evt = new PropertyChangeEvent(
             defaultView,property.xmlName(), oldValue, newValue);
         try {
-            for (ConfigBeanInterceptor interceptor : bean.getOptionalFeatures()) {
+            for (ConfigBeanInterceptor<?> interceptor : bean.getOptionalFeatures()) {
                 interceptor.beforeChange(evt);
             }
         } catch(PropertyVetoException e) {
@@ -246,7 +263,7 @@
         }
 
         changedAttributes.put(property.xmlName(), evt);
-        for (ConfigBeanInterceptor interceptor : bean.getOptionalFeatures()) {
+        for (ConfigBeanInterceptor<?> interceptor : bean.getOptionalFeatures()) {
             interceptor.afterChange(evt, System.currentTimeMillis());
         }
     }
@@ -266,8 +283,9 @@
      * @return true if the enlisting with the passed transaction was accepted,
      *         false otherwise
      */
+    @Override
     public synchronized boolean join(Transaction t) {
-        if (currentTx==null) {
+        if (currentTx == null) {
             currentTx = t;
             t.addParticipant(this);
             return true;
@@ -282,50 +300,49 @@
      *          one passed during the join(Transaction t) call.
      * @return true if the trsaction commiting would be successful
      */
+    @Override
     public synchronized boolean canCommit(Transaction t) throws TransactionFailure {
-        if (!isDeleted) { // HK2-127: validate only if not marked for deletion
-
-            Set constraintViolations =
-                beanValidator.validate(this.getProxy(this.getProxyType()));
-
+        // HK2-127: validate only if not marked for deletion
+        if (!isDeleted) {
+            Set<ConstraintViolation<ConfigBeanProxy>> constraintViolations = beanValidator
+                .validate(this.getProxy(this.getProxyType()));
             try {
                 handleValidationException(constraintViolations);
-            } catch (ConstraintViolationException constraintViolationException) {
-                throw new TransactionFailure(constraintViolationException.getMessage(), constraintViolationException);
+            } catch (ConstraintViolationException e) {
+                throw new TransactionFailure(e.getMessage(), e);
             }
         }
-
-        return currentTx==t;
+        return currentTx == t;
     }
 
-    private void handleValidationException(Set constraintViolations) throws ConstraintViolationException {
 
-        if (constraintViolations != null && !constraintViolations.isEmpty()) {
-            Iterator<ConstraintViolation<ConfigBeanProxy>> it = constraintViolations.iterator();
-
-            StringBuilder sb = new StringBuilder();
-            sb.append(MessageFormat.format(i18n.getString("bean.validation.failure"), this.<ConfigBeanProxy>getProxyType().getSimpleName()));
-            String violationMsg = i18n.getString("bean.validation.constraintViolation");
-            while (it.hasNext()) {
-                ConstraintViolation cv = it.next();
-                sb.append(" ");
-                sb.append(MessageFormat.format(violationMsg, cv.getMessage(), cv.getPropertyPath()));
-                if (it.hasNext()) {
-                    sb.append(i18n.getString("bean.validation.separator"));
-                }
-            }
-            bean.getLock().unlock();
-            throw new ConstraintViolationException(sb.toString(), constraintViolations);
+    private void handleValidationException(Set<ConstraintViolation<ConfigBeanProxy>> violations)
+        throws ConstraintViolationException {
+        if (violations == null || violations.isEmpty()) {
+            return;
         }
+        Iterator<ConstraintViolation<ConfigBeanProxy>> it = violations.iterator();
+        StringBuilder sb = new StringBuilder();
+        sb.append(MessageFormat.format(i18n.getString("bean.validation.failure"), getProxyType().getSimpleName()));
+        String violationMsg = i18n.getString("bean.validation.constraintViolation");
+        while (it.hasNext()) {
+            ConstraintViolation<ConfigBeanProxy> violation = it.next();
+            sb.append(" ");
+            sb.append(MessageFormat.format(violationMsg, violation.getMessage(), violation.getPropertyPath()));
+            if (it.hasNext()) {
+                sb.append(i18n.getString("bean.validation.separator"));
+            }
+        }
+        bean.getLock().unlock();
+        throw new ConstraintViolationException(sb.toString(), violations);
     }
 
     /** remove @ or <> eg "@foo" => "foo" or "<foo>" => "foo" */
-    public static String stripMarkers(final String s ) {
-        if ( s.startsWith("@") ) {
+    public static String stripMarkers(final String s) {
+        if (s.startsWith("@")) {
             return s.substring(1);
-        }
-        else if ( s.startsWith("<") ) {
-            return s.substring(1, s.length()-1);
+        } else if (s.startsWith("<")) {
+            return s.substring(1, s.length() - 1);
         }
         return s;
     }
@@ -334,34 +351,33 @@
      * Commit this Transaction.
      *
      * @param t the transaction commiting.
-     * @throws TransactionFailure
-     *          if the transaction commit failed
+     * @throws TransactionFailure if the transaction commit failed
      */
+    @Override
     public synchronized List<PropertyChangeEvent> commit(Transaction t) throws TransactionFailure {
-        if (currentTx==t) {
-            currentTx=null;
+        if (currentTx == t) {
+            currentTx = null;
         }
 
         // a key attribute must be non-null and have length >= 1
         final ConfigBean master = getMasterView();
         final String keyStr = master.model.key;
-        if ( keyStr != null) {
+        if (keyStr != null) {
             final String key = stripMarkers(keyStr);
             final String value = getPropertyValue(key);
-            if ( value == null ) {
-                throw new TransactionFailure( "Key value cannot be null: " + key );
+            if (value == null) {
+                throw new TransactionFailure("Key value cannot be null: " + key);
             }
-            if ( value.length() == 0 ) {
-                throw new TransactionFailure( "Key value cannot be empty string: " + key );
+            if (value.length() == 0) {
+                throw new TransactionFailure("Key value cannot be empty string: " + key);
             }
         }
 
-
         try {
-            List<PropertyChangeEvent> appliedChanges = new ArrayList<PropertyChangeEvent>();
+            List<PropertyChangeEvent> appliedChanges = new ArrayList<>();
             for (PropertyChangeEvent event : changedAttributes.values()) {
                 ConfigModel.Property property = bean.model.findIgnoreCase(event.getPropertyName());
-                ConfigBeanInterceptor interceptor  = bean.getOptionalFeature(ConfigBeanInterceptor.class);
+                ConfigBeanInterceptor<?> interceptor  = bean.getOptionalFeature(ConfigBeanInterceptor.class);
                 try {
                     if (interceptor!=null) {
                         interceptor.beforeChange(event);
@@ -370,24 +386,24 @@
                     throw new TransactionFailure(e.getMessage(), e);
                 }
                 property.set(bean, event.getNewValue());
-                if (interceptor!=null) {
+                if (interceptor != null) {
                     interceptor.afterChange(event, System.currentTimeMillis());
                 }
                 appliedChanges.add(event);
             }
-            for (ProtectedList entry :  changedCollections.values())  {
+            for (ProtectedList entry : changedCollections.values())  {
                 List<Object> originalList = entry.readOnly;
                 for (PropertyChangeEvent event : entry.changeEvents) {
-                    if (event.getOldValue()==null) {
+                    if (event.getOldValue() == null) {
                         originalList.add(event.getNewValue());
                     } else {
                         final Object toBeRemovedObj = event.getOldValue();
-                        if ( toBeRemovedObj instanceof ConfigBeanProxy ) {
-                            final Dom toBeRemoved = Dom.unwrap((ConfigBeanProxy)toBeRemovedObj);
-                            for (int index=0;index<originalList.size();index++) {
+                        if (toBeRemovedObj instanceof ConfigBeanProxy) {
+                            final Dom toBeRemoved = Dom.unwrap((ConfigBeanProxy) toBeRemovedObj);
+                            for (int index = 0; index < originalList.size(); index++) {
                                 Object element = originalList.get(index);
                                 Dom dom = Dom.unwrap((ConfigBeanProxy) element);
-                                if (dom==toBeRemoved) {
+                                if (dom == toBeRemoved) {
                                     Object newValue = event.getNewValue();
                                     if (newValue == null) {
                                         originalList.remove(index);
@@ -396,18 +412,17 @@
                                     }
                                 }
                             }
-                        }
-                        else if ( toBeRemovedObj instanceof String ) {
-                            final String toBeRemoved = (String)toBeRemovedObj;
-                            for (int index=0;index<originalList.size();index++) {
-                                final String item = (String)originalList.get(index);
+                        } else if (toBeRemovedObj instanceof String) {
+                            final String toBeRemoved = (String) toBeRemovedObj;
+                            for (int index = 0; index < originalList.size(); index++) {
+                                final String item = (String) originalList.get(index);
                                 if (item.equals(toBeRemoved)) {
                                     originalList.remove(index);
                                 }
                             }
-                        }
-                        else {
-                              throw new IllegalArgumentException();
+                        } else {
+                            throw new IllegalArgumentException(
+                                "Invalid value for key: " + event.getPropertyName() + ": " + event.getNewValue());
                         }
                     }
                     appliedChanges.add(event);
@@ -416,9 +431,9 @@
             changedAttributes.clear();
             changedCollections.clear();
             return appliedChanges;
-        } catch(TransactionFailure e) {
+        } catch (TransactionFailure e) {
             throw e;
-        } catch(Exception e) {
+        } catch (Exception e) {
             throw new TransactionFailure(e.getMessage(), e);
         } finally {
             bean.getLock().unlock();
@@ -431,8 +446,9 @@
      *
      * @param t the aborting transaction
      */
+    @Override
     public synchronized void abort(Transaction t) {
-        currentTx=null;
+        currentTx = null;
         bean.getLock().unlock();
         changedAttributes.clear();
 
@@ -447,30 +463,33 @@
      * @return the propertly constructed configuration object
      * @throws TransactionFailure if the allocation failed
      */
-
     public <T extends ConfigBeanProxy> T allocateProxy(Class<T> type) throws TransactionFailure {
-        if (currentTx==null) {
+        if (currentTx == null) {
             throw new TransactionFailure("Not part of a transaction", null);
         }
         ConfigBean newBean = bean.allocate(type);
-        WriteableView writeableView = bean.getHabitat().<ConfigSupport>getService(ConfigSupport.class).getWriteableView(newBean.getProxy(type), newBean);
+        bean.getHabitat().<ConfigSupport> getService(ConfigSupport.class);
+        WriteableView writeableView = ConfigSupport.getWriteableView(newBean.getProxy(type), newBean);
         writeableView.join(currentTx);
-
         return writeableView.getProxy(type);
    }
 
+    @Override
     public ConfigBean getMasterView() {
         return bean;
     }
 
+    @Override
     public void setMasterView(ConfigView view) {
 
     }
 
+    @Override
     public <T extends ConfigBeanProxy> Class<T> getProxyType() {
         return bean.getProxyType();
     }
 
+    @Override
     @SuppressWarnings("unchecked")
     public <T extends ConfigBeanProxy> T getProxy(final Class<T> type) {
         final ConfigBean sourceBean = getMasterView();
@@ -478,55 +497,56 @@
             throw new IllegalArgumentException("This config bean interface is " + sourceBean.model.targetTypeName
                     + " not "  + type.getName());
         }
-        Class[] interfacesClasses = { type };
         ClassLoader cl;
-        if (System.getSecurityManager()!=null) {
+        if (System.getSecurityManager() == null) {
+            cl = type.getClassLoader();
+        } else {
             cl = AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
+
                 @Override
                 public ClassLoader run() {
                     return type.getClassLoader();
                 }
             });
-        } else {
-            cl = type.getClassLoader();
         }
+        Class[] interfacesClasses = {type};
         return (T) Proxy.newProxyInstance(cl, interfacesClasses, this);
     }
 
     boolean removeNestedElements(Object object) {
-        InvocationHandler h = Proxy.getInvocationHandler(object);
-        if (!(h instanceof WriteableView)) { // h instanceof ConfigView
-            ConfigBean bean = (ConfigBean) ((ConfigView) h).getMasterView();
-            h = bean.getWriteableView();
-            if (h == null) {
+        InvocationHandler handler = Proxy.getInvocationHandler(object);
+        if (!(handler instanceof WriteableView)) {
+            ConfigBean masterView = (ConfigBean) ((ConfigView) handler).getMasterView();
+            handler = masterView.getWriteableView();
+            if (handler == null) {
                 ConfigBeanProxy writable;
                 try {
                     writable = currentTx.enroll((ConfigBeanProxy) object);
                 } catch (TransactionFailure e) {
-                    throw new RuntimeException(e); // something is seriously wrong
+                    // something is seriously wrong
+                    throw new IllegalStateException(e);
                 }
-                h = Proxy.getInvocationHandler(writable);
+                handler = Proxy.getInvocationHandler(writable);
             } else {
                 // it's possible to set leaf multiple times,
                 // so oldValue was already processed
                 return false;
             }
         }
-        WriteableView writableView = (WriteableView) h;
+        WriteableView writableView = (WriteableView) handler;
         synchronized (writableView) {
             writableView.isDeleted = true;
         }
         boolean removed = false;
         for (Property property : writableView.bean.model.elements.values()) {
             if (property.isCollection()) {
-                Object nested = writableView.getter(property,
-                        parameterizedType);
+                Object nested = writableView.getter(property, parameterizedType);
                 ProtectedList list = (ProtectedList) nested;
                 if (list.size() > 0) {
                     list.clear();
                     removed = true;
                 }
-            } else if (!property.isLeaf()) { // Element
+            } else if (!property.isLeaf()) {
                 Object oldValue = writableView.getter(property, ConfigBeanProxy.class);
                 if (oldValue != null) {
                     writableView.setter(property, null, Dom.class);
@@ -538,381 +558,384 @@
         return removed;
     }
 
-/**
- * A Protected List is a @Link java.util.List implementation which mutable
- * operations are constrained by the owner of the list.
- *
- * @author Jerome Dochez
- */
-private class ProtectedList extends AbstractList {
+    private final class WriteableViewConstraintViolation implements ConstraintViolation<ConfigBeanProxy> {
 
-    final ConfigBeanProxy readView;
-    final List<Object> readOnly;
-    final String id;
-    final List<PropertyChangeEvent> changeEvents = new ArrayList<PropertyChangeEvent>();
-    final List proxied;
+        private final AttributeLeaf leaf;
+        private final String value;
 
-    ProtectedList(List<Object> readOnly, ConfigBeanProxy parent, String id) {
-        proxied = Collections.synchronizedList(new ArrayList<Object>(readOnly));
-        this.readView = parent;
-        this.readOnly = readOnly;
-        this.id = id;
+        private WriteableViewConstraintViolation(AttributeLeaf leaf, String value) {
+            this.leaf = leaf;
+            this.value = value;
+        }
+
+        @Override
+        public String getMessage() {
+            return i18n.getString(getMessageTemplate()) + leaf.dataType;
+        }
+
+        @Override
+        public String getMessageTemplate() {
+            return "bean.validation.dataType.failure";
+        }
+
+        @Override
+        public ConfigBeanProxy getRootBean() {
+            return (ConfigBeanProxy) WriteableView.this;
+        }
+
+        @Override
+        public Class<ConfigBeanProxy> getRootBeanClass() {
+            return WriteableView.this.getProxyType();
+        }
+
+        @Override
+        public Object getLeafBean() {
+            return null;
+        }
+
+        @Override
+        public Object[] getExecutableParameters() {
+            return null;
+        }
+
+        @Override
+        public Object getExecutableReturnValue() {
+            return null;
+        }
+
+        @Override
+        public Path getPropertyPath() {
+            final Set<Path.Node> nodes = new HashSet<>();
+            nodes.add(new Path.Node() {
+                @Override
+                public String getName() {
+                    return leaf.xmlName;
+                }
+
+                @Override
+                public boolean isInIterable() {
+                    return false;
+                }
+
+                @Override
+                public Integer getIndex() {
+                    return null;
+                }
+
+                @Override
+                public Object getKey() {
+                    return null;
+                }
+
+                @Override
+                public ElementKind getKind() {
+                    return null;
+                }
+
+                @Override
+                public <T extends Path.Node> T as(Class<T> tClass) {
+                    return null;
+                }
+            });
+            return new Path() {
+                @Override
+                public Iterator<Node> iterator() {
+                    return nodes.iterator();
+                }
+
+                @Override
+                public String toString() {
+                   return nodes.iterator().next().getName();
+                }
+            };
+        }
+
+        @Override
+        public Object getInvalidValue() {
+            return value;
+        }
+
+        @Override
+        public ConstraintDescriptor<?> getConstraintDescriptor() {
+            return null;
+        }
+
+        @Override
+        public Object unwrap(Class type) {
+            return null;
+        }
     }
 
     /**
-     * Returns the number of elements in this collection.  If the collection
-     * contains more than <tt>Integer.MAX_VALUE</tt> elements, returns
-     * <tt>Integer.MAX_VALUE</tt>.
+     * A Protected List is a @Link java.util.List implementation which mutable
+     * operations are constrained by the owner of the list.
      *
-     * @return the number of elements in this collection.
+     * @author Jerome Dochez
      */
-    public int size() {
-        return proxied.size();
-    }
+    private class ProtectedList extends AbstractList<Object> {
 
-    /**
-     * Returns the element at the specified position in this list.
-     *
-     * @param index index of element to return.
-     * @return the element at the specified position in this list.
-     * @throws IndexOutOfBoundsException if the given index is out of range
-     *                                   (<tt>index &lt; 0 || index &gt;= size()</tt>).
-     */
-    public Object get(int index) {
-        return proxied.get(index);
-    }
+        final ConfigBeanProxy readView;
+        final List<Object> readOnly;
+        final String id;
+        final List<PropertyChangeEvent> changeEvents = new ArrayList<>();
+        final List<Object> proxied;
 
-    @Override
-    public synchronized boolean add(Object object) {
-        Object param = object;
-        Object handler = null;
-        try {
-            handler = Proxy.getInvocationHandler(object);
-        } catch(IllegalArgumentException e) {
-            // ignore, this is a leaf
+        ProtectedList(List<Object> readOnly, ConfigBeanProxy parent, String id) {
+            proxied = Collections.synchronizedList(new ArrayList<>(readOnly));
+            this.readView = parent;
+            this.readOnly = readOnly;
+            this.id = id;
         }
-        if (handler!=null && handler instanceof WriteableView) {
-            ConfigBean master = ((WriteableView) handler).getMasterView();
-            String key = master.model.key;
-            if (key!=null) {
-                // remove leading @
-                key = key.substring(1);
-                // check that we are not adding a duplicate key element
-                String keyValue = ((WriteableView) handler).getPropertyValue(key);
-                for (Object o : proxied) {
-                    // the proxied object can be a read-only or a writeable view, we need
-                    // to be careful
-                    // ToDo : we need to encasulate this test.
-                    String value = null;
-                    if (Proxy.getInvocationHandler(o) instanceof WriteableView) {
-                        ConfigBean masterView = ((WriteableView) handler).getMasterView();
-                        String masterViewKey = masterView.model.key;
-                        if(masterViewKey != null && key.equals(masterViewKey.substring(1))){
-                            value = ((WriteableView) Proxy.getInvocationHandler(o)).getPropertyValue(key);
+
+        /**
+         * Returns the number of elements in this collection.  If the collection
+         * contains more than <tt>Integer.MAX_VALUE</tt> elements, returns
+         * <tt>Integer.MAX_VALUE</tt>.
+         *
+         * @return the number of elements in this collection.
+         */
+        @Override
+        public int size() {
+            return proxied.size();
+        }
+
+        /**
+         * Returns the element at the specified position in this list.
+         *
+         * @param index index of element to return.
+         * @return the element at the specified position in this list.
+         * @throws IndexOutOfBoundsException if the given index is out of range
+         *                                   (<tt>index &lt; 0 || index &gt;= size()</tt>).
+         */
+        @Override
+        public Object get(int index) {
+            return proxied.get(index);
+        }
+
+        @Override
+        public synchronized boolean add(Object object) {
+            Object param = object;
+            Object handler = null;
+            try {
+                handler = Proxy.getInvocationHandler(object);
+            } catch (IllegalArgumentException e) {
+                // ignore, this is a leaf
+            }
+            if (handler != null && handler instanceof WriteableView) {
+                ConfigBean master = ((WriteableView) handler).getMasterView();
+                String key = master.model.key;
+                if (key != null) {
+                    // remove leading @
+                    key = key.substring(1);
+                    // check that we are not adding a duplicate key element
+                    String keyValue = ((WriteableView) handler).getPropertyValue(key);
+                    for (Object o : proxied) {
+                        // the proxied object can be a read-only or a writeable view, we need
+                        // to be careful
+                        // ToDo : we need to encasulate this test.
+                        String value = null;
+                        if (Proxy.getInvocationHandler(o) instanceof WriteableView) {
+                            ConfigBean masterView = ((WriteableView) handler).getMasterView();
+                            String masterViewKey = masterView.model.key;
+                            if (masterViewKey != null && key.equals(masterViewKey.substring(1))) {
+                                value = ((WriteableView) Proxy.getInvocationHandler(o)).getPropertyValue(key);
+                            }
+                        } else {
+                            Dom cbo = Dom.unwrap((ConfigBeanProxy) o);
+                            String cboKey = cbo.model.key;
+                            if (cboKey != null && key.equals(cboKey.substring(1))) {
+                                value = cbo.attribute(key);
+                            }
                         }
-                    }  else {
-                        Dom cbo = Dom.unwrap((ConfigBeanProxy) o);
-                        String cboKey = cbo.model.key;
-                        if(cboKey != null && key.equals(cboKey.substring(1))){
-                            value = cbo.attribute(key);
+                        if (keyValue != null && value != null && keyValue.equals(value)) {
+                            Dom parent = Dom.unwrap(readView);
+                            throw new IllegalArgumentException("A " + master.getProxyType().getSimpleName()
+                                + " with the same key \"" + keyValue + "\" already exists in "
+                                + parent.getProxyType().getSimpleName() + " " + parent.getKey());
+
                         }
                     }
-                    if (keyValue!=null && value != null && keyValue.equals(value)) {
-                        Dom parent = Dom.unwrap(readView);
-                        throw new IllegalArgumentException("A " + master.getProxyType().getSimpleName() +
-                                " with the same key \"" + keyValue + "\" already exists in " +
-                                parent.getProxyType().getSimpleName() + " " + parent.getKey()) ;
+                }
+                param = ((WriteableView) handler).getMasterView()
+                    .createProxy((Class<ConfigBeanProxy>) master.getImplementationClass());
 
-                    }
+            }
+            PropertyChangeEvent evt = new PropertyChangeEvent(defaultView, id, null, param);
+            changeEvents.add(evt);
+
+            boolean added = proxied.add(object);
+
+            try {
+                for (ConfigBeanInterceptor interceptor : bean.getOptionalFeatures()) {
+                    interceptor.beforeChange(evt);
+                }
+            } catch (PropertyVetoException e) {
+                throw new RuntimeException(e);
+            }
+
+            return added;
+        }
+
+        @Override
+        public synchronized void clear() {
+            // make a temporary list, iterating while removing doesn't work
+            final List<Object> allItems = new ArrayList<>(proxied);
+            for (Object item : allItems) {
+                remove(item);
+            }
+        }
+
+        @Override
+        public synchronized boolean retainAll(final Collection<?> keepers) {
+            final List<Object> toRemoveList = new ArrayList<>();
+            for (Object iffy : proxied) {
+                if (!keepers.contains(iffy)) {
+                    toRemoveList.add(iffy);
                 }
             }
-            param = ((WriteableView) handler).getMasterView().createProxy(
-                    (Class<ConfigBeanProxy>) master.getImplementationClass());
-
-        }
-        PropertyChangeEvent evt = new PropertyChangeEvent(defaultView, id, null, param);
-        changeEvents.add(evt);
-
-        boolean added =  proxied.add(object);
-
-        try {
-            for (ConfigBeanInterceptor interceptor : bean.getOptionalFeatures()) {
-                interceptor.beforeChange(evt);
-            }
-        } catch(PropertyVetoException e) {
-            throw new RuntimeException(e);
+            return removeAll(toRemoveList);
         }
 
-        return added;
-    }
-
-    @Override
-    public synchronized void clear() {
-        // make a temporary list, iterating while removing doesn't work
-        final List allItems = new ArrayList( proxied );
-        for( final Object item : allItems ) {
-            remove( item );
-        }
-    }
-
-    @Override
-    public synchronized boolean retainAll( final Collection keepers ) {
-        final List toRemoveList = new ArrayList();
-        for( final Object iffy : proxied ) {
-            if ( ! keepers.contains(iffy) ) {
-                toRemoveList.add(iffy);
-            }
-        }
-        final boolean changed = removeAll(toRemoveList);
-
-        return changed;
-    }
-
-    @Override
-    public synchronized boolean removeAll( final Collection goners ) {
-        boolean listChanged = false;
-        for( final Object goner : goners ) {
-            if ( remove(goner) ) {
-                listChanged = true;
-            }
-        }
-
-        return listChanged;
-    }
-
-    @Override
-    public synchronized boolean remove(Object object) {
-        PropertyChangeEvent evt = new PropertyChangeEvent(defaultView, id, object, null);
-        boolean removed = false;
-
-        try {
-            ConfigView handler = ((ConfigView) Proxy.getInvocationHandler(object)).getMasterView();
-            for (int index = 0 ; index<proxied.size() && !removed; index++) {
-                Object target = proxied.get(index);
-                try {
-                    ConfigView targetHandler = ((ConfigView) Proxy.getInvocationHandler(target)).getMasterView();
-                    if (targetHandler==handler) {
-                        removed = (proxied.remove(index)!=null);
-                    }
-                } catch(IllegalArgumentException ex) {
-                    // ignore
+        @Override
+        public synchronized boolean removeAll(final Collection<?> goners) {
+            boolean listChanged = false;
+            for (Object goner : goners) {
+                if (remove(goner)) {
+                    listChanged = true;
                 }
             }
-        } catch(IllegalArgumentException e) {
-            // ignore, this is a leaf
-            removed = proxied.remove(object);
-
+            return listChanged;
         }
 
-        try {
-            for (ConfigBeanInterceptor interceptor : bean.getOptionalFeatures()) {
-                interceptor.beforeChange(evt);
+        @Override
+        public synchronized boolean remove(Object object) {
+            PropertyChangeEvent evt = new PropertyChangeEvent(defaultView, id, object, null);
+            boolean removed = false;
+            try {
+                ConfigView handler = ((ConfigView) Proxy.getInvocationHandler(object)).getMasterView();
+                for (int index = 0; index < proxied.size() && !removed; index++) {
+                    Object target = proxied.get(index);
+                    try {
+                        ConfigView targetHandler = ((ConfigView) Proxy.getInvocationHandler(target)).getMasterView();
+                        if (targetHandler == handler) {
+                            removed = (proxied.remove(index) != null);
+                        }
+                    } catch (IllegalArgumentException ex) {
+                        // ignore
+                    }
+                }
+            } catch (IllegalArgumentException e) {
+                // ignore, this is a leaf
+                removed = proxied.remove(object);
+
             }
-        } catch(PropertyVetoException e) {
-            throw new RuntimeException(e);
-        }
 
-        changeEvents.add(evt);
-
-        return removed;
-    }
-
-    public Object set(int index, Object object) {
-        Object replaced = proxied.set(index, object);
-        PropertyChangeEvent evt = new PropertyChangeEvent(defaultView, id, replaced, object);
-        try {
-            for (ConfigBeanInterceptor interceptor : bean.getOptionalFeatures()) {
-                interceptor.beforeChange(evt);
+            try {
+                for (ConfigBeanInterceptor<?> interceptor : bean.getOptionalFeatures()) {
+                    interceptor.beforeChange(evt);
+                }
+            } catch (PropertyVetoException e) {
+                throw new RuntimeException(e);
             }
-        } catch(PropertyVetoException e) {
-            throw new RuntimeException(e);
+
+            changeEvents.add(evt);
+
+            return removed;
         }
-        changeEvents.add(evt);
-        return replaced;
-    }}
+
+        @Override
+        public Object set(int index, Object object) {
+            Object replaced = proxied.set(index, object);
+            PropertyChangeEvent evt = new PropertyChangeEvent(defaultView, id, replaced, object);
+            try {
+                for (ConfigBeanInterceptor<?> interceptor : bean.getOptionalFeatures()) {
+                    interceptor.beforeChange(evt);
+                }
+            } catch (PropertyVetoException e) {
+                throw new RuntimeException(e);
+            }
+            changeEvents.add(evt);
+            return replaced;
+        }}
 
     private String toCamelCase(String xmlName) {
-        StringTokenizer st =  new StringTokenizer(xmlName, "-");
-        StringBuffer camelCaseName = null;
-        if (st.hasMoreTokens()) {
-            camelCaseName = new StringBuffer(st.nextToken());
+        if (xmlName == null) {
+            return null;
         }
-        StringBuffer sb = null;
+        StringTokenizer st = new StringTokenizer(xmlName, "-");
+        StringBuilder camelCaseName = new StringBuilder();
+        camelCaseName.append(st.nextToken());
         while (st.hasMoreTokens()) {
-            sb = new StringBuffer(st.nextToken());
+            StringBuilder sb = new StringBuilder(st.nextToken());
             char startChar = sb.charAt(0);
-            sb.setCharAt(0,Character.toUpperCase(startChar));
+            sb.setCharAt(0, Character.toUpperCase(startChar));
             camelCaseName.append(sb);
         }
-        return (camelCaseName == null) ? null : camelCaseName.toString();
+        return camelCaseName.toString();
     }
 
     private void handleValidation(ConfigModel.Property property, Object value)
-    throws ConstraintViolationException {
+        throws ConstraintViolationException {
 
         // First check for dataType constraints -- as was done for v3 Prelude
         // These validations could be transformed into BV custom annotations
         // such as AssertBoolean, AssertInteger etc. But since GUI and other
         // config clients such as AMX need dataType key in @Attribute it's been
         // decided to validate using existing annotation information
-        Set<ConstraintViolation<?>> constraintViolations = new HashSet<ConstraintViolation<?>>();
+        Set<ConstraintViolation<ConfigBeanProxy>> constraintViolations = new HashSet<>();
         if (property instanceof ConfigModel.AttributeLeaf) {
             ConfigModel.AttributeLeaf al = (ConfigModel.AttributeLeaf)property;
             if (!al.isReference()) {
-                ConstraintViolation cv = validateDataType(al, value.toString());
-                if (cv!=null) {
+                ConstraintViolation<ConfigBeanProxy> cv = validateDataType(al, value.toString());
+                if (cv != null) {
                     constraintViolations.add(cv);
                 }
             }
         }
 
-        constraintViolations.addAll(
-            beanValidator.validateValue(
-                bean.getProxyType(), toCamelCase(property.xmlName()), value));
+        constraintViolations
+            .addAll(beanValidator.validateValue(bean.getProxyType(), toCamelCase(property.xmlName()), value));
 
         handleValidationException(constraintViolations);
     }
 
-    private ConstraintViolation validateDataType(final ConfigModel.AttributeLeaf al, final String value)
-    {
-        if (value.startsWith("${") && value.endsWith("}"))
-          return null;
 
-        boolean isValid = String.class.getName().equals(al.dataType);
-        if ("int".equals(al.dataType) ||
-            "java.lang.Integer".equals(al.dataType))
+    private ConstraintViolation<ConfigBeanProxy> validateDataType(final AttributeLeaf leaf, final String value) {
+        if (value.startsWith("${") && value.endsWith("}")) {
+            return null;
+        }
+        boolean isValid = String.class.getName().equals(leaf.dataType);
+        if ("int".equals(leaf.dataType) || "java.lang.Integer".equals(leaf.dataType)) {
             isValid = representsInteger(value);
-        else if ("long".equals(al.dataType) ||
-                "java.lang.Long".equals(al.dataType))
+        } else if ("long".equals(leaf.dataType) || "java.lang.Long".equals(leaf.dataType)) {
             isValid = representsLong(value);
-        else if ("boolean".equals(al.dataType) ||
-                 "java.lang.Boolean".endsWith(al.dataType))
+        } else if ("boolean".equals(leaf.dataType) || "java.lang.Boolean".endsWith(leaf.dataType)) {
             isValid = representsBoolean(value);
-        else if ("char".equals(al.dataType) ||
-                 "java.lang.Character".equals(al.dataType))
+        } else if ("char".equals(leaf.dataType) || "java.lang.Character".equals(leaf.dataType)) {
             isValid = representsChar(value);
+        }
         if (!isValid) {
-            return new ConstraintViolation() {
-                @Override
-                public String getMessage() {
-                    return i18n.getString("bean.validation.dataType.failure") + al.dataType;
-                }
-
-                @Override
-                public String getMessageTemplate() {
-                    return null;
-                }
-
-                @Override
-                public Object getRootBean() {
-                    return WriteableView.this;
-                }
-
-                @Override
-                public Class getRootBeanClass() {
-                    return WriteableView.this.getProxyType();
-                }
-
-                @Override
-                public Object getLeafBean() {
-                    return null;
-                }
-
-                @Override
-                public Object[] getExecutableParameters() {
-                    return null;
-                }
-
-                @Override
-                public Object getExecutableReturnValue() {
-                    return null;
-                }
-
-                @Override
-                public Path getPropertyPath() {
-                    final Set<Path.Node> nodes = new HashSet<Path.Node>();
-                    nodes.add(new Path.Node() {
-                        @Override
-                        public String getName() {
-                            return al.xmlName;
-                        }
-
-                        @Override
-                        public boolean isInIterable() {
-                            return false;
-                        }
-
-                        @Override
-                        public Integer getIndex() {
-                            return null;
-                        }
-
-                        @Override
-                        public Object getKey() {
-                            return null;
-                        }
-
-                        @Override
-                        public ElementKind getKind() {
-                            return null;
-                        }
-
-                        @Override
-                        public <T extends Path.Node> T as(Class<T> tClass) {
-                            return null;
-                        }
-                    });
-                    return new jakarta.validation.Path() {
-                        @Override
-                        public Iterator<Node> iterator() {
-                            return nodes.iterator();
-                        }
-
-                        @Override
-                        public String toString() {
-                           return nodes.iterator().next().getName();
-                        }
-                    };
-                }
-
-                @Override
-                public Object getInvalidValue() {
-                    return value;
-                }
-
-                @Override
-                public ConstraintDescriptor<?> getConstraintDescriptor() {
-                    return null;
-                }
-
-                @Override
-                public Object unwrap(Class type) {
-                    return null;
-                }
-
-
-            };
-        };
+            return new WriteableViewConstraintViolation(leaf, value);
+        }
         return null;
     }
 
     private boolean representsBoolean(String value) {
-        boolean isBoolean =
-           "true".equalsIgnoreCase(value) || "false".equalsIgnoreCase(value);
-        return (isBoolean);
+        return "true".equalsIgnoreCase(value) || "false".equalsIgnoreCase(value);
     }
 
     private boolean representsChar(String value) {
-            if (value.length() == 1)
-                return true;
-            return false;
+        if (value.length() == 1) {
+            return true;
+        }
+        return false;
     }
 
     private boolean representsInteger(String value) {
         try {
             Integer.parseInt(value);
             return true;
-        } catch(NumberFormatException ne) {
+        } catch (NumberFormatException ne) {
             return false;
         }
     }
@@ -922,12 +945,12 @@
         try {
             Long.parseLong(value);
             return true;
-        } catch(NumberFormatException ne) {
+        } catch (NumberFormatException ne) {
             return false;
         }
     }
 
-    private final static ParameterizedType parameterizedType = new ParameterizedType() {
+    private static final ParameterizedType parameterizedType = new ParameterizedType() {
 
         @Override
         public Type[] getActualTypeArguments() {