public String getFormattedSourceCode ( ) { try { JavaSource source = new JavaSourceParser ( ) . parse ( new StringReader ( sourceCode ) ) ; JavaSource2HTMLConverter converter = new JavaSource2HTMLConverter ( ) ; StringWriter writer = new StringWriter ( ) ; JavaSourceConversionOptions options = JavaSourceConversionOptions . getDefault ( ) ; options . setShowLineNumbers ( false ) ; options . setAddLineAnchors ( false ) ; converter . convert ( source , options , writer ) ; return writer . toString ( ) ; } catch ( IllegalConfigurationException exception ) { return sourceCode ; } catch ( IOException exception ) { return sourceCode ; } }
Returns the duplicate source code fragment as formatted HTML string .