mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Jean-Noel Rouvignac
18.30.2015 964b90734f60e5622596e08e6e0c6ae3226ad37d
AutoRefactor'ed use multi-catch
10 files modified
76 ■■■■ changed files
opendj-config/src/main/java/org/forgerock/opendj/config/AggregationPropertyDefinition.java 8 ●●●● patch | view | raw | blame | history
opendj-config/src/main/java/org/forgerock/opendj/config/ClassPropertyDefinition.java 7 ●●●● patch | view | raw | blame | history
opendj-config/src/main/java/org/forgerock/opendj/config/client/spi/Driver.java 17 ●●●● patch | view | raw | blame | history
opendj-config/src/main/java/org/forgerock/opendj/config/dsconfig/CreateSubCommandHandler.java 4 ●●● patch | view | raw | blame | history
opendj-config/src/main/java/org/forgerock/opendj/config/dsconfig/DSConfig.java 5 ●●●● patch | view | raw | blame | history
opendj-config/src/main/java/org/forgerock/opendj/config/dsconfig/SubCommandHandler.java 8 ●●●● patch | view | raw | blame | history
opendj-config/src/main/java/org/forgerock/opendj/config/server/ServerManagementContext.java 5 ●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/ServerSideSortResponseControl.java 12 ●●●● patch | view | raw | blame | history
opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDIFSearch.java 5 ●●●● patch | view | raw | blame | history
opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/Rest2LDAP.java 5 ●●●● patch | view | raw | blame | history
opendj-config/src/main/java/org/forgerock/opendj/config/AggregationPropertyDefinition.java
@@ -502,13 +502,7 @@
                ManagedObject<?> ref;
                try {
                    ref = context.getManagedObject(path);
                } catch (DefinitionDecodingException e) {
                    LocalizableMessage msg =
                        ERR_CLIENT_REFINT_TARGET_INVALID.get(ufn, name, getName(), e.getMessageObject());
                    unacceptableReasons.add(msg);
                    isAcceptable = false;
                    continue;
                } catch (ManagedObjectDecodingException e) {
                } catch (DefinitionDecodingException | ManagedObjectDecodingException e) {
                    LocalizableMessage msg =
                        ERR_CLIENT_REFINT_TARGET_INVALID.get(ufn, name, getName(), e.getMessageObject());
                    unacceptableReasons.add(msg);
opendj-config/src/main/java/org/forgerock/opendj/config/ClassPropertyDefinition.java
@@ -245,11 +245,8 @@
    private Class<?> loadClassForValidation(String componentClassName, String classToBeLoaded, boolean initialize) {
        try {
            return loadClass(classToBeLoaded.trim(), initialize);
        } catch (ClassNotFoundException e) {
            // If the class cannot be loaded then it is an invalid value.
            throw PropertyException.illegalPropertyValueException(this, componentClassName, e);
        } catch (LinkageError e) {
            // If the class cannot be initialized then it is an invalid value.
        } catch (ClassNotFoundException | LinkageError e) {
            // If the class cannot be loaded / initialized then it is an invalid value.
            throw PropertyException.illegalPropertyValueException(this, componentClassName, e);
        }
    }
opendj-config/src/main/java/org/forgerock/opendj/config/client/spi/Driver.java
@@ -202,10 +202,7 @@
                    // definition of the component being created.
                    PropertyDefinition<?> pdTmp = definition.getPropertyDefinition(propertyName);
                    pd2 = pd1.getClass().cast(pdTmp);
                } catch (IllegalArgumentException e) {
                    throw new PropertyNotFoundException(propertyName);
                } catch (ClassCastException e) {
                    // FIXME: would be nice to throw a better exception here.
                } catch (IllegalArgumentException | ClassCastException e) {
                    throw new PropertyNotFoundException(propertyName);
                }
@@ -227,16 +224,8 @@
                    // inherits its defaults from the newly created managed object.
                    return getPropertyValues(target, pd2);
                }
            } catch (PropertyException e) {
                // Wrap any errors due to recursion.
                throw PropertyException.defaultBehaviorException(pd1, e);
            } catch (DefinitionDecodingException e) {
                throw PropertyException.defaultBehaviorException(pd1, e);
            } catch (PropertyNotFoundException e) {
                throw PropertyException.defaultBehaviorException(pd1, e);
            } catch (LdapException e) {
                throw PropertyException.defaultBehaviorException(pd1, e);
            } catch (ManagedObjectNotFoundException e) {
            } catch (PropertyException | DefinitionDecodingException | PropertyNotFoundException
                    | LdapException | ManagedObjectNotFoundException e) {
                throw PropertyException.defaultBehaviorException(pd1, e);
            }
        }
opendj-config/src/main/java/org/forgerock/opendj/config/dsconfig/CreateSubCommandHandler.java
@@ -749,9 +749,7 @@
                        LocalizableMessage msg = ERR_DSCFG_ERROR_CREATE_CE.get(irelation.getUserFriendlyName(),
                                e.getMessage());
                        throw new ClientException(ReturnCode.APPLICATION_ERROR, msg);
                    } catch (DefinitionDecodingException e) {
                        // Do nothing.
                    } catch (ManagedObjectDecodingException e) {
                    } catch (DefinitionDecodingException | ManagedObjectDecodingException e) {
                        // Do nothing.
                    } catch (ManagedObjectNotFoundException e) {
                        // The child does not already exist so this name is ok.
opendj-config/src/main/java/org/forgerock/opendj/config/dsconfig/DSConfig.java
@@ -1238,10 +1238,7 @@
        try {
            // Force retrieval of management context.
            factory.getManagementContext(app);
        } catch (ArgumentException e) {
            app.errPrintln(e.getMessageObject());
            return ReturnCode.ERROR_UNEXPECTED.get();
        } catch (ClientException e) {
        } catch (ArgumentException | ClientException e) {
            app.errPrintln(e.getMessageObject());
            return ReturnCode.ERROR_UNEXPECTED.get();
        }
opendj-config/src/main/java/org/forgerock/opendj/config/dsconfig/SubCommandHandler.java
@@ -977,17 +977,11 @@
                    // For sets the RDN is the type string, the ufn is more friendly.
                    children.put(cd.getUserFriendlyName().toString(), childName);
                }
            } catch (DefinitionDecodingException e) {
                // Add it anyway: maybe the user is trying to fix the problem.
                children.put(childName, childName);
            } catch (ManagedObjectDecodingException e) {
            } catch (DefinitionDecodingException | ManagedObjectDecodingException | LdapException e) {
                // Add it anyway: maybe the user is trying to fix the problem.
                children.put(childName, childName);
            } catch (ManagedObjectNotFoundException e) {
                // Skip it - the managed object has been concurrently removed.
            } catch (LdapException e) {
                // Add it anyway: maybe the user is trying to fix the problem.
                children.put(childName, childName);
            }
        }
opendj-config/src/main/java/org/forgerock/opendj/config/server/ServerManagementContext.java
@@ -217,10 +217,7 @@
                try {
                    PropertyDefinition<?> propDefTmp = mod.getPropertyDefinition(propertyName);
                    propDef2 = propDef1.getClass().cast(propDefTmp);
                } catch (IllegalArgumentException e) {
                    throw new PropertyNotFoundException(propertyName);
                } catch (ClassCastException e) {
                    // FIXME: would be nice to throw a better exception here.
                } catch (IllegalArgumentException | ClassCastException e) {
                    throw new PropertyNotFoundException(propertyName);
                }
opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/ServerSideSortResponseControl.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions copyright 2012 ForgeRock AS.
 *      Portions copyright 2012-2015 ForgeRock AS.
 */
package org.forgerock.opendj.ldap.controls;
@@ -133,15 +133,9 @@
                        return new ServerSideSortResponseControl(control.isCritical(), result,
                                attributeDescription);
                    } catch (final IOException e) {
                    } catch (final IOException | LocalizedIllegalArgumentException e) {
                        final LocalizableMessage message =
                                INFO_SORTRES_CONTROL_CANNOT_DECODE_VALUE
                                        .get(getExceptionMessage(e));
                        throw DecodeException.error(message, e);
                    } catch (final LocalizedIllegalArgumentException e) {
                        final LocalizableMessage message =
                                INFO_SORTRES_CONTROL_CANNOT_DECODE_VALUE
                                        .get(getExceptionMessage(e));
                                INFO_SORTRES_CONTROL_CANNOT_DECODE_VALUE.get(getExceptionMessage(e));
                        throw DecodeException.error(message, e);
                    }
                }
opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDIFSearch.java
@@ -237,10 +237,7 @@
                            attributes.toArray(new String[attributes.size()])).setTypesOnly(
                            typesOnly.isPresent()).setTimeLimit(timeLimit.getIntValue())
                            .setSizeLimit(sizeLimit.getIntValue());
        } catch (final ArgumentException e) {
            errPrintln(e.getMessageObject());
            return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
        } catch (final LocalizedIllegalArgumentException e) {
        } catch (final ArgumentException | LocalizedIllegalArgumentException e) {
            errPrintln(e.getMessageObject());
            return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
        }
opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/Rest2LDAP.java
@@ -1052,10 +1052,7 @@
                }
                options.setSSLContext(builder.getSSLContext());
                options.setUseStartTLS(connectionSecurity == ConnectionSecurity.STARTTLS);
            } catch (GeneralSecurityException e) {
                // Rethrow as unchecked exception.
                throw new IllegalArgumentException(e);
            } catch (IOException e) {
            } catch (GeneralSecurityException | IOException e) {
                // Rethrow as unchecked exception.
                throw new IllegalArgumentException(e);
            }