Buggy code:
private static final Attributes BODY_ATTS = new AttributesBuilder ( ) . add ( ATTRIBUTE_NAME_CLASS , TOPIC_BODY . toString ( ) ) . build ( ) ; private static final Attributes SECTION_ATTS = new AttributesBuilder ( ) . add ( ATTRIBUTE_NAME_CLASS , TOPIC_SECTION . toString ( ) ) . build ( ) ; private static final Attributes LI_ATTS = new AttributesBuilder ( ) . add ( ATTRIBUTE_NAME_CLASS , TOPIC_LI . toString ( ) ) . build ( ) ; private static final Attributes P_ATTS = new AttributesBuilder ( ) . add ( ATTRIBUTE_NAME_CLASS , TOPIC_P . toString ( ) ) . build ( ) ; private static final Attributes I_ATTS = new AttributesBuilder ( ) . add ( ATTRIBUTE_NAME_CLASS , HI_D_I . toString ( ) ) . build ( ) ; private static final Attributes B_ATTS = new AttributesBuilder ( ) . add ( ATTRIBUTE_NAME_CLASS , HI_D_B . toString ( ) ) . build ( ) ; private static final Attributes DD_ATTS = new AttributesBuilder ( ) . add ( ATTRIBUTE_NAME_CLASS , TOPIC_DD . toString ( ) ) . build ( ) ; private static final Attributes CODEPH_ATTS = new AttributesBuilder ( ) . add ( ATTRIBUTE_NAME_CLASS , PR_D_CODEPH . toString ( ) ) . build ( ) ; private static final Attributes CODEBLOCK_ATTS = new AttributesBuilder ( ) . add ( ATTRIBUTE_NAME_CLASS , PR_D_CODEBLOCK . toString ( ) ) . build ( ) ; private static final Attributes DT_ATTS = new AttributesBuilder ( ) . add ( ATTRIBUTE_NAME_CLASS , TOPIC_DT . toString ( ) ) . build ( ) ; private static final Attributes DEL_ATTS = new AttributesBuilder ( ) . add ( ATTRIBUTE_NAME_CLASS , TOPIC_PH . toString ( ) ) . add ( "importance" , "deleted" ) . build ( ) ; private static final Attributes TITLE_ATTS = new AttributesBuilder ( ) . add ( ATTRIBUTE_NAME_CLASS , TOPIC_TITLE . toString ( ) ) . build ( ) ; private static final Attributes BLOCKQUOTE_ATTS = new AttributesBuilder ( ) . add ( ATTRIBUTE_NAME_CLASS , TOPIC_PRE . toString ( ) ) . build ( ) ; private static final Attributes UL_ATTS = new AttributesBuilder ( ) . add ( ATTRIBUTE_NAME_CLASS , TOPIC_UL . toString ( ) ) . build ( ) ; private static final Attributes DL_ATTS = new AttributesBuilder ( ) . add ( ATTRIBUTE_NAME_CLASS , TOPIC_DL . toString ( ) ) . build ( ) ; private static final Attributes OL_ATTS = new AttributesBuilder ( ) . add ( ATTRIBUTE_NAME_CLASS , TOPIC_OL . toString ( ) ) . build ( ) ; private static final Attributes TABLE_ATTS = new AttributesBuilder ( ) . add ( ATTRIBUTE_NAME_CLASS , TOPIC_TABLE . toString ( ) ) . build ( ) ; private static final Attributes TBODY_ATTS = new AttributesBuilder ( ) . add ( ATTRIBUTE_NAME_CLASS , TOPIC_TBODY . toString ( ) ) . build ( ) ; private static final Attributes THEAD_ATTS = new AttributesBuilder ( ) . add ( ATTRIBUTE_NAME_CLASS , TOPIC_THEAD . toString ( ) ) . build ( ) ; private static final Attributes TR_ATTS = new AttributesBuilder ( ) . add ( ATTRIBUTE_NAME_CLASS , TOPIC_ROW . toString ( ) ) . build ( ) ; private static final Attributes IMAGE_ATTS = new AttributesBuilder ( ) . add ( ATTRIBUTE_NAME_CLASS , TOPIC_IMAGE . toString ( ) ) . build ( ) ; private static final Attributes XREF_ATTS = new AttributesBuilder ( ) . add ( ATTRIBUTE_NAME_CLASS , TOPIC_XREF . toString ( ) ) . build ( ) ; private static final Attributes ALT_ATTS = new AttributesBuilder ( ) . add ( ATTRIBUTE_NAME_CLASS , TOPIC_ALT . toString ( ) ) . build ( ) ; private static final Attributes PH_ATTS = new AttributesBuilder ( ) . add ( ATTRIBUTE_NAME_CLASS , TOPIC_PH . toString ( ) ) . build ( ) ; private static final Attributes ENTRY_ATTS = new AttributesBuilder ( ) . add ( ATTRIBUTE_NAME_CLASS , TOPIC_ENTRY . toString ( ) ) . build ( ) ; private static final Attributes FIG_ATTS = new AttributesBuilder ( ) . add ( ATTRIBUTE_NAME_CLASS , TOPIC_FIG . toString ( ) ) . build ( ) ; public void toHtml ( final RootNode astRoot ) throws SAXException { } public void clean ( final RootNode node ) { final Node first = node . getChildren ( ) . get ( 0 ) ; if ( ( first instanceof ParaNode ) && ( toString ( first ) . startsWith ( "%" ) ) ) { final Map < String , String > metadata = new HashMap < > ( ) ; <START_BUG> final String [ ] fields = toString ( node ) . split ( "\n" ) ; <END_BUG> if ( ( fields . length ) >= 1 ) { metadata . put ( "title" , fields [ 0 ] . substring ( 1 ) ) ; } final ToDitaSerializer . MetadataNode m = new ToDitaSerializer . MetadataNode ( metadata . get ( "title" ) ) ; node . getChildren ( ) . set ( 0 , m ) ; } } private void toString ( final Node node , final StringBuilder buf ) { } private String toString ( final Node node ) { } @ Override public void visit ( final RootNode node ) { } @ Override public void visit ( final AbbreviationNode node ) { } @ Override public void visit ( final AutoLinkNode node ) { } @ Override public void visit ( final BlockQuoteNode node ) { } @ Override public void visit ( final BulletListNode node ) { } @ Override public void visit ( final CodeNode node ) { } @ Override public void visit ( final DefinitionListNode node ) { }

Fix:
final String [ ] fields = toString ( first ) . split ( "\n" ) ;