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.
Corrected… in fact, there was no need to return at that point in the code.

 

- Jeff

 

From: Spencer Marks [mailto:notifications@github.com] 
Sent: Monday, June 23, 2014 7:40 AM
To: JeffBlodgett/FileSieve
Cc: Jeff Blodgett
Subject: Re: [FileSieve] FileManagement package (#5)

 

In src/main/java/FileSieve/BusinessLogic/FileManagement/FileManager.java:

>       */
> -    public void openPathname(Path pathname) throws IOException;
> +    @Override
> +    public void openPathname(Path pathname) throws NullPointerException, UnsupportedOperationException, IllegalArgumentException, SecurityException, IOException {
> +        try {
> +            if (pathname == null) throw new NullPointerException("null pathname provided");
> +
> +            if (Desktop.isDesktopSupported()) {
> +                if (!GraphicsEnvironment.isHeadless()) {
> +                    Desktop desktop = Desktop.getDesktop();
> +                    if (desktop.isSupported(Desktop.Action.OPEN)) {
> +                        if (disableDesktopOpenMethod == false) {
> +                            desktop.open(pathname.toFile());
> +                        }
> +                        return;

try hard not to:
1) return from the middle of try statement as it make the code hard to read especially when a finally clause is factored in 
2) ideally methods should only return from one place in a method - at the end. This makes the code easier to read and understand. 

—
Reply to this email directly or view it on GitHub <https://github.com/JeffBlodgett/FileSieve/pull/5/files#r14070832> .  <https://github.com/notifications/beacon/7633920__eyJzY29wZSI6Ik5ld3NpZXM6QmVhY29uIiwiZXhwaXJlcyI6MTcxOTE0Mjc3MSwiZGF0YSI6eyJpZCI6MzQ2NTg1MTl9fQ==--489d3eeb7553423f400224c6b040a83a9a38b470.gif>