-
Notifications
You must be signed in to change notification settings - Fork 10
Open
Description
We are using smartling java sdk 0.18 to upload dynamically generated json files to smartling.
We use FilesAPI for that like this:
final InputStream stream = new ByteArrayInputStream(JACKSON_OBJECT_MAPPER.writeValueAsString(myDTOWithStrings));
final ImportTranslationsPTO pto =
ImportTranslationsPTO.builder()
.file(stream)
.fileUri(fileUri)
.fileType(JSON.name())
.translationState(TranslationState.PUBLISHED)
.overwrite(false)
.build();
...
final ImportTranslationsResponse response =
filesApi.importTranslations(projectId, locale, pto);
Quite often we get the exception:
com.smartling.api.v2.client.exception.client.ValidationErrorException: http_status=400, requestId=daedf180-7ea3-4651-92ba-847c777f4d58, top errors: 'File is required'
at com.smartling.api.v2.client.exception.DefaultRestApiExceptionMapper.toExceptionByStatus(DefaultRestApiExceptionMapper.java:89)
at com.smartling.api.v2.client.exception.DefaultRestApiExceptionMapper.toException(DefaultRestApiExceptionMapper.java:44)
at com.smartling.api.files.v2.exceptions.FilesApiExceptionMapper.toException(FilesApiExceptionMapper.java:44)
at com.smartling.api.v2.client.exception.RestApiExceptionHandler.createRestApiException(RestApiExceptionHandler.java:31)
at com.smartling.api.v2.client.ExceptionDecoratorInvocationHandler.invoke(ExceptionDecoratorInvocationHandler.java:34)
at com.sun.proxy.$Proxy101.importTranslations(Unknown Source)
[my service stack trace]
Caused by: javax.ws.rs.BadRequestException: HTTP 400 Bad Request
at org.jboss.resteasy.client.jaxrs.internal.ClientInvocation.handleErrorStatus(ClientInvocation.java:220)
at org.jboss.resteasy.client.jaxrs.internal.ClientInvocation.extractResult(ClientInvocation.java:196)
at org.jboss.resteasy.client.jaxrs.internal.proxy.extractors.BodyEntityExtractor.extractEntity(BodyEntityExtractor.java:62)
at org.jboss.resteasy.client.jaxrs.internal.proxy.ClientInvoker.invokeSync(ClientInvoker.java:151)
at org.jboss.resteasy.client.jaxrs.internal.proxy.ClientInvoker.invoke(ClientInvoker.java:112)
at org.jboss.resteasy.client.jaxrs.internal.proxy.ClientProxy.invoke(ClientProxy.java:76)
at com.sun.proxy.$Proxy100.importTranslations(Unknown Source)
at jdk.internal.reflect.GeneratedMethodAccessor349.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at com.smartling.api.v2.client.ExceptionDecoratorInvocationHandler.invoke(ExceptionDecoratorInvocationHandler.java:30)
... 32 common frames omitted
Executing the code again usually helps, but I'd like to avoid that error in the first place. What does this error actually mean and how can we avoid getting it?
Metadata
Metadata
Assignees
Labels
No labels