Search code examples
javasnakeyaml

Exception in thread "main" mapping values are not allowed here


I've go an error when trying to parse a yaml file

Yaml :

!!com.exalow.easymind.core.entities.UserImpl
avatarUrl: avatar.jpg
email: wowo.owow@magicmail.com
id: '8733a58c-4aaf-4da0-bbe7-aaf7ad66ab7a'
password: '1234'
username: Exalow
workspace: "Path"

Error :

Exception in thread "main" mapping values are not allowed here
 in 'string', line 1, column 95:
     ... jpgemail: wowo.owow@magicmail.comid: '8733a58c-4aaf-4da0-bbe7-aaf7a ... 

I use this code to read files : https://pastebin.com/ThDRGxkN


Solution

  • It seem that the line ending characters are missing (at least for the first two lines). Could it be that you read the content first from a file into a string with BufferedReader.readLine() and that you forgot to add the line breaks after adding each line to the string?