You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

This is a rather special kind of IO exception that indicates a mismatch between the bytes of a file and its encoding. For instance, if a POM file declares

<?xml version="1.0" encoding="UTF-8"?>

in its header, its binary contents must be a valid UTF-8 byte sequence. This means that any Non-ASCII character needs to be encoded as a sequence of two or more bytes. A file whose contents is not properly encoded, e.g. because a user edited/saved the file in another encoding than specified in the XML declaration, can cause this exception. While this exception is not raised on all JREs, the underlying issue is the same, the file contents is invalid and needs to be re-encoded to fit the declared encoding or the encoding given by the XML declaration needs to be adjusted to match the contents.

  • No labels