Buggy code:
public class NewCanonicalizationRemoveCommand extends AbstractHandler { private String canonVersion ; private String canonTarget ; private IFile file = null ; private ExecutionEvent event ; public Object execute ( ExecutionEvent event ) throws ExecutionException { } private void createCanonicalization ( ) { try { IDocument document = null ; if ( ( HandlerUtil . getActivePart ( event ) ) instanceof IEditorPart ) { final IEditorPart editorPart = ( ( IEditorPart ) ( HandlerUtil . getActivePart ( event ) ) ) ; if ( editorPart . isDirty ( ) ) { if ( ( null != ( editorPart . getTitle ( ) ) ) && ( ( editorPart . getTitle ( ) . length ( ) ) > 0 ) ) { IRunnableWithProgress op = new IRunnableWithProgress ( ) { public void run ( final IProgressMonitor monitor ) { editorPart . doSave ( monitor ) ; } } ; try { PlatformUI . getWorkbench ( ) . getProgressService ( ) . runInUI ( XSTUIPlugin . getActiveWorkbenchWindow ( ) , op , ResourcesPlugin . getWorkspace ( ) . getRoot ( ) ) ; } catch ( InvocationTargetException ite ) { Utils . log ( "Error<seq2seq4repair_space>while<seq2seq4repair_space>saving<seq2seq4repair_space>editor<seq2seq4repair_space>content" , ite ) ; } catch ( InterruptedException ie ) { Utils . log ( "Error<seq2seq4repair_space>while<seq2seq4repair_space>saving<seq2seq4repair_space>editor<seq2seq4repair_space>content" , ie ) ; } } else { editorPart . doSaveAs ( ) ; } } file = ( ( IFile ) ( editorPart . getEditorInput ( ) . getAdapter ( IFile . class ) ) ) ; document = ( ( IDocument ) ( editorPart . getAdapter ( IDocument . class ) ) ) ; } else { ISelection selection = HandlerUtil . getCurrentSelection ( event ) ; if ( selection instanceof IStructuredSelection ) { file = ( ( IFile ) ( ( ( IStructuredSelection ) ( selection ) ) . getFirstElement ( ) ) ) ; } } if ( ( file ) != null ) { byte [ ] outputBytes = canonicalize ( file . getContents ( ) ) ; if ( document != null ) { if ( INTERNAL_CANONICALIZATION . equals ( canonTarget ) ) { <START_BUG> document . set ( new String ( outputBytes , "UTF8" ) ) ; <END_BUG> } else { IWorkbenchPage page = HandlerUtil . getActiveWorkbenchWindow ( event ) . getActivePage ( ) ; if ( page != null ) { IFile newFile = saveCanonicalizedFile ( getCanonicalizedPath ( ) , outputBytes ) ; IEditorDescriptor desc = PlatformUI . getWorkbench ( ) . getEditorRegistry ( ) . getDefaultEditor ( newFile . getName ( ) ) ; page . openEditor ( new FileEditorInput ( newFile ) , desc . getId ( ) ) ; } } } else { if ( INTERNAL_CANONICALIZATION . equals ( canonTarget ) ) { saveCanonicalizedFile ( file . getLocation ( ) , outputBytes ) ; } else { saveCanonicalizedFile ( getCanonicalizedPath ( ) , outputBytes ) ; } } } else { MessageDialog . openInformation ( HandlerUtil . getActiveShell ( event ) , XMLCanonicalization , NLS . bind ( RemoveReadOnlyFlag , NewCanonicalizationRemoveCommand_0 ) ) ; } } catch ( Exception ex ) { Utils . showErrorDialog ( HandlerUtil . getActiveShell ( event ) , XMLCanonicalization , ErrorDuringCanonicalization , ex ) ; Utils . log ( "An<seq2seq4repair_space>error<seq2seq4repair_space>occured<seq2seq4repair_space>during<seq2seq4repair_space>canonicalization" , ex ) ; } } private void getPreferenceValues ( ) { } private IPath getCanonicalizedPath ( ) { } private IFile saveCanonicalizedFile ( final IPath newFilePath , final byte [ ] outputBytes ) throws Exception { } private byte [ ] canonicalize ( final InputStream stream ) throws Exception { } private String getCanonicalizationAlgorithm ( ) { } }

Fix:
document . set ( new String ( outputBytes , IXMLSecurityConstants . CHARSET ) ) ;