Fix CodeQL note-severity alerts: deprecated JDK calls and inefficient expressions (#823)
| | |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2014-2016 ForgeRock AS. |
| | | * Portions Copyright 2026 3A Systems, LLC. |
| | | */ |
| | | package com.forgerock.opendj.cli; |
| | | |
| | |
| | | |
| | | for (final X509Certificate aChain : chain) { |
| | | try { |
| | | final String alias = aChain.getSubjectDN().getName(); |
| | | final String alias = aChain.getSubjectX500Principal().getName(); |
| | | inMemoryTrustStore.setCertificateEntry(alias, aChain); |
| | | if (permanent) { |
| | | onDiskTrustStore.setCertificateEntry(alias, aChain); |
| | |
| | | for (final X509Certificate element : chain) { |
| | | // Certificate DN |
| | | app.println(INFO_LDAP_CONN_SECURITY_SERVER_CERTIFICATE_USER_DN.get(element |
| | | .getSubjectDN().toString())); |
| | | .getSubjectX500Principal().toString())); |
| | | |
| | | // certificate validity |
| | | app.println(INFO_LDAP_CONN_SECURITY_SERVER_CERTIFICATE_VALIDITY.get(element |
| | | .getNotBefore().toString(), element.getNotAfter().toString())); |
| | | |
| | | // certificate Issuer |
| | | app.println(INFO_LDAP_CONN_SECURITY_SERVER_CERTIFICATE_ISSUER.get(element.getIssuerDN() |
| | | app.println(INFO_LDAP_CONN_SECURITY_SERVER_CERTIFICATE_ISSUER.get(element.getIssuerX500Principal() |
| | | .toString())); |
| | | |
| | | app.println(); |
| | |
| | | String command = ""; |
| | | String line; |
| | | while ((line = bReader.readLine()) != null) { |
| | | if ("".equals(line) || line.startsWith("#")) { |
| | | if (line.isEmpty() || line.startsWith("#")) { |
| | | // Empty line or comment |
| | | continue; |
| | | } |
| | |
| | | * |
| | | * Copyright 2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2012-2016 ForgeRock AS. |
| | | * Portions Copyright 2026 3A Systems, LLC. |
| | | */ |
| | | package org.forgerock.opendj.ldap; |
| | | |
| | |
| | | } catch (final CertificateExpiredException e) { |
| | | logger.warn(LocalizableMessage.raw( |
| | | "Refusing to trust security certificate \'%s\' because it expired on %s", |
| | | c.getSubjectDN().getName(), c.getNotAfter())); |
| | | c.getSubjectX500Principal().getName(), c.getNotAfter())); |
| | | throw e; |
| | | } catch (final CertificateNotYetValidException e) { |
| | | logger.warn(LocalizableMessage.raw( |
| | | "Refusing to trust security certificate \'%s\' because it is not valid until %s", |
| | | c.getSubjectDN().getName(), c.getNotBefore())); |
| | | c.getSubjectX500Principal().getName(), c.getNotBefore())); |
| | | throw e; |
| | | } |
| | | } |
| | |
| | | public static String toLDIF(final ChangeRecord change) { |
| | | try (final StringWriter writer = new StringWriter(); |
| | | final LDIFChangeRecordWriter ldifWriter = new LDIFChangeRecordWriter(writer)) { |
| | | ldifWriter.writeChangeRecord(change).toString(); |
| | | ldifWriter.writeChangeRecord(change); |
| | | ldifWriter.flush(); |
| | | return writer.toString(); |
| | | } catch (IOException e) { |
| | |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013-2016 ForgeRock AS. |
| | | * Portions Copyright 2026 3A Systems, LLC. |
| | | */ |
| | | package org.forgerock.opendj.ldif; |
| | | |
| | | import static com.forgerock.opendj.ldap.CoreMessages.*; |
| | | import static com.forgerock.opendj.util.StaticUtils.getExceptionMessage; |
| | | |
| | | import java.io.BufferedReader; |
| | | import java.io.File; |
| | |
| | | |
| | | for (final Class<?> c : defaultTagClasses) { |
| | | try { |
| | | final TemplateTag t = (TemplateTag) c.newInstance(); |
| | | final TemplateTag t = (TemplateTag) c.getDeclaredConstructor().newInstance(); |
| | | registeredTags.put(t.getName().toLowerCase(), t); |
| | | } catch (Exception e) { |
| | | // this is a programming error |
| | |
| | | |
| | | TemplateTag tag; |
| | | try { |
| | | tag = (TemplateTag) tagClass.newInstance(); |
| | | tag = (TemplateTag) tagClass.getDeclaredConstructor().newInstance(); |
| | | } catch (Exception e) { |
| | | final LocalizableMessage message = ERR_ENTRY_GENERATOR_CANNOT_INSTANTIATE_TAG.get(className); |
| | | throw DecodeException.fatalError(message, e); |
| | |
| | | |
| | | TemplateTag newTag; |
| | | try { |
| | | newTag = tag.getClass().newInstance(); |
| | | newTag = tag.getClass().getDeclaredConstructor().newInstance(); |
| | | } catch (Exception e) { |
| | | throw DecodeException.fatalError(ERR_ENTRY_GENERATOR_CANNOT_INSTANTIATE_NEW_TAG.get( |
| | | tagName, lineNumber + 1, String.valueOf(e)), e); |
| | | tagName, lineNumber + 1, getExceptionMessage(e)), e); |
| | | } |
| | | |
| | | if (branch == null) { |
| | |
| | | } |
| | | |
| | | OpenDJProvider(final KeyStoreParameters defaultConfig) { |
| | | super("OpenDJ", 1.0D, "OpenDJ LDAP security provider"); |
| | | super("OpenDJ", "1.0", "OpenDJ LDAP security provider"); |
| | | this.defaultConfig = defaultConfig; |
| | | AccessController.doPrivileged(new PrivilegedAction<Void>() { |
| | | @Override |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2012-2016 ForgeRock AS. |
| | | * Portions Copyright 2026 3A Systems, LLC. |
| | | */ |
| | | package org.forgerock.opendj.rest2ldap; |
| | | |
| | |
| | | } |
| | | |
| | | final String description = attrType.getDescription(); |
| | | if (description != null && !"".equals(description)) { |
| | | if (description != null && !description.isEmpty()) { |
| | | jsonSchema.put("title", description); |
| | | } |
| | | putWritabilityProperties(jsonSchema); |
| | |
| | | case START_OBJECT: |
| | | final TreeMap<String, ByteSequence> normalizedObject = new TreeMap<>(); |
| | | while (parser.nextToken() != END_OBJECT) { |
| | | final String key = parser.getCurrentName(); |
| | | final String key = parser.currentName(); |
| | | final ByteStringBuilder value = new ByteStringBuilder(); |
| | | normalizeJsonValue(parser, parser.nextToken(), value); |
| | | normalizedObject.put(key, value); |
| | |
| | | break; |
| | | case FIELD_NAME: |
| | | // Normalize for the pathological case where a field name happens to be a number. |
| | | jsonPointer = parentJsonPointer.child(parser.getCurrentName()); |
| | | jsonPointer = parentJsonPointer.child(parser.currentName()); |
| | | normalizedJsonPointer = normalizeJsonPointer(jsonPointer); |
| | | break; |
| | | case VALUE_NULL: |
| | |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2015-2016 ForgeRock AS. |
| | | * Portions Copyright 2026 3A Systems, LLC. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.event; |
| | |
| | | int x = event.getPoint().x - rect.x; |
| | | int y = event.getPoint().y - rect.y; |
| | | MouseEvent tEv = new MouseEvent(table, event.getID(), |
| | | event.getWhen(), event.getModifiers(), x, y, |
| | | event.getWhen(), event.getModifiersEx(), x, y, |
| | | event.getClickCount(), event.isPopupTrigger(), event.getButton()); |
| | | toolTipText = ((JComponent)comp).getToolTipText(tEv); |
| | | } |
| | |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2015-2016 ForgeRock AS. |
| | | * Portions Copyright 2026 3A Systems, LLC. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.event; |
| | |
| | | @Override |
| | | public void focusGained(FocusEvent e) |
| | | { |
| | | if (tf.getText() == null || "".equals(tf.getText())) |
| | | if (tf.getText() == null || tf.getText().isEmpty()) |
| | | { |
| | | tf.setText(" "); |
| | | tf.selectAll(); |
| | |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | * Portions Copyright 2026 3A Systems, LLC. |
| | | */ |
| | | package org.opends.guitools.controlpanel.ui; |
| | | |
| | |
| | | } |
| | | |
| | | String f = filter.getText().trim(); |
| | | if ("".equals(f)) |
| | | if (f.isEmpty()) |
| | | { |
| | | errors.add(ERR_CTRL_PANEL_NO_FILTER_FOR_VLV_PROVIDED.get()); |
| | | setPrimaryInvalid(lFilter); |
| | |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | * Portions Copyright 2026 3A Systems, LLC. |
| | | */ |
| | | package org.opends.guitools.controlpanel.ui; |
| | | |
| | |
| | | } |
| | | |
| | | String parentPath = parentDirectory.getText(); |
| | | if (parentPath == null || parentPath.trim().equals("")) |
| | | if (parentPath == null || parentPath.trim().isEmpty()) |
| | | { |
| | | errors.add(ERR_CTRL_PANEL_NO_BACKUP_PATH_PROVIDED.get()); |
| | | setPrimaryInvalid(lPath); |
| | |
| | | } |
| | | } |
| | | String dir = backupID.getText(); |
| | | if (dir == null || dir.trim().equals("")) |
| | | if (dir == null || dir.trim().isEmpty()) |
| | | { |
| | | errors.add(ERR_CTRL_PANEL_NO_BACKUP_ID_PROVIDED.get()); |
| | | setPrimaryInvalid(lBackupID); |
| | |
| | | else |
| | | { |
| | | String parentID = parentBackupID.getText(); |
| | | if (parentID == null || parentID.trim().equals("")) |
| | | if (parentID == null || parentID.trim().isEmpty()) |
| | | { |
| | | errors.add(ERR_CTRL_PANEL_NO_PARENT_BACKUP_ID_PROVIDED.get()); |
| | | setPrimaryInvalid(lParentID); |
| | |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | * Portions Copyright 2026 3A Systems, LLC. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui; |
| | |
| | | setPrimaryValid(dnLabel); |
| | | LinkedHashSet<LocalizableMessage> errors = new LinkedHashSet<>(); |
| | | |
| | | if ("".equals(dn.getText().trim())) |
| | | if (dn.getText().trim().isEmpty()) |
| | | { |
| | | errors.add(ERR_CTRL_PANEL_NO_BASE_DN_PROVIDED.get()); |
| | | } |
| | |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | * Portions Copyright 2026 3A Systems, LLC. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui; |
| | |
| | | import java.util.Collection; |
| | | import java.util.HashSet; |
| | | import java.util.LinkedHashSet; |
| | | import java.util.List; |
| | | import java.util.SortedSet; |
| | | import java.util.TreeSet; |
| | | |
| | |
| | | ProgressDialog progressDialog = new ProgressDialog( |
| | | Utilities.createFrame(), |
| | | Utilities.getParentDialog(this), getTitle(), getInfo()); |
| | | @SuppressWarnings("deprecation") |
| | | Object[] backends = list.getSelectedValues(); |
| | | List<?> backends = list.getSelectedValuesList(); |
| | | ArrayList<BackendDescriptor> backendsToDelete = new ArrayList<>(); |
| | | for (Object o : backends) |
| | | { |
| | |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | * Portions Copyright 2026 3A Systems, LLC. |
| | | */ |
| | | package org.opends.guitools.controlpanel.ui; |
| | | |
| | |
| | | import java.awt.event.ActionListener; |
| | | import java.util.ArrayList; |
| | | import java.util.Collection; |
| | | import java.util.Collections; |
| | | import java.util.HashMap; |
| | | import java.util.HashSet; |
| | | import java.util.LinkedHashSet; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Set; |
| | | import java.util.SortedSet; |
| | |
| | | @Override |
| | | public void run() |
| | | { |
| | | @SuppressWarnings("deprecation") |
| | | Object[] s = list.getSelectedValues(); |
| | | Set<Object> selected = new HashSet<>(); |
| | | if (s != null) |
| | | { |
| | | Collections.addAll(selected, s); |
| | | } |
| | | Set<Object> selected = new HashSet<>(list.getSelectedValuesList()); |
| | | final DefaultListModel model = (DefaultListModel)list.getModel(); |
| | | model.clear(); |
| | | SortedSet<Integer> indices = new TreeSet<>(); |
| | |
| | | ProgressDialog progressDialog = new ProgressDialog( |
| | | Utilities.createFrame(), |
| | | Utilities.getParentDialog(this), getTitle(), getInfo()); |
| | | @SuppressWarnings("deprecation") |
| | | Object[] dns = list.getSelectedValues(); |
| | | List<?> dns = list.getSelectedValuesList(); |
| | | ArrayList<BaseDNDescriptor> baseDNsToDelete = new ArrayList<>(); |
| | | for (Object o : dns) |
| | | { |
| | |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | * Portions Copyright 2026 3A Systems, LLC. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui; |
| | |
| | | } |
| | | |
| | | String ldifPath = file.getText(); |
| | | if (ldifPath == null || ldifPath.trim().equals("")) |
| | | if (ldifPath == null || ldifPath.trim().isEmpty()) |
| | | { |
| | | errors.add(INFO_NO_LDIF_PATH.get()); |
| | | setPrimaryInvalid(lFile); |
| | |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | * Portions Copyright 2026 3A Systems, LLC. |
| | | */ |
| | | package org.opends.guitools.controlpanel.ui; |
| | | |
| | |
| | | } |
| | | |
| | | String ldifPath = file.getText(); |
| | | if (ldifPath == null || "".equals(ldifPath.trim())) |
| | | if (ldifPath == null || ldifPath.trim().isEmpty()) |
| | | { |
| | | errors.add(INFO_NO_LDIF_PATH.get()); |
| | | setPrimaryInvalid(lFile); |
| | |
| | | if (writeRejects.isSelected()) |
| | | { |
| | | String rejectPath = rejectsFile.getText(); |
| | | if (rejectPath == null || "".equals(rejectPath.trim())) |
| | | if (rejectPath == null || rejectPath.trim().isEmpty()) |
| | | { |
| | | errors.add(ERR_CTRL_PANEL_REJECTS_FILE_REQUIRED.get()); |
| | | setPrimaryInvalid(lRejectsFile); |
| | |
| | | if (writeSkips.isSelected()) |
| | | { |
| | | String skipPath = skipsFile.getText(); |
| | | if (skipPath == null || "".equals(skipPath.trim())) |
| | | if (skipPath == null || skipPath.trim().isEmpty()) |
| | | { |
| | | errors.add(ERR_CTRL_PANEL_SKIPS_FILE_REQUIRED.get()); |
| | | setPrimaryInvalid(lSkipsFile); |
| | |
| | | * |
| | | * Copyright 2009-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2016 ForgeRock AS. |
| | | * Portions Copyright 2026 3A Systems, LLC. |
| | | */ |
| | | package org.opends.guitools.controlpanel.ui; |
| | | |
| | |
| | | boolean doChecks = !isLocal || isLocalServerRunning; |
| | | if (doChecks) |
| | | { |
| | | if ("".equals(dn.getText().trim())) |
| | | if (dn.getText().trim().isEmpty()) |
| | | { |
| | | dnInvalid = true; |
| | | errors.add(INFO_EMPTY_DIRECTORY_MANAGER_DN.get()); |
| | |
| | | |
| | | if (!isLocal) |
| | | { |
| | | if ("".equals(hostName.getText().trim())) |
| | | if (hostName.getText().trim().isEmpty()) |
| | | { |
| | | errors.add(INFO_EMPTY_REMOTE_HOST_NAME.get()); |
| | | } |
| | |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2016 ForgeRock AS. |
| | | * Portions Copyright 2026 3A Systems, LLC. |
| | | */ |
| | | package org.opends.guitools.controlpanel.ui; |
| | | |
| | |
| | | boolean dnInvalid = false; |
| | | boolean pwdInvalid = false; |
| | | |
| | | if ("".equals(dn.getText().trim())) |
| | | if (dn.getText().trim().isEmpty()) |
| | | { |
| | | dnInvalid = true; |
| | | errors.add(INFO_EMPTY_DIRECTORY_MANAGER_DN.get()); |
| | |
| | | if (importDataFromLDIF.isSelected()) |
| | | { |
| | | String ldifPath = path.getText(); |
| | | if (ldifPath == null || "".equals(ldifPath.trim())) |
| | | if (ldifPath == null || ldifPath.trim().isEmpty()) |
| | | { |
| | | errors.add(INFO_NO_LDIF_PATH.get()); |
| | | setSecondaryInvalid(lPath); |
| | |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | * Portions Copyright 2026 3A Systems, LLC. |
| | | */ |
| | | package org.opends.guitools.controlpanel.ui; |
| | | |
| | |
| | | else |
| | | { |
| | | String parentPath = parentDirectory.getText(); |
| | | if (parentPath == null || parentPath.trim().equals("")) |
| | | if (parentPath == null || parentPath.trim().isEmpty()) |
| | | { |
| | | errors.add(ERR_CTRL_PANEL_NO_BACKUP_PATH_PROVIDED.get()); |
| | | setPrimaryInvalid(lPath); |
| | | } |
| | | |
| | | String id = backupID.getText(); |
| | | if (id == null || id.trim().equals("")) |
| | | if (id == null || id.trim().isEmpty()) |
| | | { |
| | | errors.add(ERR_CTRL_PANEL_NO_BACKUP_ID_PROVIDED.get()); |
| | | setPrimaryInvalid(lBackupID); |
| | |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | * Portions Copyright 2026 3A Systems, LLC. |
| | | */ |
| | | package org.opends.guitools.uninstaller.ui; |
| | | |
| | |
| | | |
| | | String uid = tfUid.getText(); |
| | | ArrayList<LocalizableMessage> possibleCauses = new ArrayList<>(); |
| | | if ("".equals(uid.trim())) |
| | | if (uid.trim().isEmpty()) |
| | | { |
| | | uidInvalid = true; |
| | | possibleCauses.add(INFO_EMPTY_ADMINISTRATOR_UID.get()); |
| | | } |
| | | |
| | | if ("".equals(tfPwd.getText())) |
| | | if (tfPwd.getText().isEmpty()) |
| | | { |
| | | pwdInvalid = true; |
| | | possibleCauses.add(INFO_EMPTY_PWD.get()); |
| | |
| | | |
| | | import java.io.ByteArrayOutputStream; |
| | | import java.io.PrintStream; |
| | | import java.lang.reflect.InvocationTargetException; |
| | | import java.util.Map; |
| | | import java.util.Set; |
| | | |
| | |
| | | Class<?> appClass = null; |
| | | try { |
| | | appClass = Class.forName(appClassName); |
| | | app = (GuiApplication) appClass.newInstance(); |
| | | app = (GuiApplication) appClass.getDeclaredConstructor().newInstance(); |
| | | } catch (ClassNotFoundException e) { |
| | | logger.info(LocalizableMessage.raw("error creating quicksetup application", e)); |
| | | String msg = "Application class " + appClass + " not found"; |
| | | throw new RuntimeException(msg, e); |
| | | } catch (IllegalAccessException e) { |
| | | } catch (IllegalAccessException | NoSuchMethodException e) { |
| | | logger.info(LocalizableMessage.raw("error creating quicksetup application", e)); |
| | | String msg = "Could not access class " + appClass; |
| | | throw new RuntimeException(msg, e); |
| | | } catch (InstantiationException e) { |
| | | } catch (InstantiationException | InvocationTargetException e) { |
| | | logger.info(LocalizableMessage.raw("error creating quicksetup application", e)); |
| | | String msg = "Error instantiating class " + appClass; |
| | | throw new RuntimeException(msg, e); |
| | |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013-2016 ForgeRock AS. |
| | | * Portions Copyright 2026 3A Systems, LLC. |
| | | */ |
| | | package org.opends.quicksetup; |
| | | |
| | |
| | | public int getReturnCode() { |
| | | return code; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "ReturnCode(" + code + ")"; |
| | | } |
| | | } |
| | |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2015-2016 ForgeRock AS. |
| | | * Portions Copyright 2026 3A Systems, LLC. |
| | | */ |
| | | package org.opends.quicksetup; |
| | | |
| | |
| | | try |
| | | { |
| | | quickSetupClass = Class.forName("org.opends.quicksetup.ui.QuickSetup"); |
| | | quickSetup = quickSetupClass.newInstance(); |
| | | quickSetup = quickSetupClass.getDeclaredConstructor().newInstance(); |
| | | quickSetupClass.getMethod("initialize", new Class[] { TempLogFile.class, String[].class }) |
| | | .invoke(quickSetup, tempLogFile, args); |
| | | } catch (Exception e) |
| | |
| | | boolean fieldIsValid = true; |
| | | final List<LocalizableMessage> localErrorMsgs = new LinkedList<>(); |
| | | final String nEntries = ui.getFieldStringValue(FieldName.NUMBER_ENTRIES); |
| | | if (nEntries == null || "".equals(nEntries.trim())) |
| | | if (nEntries == null || nEntries.trim().isEmpty()) |
| | | { |
| | | localErrorMsgs.add(INFO_NO_NUMBER_ENTRIES.get()); |
| | | fieldIsValid = false; |
| | |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013-2016 ForgeRock AS. |
| | | * Portions Copyright 2026 3A Systems, LLC. |
| | | */ |
| | | package org.opends.quicksetup.ui; |
| | | |
| | |
| | | @Override |
| | | public void focusGained(FocusEvent e) |
| | | { |
| | | if (tf.getText() == null || "".equals(tf.getText())) |
| | | if (tf.getText() == null || tf.getText().isEmpty()) |
| | | { |
| | | tf.setText(" "); |
| | | tf.selectAll(); |
| | |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2016 ForgeRock AS. |
| | | * Portions Copyright 2026 3A Systems, LLC. |
| | | */ |
| | | |
| | | package org.opends.quicksetup.util; |
| | |
| | | KeyStore k = getInstance(); |
| | | for (X509Certificate aChain : chain) { |
| | | if (!containsCertificate(aChain, k)) { |
| | | String alias = aChain.getSubjectDN().getName(); |
| | | String alias = aChain.getSubjectX500Principal().getName(); |
| | | int j = 1; |
| | | while (k.containsAlias(alias)) { |
| | | alias = aChain.getSubjectDN().getName() + "-" + j; |
| | | alias = aChain.getSubjectX500Principal().getName() + "-" + j; |
| | | j++; |
| | | } |
| | | k.setCertificateEntry(alias, aChain); |
| | |
| | | try |
| | | { |
| | | Class<?> c = Class.forName(Utils.CUSTOMIZATION_CLASS_NAME); |
| | | Object obj = c.newInstance(); |
| | | Object obj = c.getDeclaredConstructor().newInstance(); |
| | | return valueClass.cast(c.getField(fieldName).get(obj)); |
| | | } |
| | | catch (Exception ignored) |
| | |
| | | } |
| | | |
| | | private boolean isRoot(String name) { |
| | | return name.equals(""); |
| | | return name.isEmpty(); |
| | | } |
| | | |
| | | /** |
| | |
| | | } else if (actionType == Type.NONE) { |
| | | actionStr = "None"; |
| | | } |
| | | String dot = actionStr.equals("") ? "" : ". "; |
| | | String dot = actionStr.isEmpty() ? "" : ". "; |
| | | action = actionStr + |
| | | ((synopsis != null) ? dot + synopsis : ""); |
| | | } |
| | |
| | | RelationDefinition rel = relList.get(mo.getName()); |
| | | if (rel != null) { |
| | | String baseDn = ldapProfile.getRelationRDNSequence(rel); |
| | | if (!baseDn.equals("")) { |
| | | if (!baseDn.isEmpty()) { |
| | | return baseDn; |
| | | } else { |
| | | // Check the parent relation |
| | |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | * Portions Copyright 2026 3A Systems, LLC. |
| | | */ |
| | | package org.opends.server.backends.task; |
| | | |
| | |
| | | // Make sure that the specified class can be instantiated as a task. |
| | | try |
| | | { |
| | | task = (Task) taskClass.newInstance(); |
| | | task = (Task) taskClass.getDeclaredConstructor().newInstance(); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | |
| | | |
| | | try { |
| | | // Make a regular task iteration from this recurring task. |
| | | nextTask = task.getClass().newInstance(); |
| | | nextTask = task.getClass().getDeclaredConstructor().newInstance(); |
| | | Entry nextTaskEntry = recurringTaskEntry.duplicate(false); |
| | | SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
| | | String nextTaskID = task.getTaskID() + "-" + df.format(nextTaskDate); |
| | |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013-2016 ForgeRock AS. |
| | | * Portions Copyright 2026 3A Systems, LLC. |
| | | */ |
| | | package org.opends.server.backends.task; |
| | | |
| | |
| | | Task task; |
| | | try |
| | | { |
| | | task = (Task) taskClass.newInstance(); |
| | | task = (Task) taskClass.getDeclaredConstructor().newInstance(); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | * Portions Copyright 2026 3A Systems, LLC. |
| | | */ |
| | | package org.opends.server.core; |
| | | |
| | |
| | | definition.getJavaClassPropertyDefinition(); |
| | | Class<? extends AccessControlHandler> providerClass = |
| | | propertyDefinition.loadClass(className, AccessControlHandler.class); |
| | | AccessControlHandler<T> provider = providerClass.newInstance(); |
| | | AccessControlHandler<T> provider = providerClass.getDeclaredConstructor().newInstance(); |
| | | |
| | | if (configuration != null) |
| | | { |
| | |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | * Portions Copyright 2026 3A Systems, LLC. |
| | | */ |
| | | package org.opends.server.core; |
| | | |
| | |
| | | propertyDefinition.loadClass(className, |
| | | AccountStatusNotificationHandler.class); |
| | | final AccountStatusNotificationHandler<T> notificationHandler = |
| | | handlerClass.newInstance(); |
| | | handlerClass.getDeclaredConstructor().newInstance(); |
| | | |
| | | if (initialize) |
| | | { |
| | |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | * Portions Copyright 2026 3A Systems, LLC. |
| | | */ |
| | | package org.opends.server.core; |
| | | |
| | |
| | | definition.getJavaClassPropertyDefinition(); |
| | | Class<? extends AlertHandler> handlerClass = |
| | | propertyDefinition.loadClass(className, AlertHandler.class); |
| | | AlertHandler handler = handlerClass.newInstance(); |
| | | AlertHandler handler = handlerClass.getDeclaredConstructor().newInstance(); |
| | | |
| | | if (initialize) |
| | | { |
| | |
| | | Backend<? extends BackendCfg> backend; |
| | | try |
| | | { |
| | | backend = loadBackendClass(className).newInstance(); |
| | | backend = loadBackendClass(className).getDeclaredConstructor().newInstance(); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | |
| | | return false; |
| | | } |
| | | |
| | | Backend<BackendCfg> b = backendClass.newInstance(); |
| | | Backend<BackendCfg> b = backendClass.getDeclaredConstructor().newInstance(); |
| | | if (! b.isConfigurationAcceptable(configEntry, unacceptableReason, serverContext)) |
| | | { |
| | | return false; |
| | |
| | | { |
| | | try |
| | | { |
| | | backend = loadBackendClass(className).newInstance(); |
| | | backend = loadBackendClass(className).getDeclaredConstructor().newInstance(); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | |
| | | Backend<BackendCfg> backend; |
| | | try |
| | | { |
| | | backend = loadBackendClass(className).newInstance(); |
| | | backend = loadBackendClass(className).getDeclaredConstructor().newInstance(); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | |
| | | Backend<? extends BackendCfg> backend; |
| | | try |
| | | { |
| | | backend = loadBackendClass(className).newInstance(); |
| | | backend = loadBackendClass(className).getDeclaredConstructor().newInstance(); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | * Portions Copyright 2026 3A Systems, LLC. |
| | | */ |
| | | package org.opends.server.core; |
| | | |
| | |
| | | definition.getJavaClassPropertyDefinition(); |
| | | Class<? extends CertificateMapper> mapperClass = |
| | | propertyDefinition.loadClass(className, CertificateMapper.class); |
| | | CertificateMapper mapper = mapperClass.newInstance(); |
| | | CertificateMapper mapper = mapperClass.getDeclaredConstructor().newInstance(); |
| | | |
| | | if (initialize) |
| | | { |
| | |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2012-2016 ForgeRock AS. |
| | | * Portions Copyright 2026 3A Systems, LLC. |
| | | */ |
| | | package org.opends.server.core; |
| | | |
| | |
| | | @SuppressWarnings("rawtypes") |
| | | Class<? extends ConnectionHandler> theClass = |
| | | pd.loadClass(className, ConnectionHandler.class); |
| | | ConnectionHandler<T> connectionHandler = theClass.newInstance(); |
| | | ConnectionHandler<T> connectionHandler = theClass.getDeclaredConstructor().newInstance(); |
| | | |
| | | connectionHandler.initializeConnectionHandler(serverContext, config); |
| | | |
| | |
| | | @SuppressWarnings("rawtypes") |
| | | Class<? extends ConnectionHandler> theClass = |
| | | pd.loadClass(className, ConnectionHandler.class); |
| | | connectionHandler = theClass.newInstance(); |
| | | connectionHandler = theClass.getDeclaredConstructor().newInstance(); |
| | | } |
| | | |
| | | return connectionHandler.isConfigurationAcceptable(config, unacceptableReasons); |
| | |
| | | // it instead of creating a new one unless explicit init is requested. |
| | | EntryCache<T> cache; |
| | | if (initialize || entryCache == null) { |
| | | cache = cacheClass.newInstance(); |
| | | cache = cacheClass.getDeclaredConstructor().newInstance(); |
| | | } else { |
| | | cache = entryCache; |
| | | } |
| | |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | * Portions Copyright 2026 3A Systems, LLC. |
| | | */ |
| | | package org.opends.server.core; |
| | | |
| | |
| | | { |
| | | Class<? extends ExtendedOperationHandler> theClass = |
| | | pd.loadClass(className, ExtendedOperationHandler.class); |
| | | ExtendedOperationHandler extendedOperationHandler = theClass.newInstance(); |
| | | ExtendedOperationHandler extendedOperationHandler = theClass.getDeclaredConstructor().newInstance(); |
| | | |
| | | extendedOperationHandler.initializeExtendedOperationHandler(config); |
| | | |
| | |
| | | catch (Exception e) |
| | | { |
| | | logger.traceException(e); |
| | | throw new ConfigException(ERR_CONFIG_EXTOP_INVALID_CLASS.get(className, config.dn(), e), e); |
| | | throw new ConfigException(ERR_CONFIG_EXTOP_INVALID_CLASS.get(className, config.dn(), |
| | | stackTraceToSingleLineString(e)), e); |
| | | } |
| | | } |
| | | |
| | |
| | | try { |
| | | Class<? extends ExtendedOperationHandler> theClass = |
| | | pd.loadClass(className, ExtendedOperationHandler.class); |
| | | ExtendedOperationHandler extOpHandler = theClass.newInstance(); |
| | | ExtendedOperationHandler extOpHandler = theClass.getDeclaredConstructor().newInstance(); |
| | | |
| | | return extOpHandler.isConfigurationAcceptable(config, unacceptableReasons); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | logger.traceException(e); |
| | | unacceptableReasons.add(ERR_CONFIG_EXTOP_INVALID_CLASS.get(className, config.dn(), e)); |
| | | unacceptableReasons.add(ERR_CONFIG_EXTOP_INVALID_CLASS.get(className, config.dn(), |
| | | stackTraceToSingleLineString(e))); |
| | | return false; |
| | | } |
| | | } |
| | |
| | | * |
| | | * Copyright 2007-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2016 ForgeRock AS. |
| | | * Portions Copyright 2025 3A Systems,LLC. |
| | | * Portions Copyright 2025-2026 3A Systems,LLC. |
| | | */ |
| | | package org.opends.server.core; |
| | | |
| | |
| | | definition.getJavaClassPropertyDefinition(); |
| | | Class<? extends Group> groupClass = |
| | | propertyDefinition.loadClass(className, Group.class); |
| | | Group group = groupClass.newInstance(); |
| | | Group group = groupClass.getDeclaredConstructor().newInstance(); |
| | | |
| | | if (initialize) |
| | | { |
| | |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | * Portions Copyright 2026 3A Systems, LLC. |
| | | */ |
| | | package org.opends.server.core; |
| | | |
| | |
| | | definition.getJavaClassPropertyDefinition(); |
| | | Class<? extends IdentityMapper> mapperClass = |
| | | propertyDefinition.loadClass(className, IdentityMapper.class); |
| | | IdentityMapper mapper = mapperClass.newInstance(); |
| | | IdentityMapper mapper = mapperClass.getDeclaredConstructor().newInstance(); |
| | | |
| | | if (initialize) |
| | | { |
| | |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | * Portions Copyright 2026 3A Systems, LLC. |
| | | */ |
| | | package org.opends.server.core; |
| | | |
| | |
| | | definition.getJavaClassPropertyDefinition(); |
| | | Class<? extends KeyManagerProvider> providerClass = |
| | | propertyDefinition.loadClass(className, KeyManagerProvider.class); |
| | | KeyManagerProvider provider = providerClass.newInstance(); |
| | | KeyManagerProvider provider = providerClass.getDeclaredConstructor().newInstance(); |
| | | |
| | | if (initialize) |
| | | { |
| | |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | * Portions Copyright 2026 3A Systems, LLC. |
| | | */ |
| | | package org.opends.server.core; |
| | | |
| | |
| | | Class<? extends RetentionPolicy> theClass = |
| | | pd.loadClass(className, RetentionPolicy.class); |
| | | // Explicitly cast to check that implementation implements the correct interface. |
| | | RetentionPolicy<?> retentionPolicy = theClass.newInstance(); |
| | | RetentionPolicy<?> retentionPolicy = theClass.getDeclaredConstructor().newInstance(); |
| | | // next line is here to ensure that eclipse does not remove the cast in the line above |
| | | retentionPolicy.hashCode(); |
| | | return true; |
| | | } catch (Exception e) { |
| | | unacceptableReasons.add( |
| | | ERR_CONFIG_RETENTION_POLICY_INVALID_CLASS.get(className, config.dn(), e)); |
| | | ERR_CONFIG_RETENTION_POLICY_INVALID_CLASS.get(className, config.dn(), stackTraceToSingleLineString(e))); |
| | | return false; |
| | | } |
| | | } |
| | |
| | | try { |
| | | Class<? extends RetentionPolicy> theClass = |
| | | pd.loadClass(className, RetentionPolicy.class); |
| | | RetentionPolicy<LogRetentionPolicyCfg> retentionPolicy = theClass.newInstance(); |
| | | RetentionPolicy<LogRetentionPolicyCfg> retentionPolicy = theClass.getDeclaredConstructor().newInstance(); |
| | | retentionPolicy.initializeLogRetentionPolicy(config); |
| | | return retentionPolicy; |
| | | } catch (Exception e) { |
| | | LocalizableMessage message = ERR_CONFIG_RETENTION_POLICY_INVALID_CLASS.get( |
| | | className, config.dn(), e); |
| | | className, config.dn(), stackTraceToSingleLineString(e)); |
| | | throw new ConfigException(message, e); |
| | | } |
| | | } |
| | |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | * Portions Copyright 2026 3A Systems, LLC. |
| | | */ |
| | | package org.opends.server.core; |
| | | import java.util.List; |
| | |
| | | Class<? extends RotationPolicy> theClass = |
| | | pd.loadClass(className, RotationPolicy.class); |
| | | // Explicitly cast to check that implementation implements the correct interface. |
| | | RotationPolicy<?> retentionPolicy = theClass.newInstance(); |
| | | RotationPolicy<?> retentionPolicy = theClass.getDeclaredConstructor().newInstance(); |
| | | // next line is here to ensure that eclipse does not remove the cast in the line above |
| | | retentionPolicy.hashCode(); |
| | | return true; |
| | | } catch (Exception e) { |
| | | unacceptableReasons.add( |
| | | ERR_CONFIG_ROTATION_POLICY_INVALID_CLASS.get(className, config.dn(), e)); |
| | | ERR_CONFIG_ROTATION_POLICY_INVALID_CLASS.get(className, config.dn(), stackTraceToSingleLineString(e))); |
| | | return false; |
| | | } |
| | | } |
| | |
| | | try { |
| | | Class<? extends RotationPolicy> theClass = |
| | | pd.loadClass(className, RotationPolicy.class); |
| | | RotationPolicy<LogRotationPolicyCfg> rotationPolicy = theClass.newInstance(); |
| | | RotationPolicy<LogRotationPolicyCfg> rotationPolicy = theClass.getDeclaredConstructor().newInstance(); |
| | | rotationPolicy.initializeLogRotationPolicy(config); |
| | | return rotationPolicy; |
| | | } catch (Exception e) { |
| | | LocalizableMessage message = ERR_CONFIG_ROTATION_POLICY_INVALID_CLASS.get( |
| | | className, config.dn(), e); |
| | | className, config.dn(), stackTraceToSingleLineString(e)); |
| | | throw new ConfigException(message, e); |
| | | } |
| | | } |
| | |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013-2016 ForgeRock AS. |
| | | * Portions Copyright 2026 3A Systems, LLC. |
| | | */ |
| | | package org.opends.server.core; |
| | | |
| | |
| | | Class<? extends MonitorProvider<T>> providerClass = |
| | | (Class<? extends MonitorProvider<T>>) propertyDefinition |
| | | .loadClass(className, MonitorProvider.class); |
| | | MonitorProvider<T> monitor = providerClass.newInstance(); |
| | | MonitorProvider<T> monitor = providerClass.getDeclaredConstructor().newInstance(); |
| | | |
| | | if (configuration != null) |
| | | { |
| | |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | * Portions Copyright 2026 3A Systems, LLC. |
| | | */ |
| | | package org.opends.server.core; |
| | | |
| | |
| | | definition.getJavaClassPropertyDefinition(); |
| | | Class<? extends PasswordGenerator> generatorClass = |
| | | propertyDefinition.loadClass(className, PasswordGenerator.class); |
| | | PasswordGenerator<T> generator = generatorClass.newInstance(); |
| | | PasswordGenerator<T> generator = generatorClass.getDeclaredConstructor().newInstance(); |
| | | |
| | | if (initialize) |
| | | { |
| | |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2016 ForgeRock AS. |
| | | * Portions Copyright 2026 3A Systems, LLC. |
| | | */ |
| | | package org.opends.server.core; |
| | | |
| | |
| | | Class<AuthenticationPolicyFactory<T>> theClass = |
| | | (Class<AuthenticationPolicyFactory<T>>) pd.loadClass(className, |
| | | AuthenticationPolicyFactory.class); |
| | | AuthenticationPolicyFactory<T> factory = theClass.newInstance(); |
| | | AuthenticationPolicyFactory<T> factory = theClass.getDeclaredConstructor().newInstance(); |
| | | factory.setServerContext(serverContext); |
| | | |
| | | AuthenticationPolicy policy = factory.createAuthenticationPolicy(policyConfiguration); |
| | |
| | | Class<?> theClass = |
| | | pd.loadClass(className, AuthenticationPolicyFactory.class); |
| | | AuthenticationPolicyFactory<T> factory = |
| | | (AuthenticationPolicyFactory<T>) theClass.newInstance(); |
| | | (AuthenticationPolicyFactory<T>) theClass.getDeclaredConstructor().newInstance(); |
| | | factory.setServerContext(serverContext); |
| | | |
| | | return factory.isConfigurationAcceptable(policyConfiguration, unacceptableReasons); |
| | |
| | | if (historyDuration > 0L) |
| | | { |
| | | long minAgeToKeep = currentTime - 1000L * historyDuration; |
| | | Iterator<Long> iterator = historyMap.keySet().iterator(); |
| | | Iterator<Map.Entry<Long, ByteString>> iterator = historyMap.entrySet().iterator(); |
| | | LinkedHashSet<ByteString> removeValues = new LinkedHashSet<>(); |
| | | while (iterator.hasNext()) |
| | | { |
| | | long timestamp = iterator.next(); |
| | | if (timestamp >= minAgeToKeep) |
| | | Map.Entry<Long, ByteString> historyEntry = iterator.next(); |
| | | if (historyEntry.getKey() >= minAgeToKeep) |
| | | { |
| | | break; |
| | | } |
| | | |
| | | ByteString v = historyMap.get(timestamp); |
| | | ByteString v = historyEntry.getValue(); |
| | | removeValues.add(v); |
| | | iterator.remove(); |
| | | |
| | |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | * Portions Copyright 2026 3A Systems, LLC. |
| | | */ |
| | | package org.opends.server.core; |
| | | |
| | |
| | | PasswordStorageSchemeCfgDefn definition = PasswordStorageSchemeCfgDefn.getInstance(); |
| | | propertyDefinition = definition.getJavaClassPropertyDefinition(); |
| | | schemeClass = propertyDefinition.loadClass(className, PasswordStorageScheme.class); |
| | | PasswordStorageScheme<T> passwordStorageScheme = schemeClass.newInstance(); |
| | | PasswordStorageScheme<T> passwordStorageScheme = schemeClass.getDeclaredConstructor().newInstance(); |
| | | |
| | | if (initialize) |
| | | { |
| | |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | * Portions Copyright 2026 3A Systems, LLC. |
| | | */ |
| | | package org.opends.server.core; |
| | | |
| | |
| | | definition.getJavaClassPropertyDefinition(); |
| | | Class<? extends PasswordValidator> validatorClass = |
| | | propertyDefinition.loadClass(className, PasswordValidator.class); |
| | | PasswordValidator<T> validator = validatorClass.newInstance(); |
| | | PasswordValidator<T> validator = validatorClass.getDeclaredConstructor().newInstance(); |
| | | |
| | | if (initialize) |
| | | { |
| | |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2016 ForgeRock AS. |
| | | * Portions Copyright 2026 3A Systems, LLC. |
| | | */ |
| | | package org.opends.server.core; |
| | | |
| | |
| | | definition.getJavaClassPropertyDefinition(); |
| | | Class<? extends DirectoryServerPlugin> pluginClass = |
| | | propertyDefinition.loadClass(className, DirectoryServerPlugin.class); |
| | | DirectoryServerPlugin<T> plugin = pluginClass.newInstance(); |
| | | DirectoryServerPlugin<T> plugin = pluginClass.getDeclaredConstructor().newInstance(); |
| | | |
| | | if (initialize) |
| | | { |
| | |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | * Portions Copyright 2026 3A Systems, LLC. |
| | | */ |
| | | package org.opends.server.core; |
| | | |
| | |
| | | definition.getJavaClassPropertyDefinition(); |
| | | Class<? extends SASLMechanismHandler> handlerClass = |
| | | propertyDefinition.loadClass(className, SASLMechanismHandler.class); |
| | | SASLMechanismHandler handler = handlerClass.newInstance(); |
| | | SASLMechanismHandler handler = handlerClass.getDeclaredConstructor().newInstance(); |
| | | |
| | | if (initialize) |
| | | { |
| | |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | * Portions Copyright 2026 3A Systems, LLC. |
| | | */ |
| | | package org.opends.server.core; |
| | | |
| | |
| | | try |
| | | { |
| | | // Instantiate the class. |
| | | provider = theClass.newInstance(); |
| | | provider = theClass.getDeclaredConstructor().newInstance(); |
| | | } catch (Exception e) |
| | | { |
| | | // Handle the exception: put a message in the unacceptable reasons. |
| | |
| | | { |
| | | Class<? extends SynchronizationProvider> theClass = |
| | | pd.loadClass(className, SynchronizationProvider.class); |
| | | SynchronizationProvider provider = theClass.newInstance(); |
| | | SynchronizationProvider provider = theClass.getDeclaredConstructor().newInstance(); |
| | | |
| | | return provider.isConfigurationAcceptable(configuration, |
| | | unacceptableReasons); |
| | |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | * Portions Copyright 2026 3A Systems, LLC. |
| | | */ |
| | | package org.opends.server.core; |
| | | |
| | |
| | | definition.getJavaClassPropertyDefinition(); |
| | | Class<? extends TrustManagerProvider> providerClass = |
| | | propertyDefinition.loadClass(className, TrustManagerProvider.class); |
| | | TrustManagerProvider<T> provider = providerClass.newInstance(); |
| | | TrustManagerProvider<T> provider = providerClass.getDeclaredConstructor().newInstance(); |
| | | |
| | | if (initialize) |
| | | { |
| | |
| | | * |
| | | * Copyright 2007-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2016 ForgeRock AS. |
| | | * Portions Copyright 2026 3A Systems, LLC. |
| | | */ |
| | | package org.opends.server.core; |
| | | |
| | |
| | | Class<? extends VirtualAttributeProvider> providerClass = |
| | | propertyDefinition.loadClass(className, |
| | | VirtualAttributeProvider.class); |
| | | VirtualAttributeProvider provider = providerClass.newInstance(); |
| | | VirtualAttributeProvider provider = providerClass.getDeclaredConstructor().newInstance(); |
| | | |
| | | if (initialize) |
| | | { |
| | |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | * Portions Copyright 2026 3A Systems, LLC. |
| | | */ |
| | | package org.opends.server.core; |
| | | import java.util.List; |
| | |
| | | |
| | | try |
| | | { |
| | | WorkQueue workQueue = workQueueClass.newInstance(); |
| | | WorkQueue workQueue = workQueueClass.getDeclaredConstructor().newInstance(); |
| | | |
| | | workQueue.initializeWorkQueue(workQueueConfig); |
| | | |
| | |
| | | private ServiceDiscoveryMechanism loadAndInitializeMechanism(ServiceDiscoveryMechanismCfg cfg) throws Exception |
| | | { |
| | | final ServiceDiscoveryMechanism newMechanism = |
| | | ((Class<ServiceDiscoveryMechanism>) DirectoryServer.loadClass(cfg.getJavaClass())).newInstance(); |
| | | ((Class<ServiceDiscoveryMechanism>) DirectoryServer.loadClass(cfg.getJavaClass())).getDeclaredConstructor().newInstance(); |
| | | newMechanism.initializeMechanism(cfg, serverContext); |
| | | return newMechanism; |
| | | } |
| | |
| | | // is closest to the naming context. If not, then add a new list with |
| | | // the current base DN. |
| | | boolean found = false; |
| | | Iterator<DN> iterator = baseDNs.keySet().iterator(); |
| | | Iterator<Map.Entry<DN, LinkedList<LDAPURL>>> iterator = baseDNs.entrySet().iterator(); |
| | | while (iterator.hasNext()) |
| | | { |
| | | DN existingBaseDN = iterator.next(); |
| | | Map.Entry<DN, LinkedList<LDAPURL>> baseDNEntry = iterator.next(); |
| | | DN existingBaseDN = baseDNEntry.getKey(); |
| | | if (urlBaseDN.isSubordinateOrEqualTo(existingBaseDN)) |
| | | { |
| | | // The base DN for the current URL is below an existing base DN, |
| | | // so we can just add this URL to the existing list and be done. |
| | | urlList = baseDNs.get(existingBaseDN); |
| | | urlList = baseDNEntry.getValue(); |
| | | urlList.add(memberURL); |
| | | found = true; |
| | | break; |
| | |
| | | // The base DN for the current URL is above the existing base DN, |
| | | // so we should use the base DN for the current URL instead of the |
| | | // existing one. |
| | | urlList = baseDNs.get(existingBaseDN); |
| | | urlList = baseDNEntry.getValue(); |
| | | urlList.add(memberURL); |
| | | iterator.remove(); |
| | | baseDNs.put(urlBaseDN, urlList); |
| | |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2016 ForgeRock AS. |
| | | * Portions Copyright 2026 3A Systems, LLC. |
| | | */ |
| | | package org.opends.server.loggers; |
| | | |
| | |
| | | String className = config.getJavaClass(); |
| | | ClassPropertyDefinition pd = getJavaClassPropertyDefinition(); |
| | | try { |
| | | P publisher = pd.loadClass(className, logPublisherClass).newInstance(); |
| | | P publisher = pd.loadClass(className, logPublisherClass).getDeclaredConstructor().newInstance(); |
| | | return publisher.isConfigurationAcceptable(config, unacceptableReasons); |
| | | } catch (Exception e) { |
| | | unacceptableReasons.add(invalidLoggerClassErrorMessage.get(className, config.dn(), e)); |
| | | unacceptableReasons.add(invalidLoggerClassErrorMessage.get(className, config.dn(), |
| | | stackTraceToSingleLineString(e))); |
| | | return false; |
| | | } |
| | | } |
| | |
| | | String className = config.getJavaClass(); |
| | | ClassPropertyDefinition pd = getJavaClassPropertyDefinition(); |
| | | try { |
| | | P logPublisher = pd.loadClass(className, logPublisherClass).newInstance(); |
| | | P logPublisher = pd.loadClass(className, logPublisherClass).getDeclaredConstructor().newInstance(); |
| | | logPublisher.initializeLogPublisher(config, serverContext); |
| | | return logPublisher; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | throw new ConfigException( |
| | | invalidLoggerClassErrorMessage.get(className, config.dn(), e), e); |
| | | invalidLoggerClassErrorMessage.get(className, config.dn(), stackTraceToSingleLineString(e)), e); |
| | | } |
| | | } |
| | | |
| | |
| | | * information: "Portions copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2016 ForgeRock AS. |
| | | * Portions Copyright 2026 3A Systems, LLC. |
| | | */ |
| | | package org.opends.server.protocols.http.rest2ldap; |
| | | |
| | |
| | | } |
| | | |
| | | final String title = attrType.getDescription(); |
| | | if (title != null && !"".equals(title)) |
| | | if (title != null && !title.isEmpty()) |
| | | { |
| | | result.put("title", title); |
| | | } |
| | |
| | | * |
| | | * Copyright 2007-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2015 ForgeRock AS. |
| | | * Portions Copyright 2026 3A Systems, LLC. |
| | | */ |
| | | package org.opends.server.replication.protocol; |
| | | |
| | |
| | | + "CONNECTED RS SERVERS:" |
| | | + "\n--------------------\n" |
| | | + rsStr |
| | | + ("".equals(rsStr) ? "----------------------------\n" : ""); |
| | | + (rsStr.isEmpty() ? "----------------------------\n" : ""); |
| | | } |
| | | |
| | | /** |
| | |
| | | * Returns the newest (last) record from this log. |
| | | * |
| | | * @return the newest record, which may be {@code null} |
| | | * @throws ChangelogException |
| | | * If an error occurs while retrieving the record. |
| | | */ |
| | | Record<K, V> getNewestRecord() |
| | | { |
| | |
| | | logger.trace("[IE] Domain=" + this |
| | | + " ends initialization with exception=" + ieCtx.getException() |
| | | + " connected=" + broker.isConnected() |
| | | + " task=" + initFromTask |
| | | + " task=" + (initFromTask != null ? initFromTask.getTaskEntryDN() : null) |
| | | + " attempt=" + ieCtx.attemptCnt); |
| | | } |
| | | |
| | |
| | | { |
| | | final ClassPropertyDefinition propertyDef = SchemaProviderCfgDefn.getInstance().getJavaClassPropertyDefinition(); |
| | | final Class<? extends SchemaProvider> providerClass = propertyDef.loadClass(className, SchemaProvider.class); |
| | | final SchemaProvider<T> provider = providerClass.newInstance(); |
| | | final SchemaProvider<T> provider = providerClass.getDeclaredConstructor().newInstance(); |
| | | |
| | | if (initialize) |
| | | { |
| | |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013-2016 ForgeRock AS. |
| | | * Portions Copyright 2026 3A Systems, LLC. |
| | | */ |
| | | package org.opends.server.tools; |
| | | |
| | |
| | | final BackendCfg cfg; |
| | | try |
| | | { |
| | | backend = (LocalBackend) backendClass.newInstance(); |
| | | backend = (LocalBackend) backendClass.getDeclaredConstructor().newInstance(); |
| | | backend.setBackendID(backendID); |
| | | cfg = root.getBackend(backendID); |
| | | backend.configureBackend(cfg, serverContext); |
| | |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | * Portions Copyright 2026 3A Systems, LLC. |
| | | */ |
| | | package org.opends.server.tools; |
| | | |
| | |
| | | } |
| | | |
| | | System.out.println(INFO_PROMPTTM_SERVER_CERT.get( |
| | | chain[0].getSubjectDN().getName(), |
| | | chain[0].getIssuerDN().getName(), |
| | | chain[0].getSubjectX500Principal().getName(), |
| | | chain[0].getIssuerX500Principal().getName(), |
| | | notBeforeDate, |
| | | notAfterDate)); |
| | | } |
| | |
| | | public void progressUpdate(ProgressUpdateEvent ev) |
| | | { |
| | | LocalizableMessage newLogDetails = ev.getNewLogs(); |
| | | if (newLogDetails != null && !"".equals(newLogDetails.toString().trim())) |
| | | if (newLogDetails != null && !newLogDetails.toString().trim().isEmpty()) |
| | | { |
| | | print(newLogDetails); |
| | | println(); |
| | |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013-2016 ForgeRock AS. |
| | | * Portions Copyright 2026 3A Systems, LLC. |
| | | */ |
| | | package org.opends.server.tools.makeldif; |
| | | |
| | |
| | | { |
| | | try |
| | | { |
| | | Tag t = (Tag) c.newInstance(); |
| | | Tag t = (Tag) c.getDeclaredConstructor().newInstance(); |
| | | registeredTags.put(toLowerCase(t.getName()), t); |
| | | } |
| | | catch (Exception e) |
| | |
| | | Tag tag; |
| | | try |
| | | { |
| | | tag = (Tag) tagClass.newInstance(); |
| | | tag = (Tag) tagClass.getDeclaredConstructor().newInstance(); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | |
| | | Tag newTag; |
| | | try |
| | | { |
| | | newTag = t.getClass().newInstance(); |
| | | newTag = t.getClass().getDeclaredConstructor().newInstance(); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | throw new MakeLDIFException(ERR_MAKELDIF_CANNOT_INSTANTIATE_NEW_TAG.get(tagName, lineNumber, e), e); |
| | | throw new MakeLDIFException(ERR_MAKELDIF_CANNOT_INSTANTIATE_NEW_TAG.get(tagName, lineNumber, |
| | | getExceptionMessage(e)), e); |
| | | } |
| | | |
| | | if (branch == null) |
| | |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | * Portions Copyright 2026 3A Systems, LLC. |
| | | */ |
| | | package org.opends.server.tools.tasks; |
| | | |
| | |
| | | if (task == null && className != null) { |
| | | try { |
| | | Class<?> clazz = Class.forName(className); |
| | | Object o = clazz.newInstance(); |
| | | Object o = clazz.getDeclaredConstructor().newInstance(); |
| | | if (Task.class.isAssignableFrom(o.getClass())) { |
| | | this.task = (Task) o; |
| | | } |
| | |
| | | } |
| | | |
| | | SearchScope scope; |
| | | if (scopeString.equals("")) |
| | | if (scopeString.isEmpty()) |
| | | { |
| | | scope = DEFAULT_SEARCH_SCOPE; |
| | | } |
| | |
| | | SearchFilter filter; |
| | | if (fullyDecode) |
| | | { |
| | | if (filterString.equals("")) |
| | | if (filterString.isEmpty()) |
| | | { |
| | | filter = DEFAULT_SEARCH_FILTER; |
| | | } |
| | |
| | | * |
| | | * @throws DirectoryException |
| | | * If a Directory Server error occurs. |
| | | * @throws IOException |
| | | * If an I/O exception occurs during the restore. |
| | | */ |
| | | private void restoreArchive(Path restoreDir, |
| | | Set<String> filesToRestore, |
| | |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | * Portions Copyright 2026 3A Systems, LLC. |
| | | */ |
| | | package org.opends.server.util; |
| | | |
| | |
| | | catch (CertificateExpiredException cee) |
| | | { |
| | | logger.error(ERR_EXPCHECK_TRUSTMGR_CLIENT_CERT_EXPIRED, |
| | | c.getSubjectDN().getName(), c.getNotAfter()); |
| | | c.getSubjectX500Principal().getName(), c.getNotAfter()); |
| | | throw cee; |
| | | } |
| | | catch (CertificateNotYetValidException cnyve) |
| | | { |
| | | logger.error(ERR_EXPCHECK_TRUSTMGR_CLIENT_CERT_NOT_YET_VALID, |
| | | c.getSubjectDN().getName(), c.getNotBefore()); |
| | | c.getSubjectX500Principal().getName(), c.getNotBefore()); |
| | | throw cnyve; |
| | | } |
| | | } |
| | |
| | | catch (CertificateExpiredException cee) |
| | | { |
| | | logger.error(ERR_EXPCHECK_TRUSTMGR_SERVER_CERT_EXPIRED, |
| | | c.getSubjectDN().getName(), c.getNotAfter()); |
| | | c.getSubjectX500Principal().getName(), c.getNotAfter()); |
| | | throw cee; |
| | | } |
| | | catch (CertificateNotYetValidException cnyve) |
| | | { |
| | | logger.error(ERR_EXPCHECK_TRUSTMGR_SERVER_CERT_NOT_YET_VALID, |
| | | c.getSubjectDN().getName(), c.getNotBefore()); |
| | | c.getSubjectX500Principal().getName(), c.getNotBefore()); |
| | | throw cnyve; |
| | | } |
| | | } |
| | |
| | | * Copyright 2009-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013-2016 ForgeRock AS. |
| | | * Portions Copyright 2025 Wren Security. |
| | | * Portions Copyright 2025 3A Systems LLC. |
| | | * Portions Copyright 2025-2026 3A Systems LLC. |
| | | */ |
| | | |
| | | package org.opends.server.util; |
| | |
| | | */ |
| | | private boolean isSelfSigned(X509Certificate cert) |
| | | { |
| | | return cert.getSubjectDN().equals(cert.getIssuerDN()); |
| | | return cert.getSubjectX500Principal().equals(cert.getIssuerX500Principal()); |
| | | } |
| | | } |
| | | |
| | |
| | | certificateNumber++; |
| | | X509Certificate certif = (X509Certificate) keystore.getCertificate(alias); |
| | | builder.addNumberedOption(INFO_LDAP_CONN_PROMPT_SECURITY_CERTIFICATE_ALIAS.get( |
| | | alias, certif.getSubjectDN().getName()), |
| | | alias, certif.getSubjectX500Principal().getName()), |
| | | MenuResult.success(alias)); |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | // Certificate DN |
| | | app.println(INFO_LDAP_CONN_SECURITY_SERVER_CERTIFICATE_USER_DN.get(cert.getSubjectDN())); |
| | | app.println(INFO_LDAP_CONN_SECURITY_SERVER_CERTIFICATE_USER_DN.get(cert.getSubjectX500Principal())); |
| | | // certificate validity |
| | | app.println(INFO_LDAP_CONN_SECURITY_SERVER_CERTIFICATE_VALIDITY.get( |
| | | cert.getNotBefore(), cert.getNotAfter())); |
| | | // certificate Issuer |
| | | app.println(INFO_LDAP_CONN_SECURITY_SERVER_CERTIFICATE_ISSUER.get(cert.getIssuerDN())); |
| | | app.println(INFO_LDAP_CONN_SECURITY_SERVER_CERTIFICATE_ISSUER.get(cert.getIssuerX500Principal())); |
| | | } |
| | | } |
| | | |
| | |
| | | // User choice if to add the certificate to the trust store for the current session or permanently. |
| | | for (final X509Certificate cert : chain) |
| | | { |
| | | state.truststore.setCertificateEntry(cert.getSubjectDN().getName(), cert); |
| | | state.truststore.setCertificateEntry(cert.getSubjectX500Principal().getName(), cert); |
| | | } |
| | | |
| | | // Update the trust manager |
| | |
| | | |
| | | for (final X509Certificate cert : chain) |
| | | { |
| | | keyStore.setCertificateEntry(cert.getSubjectDN().getName(), cert); |
| | | keyStore.setCertificateEntry(cert.getSubjectX500Principal().getName(), cert); |
| | | } |
| | | |
| | | try (final FileOutputStream trustStoreOutputFile = new FileOutputStream(trustStorePath)) |
| | |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2016 ForgeRock AS. |
| | | * Portions Copyright 2026 3A Systems, LLC. |
| | | */ |
| | | package org.opends.server.util; |
| | | |
| | |
| | | static { |
| | | try { |
| | | Class<?> c = Class.forName("org.opends.server.util.ReleaseDefinition"); |
| | | Object obj = c.newInstance(); |
| | | Object obj = c.getDeclaredConstructor().newInstance(); |
| | | |
| | | try { |
| | | PRODUCT_NAME = (String)c.getField("PRODUCT_NAME").get(obj); |
| | |
| | | super(mib); |
| | | this.server = server; |
| | | this.connectionHandlerName = connectionHandlerObjectName; |
| | | this.ApplIndex = new Integer(applIndex); |
| | | this.DsApplIfProtocolIndex = new Integer(connectionHandlerIndex); |
| | | this.ApplIndex = Integer.valueOf(applIndex); |
| | | this.DsApplIfProtocolIndex = Integer.valueOf(connectionHandlerIndex); |
| | | this.monitor = SNMPMonitor.getMonitor(server); |
| | | } |
| | | |
| | |
| | | if (index==-1) { |
| | | return this.DsApplIfProtocol; |
| | | } |
| | | return new String("1.3.6.1..27.3.") + portNumber.substring(index+1); |
| | | return "1.3.6.1..27.3." + portNumber.substring(index+1); |
| | | } |
| | | } |
| | | |
| | |
| | | super(mib); |
| | | this.server = server; |
| | | this.monitor = SNMPMonitor.getMonitor(server); |
| | | this.applIndex = new Integer(index); |
| | | this.applIndex = Integer.valueOf(index); |
| | | } |
| | | |
| | | /** |
| | |
| | | Object value = this.monitor.getAttribute(name, |
| | | "ds-backend-entry-count"); |
| | | if (value != null && value instanceof String) { |
| | | result = result + new Long((String) value); |
| | | result = result + Long.valueOf((String) value); |
| | | }else if (value != null && value instanceof Long) { |
| | | result = result + (Long)value; |
| | | } |
| | |
| | | Byte[] barray = new Byte[b.length]; |
| | | for (int index = 0; index < b.length; index++) |
| | | { |
| | | barray[index] = new Byte(b[index]); |
| | | barray[index] = Byte.valueOf(b[index]); |
| | | } |
| | | return barray; |
| | | } |
| | |
| | | long v = V.longValue(); |
| | | if (v > (pow(2, 32) - 1)) |
| | | { |
| | | return new Long(v % pow(2, 32)); |
| | | return Long.valueOf(v % pow(2, 32)); |
| | | } |
| | | else |
| | | { |
| | |
| | | long v = V.longValue(); |
| | | if (v > (pow(2, 32) - 1)) |
| | | { |
| | | return new Long(pow(2, 32) - 1); |
| | | return Long.valueOf(pow(2, 32) - 1); |
| | | } |
| | | else |
| | | { |
| | |
| | | { |
| | | throw new SnmpStatusException("Returned intrumented value size too big"); |
| | | } |
| | | Integer ret = new Integer(V.intValue()); |
| | | Integer ret = Integer.valueOf(V.intValue()); |
| | | return ret; |
| | | } |
| | | |