Skip to content

Fix: capitalize breaks with empty strings #751

@TobiasNx

Description

@TobiasNx

Code reviewer: @blackwinter

https://metafacture.org/playground/?flux=inputFile%0A%7Copen-file%0A%7Cas-lines%0A%7Cdecode-json%0A%7Cfix%28transformationFile%29%0A%7Cencode-yaml%0A%7Cprint%0A%3B&transformation=capitalize%28%22test%22%29&data=%7B%22test%22%3A+%22%22%7D

In:

{"test": ""}

Flux:

inputFile
|open-file
|as-lines
|decode-json
|fix(transformationFile)
|encode-yaml
|print
;

Error:

org.metafacture.metafix.FixProcessException: Error while executing Fix expression (at file:/home/playground/metafacture-playground/tmp/metafix6198042882328814353.fix, line 1): capitalize("test")
...
Caused by: java.lang.StringIndexOutOfBoundsException: begin 0, end 1, length 0

The function should skip the string if it is empty.

Metadata

Metadata

Assignees

Type

No fields configured for Bug.

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions