Skip to content

Commit

Permalink
Polishing
Browse files Browse the repository at this point in the history
  • Loading branch information
jpomykala committed Sep 8, 2023
1 parent ec6b260 commit 7a842c5
Show file tree
Hide file tree
Showing 19 changed files with 195 additions and 127 deletions.
2 changes: 1 addition & 1 deletion junit/mock-server/test.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
public class ObjectMapperSingleton
{

private static ObjectMapper INSTANCE = null;
private static ObjectMapper INSTANCE = null; //NOSONAR

private ObjectMapperSingleton()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,12 +182,12 @@ private void throwOnError(HttpResponse<?> httpResponse)

private String safeCastHttpBodyToString(Object responseBody)
{
if (responseBody instanceof byte[])
if (responseBody instanceof byte[] responseBodyBytes)
{
return new String((byte[]) responseBody);
} else if (responseBody instanceof String)
return new String(responseBodyBytes);
} else if (responseBody instanceof String responseBodyString)
{
return (String) responseBody;
return responseBodyString;
}
return "";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ private DownloadRequestBuilder()
{
}

public static DownloadRequestBuilder Builder()
public static DownloadRequestBuilder builder()
{
return new DownloadRequestBuilder();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ private FileToUploadBuilder()
{
}

public static FileToUploadBuilder Builder()
public static FileToUploadBuilder builder()
{
return new FileToUploadBuilder();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ private UploadFileRequestBuilder()
{
}

public static UploadFileRequestBuilder Builder()
public static UploadFileRequestBuilder builder()
{
return new UploadFileRequestBuilder();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ private DownloadableFileBuilder()
{
}

public static DownloadableFileBuilder Builder()
public static DownloadableFileBuilder builder()
{
return new DownloadableFileBuilder();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public void invoke() throws IOException, InterruptedException
downloadOptions.add("SPLIT_BY_LANGUAGES");
}

DownloadRequest downloadRequest = DownloadRequest.DownloadRequestBuilder.Builder()
DownloadRequest downloadRequest = DownloadRequest.DownloadRequestBuilder.builder()
.withFormat(downloadFormat)
.withOptions(downloadOptions)
.withCustomerId(customerId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public void invoke() throws IOException, InterruptedException
Float translated = Objects.requireNonNullElse(translatedNullable, 0.0f);
Float translatedPercentage = translated * 100;
String translatedPercentageFormatted = String.format("%.0f", translatedPercentage);
log.info("Translated: {}", translatedPercentageFormatted + "%");
log.info("Translated: {}%", translatedPercentageFormatted);
log.info("Languages: {}", json.read("$.data.languages[*].key").toString());
log.info("Environments: {}", json.read("$.data.environments[*].key").toString());
log.info("Namespaces: {}", json.read("$.data.namespaces[*].name").toString());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import java.util.List;
import java.util.Optional;

import static io.simplelocalize.cli.client.dto.UploadRequest.UploadFileRequestBuilder.Builder;
import static io.simplelocalize.cli.client.dto.UploadRequest.UploadFileRequestBuilder.builder;

public class UploadCommand implements CliCommand
{
Expand Down Expand Up @@ -93,7 +93,7 @@ public void invoke() throws IOException, InterruptedException
String uploadFormat = configuration.getUploadFormat();
String customerId = configuration.getCustomerId();
List<String> uploadOptions = configuration.getUploadOptions();
UploadRequest uploadRequest = Builder()
UploadRequest uploadRequest = builder()
.withPath(fileToUpload.path())
.withLanguageKey(requestLanguageKey)
.withNamespace(fileToUpload.namespace())
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/io/simplelocalize/cli/io/FileListReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ private List<FileToUpload> findMatchingFiles(Path parentDirectory, String patter
{
String lang = getGroupOrNull("lang", matcher);
String ns = getGroupOrNull("ns", matcher);
return FileToUpload.FileToUploadBuilder.Builder()
return FileToUpload.FileToUploadBuilder.builder()
.withLanguage(lang)
.withNamespace(ns)
.withPath(file).build();
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/io/simplelocalize/cli/io/JsonReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ public JsonReader()

public DocumentContext read(String json)
{
Configuration mappingConfiguration = Configuration.defaultConfiguration()
Configuration jsonPathConfiguration = Configuration.defaultConfiguration()
.jsonProvider(this.jsonProvider)
.mappingProvider(this.mappingConfiguration);
return JsonPath.parse(json, mappingConfiguration);
return JsonPath.parse(json, jsonPathConfiguration);
}
}
Loading

0 comments on commit 7a842c5

Please sign in to comment.