FileManagement package

Lots of work this past week on the FileManagement package.  Not yet finished, but getting close.  Note that JavaDoc comments are in need of tweaking and should not be trusted.
Yes – I can immediately see that it could broken into 3 methods – one for the upfront validations and directory streaming, one for copying in the case of a folder, and one for copying in the case of a file.  I’ll make it so!

 

- Jeff

 

From: Spencer Marks [mailto:notifications@github.com] 
Sent: Monday, June 23, 2014 7:27 AM
To: JeffBlodgett/FileSieve
Cc: Jeff Blodgett
Subject: Re: [FileSieve] FileManagement package (#5)

 

In src/main/java/FileSieve/BusinessLogic/FileManagement/ConcurrentFileManager.java:

> +                        setProgress((int) ((totalPercentPreviouslyCopied + fileBytes) * 100 / totalBytes));
> +                        publish(new SimpleImmutableEntry(this.targetPathname, getProgress()));
> +                        publish(new SimpleImmutableEntry(targetPathname, null));
> +
> +                        try {
> +                            if (Files.exists(targetPathname) && ((targetPathname.toFile().length() == 0L) || (soFar > 0))) {
> +                                Files.delete(targetPathname);
> +                            }
> +                        } catch (SecurityException | IOException ex) {
> +                            // Ignore exceptions - this is a best attempt at deleting the written file, which was cut short
> +                        }
> +                    }
> +                }
> +            }
> +        }
> +

Yikes, this is a really long method. Can it be broken up into smaller discrete methods?

—
Reply to this email directly or view it on GitHub <https://github.com/JeffBlodgett/FileSieve/pull/5/files#r14070474> .  <https://github.com/notifications/beacon/7633920__eyJzY29wZSI6Ik5ld3NpZXM6QmVhY29uIiwiZXhwaXJlcyI6MTcxOTE0MjAzOCwiZGF0YSI6eyJpZCI6MzQ2NTg1MTl9fQ==--9ac68140887130e3638315d822d873c6f47973fd.gif>