Where to provide try catch block
<p>I am trying to copy files from windows server1 to another windows server2 and not sure where to put the try catch block. I want to inform the user whenver windows server1 or windows server2 shuts down while copying process is ongoing either throught a popup or displaying in a textArea and here is my swingworker code. Thanks in advance</p>

<pre><code>class CopyTask extends SwingWorker&lt;Void, Integer&gt;
{
    private File source;
    private File target;
    private long totalBytes = 0;
    private long copiedBytes = 0;

    public CopyTask(File src, File dest)
    {
        this.source = src;
        this.target = dest;


        progressAll.setValue(0);
        progressCurrent.setValue(0);
    }

    @Override
    public Void doInBackground() throws Exception
    {
        ta.append("Retrieving info ... ");

        retrieveTotalBytes(source);
        ta.append("Done!\n");

        copyFiles(source, target);
        return null;
    }

    @Override
    public void process(List&lt;Integer&gt; chunks)
    {
        for(int i : chunks)
        {
            progressCurrent.setValue(i);
        }
    }

    @Override
    public void done()
    {
        setProgress(100);


    }
    private void retrieveTotalBytes(File sourceFile)
    {
        File[] files = sourceFile.listFiles();
        for(File file : files)
        {
            if(file.isDirectory()) retrieveTotalBytes(file);
            else totalBytes += file.length();
        }
    }

    private void copyFiles(File sourceFile, File targetFile) throws IOException
    {

        if(sourceFile.isDirectory())
        {

            if(!targetFile.exists()) targetFile.mkdirs();

            String[] filePaths = sourceFile.list();

            for(String filePath : filePaths)
            {
                File srcFile = new File(sourceFile, filePath);
                File destFile = new File(targetFile, filePath);

                copyFiles(srcFile, destFile);
            }


        }
        else
        {

            ta.append("Copying " + sourceFile.getAbsolutePath() + " to " + targetFile.getAbsolutePath() ); //appends to textarea
            bis = new BufferedInputStream(new FileInputStream(sourceFile));
            bos = new BufferedOutputStream(new FileOutputStream(targetFile));

            long fileBytes = sourceFile.length();
            long soFar = 0;

            int theByte;

            while((theByte = bis.read()) != -1)
            {
                bos.write(theByte);

                setProgress((int) (copiedBytes++ * 100 / totalBytes));
                publish((int) (soFar++ * 100 / fileBytes));
            }



            bis.close();
            bos.close();
            publish(100);
        }
    }
</code></pre>
