You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mina.apache.org by gg...@apache.org on 2022/04/14 11:47:12 UTC
[mina-ftpserver] 02/02: [FTPSERVER-506] Fix binary compatibility issues.
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch 1.1.X
in repository https://gitbox.apache.org/repos/asf/mina-ftpserver.git
commit 02467a09beea50b841eabe751d54644d7b3a1566
Author: Gary Gregory <gg...@rocketsoftware.com>
AuthorDate: Wed Apr 13 21:07:39 2022 -0400
[FTPSERVER-506] Fix binary compatibility issues.
Pick 1.1.2 as the baseline for FTPSERVER-506 but it should be the
previous version in more normal usage when you've been sure that binary
compatibility has not been broken from release to release.
---
.../org/apache/ftpserver/util/StringUtils.java | 23 +++---
distribution/pom.xml | 1 +
examples/ftpserver-example-spring-war/pom.xml | 1 +
examples/ftpserver-osgi-ftplet-service/pom.xml | 1 +
examples/ftpserver-osgi-spring-service/pom.xml | 1 +
examples/pom.xml | 1 +
pom.xml | 82 ++++++++++++++++++----
7 files changed, 88 insertions(+), 22 deletions(-)
diff --git a/core/src/main/java/org/apache/ftpserver/util/StringUtils.java b/core/src/main/java/org/apache/ftpserver/util/StringUtils.java
index 7bba65dc..a618ed7c 100644
--- a/core/src/main/java/org/apache/ftpserver/util/StringUtils.java
+++ b/core/src/main/java/org/apache/ftpserver/util/StringUtils.java
@@ -28,8 +28,13 @@ import java.util.Map;
*
* @author <a href="http://mina.apache.org">Apache MINA Project</a>
*/
-public final class StringUtils {
- private StringUtils() {
+public class StringUtils {
+
+ /**
+ * @deprecated Do not instantiate.
+ */
+ @Deprecated
+ public StringUtils() {
// Nothing to do
}
@@ -41,7 +46,7 @@ public final class StringUtils {
* @param newStr The replacement string
* @return The modified string
*/
- public static String replaceString(String source, String oldStr,
+ public static final String replaceString(String source, String oldStr,
String newStr) {
StringBuilder sb = new StringBuilder(source.length());
int sind = 0;
@@ -68,7 +73,7 @@ public final class StringUtils {
* the original string
* @return The modified string
*/
- public static String replaceString(String source, Object[] args) {
+ public static final String replaceString(String source, Object[] args) {
int startIndex = 0;
int openIndex = source.indexOf('{', startIndex);
if (openIndex == -1) {
@@ -117,7 +122,7 @@ public final class StringUtils {
* the original string
* @return The modified string
*/
- public static String replaceString(String source,
+ public static final String replaceString(String source,
Map<String, Object> args) {
int startIndex = 0;
int openIndex = source.indexOf('{', startIndex);
@@ -165,7 +170,7 @@ public final class StringUtils {
* '>' will be replaced by >
* @param bReplaceQuote if true '\"' will be replaced by "
*/
- public static String formatHtml(String source, boolean bReplaceNl,
+ public static final String formatHtml(String source, boolean bReplaceNl,
boolean bReplaceTag, boolean bReplaceQuote) {
StringBuilder sb = new StringBuilder();
@@ -231,7 +236,7 @@ public final class StringUtils {
/**
* Pad string object.
*/
- public static String pad(String src, char padChar, boolean rightPad,
+ public static final String pad(String src, char padChar, boolean rightPad,
int totalLength) {
int srcLength = src.length();
@@ -255,7 +260,7 @@ public final class StringUtils {
/**
* Get hex string from byte array.
*/
- public static String toHexString(byte[] res) {
+ public static final String toHexString(byte[] res) {
StringBuilder sb = new StringBuilder(res.length << 1);
for (int i = 0; i < res.length; i++) {
String digit = Integer.toHexString(0xFF & res[i]);
@@ -270,7 +275,7 @@ public final class StringUtils {
/**
* Get byte array from hex string.
*/
- public static byte[] toByteArray(String hexString) {
+ public static final byte[] toByteArray(String hexString) {
int arrLength = hexString.length() >> 1;
byte buff[] = new byte[arrLength];
for (int i = 0; i < arrLength; i++) {
diff --git a/distribution/pom.xml b/distribution/pom.xml
index c71d83c5..df87d759 100644
--- a/distribution/pom.xml
+++ b/distribution/pom.xml
@@ -25,6 +25,7 @@
<properties>
<checkstyle.configdir>..</checkstyle.configdir>
+ <japicmp.skip>true</japicmp.skip>
</properties>
<build>
diff --git a/examples/ftpserver-example-spring-war/pom.xml b/examples/ftpserver-example-spring-war/pom.xml
index a3d27a68..edd0a6bf 100644
--- a/examples/ftpserver-example-spring-war/pom.xml
+++ b/examples/ftpserver-example-spring-war/pom.xml
@@ -25,6 +25,7 @@
<properties>
<checkstyle.configdir>../..</checkstyle.configdir>
+ <japicmp.skip>true</japicmp.skip>
</properties>
<dependencies>
diff --git a/examples/ftpserver-osgi-ftplet-service/pom.xml b/examples/ftpserver-osgi-ftplet-service/pom.xml
index 830eeaf8..bdfb0d74 100644
--- a/examples/ftpserver-osgi-ftplet-service/pom.xml
+++ b/examples/ftpserver-osgi-ftplet-service/pom.xml
@@ -30,6 +30,7 @@
<properties>
<checkstyle.configdir>../..</checkstyle.configdir>
+ <japicmp.skip>true</japicmp.skip>
</properties>
<dependencies>
diff --git a/examples/ftpserver-osgi-spring-service/pom.xml b/examples/ftpserver-osgi-spring-service/pom.xml
index da53d298..ac6ad356 100644
--- a/examples/ftpserver-osgi-spring-service/pom.xml
+++ b/examples/ftpserver-osgi-spring-service/pom.xml
@@ -30,6 +30,7 @@
<properties>
<checkstyle.configdir>../..</checkstyle.configdir>
+ <japicmp.skip>true</japicmp.skip>
</properties>
<dependencies>
diff --git a/examples/pom.xml b/examples/pom.xml
index 323ef219..2e93919c 100644
--- a/examples/pom.xml
+++ b/examples/pom.xml
@@ -35,6 +35,7 @@
<properties>
<checkstyle.configdir>..</checkstyle.configdir>
+ <japicmp.skip>true</japicmp.skip>
</properties>
</project>
diff --git a/pom.xml b/pom.xml
index d64fe237..fd08400e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -40,18 +40,6 @@
</license>
</licenses>
- <!-- Temporary add snapshot repository here to be able to resolve snapshot parent pom -->
- <repositories>
- <repository>
- <id>apache.snapshots</id>
- <name>Apache Snapshot Repository</name>
- <url>https://repository.apache.org/snapshots</url>
- <releases>
- <enabled>false</enabled>
- </releases>
- </repository>
- </repositories>
-
<mailingLists>
<mailingList>
<name>FtpServer Users mailing list</name>
@@ -271,7 +259,7 @@
</dependencyManagement>
<build>
- <defaultGoal>clean verify</defaultGoal>
+ <defaultGoal>clean verify japicmp:cmp</defaultGoal>
<pluginManagement>
<plugins>
<plugin>
@@ -359,6 +347,50 @@
</dependency>
</dependencies>
</plugin>
+
+ <plugin>
+ <groupId>com.github.siom79.japicmp</groupId>
+ <artifactId>japicmp-maven-plugin</artifactId>
+ <version>0.15.7</version>
+ <configuration>
+ <oldVersion>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>${project.artifactId}</artifactId>
+ <!--
+ Pick 1.1.2 for FTPSERVER-506 but it should be the previous version in more normal usage
+ when you've been sure that binary compatibility has not been broken from release to release.
+ -->
+ <version>1.1.2</version>
+ <type>jar</type>
+ </dependency>
+ </oldVersion>
+ <newVersion>
+ <file>
+ <path>${project.build.directory}/${project.artifactId}-${project.version}.jar</path>
+ </file>
+ </newVersion>
+ <parameter>
+ <onlyModified>true</onlyModified>
+ <breakBuildOnBinaryIncompatibleModifications>true</breakBuildOnBinaryIncompatibleModifications>
+ <breakBuildOnSourceIncompatibleModifications>true</breakBuildOnSourceIncompatibleModifications>
+ <!-- skip japicmp on "mvn site" - use "mvn package site" to include report -->
+ <ignoreMissingNewVersion>true</ignoreMissingNewVersion>
+ <reportOnlyFilename>true</reportOnlyFilename>
+ <skipPomModules>true</skipPomModules>
+ <ignoreMissingClasses>false</ignoreMissingClasses>
+ <overrideCompatibilityChangeParameters>
+ <overrideCompatibilityChangeParameter>
+ <compatibilityChange>METHOD_NEW_DEFAULT</compatibilityChange>
+ <binaryCompatible>true</binaryCompatible>
+ <sourceCompatible>true</sourceCompatible>
+ <semanticVersionLevel>PATCH</semanticVersionLevel>
+ </overrideCompatibilityChangeParameter>
+ </overrideCompatibilityChangeParameters>
+ </parameter>
+ </configuration>
+ </plugin>
+
</plugins>
</pluginManagement>
@@ -565,6 +597,30 @@
</plugins>
</build>
</profile>
+ <profile>
+ <id>japicmp</id>
+ <activation>
+ <property>
+ <name>enforce.japicmp</name>
+ </property>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>com.github.siom79.japicmp</groupId>
+ <artifactId>japicmp-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>verify</phase>
+ <goals>
+ <goal>cmp</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
</profiles>
<modules>