search cancel

java.nio.charset.MalformedInputException Error while masking the file with Special characters '£' in FDM

book

Article ID: 215030

calendar_today

Updated On:

Products

CA Test Data Manager (Data Finder / Grid Tools)

Issue/Introduction

Working on data masking of files which has special characters. Masking is being failed specifically for character  '£. 

java.io.UncheckedIOException: java.nio.charset.MalformedInputException: Input length = 1
 at java.io.BufferedReader$1.hasNext(Unknown Source)
 at java.util.Iterator.forEachRemaining(Unknown Source)
 at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Unknown Source)
 at java.util.stream.AbstractPipeline.copyInto(Unknown Source)
 at java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source)
 at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(Unknown Source)
 at java.util.stream.AbstractPipeline.evaluate(Unknown Source)
 at java.util.stream.LongPipeline.reduce(Unknown Source)
 at java.util.stream.LongPipeline.sum(Unknown Source)
 at java.util.stream.ReferencePipeline.count(Unknown Source)
 at com.grid_tools.products.datamasker.Datamasker.getNumberOfLines(Datamasker.java:5970)
 at com.grid_tools.products.datamasker.Datamasker.doFileMasking(Datamasker.java:8202)
 at com.grid_tools.products.datamasker.Datamasker.main(Datamasker.java:2662)
Caused by: java.nio.charset.MalformedInputException: Input length = 1

 

Cause

This error may be caused due to incorrect file encoding. For example the file encoding could be ANSI.

Environment

Release : 4.9

Component : CA Test Data Manager - Others

Resolution

We found that the issue was with the file encoding being "ANSI".

To check. open the source file in a text editor like Notepad++ and check the encoding menu.

If it is anything other than UTF-8, then convert the source file to UTF-8 encoding and save.

Using this converted file, masking would be successful.