Fix CodeQL note-severity alerts: confusable class and method names, and an unused verifier (#849)
6 files modified
1 files deleted
2 files renamed
| | |
| | | /* |
| | | * The contents of this file are subject to the terms of the Common Development and |
| | | * Distribution License (the License). You may not use this file except in compliance with the |
| | | * License. |
| | | * |
| | | * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the |
| | | * specific language governing permission and limitations under the License. |
| | | * |
| | | * When distributing Covered Software, include this CDDL Header Notice in each file and include |
| | | * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL |
| | | * Header, with the fields enclosed by brackets [] replaced by your own identifying |
| | | * information: "Portions copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2023-2026 3A Systems, LLC. |
| | | */ |
| | | package org.opends.server.backends.cassandra; |
| | | |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | |
| | | public class Backend extends BackendImpl<CASBackendCfg>{ |
| | | |
| | | @Override |
| | | protected Storage configureStorage(CASBackendCfg cfg, ServerContext serverContext) throws ConfigException |
| | | protected CASStorage configureStorage(CASBackendCfg cfg, ServerContext serverContext) throws ConfigException |
| | | { |
| | | return new Storage(cfg, serverContext); |
| | | return new CASStorage(cfg, serverContext); |
| | | } |
| | | |
| | | } |
| File was renamed from opendj-server-legacy/src/main/java/org/opends/server/backends/cassandra/Storage.java |
| | |
| | | import com.github.benmanes.caffeine.cache.Caffeine; |
| | | import com.github.benmanes.caffeine.cache.LoadingCache; |
| | | |
| | | public class Storage implements org.opends.server.backends.pluggable.spi.Storage, ConfigurationChangeListener<CASBackendCfg>{ |
| | | public class CASStorage implements org.opends.server.backends.pluggable.spi.Storage, ConfigurationChangeListener<CASBackendCfg>{ |
| | | |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | private CASBackendCfg config; |
| | | |
| | | public Storage(CASBackendCfg cfg, ServerContext serverContext) { |
| | | public CASStorage(CASBackendCfg cfg, ServerContext serverContext) { |
| | | this.config = cfg; |
| | | cfg.addCASChangeListener(this); |
| | | } |
| | |
| | | this.accessMode=accessMode; |
| | | session=CqlSession.builder() |
| | | .withApplicationName("OpenDJ "+getKeyspaceName()+"."+config.getBackendId()) |
| | | .withConfigLoader(DriverConfigLoader.fromDefaults(Storage.class.getClassLoader())) |
| | | .withConfigLoader(DriverConfigLoader.fromDefaults(CASStorage.class.getClassLoader())) |
| | | .build(); |
| | | if (AccessMode.READ_WRITE.equals(accessMode)) { |
| | | execute(prepared.get("CREATE KEYSPACE IF NOT EXISTS "+getKeyspaceName()+" WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'};").bind().setExecutionProfileName(profile)); |
| | |
| | | @Override |
| | | public void close() { |
| | | if (!isOpen) { |
| | | Storage.this.close(); |
| | | CASStorage.this.close(); |
| | | } |
| | | } |
| | | |
| | |
| | | * Header, with the fields enclosed by brackets [] replaced by your own identifying |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2024 3A Systems, LLC. |
| | | * Copyright 2024-2026 3A Systems, LLC. |
| | | */ |
| | | package org.opends.server.backends.jdbc; |
| | | |
| | |
| | | public class Backend extends BackendImpl<JDBCBackendCfg>{ |
| | | |
| | | @Override |
| | | protected Storage configureStorage(JDBCBackendCfg cfg, ServerContext serverContext) throws ConfigException |
| | | protected JDBCStorage configureStorage(JDBCBackendCfg cfg, ServerContext serverContext) throws ConfigException |
| | | { |
| | | return new Storage(cfg, serverContext); |
| | | return new JDBCStorage(cfg, serverContext); |
| | | } |
| | | |
| | | } |
| File was renamed from opendj-server-legacy/src/main/java/org/opends/server/backends/jdbc/Storage.java |
| | |
| | | import static org.opends.server.backends.pluggable.spi.StorageUtils.addErrorMessage; |
| | | import static org.opends.server.util.StaticUtils.stackTraceToSingleLineString; |
| | | |
| | | public class Storage implements org.opends.server.backends.pluggable.spi.Storage, ConfigurationChangeListener<JDBCBackendCfg>{ |
| | | public class JDBCStorage implements org.opends.server.backends.pluggable.spi.Storage, ConfigurationChangeListener<JDBCBackendCfg>{ |
| | | |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | private JDBCBackendCfg config; |
| | | |
| | | public Storage(JDBCBackendCfg cfg, ServerContext serverContext) { |
| | | public JDBCStorage(JDBCBackendCfg cfg, ServerContext serverContext) { |
| | | this.config = cfg; |
| | | cfg.addJDBCChangeListener(this); |
| | | } |
| | |
| | | throw new StorageRuntimeException(e); |
| | | } |
| | | if (!isOpen) { |
| | | Storage.this.close(); |
| | | JDBCStorage.this.close(); |
| | | } |
| | | } |
| | | |
| | |
| | | * |
| | | * Copyright 2009-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2016 ForgeRock AS. |
| | | * Portions Copyright 2026 3A Systems, LLC. |
| | | */ |
| | | package org.opends.server.core; |
| | | |
| | |
| | | lock.writeLock().lock(); |
| | | try |
| | | { |
| | | if (!removeSubEntry(dn2SubEntry, entry)) |
| | | if (!removeSubentryFrom(dn2SubEntry, entry)) |
| | | { |
| | | removeSubEntry(dn2CollectiveSubEntry, entry); |
| | | removeSubentryFrom(dn2CollectiveSubEntry, entry); |
| | | } |
| | | } |
| | | finally |
| | |
| | | } |
| | | } |
| | | |
| | | private boolean removeSubEntry(Map<DN, List<SubEntry>> subEntryMap, Entry entry) |
| | | private boolean removeSubentryFrom(Map<DN, List<SubEntry>> subEntryMap, Entry entry) |
| | | { |
| | | Iterator<List<SubEntry>> subEntryListsIt = subEntryMap.values().iterator(); |
| | | while (subEntryListsIt.hasNext()) |
| | |
| | | * Header, with the fields enclosed by brackets [] replaced by your own identifying |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2023 3A Systems, LLC. |
| | | * Copyright 2023-2026 3A Systems, LLC. |
| | | */ |
| | | package org.opends.server.backends.cassandra; |
| | | |
| | |
| | | |
| | | //test allow cassandra |
| | | try(CqlSession session=CqlSession.builder() |
| | | .withConfigLoader(DriverConfigLoader.fromDefaults(Storage.class.getClassLoader())) |
| | | .withConfigLoader(DriverConfigLoader.fromDefaults(CASStorage.class.getClassLoader())) |
| | | .build()){ |
| | | session.close(); |
| | | }catch (AllNodesFailedException e) { |
| | |
| | | * Header, with the fields enclosed by brackets [] replaced by your own identifying |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2023 3A Systems, LLC. |
| | | * Copyright 2023-2026 3A Systems, LLC. |
| | | */ |
| | | package org.opends.server.backends.cassandra; |
| | | |
| | |
| | | |
| | | //test allow cassandra |
| | | try(CqlSession session=CqlSession.builder() |
| | | .withConfigLoader(DriverConfigLoader.fromDefaults(Storage.class.getClassLoader())) |
| | | .withConfigLoader(DriverConfigLoader.fromDefaults(CASStorage.class.getClassLoader())) |
| | | .build()){ |
| | | session.close(); |
| | | }catch (AllNodesFailedException e) { |
| | |
| | | @Test |
| | | public void testCursorCrossesFetchSizeBatches() throws Exception { |
| | | System.setProperty("org.openidentityplatform.opendj.jdbc.fetchsize", "2"); |
| | | final Storage storage = new Storage(createBackendCfg(), null); |
| | | final JDBCStorage storage = new JDBCStorage(createBackendCfg(), null); |
| | | final TreeName tree = new TreeName("testCursorBatch", "tree"); |
| | | try { |
| | | storage.open(AccessMode.READ_WRITE); |