Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import java.util.Map;

import org.identityconnectors.common.StringUtil;
import org.identityconnectors.common.IOUtil;
import org.identityconnectors.common.logging.Log;
import org.identityconnectors.common.security.GuardedString;
import org.identityconnectors.databasetable.mapping.AttributeConvertor;
Expand Down Expand Up @@ -289,7 +290,7 @@ public void test() {
// nothing to do, just invalidate the connection
throw new ConnectorException(config.getMessage(MSG_CAN_NOT_READ, sql), ex);
} finally {
SQLUtil.closeQuietly(stmt);
IOUtil.quietClose(stmt);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@

import org.identityconnectors.common.Assertions;
import org.identityconnectors.common.CollectionUtil;
import org.identityconnectors.common.IOUtil;
import org.identityconnectors.common.StringUtil;
import org.identityconnectors.common.logging.Log;
import org.identityconnectors.common.security.GuardedString;
Expand Down Expand Up @@ -323,7 +324,7 @@ public Uid create(ObjectClass oclass, Set<Attribute> attrs, OperationOptions opt
}
} finally {
// clean up...
SQLUtil.closeQuietly(pstmt);
IOUtil.quietClose(pstmt);
closeConnection();
}
log.ok("Account {0} created", accountName);
Expand Down Expand Up @@ -404,7 +405,7 @@ public void delete(final ObjectClass oclass, final Uid uid, final OperationOptio
throw new ConnectorException(config.getMessage(MSG_CAN_NOT_DELETE, accountUid), e);
} finally {
// clean up..
SQLUtil.closeQuietly(stmt);
IOUtil.quietClose(stmt);
closeConnection();
}
log.ok("Account Uid {0} deleted", accountUid);
Expand Down Expand Up @@ -489,7 +490,7 @@ public Uid update(ObjectClass oclass, Uid uid, Set<Attribute> attrs, OperationOp
}
} finally {
// clean up..
SQLUtil.closeQuietly(stmt);
IOUtil.quietClose(stmt);

closeConnection();
}
Expand Down Expand Up @@ -562,8 +563,8 @@ public void executeQuery(ObjectClass oclass, FilterWhereBuilder where, ResultsHa
throw new ConnectorException(config.getMessage(MSG_CAN_NOT_READ, tblname), e);
}
} finally {
SQLUtil.closeQuietly(result);
SQLUtil.closeQuietly(statement);
IOUtil.quietClose(result);
IOUtil.quietClose(statement);
closeConnection();
}
log.ok("Query Account commited");
Expand Down Expand Up @@ -643,8 +644,8 @@ public void sync(ObjectClass oclass, SyncToken token, SyncResultsHandler handler
SQLUtil.rollbackQuietly(getConn());
throw new ConnectorException(config.getMessage(MSG_CAN_NOT_READ, tblname), e);
} finally {
SQLUtil.closeQuietly(result);
SQLUtil.closeQuietly(statement);
IOUtil.quietClose(result);
IOUtil.quietClose(statement);

closeConnection();
}
Expand Down Expand Up @@ -701,8 +702,8 @@ public SyncToken getLatestSyncToken(ObjectClass oclass) {
throw new ConnectorException(config.getMessage(MSG_CAN_NOT_READ, tblname), e);
} finally {
// clean up..
SQLUtil.closeQuietly(rset);
SQLUtil.closeQuietly(stmt);
IOUtil.quietClose(rset);
IOUtil.quietClose(stmt);

closeConnection();
}
Expand Down Expand Up @@ -840,8 +841,8 @@ public Uid authenticate(ObjectClass oclass, String username, GuardedString passw
SQLUtil.rollbackQuietly(getConn());
throw new ConnectorException(config.getMessage(MSG_CAN_NOT_READ, config.getTable()), e);
} finally {
SQLUtil.closeQuietly(result);
SQLUtil.closeQuietly(stmt);
IOUtil.quietClose(result);
IOUtil.quietClose(stmt);

closeConnection();
}
Expand Down Expand Up @@ -904,8 +905,8 @@ public Uid resolveUsername(ObjectClass oclass, String username, OperationOptions
SQLUtil.rollbackQuietly(getConn());
throw new ConnectorException(config.getMessage(MSG_CAN_NOT_READ, config.getTable()), e);
} finally {
SQLUtil.closeQuietly(result);
SQLUtil.closeQuietly(stmt);
IOUtil.quietClose(result);
IOUtil.quietClose(stmt);

closeConnection();
}
Expand Down Expand Up @@ -1059,8 +1060,8 @@ private Set<AttributeInfo> buildSelectBasedAttributeInfos() {
SQLUtil.rollbackQuietly(getConn());
throw new ConnectorException(config.getMessage(MSG_CAN_NOT_READ, config.getTable()), ex);
} finally {
SQLUtil.closeQuietly(rset);
SQLUtil.closeQuietly(stmt);
IOUtil.quietClose(rset);
IOUtil.quietClose(stmt);
}
log.ok("schema created");
return attrInfo;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
* enclosed by brackets [] replaced by your own identifying information:
* "Portions Copyrighted [year] [name of copyright owner]"
* ====================
* Portions Copyrighted 2026 3A Systems, LLC
*/
package org.identityconnectors.dbcommon;

Expand All @@ -30,6 +31,7 @@
import java.util.List;

import org.identityconnectors.common.logging.Log;
import org.identityconnectors.common.IOUtil;
import org.identityconnectors.framework.common.exceptions.ConnectorException;
import org.identityconnectors.framework.spi.Configuration;

Expand Down Expand Up @@ -76,9 +78,8 @@ public DatabaseConnection(final Connection conn) {
/**
* Closes the internal {@link java.sql.Connection}.
*/
@SuppressWarnings("deprecation")
public void dispose() {
SQLUtil.closeQuietly(nativeConn);
IOUtil.quietClose(nativeConn);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ public static void closeQuietly(final Connection connection) {
*/
public static void closeQuietly(final DatabaseConnection conn) {
if (conn != null) {
closeQuietly(conn.getConnection());
IOUtil.quietClose(conn.getConnection());
}
}

Expand Down Expand Up @@ -434,7 +434,7 @@ public static java.sql.Date string2Date(String param) {
} catch (IllegalArgumentException e) {
// Wrong string, cloud be a string number
try {
parsedDate = new java.sql.Date(new Long(param));
parsedDate = new java.sql.Date(Long.parseLong(param));
} catch (NumberFormatException expected) {
// Locale parsed date, possible lost of precision
try {
Expand Down Expand Up @@ -462,7 +462,7 @@ public static java.sql.Timestamp string2Timestamp(String param) {
} catch (IllegalArgumentException e) {
// Wrong string, cloud be a number
try {
parsedTms = new java.sql.Timestamp(new Long(param));
parsedTms = new java.sql.Timestamp(Long.parseLong(param));
} catch (NumberFormatException expected) {
// Locale parsed date, possible lost of precision
try {
Expand Down Expand Up @@ -1051,8 +1051,8 @@ public static Object selectSingleValue(Connection conn, String sql, SQLParam...
}
return null;
} finally {
closeQuietly(rs);
closeQuietly(st);
IOUtil.quietClose(rs);
IOUtil.quietClose(st);
}
}

Expand Down Expand Up @@ -1096,8 +1096,8 @@ public static List<Object[]> selectRows(Connection conn, String sql, SQLParam...
}
return rows;
} finally {
closeQuietly(rs);
closeQuietly(st);
IOUtil.quietClose(rs);
IOUtil.quietClose(st);
}
}

Expand Down Expand Up @@ -1128,7 +1128,7 @@ public static int executeUpdateStatement(Connection conn, String sql, SQLParam..
setParams(st, Arrays.asList(params));
return st.executeUpdate();
} finally {
closeQuietly(st);
IOUtil.quietClose(st);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,8 @@ private void initQueriedPropsDump() {
if (StringUtil.isNotBlank(pOut)) {
try {
_queriedPropsOutFile = new File(pOut);
if (!_queriedPropsOutFile.exists()) {
_queriedPropsOutFile.createNewFile();
if (!_queriedPropsOutFile.exists() && !_queriedPropsOutFile.createNewFile()) {
throw new IOException("Could not create " + _queriedPropsOutFile);
}
if (!_queriedPropsOutFile.canWrite()) {
_queriedPropsOutFile = null;
Expand All @@ -263,8 +263,8 @@ private void initSnapshot() {
if (StringUtil.isNotBlank(pOut)) {
try {
_propertyOutFile = new File(pOut);
if (!_propertyOutFile.exists()) {
_propertyOutFile.createNewFile();
if (!_propertyOutFile.exists() && !_propertyOutFile.createNewFile()) {
throw new IOException("Could not create " + _propertyOutFile);
}
if (!_propertyOutFile.canWrite()) {
_propertyOutFile = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
* enclosed by brackets [] replaced by your own identifying information:
* "Portions Copyrighted [year] [name of copyright owner]"
* ====================
* Portions Copyrighted 2026 3A Systems, LLC
*/
package org.identityconnectors.contract.data;

Expand Down Expand Up @@ -154,11 +155,11 @@ private static Map<Character, Set<Character>> getDefaultCharacterSetMap() {
alpha_mixed.addAll(alpha_upper);

// setup the mappings
characterSetMap.put(new Character('#'), numeric);
characterSetMap.put(new Character('a'), alpha_lower);
characterSetMap.put(new Character('A'), alpha_upper);
characterSetMap.put(new Character('?'), alpha_mixed);
characterSetMap.put(new Character('.'), alpha_numeric);
characterSetMap.put(Character.valueOf('#'), numeric);
characterSetMap.put(Character.valueOf('a'), alpha_lower);
characterSetMap.put(Character.valueOf('A'), alpha_upper);
characterSetMap.put(Character.valueOf('?'), alpha_mixed);
characterSetMap.put(Character.valueOf('.'), alpha_numeric);

return characterSetMap;
}
Expand All @@ -179,7 +180,7 @@ private static void addRange(Set<Character> s, char min, char max) {
}

for (char i = min; i <= max; i++) {
s.add(new Character(i));
s.add(Character.valueOf(i));
}
}

Expand Down Expand Up @@ -212,7 +213,7 @@ private static String createRandomString(String pattern,
Map<Character, Set<Character>> characterSetMap) {
StringBuffer replacement = new StringBuffer();
for (int i = 0; i < pattern.length(); i++) {
Set<Character> characterSet = characterSetMap.get(new Character(
Set<Character> characterSet = characterSetMap.get(Character.valueOf(
pattern.charAt(i)));
if (pattern.charAt(i) == '\\') {
// do escape, and print the next character
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,10 @@ public static DataProvider createDataProvider() {
throw new Exception("Class " + customDataProvider + " is not of type "
+ DataProvider.class.getName());
}
dp = (DataProvider) dpClass.newInstance();
dp = (DataProvider) dpClass.getDeclaredConstructor().newInstance();
} else {
logger.info("DataProvider class not specified, using default ''"+DEFAULT_DATA_PROVIDER+"''.");
dp = (DataProvider) DEFAULT_DATA_PROVIDER.newInstance();
dp = (DataProvider) DEFAULT_DATA_PROVIDER.getDeclaredConstructor().newInstance();
}
} catch (Exception ex) {
throw ContractException.wrap(ex);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
* ====================
*
* Portions Copyrighted 2012 ForgeRock AS
* Portions Copyrighted 2026 3A Systems, LLC
*
*/
package org.identityconnectors.contract.test;
Expand Down Expand Up @@ -580,7 +581,7 @@ public void testPasswordChangeIntervalPredAttribute(ObjectClass objectClass) {
* @param createValue value used for create
* @param updateValue value used for update
* @param type expected type of the value
* @param addPassword, add password to attributes in the update
* @param addPassword add password to attributes in the update
*/
private void checkOpAttribute(ObjectClass objectClass, String attrName, Object createValue, Object updateValue, Class<?> type, boolean addPassword) {
final int iteration = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
* "Portions Copyrighted [year] [name of copyright owner]"
* ====================
* Portions Copyrighted 2010-2013 ForgeRock AS.
* Portions Copyrighted 2026 3A Systems, LLC
*/

package org.identityconnectors.framework.impl.api.local;
Expand Down Expand Up @@ -165,7 +166,7 @@ public PoolableConnector makeObject() {
config = context.getConfiguration();
}

connector = (PoolableConnector) clazz.newInstance();
connector = (PoolableConnector) clazz.getDeclaredConstructor().newInstance();
connector.init(config);
} else {
throw new ConnectorException("The Connector is not PoolableConnector: "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ private static Set<Class<? extends APIOperation>> translateOperations(

private static Configuration createBean2(ConfigurationPropertiesImpl properties,
Class<? extends Configuration> configClass) throws Exception {
Configuration rv = configClass.newInstance();
Configuration rv = configClass.getDeclaredConstructor().newInstance();
rv.setConnectorMessages(properties.getParent().getConnectorInfo().getMessages());
mergeIntoBean2(properties, rv);
return rv;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
* ====================
* Portions Copyrighted 2010-2015 ForgeRock AS.
* Portions Copyrighted 2010-2014 Tirasa.
* Portions Copyrighted 2026 3A Systems, LLC
*/
package org.identityconnectors.framework.impl.api.local;

Expand Down Expand Up @@ -325,7 +326,7 @@ public static APIConfigurationImpl createDefaultAPIConfiguration(
try {
final Class<? extends Connector> connectorClass = localInfo.getConnectorClass();
final APIConfigurationImpl rv = new APIConfigurationImpl();
final Configuration config = localInfo.getConnectorConfigurationClass().newInstance();
final Configuration config = localInfo.getConnectorConfigurationClass().getDeclaredConstructor().newInstance();
final boolean pooling = PoolableConnector.class.isAssignableFrom(connectorClass);
rv.setConnectorPoolingSupported(pooling);
rv.setConfigurationProperties(JavaClassProperties.createConfigurationProperties(config));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
* "Portions Copyrighted [year] [name of copyright owner]"
* ====================
* Portions Copyrighted 2010-2015 ForgeRock AS.
* Portions Copyrighted 2026 3A Systems, LLC
*/
package org.identityconnectors.framework.impl.api.local.operations;

Expand Down Expand Up @@ -95,7 +96,7 @@ public Object invoke(Object proxy, Method method, Object[] args)
}
else {
// get a new instance of the connector..
connector = connectorClazz.newInstance();
connector = connectorClazz.getDeclaredConstructor().newInstance();
// initialize the connector..
connector.init(context.getConfiguration());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public abstract class ConnectorServer {
public static ConnectorServer newInstance() {
try {
final Class<?> clazz = Class.forName(IMPL_NAME);
return (ConnectorServer) clazz.newInstance();
return (ConnectorServer) clazz.getDeclaredConstructor().newInstance();
} catch (Exception e) {
throw ConnectorException.wrap(e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ private APIConfigurationImpl createDefaultAPIConfiguration(LocalConnectorInfoImp
try {
Class<? extends Connector> connectorClass = localInfo.getConnectorClass();
APIConfigurationImpl rv = new APIConfigurationImpl();
Configuration config = localInfo.getConnectorConfigurationClass().newInstance();
Configuration config = localInfo.getConnectorConfigurationClass().getDeclaredConstructor().newInstance();
boolean pooling = PoolableConnector.class.isAssignableFrom(connectorClass);
rv.setConnectorPoolingSupported(pooling);
rv.setConfigurationProperties(JavaClassProperties.createConfigurationProperties(config));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ private APIConfigurationImpl createDefaultAPIConfiguration(OsgiConnectorInfoImpl
try {
Class<? extends Connector> connectorClass = localInfo.getConnectorClass();
APIConfigurationImpl rv = new APIConfigurationImpl();
Configuration config = localInfo.getConnectorConfigurationClass().newInstance();
Configuration config = localInfo.getConnectorConfigurationClass().getDeclaredConstructor().newInstance();
boolean pooling = PoolableConnector.class.isAssignableFrom(connectorClass);
rv.setConnectorPoolingSupported(pooling);
rv.setConfigurationProperties(JavaClassProperties.createConfigurationProperties(config));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ public static void quietClose(final Statement stmt) {
*/
public static void quietClose(final Connection conn) {
try {
if (conn != null) {
if (conn != null && !conn.isClosed()) {
conn.close();
}
} catch (SQLException e) {
Expand Down
Loading
Loading