freenowtech / freenowtech/phrase-java-client

Missing translation files keep PhraseAppSyncTask to fail

Offen
#3 0 Kommentare 0 Reaktionen 1 zugewiesene Person Beansprucht von @cod3hulk Auf GitHub ansehen
bug
Vorherrschende Sprache
Java
Sterne
7
Forks
7
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

When an empty local is added to the project, without any translations, the update process of the translations will fail due to the missing translation file.

```java
com.mytaxi.apis.phrase.exception.PhraseAppApiException: Could not get data from cache! Somethings goes wrong.
at com.mytaxi.apis.phrase.api.GenericPhraseAPI.getCachedData(GenericPhraseAPI.java:138)
at com.mytaxi.apis.phrase.api.GenericPhraseAPI.handleResponse(GenericPhraseAPI.java:162)
at com.mytaxi.apis.phrase.api.localedownload.DefaultPhraseLocaleDownloadAPI.downloadLocale(DefaultPhraseLocaleDownloadAPI.java:87)
at com.mytaxi.apis.phrase.tasks.PhraseAppSyncTask.run(PhraseAppSyncTask.java:87)
```

This leads to the failing update for the remaining locales because of the implementation in the PhraseAppSyncTask is not handling the error inside the update loop of the locales:
```java
@Override
public void run()
{
try
{
LOG.info("START Update Messages in messagesPath: " + fileService.getGeneratedResourcesFoldername());

checkAndGetPhraseLocales();

for (final String projectId : projectIds)
{
final List locales = getLocales(projectId);
if (locales != null)
{
for (final PhraseLocale locale : locales)
{
byte[] translationByteArray = localeDownloadAPI.downloadLocale(projectId, locale.getId(), format);
if (translationByteArray == null || translationByteArray.length == 0)
{
LOG.warn("Could not receive any data from PhraseAppApi for locale: {}. Please check configuration in PhraseApp!", locale);
translationByteArray = "no.data.received=true".getBytes();
}
fileService.saveToFile(projectId, translationByteArray, locale.getCode().replace('-', '_'));
}
}
}

LOG.info("FINISHED Update Messages");
}
catch (final Exception e)
{
LOG.error("Error due running the PhraseAppSyncTask", e);
}
}
```

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.