Skip to content
Closed
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
8 changes: 5 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: 2
jobs:
test:
docker:
- image: openjdk:11
- image: openjdk:17
steps:
- checkout
- run:
Expand All @@ -17,7 +17,7 @@ jobs:
path: test-results
deploy:
docker:
- image: openjdk:11
- image: openjdk:17
steps:
- add_ssh_keys:
fingerprints:
Expand Down Expand Up @@ -49,4 +49,6 @@ workflows:
- test
filters:
branches:
only: master
only:
- master
- 2.x
2 changes: 1 addition & 1 deletion .mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.2/apache-maven-3.6.2-bin.zip
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.8/apache-maven-3.8.8-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.5/maven-wrapper-0.5.5.jar
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,26 @@

Java SDK for integrating with the [Smartling API].

> **Note**: Version 2.x requires Java 17+. If you need Java 8 compatibility, use version 1.x (maintenance mode).

## SDK Versions

We maintain two major versions of this SDK:

### Version 2.x (Current - Recommended)
- **Branch**: `2.x`
- **Java Compatibility**: Java 17+
- **Status**: Active development
- **Recommendation**: All new projects should use 2.x. Existing projects are strongly encouraged to migrate.

### Version 1.x (Maintenance Mode)
- **Branch**: `master`
- **Java Compatibility**: Java 8+
- **Status**: Maintenance only - critical fixes and security updates
- **Future**: Will be deprecated once migration to 2.x is complete

We strongly encourage all users to migrate to version 2.x to benefit from modern Java features, improved performance, and continued feature development. Version 1.x will eventually be deprecated as Smartling projects and clients complete their migration.

## Using this SDK

The Smartling API SDK is distributed via Maven Central and is compatible with JDK 1.7
Expand Down
47 changes: 28 additions & 19 deletions pom.xml
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we have to change the major version of sdk itsefl (1.26... --> 2.0.0)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, change the version and a couple more minor tweaks.

The purpose of this PR is to inform everyone that there will be a new major version (since all teams are actively working on updating services).

Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,20 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<org.powermock.version>2.0.4</org.powermock.version>
<org.jboss.resteasy.version>4.6.1.Final</org.jboss.resteasy.version>
<org.jboss.resteasy.version>4.7.10.Final</org.jboss.resteasy.version>
<apache.httpclient.version>4.5.14</apache.httpclient.version>
<jackson.version>2.12.3</jackson.version>
<okhttp.version>4.9.3</okhttp.version>
<wiremock.version>2.26.0</wiremock.version>
<jackson.version>2.17.3</jackson.version>
<okhttp.version>4.12.0</okhttp.version>
<wiremock.version>2.35.2</wiremock.version>
</properties>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>1.3.2</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
Expand All @@ -45,10 +49,15 @@
</dependencyManagement>

<dependencies>
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>1.3.2</version>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can drop version here, it is defined in dependencyManagement

</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.10</version>
<version>1.18.38</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -79,24 +88,24 @@
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.28</version>
<version>2.0.16</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.28</version>
<version>2.0.16</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.1</version>
<version>4.13.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>2.28.2</version>
<version>5.18.0</version>
<scope>test</scope>
</dependency>
<dependency>
Expand All @@ -107,7 +116,7 @@
</dependency>
<dependency>
<groupId>com.github.tomakehurst</groupId>
<artifactId>wiremock</artifactId>
<artifactId>wiremock-jre8</artifactId>
<version>${wiremock.version}</version>
<scope>test</scope>
</dependency>
Expand All @@ -118,10 +127,10 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<version>3.13.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<source>17</source>
<target>17</target>
<compilerArgs>
<arg>-parameters</arg>
</compilerArgs>
Expand All @@ -130,7 +139,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.6</version>
<version>3.2.7</version>
<configuration>
<gpgArguments>
<gpgArgument>--no-tty</gpgArgument>
Expand All @@ -152,7 +161,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.1.1</version>
<version>3.11.2</version>
<configuration>
<links>
<link>https://docs.oracle.com/javaee/7/api/</link>
Expand Down Expand Up @@ -226,7 +235,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.5.3</version>
<version>3.1.1</version>
<configuration>
<autoVersionSubmodules>true</autoVersionSubmodules>
<dryRun>false</dryRun>
Expand All @@ -241,7 +250,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.2.1</version>
<version>3.3.1</version>
<executions>
<execution>
<id>attach-sources</id>
Expand All @@ -254,7 +263,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.1.1</version>
<version>3.11.2</version>
<executions>
<execution>
<id>attach-javadocs</id>
Expand Down
7 changes: 6 additions & 1 deletion samrtling-api-test-utils/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,13 @@
<dependencies>
<dependency>
<groupId>com.github.tomakehurst</groupId>
<artifactId>wiremock</artifactId>
<artifactId>wiremock-jre8</artifactId>
<version>${wiremock.version}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.17.0</version>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,12 @@ public class DefaultClientConfiguration implements ClientConfiguration
@NonNull
private HttpClientConfiguration httpClientConfiguration = new HttpClientConfiguration();

@Builder.Default
private ResteasyProviderFactory resteasyProviderFactory = null;

@Builder.Default
private RestApiExceptionMapper exceptionMapper = null;

@Builder.Default
private LibNameVersionHolder libNameVersionHolder = null;
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public RestApiContextResolver(final Map<Class<?>, JsonDeserializer<?>> classJson
deserializerModule.addSerializer(klass, (JsonSerializer) classJsonSerializerMap.get(klass));

objectMapper.registerModule(deserializerModule);
objectMapper.registerModule(new KotlinModule());
objectMapper.registerModule(new KotlinModule.Builder().build());

this.objectMapper = objectMapper;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import org.apache.commons.lang3.StringUtils;
import org.jboss.resteasy.annotations.providers.multipart.PartType;
import org.jboss.resteasy.plugins.providers.multipart.FieldEnablerPrivilegedAction;
import org.jboss.resteasy.plugins.providers.multipart.MultipartFormAnnotationWriter;
import org.jboss.resteasy.plugins.providers.multipart.MultipartFormDataOutput;
import org.jboss.resteasy.spi.WriterException;
Expand All @@ -12,7 +11,6 @@
import javax.ws.rs.ext.Provider;
import java.io.IOException;
import java.lang.reflect.Field;
import java.security.AccessController;
import java.util.List;
import java.util.Map;

Expand All @@ -39,7 +37,7 @@ protected void getFields(Class<?> type, MultipartFormDataOutput output, Object o
{
if (field.isAnnotationPresent(DynamicFormParam.class) && field.isAnnotationPresent(PartType.class))
{
AccessController.doPrivileged(new FieldEnablerPrivilegedAction(field));
field.setAccessible(true);

Object value = safeExtractValue(obj, field);

Expand Down Expand Up @@ -67,7 +65,7 @@ protected void getFields(Class<?> type, MultipartFormDataOutput output, Object o
}
if (field.isAnnotationPresent(ListFormParam.class) && field.isAnnotationPresent(PartType.class))
{
AccessController.doPrivileged(new FieldEnablerPrivilegedAction(field));
field.setAccessible(true);
Object value = safeExtractValue(obj, field);

if (value instanceof List)
Expand All @@ -88,7 +86,7 @@ protected void getFields(Class<?> type, MultipartFormDataOutput output, Object o
}
if (field.isAnnotationPresent(FileFormParam.class) && field.isAnnotationPresent(PartType.class))
{
AccessController.doPrivileged(new FieldEnablerPrivilegedAction(field));
field.setAccessible(true);

FileFormParam fileFormParam = field.getAnnotation(FileFormParam.class);
String name = fileFormParam.value();
Expand All @@ -112,7 +110,7 @@ private String getFilename(Object obj, Field[] declaredFields, Field field)
{
if (declaredField.getName().equals(filenameField))
{
AccessController.doPrivileged(new FieldEnablerPrivilegedAction(declaredField));
declaredField.setAccessible(true);

return (String) safeExtractValue(obj, declaredField);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,9 @@ public void shouldLogWeirdContentType()
"\tgenericType: class com.smartling.api.v2.authentication.pto.Authentication\n" +
"\tannotations: [\n" +
"\t\t@javax.ws.rs.POST()\n" +
"\t\t@javax.ws.rs.Path(value=\"/authenticate\")\n" +
"\t\t@javax.ws.rs.Path(\"/authenticate\")\n" +
"\t]\n" +
"\theaders: [Content-Type=*/*,Matched-Stub-Id=" + stubMapping.getId() + ",Server=Jetty(9.2.28.v20190418),Transfer-Encoding=chunked,Vary=Accept-Encoding, User-Agent]\n" +
"\theaders: [Content-Type=*/*,Matched-Stub-Id=" + stubMapping.getId() + ",Transfer-Encoding=chunked,Vary=Accept-Encoding, User-Agent]\n" +
"\tmedia type: */*\n" +
"\tbody: {\"response\":{\"code\":\"SUCCESS\",\"data\":{\"accessToken\":\"accessTokenValue\",\"refreshToken\":\"refreshTokenValue\",\"expiresIn\":480,\"refreshExpiresIn\":21600,\"tokenType\":\"Bearer\"}}}";
String actualMessage = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public void setUp() throws Exception
public void testDeserializeNullBody() throws Exception
{
when(node.getNodeType()).thenReturn(JsonNodeType.NULL);
when(node.isNull()).thenReturn(true);
final Details details = detailsDeserializer.deserialize(parser, null);
assertNull(details);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,25 +183,25 @@ public void testUploadAttachment() throws Exception
"\r\n" +
"content\r\n" +
partSeparator + "\r\n" +
"Content-Disposition: form-data; name=\"name\"\r\n" +
"Content-Disposition: form-data; name=\"entityUids\"\r\n" +
"Content-Type: text/plain\r\n" +
"\r\n" +
"test.txt\r\n" +
"jobUuid1\r\n" +
partSeparator + "\r\n" +
"Content-Disposition: form-data; name=\"description\"\r\n" +
"Content-Disposition: form-data; name=\"entityUids\"\r\n" +
"Content-Type: text/plain\r\n" +
"\r\n" +
"description\r\n" +
"jobUuid2\r\n" +
partSeparator + "\r\n" +
"Content-Disposition: form-data; name=\"entityUids\"\r\n" +
"Content-Disposition: form-data; name=\"name\"\r\n" +
"Content-Type: text/plain\r\n" +
"\r\n" +
"jobUuid1\r\n" +
"test.txt\r\n" +
partSeparator + "\r\n" +
"Content-Disposition: form-data; name=\"entityUids\"\r\n" +
"Content-Disposition: form-data; name=\"description\"\r\n" +
"Content-Type: text/plain\r\n" +
"\r\n" +
"jobUuid2\r\n" +
"description\r\n" +
partSeparator + "--");

assertEquals(expectedPTO.getAttachmentUid(), response.getAttachmentUid());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import org.jboss.resteasy.annotations.providers.multipart.PartType;
import org.jboss.resteasy.client.jaxrs.ResteasyWebTarget;
import org.jboss.resteasy.client.jaxrs.internal.ClientResponse;
import org.jboss.resteasy.plugins.providers.multipart.FieldEnablerPrivilegedAction;
import org.jboss.resteasy.plugins.providers.multipart.MultipartFormDataOutput;

import javax.ws.rs.FormParam;
Expand All @@ -21,7 +20,6 @@
import java.lang.reflect.AccessibleObject;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.security.AccessController;
import java.util.Map;

@Slf4j
Expand Down Expand Up @@ -65,7 +63,7 @@ public static void getFields(Class<?> type, MultipartFormDataOutput output, Obje
{
for (Field field : type.getDeclaredFields())
{
AccessController.doPrivileged(new FieldEnablerPrivilegedAction(field));
field.setAccessible(true);
Object value = getFieldValue(field, obj);
if (value == null)
{
Expand Down
Loading