public void run() {
    try {
      targetFile = KettleVFS.getFileObject( targetPath );
      if ( targetFile.exists() ) {
        if ( !targetFile.delete() ) {
          throw new ReportProcessingException( messages.getErrorString( "ReportExportTask.ERROR_0001_TARGET_EXISTS" ) ); //$NON-NLS-1$
        }
      }

      if ( createParentFolder ) {
        targetFile.getParent().createFolder();
      } else if ( !targetFile.getParent().exists() ) {
        throw new ReportProcessingException( messages.getString(
          "ReportExportTask.PARENT_FOLDER_DOES_NOT_EXIST", targetFile.getParent().getName().getPath() ) );
      }

      execute();
    } catch ( Exception ex ) {
      statusListener.setStatus( StatusType.ERROR, messages.getString( "ReportExportTask.USER_EXPORT_FAILED" ), ex ); //$NON-NLS-1$
      logger.error( "Failed" ); //$NON-NLS-1$
    }
  }
@Test
  public void testExportReportWithUnsupportedLocale() {
    when( masterReport.getConfiguration() ).thenReturn( mock( Configuration.class ) );
    when( masterReport.getResourceManager() ).thenReturn( new ResourceManager() );

    when( swingGuiContext.getLocale() ).thenReturn( Locale.UK );
    when( swingGuiContext.getStatusListener() ).thenReturn( mock( StatusListener.class ) );

    Runnable exportTask = new ReportExportTask( masterReport, swingGuiContext, targetPath, createParentFolder ) {
      protected ReportProcessor createReportProcessor( OutputStream fout ) throws Exception {
        PdfOutputProcessor outputProcessor =
          new PdfOutputProcessor( masterReport.getConfiguration(), fout, masterReport.getResourceManager() );
        return new PageableReportProcessor( masterReport, outputProcessor );
      }
    };

    assertNotNull( exportTask );
    exportTask.run();
    assertThat( swingGuiContext.getStatusType(), not( StatusType.ERROR ) );
  }