Skip to content
Merged
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 @@ -18,10 +18,9 @@
import java.util.Map;
import java.util.Set;
import java.util.concurrent.Callable;
import java.util.concurrent.TimeoutException;
import java.util.logging.Logger;

import javax.naming.TimeLimitExceededException;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import picocli.CommandLine;
Expand Down Expand Up @@ -216,7 +215,7 @@ public Integer call() throws Exception {
LocaleData.TxJobStatus jobStatus = null;
try {
jobStatus = cdsHandler.pushSourceStrings(postData);
} catch (TimeLimitExceededException e) {
} catch (TimeoutException e) {
System.out.println("Strings are queued for processing");
return 0;
}
Expand Down Expand Up @@ -270,7 +269,7 @@ public Integer call() throws Exception {
LocaleData.TxJobStatus jobStatus = null;
try {
jobStatus = cdsHandler.pushSourceStrings(postData);
} catch (TimeLimitExceededException e) {
} catch (TimeoutException e) {
System.out.println("Source string clearing is queued for processing");
return 0;
}
Expand Down Expand Up @@ -446,4 +445,4 @@ String getErrorString(@NonNull LocaleData.TxJobStatus jobStatus) {
private static @NonNull String getNonDownloadedLocalesString(@NonNull HashSet<String> nonDownloadedLocales) {
return "The translations for the following locales were not downloaded: " + Arrays.toString(nonDownloadedLocales.toArray());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,10 @@
import java.net.URISyntaxException;
import java.net.URL;
import java.util.Set;
import java.util.concurrent.TimeoutException;
import java.util.logging.Level;
import java.util.logging.Logger;

import javax.naming.TimeLimitExceededException;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

Expand Down Expand Up @@ -345,11 +344,11 @@ public LocaleData.TranslationMap fetchTranslations(@Nullable String localeCode,
* The job status can be either <code>"completed"</code> or <code>"failed"</code>.
* If everything fails, <code>null</code> is returned.
*
* @throws TimeLimitExceededException When the server takes longer than 20 seconds to complete
* @throws TimeoutException When the server takes longer than 20 seconds to complete
* processing the job.
*/
public @Nullable
LocaleData.TxJobStatus pushSourceStrings(@NonNull LocaleData.TxPostData postData) throws TimeLimitExceededException {
LocaleData.TxJobStatus pushSourceStrings(@NonNull LocaleData.TxPostData postData) throws TimeoutException {
LocaleData.TxPostResponseData response = pushSourceStringsInternal(postData);
if (response == null) {
return null;
Expand Down Expand Up @@ -462,13 +461,13 @@ LocaleData.TxJobStatus pushSourceStrings(@NonNull LocaleData.TxPostData postData
* @return The job status object or <code>null</code> if everything failed. The job status can
* be either <code>"completed"</code> or <code>"failed"</code>.
*
* @throws TimeLimitExceededException When the server takes longer than 20 seconds to complete
* @throws TimeoutException When the server takes longer than 20 seconds to complete
* processing the job.
*
* @see <a href="https://github.com/transifex/transifex-delivery/#job-status">
* https://github.com/transifex/transifex-delivery/#job-status</a>
*/
private @Nullable LocaleData.TxJobStatus getJobStatus(@NonNull LocaleData.TxPostResponseData responseData) throws TimeLimitExceededException {
private @Nullable LocaleData.TxJobStatus getJobStatus(@NonNull LocaleData.TxPostResponseData responseData) throws TimeoutException {
URL url = null;
try {
URI cdsContentURI = new URI(mCdsHost);
Expand Down Expand Up @@ -531,7 +530,7 @@ LocaleData.TxJobStatus pushSourceStrings(@NonNull LocaleData.TxPostData postData
}
}

throw new TimeLimitExceededException("Server is still processing the pushed strings");
throw new TimeoutException("Server is still processing the pushed strings");
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
import java.util.Arrays;
import java.util.HashSet;
import java.util.LinkedHashMap;

import javax.naming.TimeLimitExceededException;
import java.util.concurrent.TimeoutException;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
Expand Down Expand Up @@ -354,7 +353,7 @@ public void testPushSourceStrings_badURL() {
LocaleData.TxJobStatus jobStatus = null;
try {
jobStatus = cdsHandler.pushSourceStrings(postData);
} catch (TimeLimitExceededException ignored) {}
} catch (TimeoutException ignored) {}

assertThat(jobStatus).isNull();
}
Expand All @@ -369,7 +368,7 @@ public void testPushSourceStrings_normal() {
LocaleData.TxJobStatus jobStatus = null;
try {
jobStatus = cdsHandler.pushSourceStrings(postData);
} catch (TimeLimitExceededException ignored) {}
} catch (TimeoutException ignored) {}

assertThat(jobStatus).isNotNull();

Expand Down Expand Up @@ -405,7 +404,7 @@ public void testPushSourceStrings_CDSRespondsWith409_returnNull() {
LocaleData.TxJobStatus jobStatus = null;
try {
jobStatus = cdsHandler.pushSourceStrings(postData);
} catch (TimeLimitExceededException ignored) {}
} catch (TimeoutException ignored) {}


assertThat(jobStatus).isNull();
Expand All @@ -421,7 +420,7 @@ public void testPushSourceStrings_CDSRespondsWithFailedJob_returnErrorInResponse
LocaleData.TxJobStatus jobStatus = null;
try {
jobStatus = cdsHandler.pushSourceStrings(postData);
} catch (TimeLimitExceededException ignored) {}
} catch (TimeoutException ignored) {}

assertThat(jobStatus).isNotNull();

Expand Down
Loading