Code cleanup removing potential issues detected by FindBugs
| | |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2009 Parametric Technology Corporation (PTC) |
| | | * Portions Copyright 2011 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.admin.ads.util; |
| | |
| | | boolean hostMatch = h1.length == h2.length; |
| | | for (int i=0; i<h1.length && hostMatch; i++) |
| | | { |
| | | if (!h1[i].equals("*") && !h2.equals("*")) |
| | | if (!h1[i].equals("*") && !h2[i].equals("*")) |
| | | { |
| | | hostMatch = h1[i].equalsIgnoreCase(h2[i]); |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.datamodel; |
| | |
| | | } |
| | | if (returnValue == 0) |
| | | { |
| | | getBackend().getBackendID().compareTo( |
| | | returnValue = getBackend().getBackendID().compareTo( |
| | | desc.getBackend().getBackendID()); |
| | | } |
| | | if (returnValue == 0) |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui; |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public boolean requiresBorder() |
| | | { |
| | | return false; |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public boolean requiresScroll() |
| | | { |
| | | return false; |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public boolean callConfigurationChangedInBackground() |
| | | { |
| | | return true; |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public void setInfo(ControlPanelInfo info) |
| | | { |
| | | if (controller == null) |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public final GenericDialog.ButtonType getButtonType() |
| | | { |
| | | return GenericDialog.ButtonType.NO_BUTTON; |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public void toBeDisplayed(boolean visible) |
| | | { |
| | | super.toBeDisplayed(visible); |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | protected void setEnabledOK(boolean enable) |
| | | { |
| | | okButton.setEnabled(enable); |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | protected void setEnabledCancel(boolean enable) |
| | | { |
| | | cancelButton.setEnabled(enable); |
| | |
| | | INFO_CTRL_PANEL_SUBSTRING_SEARCH_INLINE_HELP.get().toString()); |
| | | filter.addKeyListener(new KeyAdapter() |
| | | { |
| | | @Override |
| | | public void keyReleased(KeyEvent e) |
| | | { |
| | | if ((e.getKeyCode() == KeyEvent.VK_ENTER) && applyButton.isEnabled()) |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public void cancelClicked() |
| | | { |
| | | setPrimaryValid(lBaseDN); |
| | |
| | | le.getMessageObject().toString())); |
| | | setPrimaryInvalid(lFilter); |
| | | } |
| | | if (errors.size() == 0) |
| | | if (errors.isEmpty()) |
| | | { |
| | | lLimit.setVisible(false); |
| | | lNumberOfEntries.setVisible(true); |
| | |
| | | { |
| | | String backendID = backend.getBackendID(); |
| | | backendIDs.add(backendID); |
| | | SortedSet<String> baseDNs = new TreeSet<String>(); |
| | | SortedSet<String> someBaseDNs = new TreeSet<String>(); |
| | | for (BaseDNDescriptor baseDN : backend.getBaseDns()) |
| | | { |
| | | try |
| | | { |
| | | baseDNs.add(Utilities.unescapeUtf8(baseDN.getDn().toString())); |
| | | someBaseDNs.add(Utilities.unescapeUtf8(baseDN.getDn().toString())); |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | |
| | | Utilities.unescapeUtf8(baseDN.getDn().toString()), baseDN); |
| | | } |
| | | } |
| | | hmBaseDNs.put(backendID, baseDNs); |
| | | hmBaseDNs.put(backendID, someBaseDNs); |
| | | if (backendID.equalsIgnoreCase("userRoot")) |
| | | { |
| | | for (String baseDN : baseDNs) |
| | | for (String baseDN : someBaseDNs) |
| | | { |
| | | baseDNWithEntries = hmBaseDNWithEntries.get(baseDN); |
| | | if (baseDNWithEntries != null) |
| | |
| | | { |
| | | baseDNNewElements.add(new CategorizedComboBoxElement(backendID, |
| | | CategorizedComboBoxElement.Type.CATEGORY)); |
| | | SortedSet<String> baseDNs = hmBaseDNs.get(backendID); |
| | | for (String baseDN : baseDNs) |
| | | SortedSet<String> someBaseDNs = hmBaseDNs.get(backendID); |
| | | for (String baseDN : someBaseDNs) |
| | | { |
| | | baseDNNewElements.add(new CategorizedComboBoxElement(baseDN, |
| | | CategorizedComboBoxElement.Type.REGULAR)); |
| | |
| | | { |
| | | dn = ALL_BASE_DNS; |
| | | } |
| | | else if (OTHER_BASE_DN.equals(dn)) |
| | | { |
| | | dn = null; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | dn = null; |
| | | // The following is never true. OTHER_BASE_DN is a Message |
| | | // Comment out buggy code |
| | | // else if (OTHER_BASE_DN.equals(dn)) |
| | | // { |
| | | // dn = null; |
| | | // } |
| | | } |
| | | return dn; |
| | | } |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public Component getListCellRendererComponent(JList list, Object value, |
| | | int index, boolean isSelected, boolean cellHasFocus) |
| | | { |
| | |
| | | /** |
| | | * Executes the updater. |
| | | */ |
| | | @Override |
| | | public void run() |
| | | { |
| | | while (true) |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui; |
| | |
| | | Component[][] comps = {{parent, aliases, origin, file}, |
| | | {usage, singleValued, nonModifiable, collective, obsolete}, |
| | | {approximate, equality, ordering, substring}}; |
| | | JLabel[][] labels = {{lSuperior, lAliases, lOrigin, lFile}, |
| | | JLabel[][] someLabels = {{lSuperior, lAliases, lOrigin, lFile}, |
| | | {lUsage, lType, null, null, null}, |
| | | {lApproximate, lEquality, lOrdering, lSubstring}}; |
| | | JLabel[][] inlineHelps = {{null, |
| | |
| | | gbc1.fill = GridBagConstraints.HORIZONTAL; |
| | | gbc1.gridy = 0; |
| | | |
| | | add(labels[i], comps[i], inlineHelps[i], p, gbc1); |
| | | add(someLabels[i], comps[i], inlineHelps[i], p, gbc1); |
| | | final BasicExpander expander = expanders[i]; |
| | | ChangeListener changeListener = new ChangeListener() |
| | | { |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public void mouseClicked(MouseEvent ev) |
| | | { |
| | | if (ev.getClickCount() == 1) |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public void keyTyped(KeyEvent ev) |
| | | { |
| | | if ((ev.getKeyChar() == KeyEvent.VK_SPACE) || |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public boolean mustCheckUnsavedChanges() |
| | | { |
| | | return saveChanges.isEnabled(); |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public UnsavedChangesDialog.Result checkUnsavedChanges() |
| | | { |
| | | UnsavedChangesDialog.Result result; |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public boolean requiresScroll() |
| | | { |
| | | return false; |
| | |
| | | { |
| | | parent.setSelectedItem(superior); |
| | | } |
| | | Set<String> aliases = getAliases(attr); |
| | | Set<String> someAliases = getAliases(attr); |
| | | lastAliases.clear(); |
| | | lastAliases.addAll(aliases); |
| | | this.aliases.setText(Utilities.getStringFromCollection(aliases, ", ")); |
| | | lastAliases.addAll(someAliases); |
| | | this.aliases.setText(Utilities.getStringFromCollection(someAliases, ", ")); |
| | | |
| | | String sOrigin = Utilities.getOrigin(attr); |
| | | if (sOrigin == null) |
| | |
| | | { |
| | | errors.add(ERR_CTRL_PANEL_SCHEMA_NOT_FOUND_DETAILS.get()); |
| | | } |
| | | if (errors.size() == 0) |
| | | if (errors.isEmpty()) |
| | | { |
| | | MessageBuilder mb = new MessageBuilder(); |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | Collection<String> aliases = getAliases(); |
| | | Collection<String> someAliases = getAliases(); |
| | | Collection<String> oldAliases = getAliases(attribute); |
| | | |
| | | if (!aliases.equals(oldAliases)) |
| | | if (!someAliases.equals(oldAliases)) |
| | | { |
| | | for (String alias : aliases) |
| | | for (String alias : someAliases) |
| | | { |
| | | if (alias.trim().length() == 0) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | if (errors.size() == 0) |
| | | if (errors.isEmpty()) |
| | | { |
| | | ProgressDialog dlg = new ProgressDialog( |
| | | Utilities.createFrame(), |
| | |
| | | { |
| | | task.canLaunch(newTask, errors); |
| | | } |
| | | if (errors.size() == 0) |
| | | if (errors.isEmpty()) |
| | | { |
| | | launchOperation(newTask, |
| | | INFO_CTRL_PANEL_MODIFYING_ATTRIBUTE_SUMMARY.get(attrName), |
| | |
| | | * |
| | | * |
| | | * Copyright 2009-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui; |
| | |
| | | errors.add(INFO_NOT_A_DIRECTORY_MANAGER_DN.get()); |
| | | } |
| | | |
| | | if ("".equals(pwd.getPassword().length == 0)) |
| | | if (pwd.getPassword().length == 0) |
| | | { |
| | | pwdInvalid = true; |
| | | errors.add(INFO_EMPTY_PWD.get()); |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui; |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public void toBeDisplayed(boolean visible) |
| | | { |
| | | super.toBeDisplayed(visible); |
| | |
| | | errors.add(INFO_NOT_A_DIRECTORY_MANAGER_DN.get()); |
| | | } |
| | | |
| | | if ("".equals(pwd.getPassword().length == 0)) |
| | | if (pwd.getPassword().length == 0) |
| | | { |
| | | pwdInvalid = true; |
| | | errors.add(INFO_EMPTY_PWD.get()); |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public void cancelClicked() |
| | | { |
| | | setPrimaryValid(dnLabel); |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui; |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public GenericDialog.ButtonType getButtonType() |
| | | { |
| | | return GenericDialog.ButtonType.NO_BUTTON; |
| | |
| | | getObfuscatedCommandLineArguments(getDSConfigCommandLineArguments()); |
| | | for (String arg : args) |
| | | { |
| | | sb.append(" "+CommandBuilder.escapeValue(arg)); |
| | | sb.append(" "); |
| | | sb.append(CommandBuilder.escapeValue(arg)); |
| | | } |
| | | |
| | | ManagementContext mCtx = LDAPManagementContext.createFromContext( |
| | |
| | | { |
| | | index.setScope(scope); |
| | | } |
| | | if (!indexToModify.getScope().equals(sortOrder)) |
| | | if (!indexToModify.getSortOrder().equals(sortOrder)) |
| | | { |
| | | index.setSortOrder(sortOrderStringValue); |
| | | } |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public void postOperation() |
| | | { |
| | | if ((lastException == null) && (state == State.FINISHED_SUCCESSFULLY)) |
| | |
| | | args.add("filter:"+filterValue); |
| | | } |
| | | |
| | | if (!indexToModify.getScope().equals(sortOrder)) |
| | | if (!indexToModify.getSortOrder().equals(sortOrder)) |
| | | { |
| | | args.add("--set"); |
| | | args.add("sort-order:"+sortOrderStringValue); |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011 ForgeRock AS |
| | | */ |
| | | package org.opends.quicksetup.installer; |
| | | |
| | |
| | | String sPort = qs.getFieldStringValue(FieldName.REMOTE_SERVER_PORT); |
| | | checkRemoteHostPortDnAndPwd(host, sPort, dn, pwd, qs, errorMsgs); |
| | | |
| | | if (errorMsgs.size() == 0) |
| | | if (errorMsgs.isEmpty()) |
| | | { |
| | | port = Integer.parseInt(sPort); |
| | | // Try to connect |
| | |
| | | type); |
| | | } |
| | | |
| | | if (errorMsgs.size() == 0) |
| | | if (errorMsgs.isEmpty()) |
| | | { |
| | | AuthenticationData auth = new AuthenticationData(); |
| | | auth.setHostName(host); |
| | |
| | | SuffixesToReplicateOptions.Type.REPLICATE_WITH_EXISTING_SUFFIXES) |
| | | { |
| | | Set<?> s = (Set<?>)qs.getFieldValue(FieldName.SUFFIXES_TO_REPLICATE); |
| | | if (s.size() == 0) |
| | | if (s.isEmpty()) |
| | | { |
| | | errorMsgs.add(INFO_NO_SUFFIXES_CHOSEN_TO_REPLICATE.get()); |
| | | qs.displayFieldInvalid(FieldName.SUFFIXES_TO_REPLICATE, true); |
| | |
| | | lastLoadedCache.setPreferredConnections(cnx); |
| | | lastLoadedCache.reloadTopology(); |
| | | Set<SuffixDescriptor> suffixes = lastLoadedCache.getSuffixes(); |
| | | |
| | | Set<SuffixDescriptor> moreSuffixes = null; |
| | | if (suf != null) |
| | | { |
| | | moreSuffixes = suf.getSuffixes(); |
| | | } |
| | | getUserData().setSuffixesToReplicateOptions( |
| | | new SuffixesToReplicateOptions(type, suffixes, suf.getSuffixes())); |
| | | new SuffixesToReplicateOptions(type, suffixes, moreSuffixes)); |
| | | |
| | | /* Analyze if we had any exception while loading servers. For the moment |
| | | * only throw the exception found if the user did not provide the |
| | |
| | | { |
| | | suffixes.add(replica.getSuffix()); |
| | | } |
| | | Set<SuffixDescriptor> moreSuffixes = null; |
| | | if (suf != null){ |
| | | moreSuffixes = suf.getSuffixes(); |
| | | } |
| | | getUserData().setSuffixesToReplicateOptions( |
| | | new SuffixesToReplicateOptions(type, suffixes, suf.getSuffixes())); |
| | | new SuffixesToReplicateOptions(type, suffixes, moreSuffixes)); |
| | | } |
| | | |
| | | /** |