Skip to content

Commit

Permalink
#759 Mark classes/methods/constants removed in Jaybird 6 as deprecated
Browse files Browse the repository at this point in the history
  • Loading branch information
mrotteveel committed Jul 21, 2023
1 parent 0bacb9b commit 9137856
Show file tree
Hide file tree
Showing 19 changed files with 163 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@
*
* @author <a href="mailto:mrotteveel@users.sourceforge.net">Mark Rotteveel</a>
* @since 3.0
* @deprecated will be removed in Jaybird 6 without replacement
*/
@Deprecated
public class FbLocalDatabaseFactory extends AbstractNativeDatabaseFactory {

private static final FbLocalDatabaseFactory INSTANCE = new FbLocalDatabaseFactory();
Expand Down
3 changes: 3 additions & 0 deletions src/main/org/firebirdsql/encodings/IEncodingFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,9 @@ public interface IEncodingFactory {
* @param <T>
* Type parameter of type {@link DatatypeCoder}
* @return New or cached instance of datatype coder
* @deprecated will be removed in Jaybird 6 and replaced by
* {@code <T extends DatatypeCoder> T getOrCreateDatatypeCoder(Class<T>, Function<IEncodingFactory, T>)}
*/
@Deprecated
<T extends DatatypeCoder> T getOrCreateDatatypeCoder(Class<T> datatypeCoderClass);
}
40 changes: 40 additions & 0 deletions src/main/org/firebirdsql/gds/GDSException.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,17 @@
*/
package org.firebirdsql.gds;

import java.sql.SQLException;
import java.util.concurrent.atomic.AtomicReferenceFieldUpdater;

/**
* A GDS-specific exception
*
* @author <a href="mailto:d_jencks@users.sourceforge.net">David Jencks</a>
* @author <a href="mailto:rrokytskyy@users.sourceforge.net">Roman Rokytskyy</a>
* @deprecated use a normal SQLException or subclass, this class may be removed in Jaybird 7 or later
*/
@Deprecated
public class GDSException extends Exception {

private static final long serialVersionUID = -2993273656432230359L;
Expand Down Expand Up @@ -65,7 +68,9 @@ public class GDSException extends Exception {
*
* @param message Message for the new instance
* @param xaErrorCode The <code>XA</code> error code
* @deprecated will be removed in Jaybird 6 without replacement
*/
@Deprecated
public static GDSException createWithXAErrorCode(String message, int xaErrorCode) {
GDSException gdse = new GDSException(message);
gdse.setXAErrorCode(xaErrorCode);
Expand All @@ -79,7 +84,11 @@ public static GDSException createWithXAErrorCode(String message, int xaErrorCode
* {@link ISCConstants#isc_arg_gds}, otherwise no message will be
* displayed.
* @param intParam Additional int parameter about the new exception
* @deprecated will be removed in Jaybird 6, if you really must use this class, use {@link #GDSException(String)},
* {@link #GDSException(int)}, or {@link #GDSException(int,Throwable)}, but keep in mind this class will be removed
* in Jaybird 7 or later
*/
@Deprecated
public GDSException(int type, int intParam) {
this.type = type;
this.intParam = intParam;
Expand All @@ -95,7 +104,11 @@ public GDSException(int type, int intParam) {
* @param strParam value of the string parameter that will substitute
* <code>{0}</code> entry in error message corresponding to the
* specified error code.
* @deprecated will be removed in Jaybird 6, if you really must use this class, use {@link #GDSException(String)},
* {@link #GDSException(int)}, or {@link #GDSException(int,Throwable)}, but keep in mind this class will be removed
* in Jaybird 7 or later
*/
@Deprecated
public GDSException(int type, String strParam) {
this.type = type;
this.strParam = strParam;
Expand All @@ -114,7 +127,11 @@ public GDSException(int type, String strParam) {
* @param strParam value of the string parameter that will substitute
* <code>{0}</code> entry in error message corresponding to the specified
* error code.
* @deprecated will be removed in Jaybird 6, if you really must use this class, use {@link #GDSException(String)},
* {@link #GDSException(int)}, or {@link #GDSException(int,Throwable)}, but keep in mind this class will be removed
* in Jaybird 7 or later
*/
@Deprecated
public GDSException(int type, int fbErrorCode, String strParam) {
this.type = type;
this.intParam = fbErrorCode;
Expand All @@ -136,7 +153,11 @@ public GDSException(int type, int fbErrorCode, String strParam) {
* error code.
*
* @param cause Cause of this exception
* @deprecated will be removed in Jaybird 6, if you really must use this class, use {@link #GDSException(String)},
* {@link #GDSException(int)}, or {@link #GDSException(int,Throwable)}, but keep in mind this class will be removed
* in Jaybird 7 or later
*/
@Deprecated
public GDSException(int type, int fbErrorCode, String strParam, Throwable cause) {
this(type, fbErrorCode, strParam);
initCause(cause);
Expand Down Expand Up @@ -181,7 +202,9 @@ public GDSException(String message) {
* Get the Firebird-specific error code for this exception.
*
* @return The Firebird error code
* @deprecated will be removed in Jaybird 6 without replacement
*/
@Deprecated
public int getFbErrorCode() {
switch (type) {
case ISCConstants.isc_arg_number:
Expand All @@ -198,7 +221,9 @@ public int getFbErrorCode() {
*
* @return the SQL state of this exception or <code>null</code> if this
* object does not represent an error.
* @deprecated will be removed in Jaybird 6, but replaced by {@link SQLException#getSQLState()}
*/
@Deprecated
public String getSQLState() {
switch (type) {
case ISCConstants.isc_arg_number:
Expand All @@ -213,7 +238,9 @@ public String getSQLState() {
* Get the <code>int</code> parameter for this exception.
*
* @return The <code>int</code> parameter
* @deprecated will be removed in Jaybird 6 without replacement
*/
@Deprecated
public int getIntParam() {
return intParam;
}
Expand All @@ -222,15 +249,19 @@ public int getIntParam() {
/**
* Get the XaErrorCode value.
* @return the XaErrorCode value.
* @deprecated will be removed in Jaybird 6 without replacement
*/
@Deprecated
public int getXAErrorCode() {
return xaErrorCode;
}

/**
* Set the XaErrorCode value.
* @param xaErrorCode The new XaErrorCode value.
* @deprecated will be removed in Jaybird 6 without replacement
*/
@Deprecated
public void setXAErrorCode(int xaErrorCode) {
this.xaErrorCode = xaErrorCode;
}
Expand All @@ -239,7 +270,9 @@ public void setXAErrorCode(int xaErrorCode) {
* Set the next exception in the chain.
*
* @param e The next chained exception
* @deprecated will be removed in Jaybird 6 without replacement
*/
@Deprecated
public void setNext(GDSException e) {
GDSException current = this;
for(;;) {
Expand All @@ -260,7 +293,9 @@ public void setNext(GDSException e) {
* Get the next chained exception.
*
* @return The next chained exception
* @deprecated will be removed in Jaybird 6 without replacement
*/
@Deprecated
public GDSException getNext() {
return next;
}
Expand All @@ -270,7 +305,9 @@ public GDSException getNext() {
*
* @return <code>true</code> if this is a warning,
* <code>false</code> otherwise
* @deprecated will be removed in Jaybird 6 without replacement
*/
@Deprecated
public boolean isWarning() {
return type == ISCConstants.isc_arg_warning;
}
Expand Down Expand Up @@ -315,7 +352,10 @@ public String getMessage() {

/**
* Returns the parameter depending on the type of the error code.
*
* @deprecated will be removed in Jaybird 6 without replacement
*/
@Deprecated
public String getParam() {
switch (type) {
case ISCConstants.isc_arg_interpreted:
Expand Down
24 changes: 24 additions & 0 deletions src/main/org/firebirdsql/gds/JaybirdSystemProperties.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,20 @@ public final class JaybirdSystemProperties {

// do not include 'sensitive' properties, and only include Jaybird specific properties

/**
* @deprecated will be removed in Jaybird 6 without replacement
*/
@Deprecated
public static final String FORCE_CONSOLE_LOGGER_PROP = JDBC_PREFIX + "forceConsoleLogger";
/**
* @deprecated will be removed in Jaybird 6 without replacement
*/
@Deprecated
public static final String DISABLE_LOGGING_PROP = JDBC_PREFIX + "disableLogging";
/**
* @deprecated will be removed in Jaybird 6 without replacement
*/
@Deprecated
public static final String LOGGER_IMPLEMENTATION_PROP = JDBC_PREFIX + "loggerImplementation";
public static final String SYNC_WRAP_NATIVE_LIBRARY_PROP = COMMON_PREFIX + "jna.syncWrapNativeLibrary";
public static final String PROCESS_ID_PROP = JDBC_PREFIX + "pid";
Expand All @@ -48,14 +60,26 @@ private JaybirdSystemProperties() {
// no instances
}

/**
* @deprecated will be removed in Jaybird 6 without replacement
*/
@Deprecated
public static boolean isForceConsoleLogger() {
return getBooleanSystemPropertyPrivileged(FORCE_CONSOLE_LOGGER_PROP);
}

/**
* @deprecated will be removed in Jaybird 6 without replacement
*/
@Deprecated
public static boolean isDisableLogging() {
return getBooleanSystemPropertyPrivileged(DISABLE_LOGGING_PROP);
}

/**
* @deprecated will be removed in Jaybird 6 without replacement
*/
@Deprecated
public static String getLoggerImplementation() {
return getSystemPropertyPrivileged(LOGGER_IMPLEMENTATION_PROP);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,14 @@ public final class StringArgument extends TypedArgument {
private static final EnumSet<ArgumentType> SUPPORTED_ARGUMENT_TYPES =
EnumSet.of(ArgumentType.TraditionalDpb, ArgumentType.Wide, ArgumentType.StringSpb);
private static final long serialVersionUID = -7980793147101287101L;

private final String value;
private final byte[] asBytes;
private final Encoding encoding;

/**
* @deprecated will be removed in Jaybird 6, use {@link #StringArgument(int, ArgumentType, String, Encoding)}
*/
@Deprecated
public StringArgument(int type, ArgumentType argumentType, String value) {
this(type, argumentType, value, EncodingFactory.getPlatformEncoding());
Expand Down
18 changes: 8 additions & 10 deletions src/main/org/firebirdsql/gds/ng/DefaultDatatypeCoder.java
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public int sizeOfShort() {

@Override
public byte[] encodeShort(short value) {
return intToBytes(value);
return encodeInt(value);
}

@Override
Expand All @@ -132,7 +132,9 @@ public short decodeShort(byte[] bytes, int fromIndex) {

@Override
public byte[] encodeInt(int value) {
return intToBytes(value);
byte[] ret = new byte[4];
encodeInt(value, ret, 0);
return ret;
}

@Override
Expand All @@ -148,16 +150,12 @@ public void encodeInt(int value, byte[] target, int fromIndex) {
*
* @param value
* The value to be encoded
* @return The value of <code>value</code> encoded as a
* <code>byte</code> array
* @return The value of <code>value</code> encoded as a <code>byte</code> array
* @deprecated will be removed in Jaybird 6, use {@link #encodeInt(int)}
*/
@Deprecated
protected byte[] intToBytes(int value) {
byte[] ret = new byte[4];
ret[0] = (byte) ((value >>> 24) & 0xff);
ret[1] = (byte) ((value >>> 16) & 0xff);
ret[2] = (byte) ((value >>> 8) & 0xff);
ret[3] = (byte) ((value) & 0xff);
return ret;
return encodeInt(value);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,14 @@

import java.nio.charset.StandardCharsets;

/** Unix Crypt.
* Implements the one way cryptography used by Unix systems for
* simple password protection.
/**
* Unix Crypt. Implements the one way cryptography used by Unix systems for simple password protection.
*
* @version $Id: UnixCrypt.java,v 1.5 2004/10/11 00:28:41 gregwilkins Exp $
* @author Greg Wilkins (gregw)
* @deprecated will be removed in Jaybird 6, and replaced by {@code LegacyHash} which will be introduced in Jaybird 6
*/
@Deprecated
public class UnixCrypt {

//@formatter:off
Expand Down
4 changes: 4 additions & 0 deletions src/main/org/firebirdsql/jaybird/xca/FBXAException.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@
*/
public class FBXAException extends XAException {

/**
* @deprecated will be removed in Jaybird 6, use one of the other constructors
*/
@Deprecated
public FBXAException() {
super();
}
Expand Down
16 changes: 14 additions & 2 deletions src/main/org/firebirdsql/jdbc/FBConnection.java
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ public FBConnection(FBManagedConnection mc) {
: ResultSet.CLOSE_CURSORS_AT_COMMIT;
}

/**
* @deprecated will be removed in Jaybird 6 without replacement
*/
@Deprecated
public FBObjectListener.StatementListener getStatementListener() {
return txCoordinator;
}
Expand Down Expand Up @@ -700,7 +704,10 @@ public PreparedStatement prepareStatement(String sql, int resultSetType, int res
return prepareStatement(sql, resultSetType, resultSetConcurrency, resultSetHoldability, false, false);
}

// TODO Why unused? Remove?
/**
* @deprecated will be removed in Jaybird 6, use {@link #prepareStatement(String, int, int, int, boolean, boolean)}
*/
@Deprecated
protected PreparedStatement prepareMetaDataStatement(String sql, int resultSetType, int resultSetConcurrency)
throws SQLException {
return prepareStatement(sql, resultSetType, resultSetConcurrency, resultSetHoldability, true, false);
Expand Down Expand Up @@ -1054,8 +1061,11 @@ public String getSchema() throws SQLException {
}

/**
* Check if this connection is currently involved in a transaction
* Check if this connection is currently involved in a transaction.
*
* @deprecated will be removed in Jaybird 6 without replacement
*/
@Deprecated
public boolean inTransaction() throws SQLException {
return getGDSHelper().inTransaction();
}
Expand Down Expand Up @@ -1113,7 +1123,9 @@ public boolean isUseFirebirdAutoCommit() {
*
* @throws SQLException
* If the client info is not supported, or if there is no database connection.
* @deprecated will be removed in Jaybird 6 without replacement
*/
@Deprecated
protected void checkClientInfoSupport() throws SQLException {
if (!getFbDatabase().getServerVersion().isEqualOrAbove(2, 0)) {
throw new FBDriverNotCapableException(
Expand Down
4 changes: 4 additions & 0 deletions src/main/org/firebirdsql/jdbc/FBResultSet.java
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,10 @@ public boolean isClosed() throws SQLException {
return closed;
}

/**
* @deprecated use {@link #close(boolean, CompletionReason)}, will be removed in Jaybird 6
*/
@Deprecated
void close(boolean notifyListener) throws SQLException {
close(notifyListener, CompletionReason.OTHER);
}
Expand Down
Loading

0 comments on commit 9137856

Please sign in to comment.