You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Maruan Sahyoun (JIRA)" <ji...@apache.org> on 2018/03/11 18:09:00 UTC

[jira] [Comment Edited] (PDFBOX-4071) Improve code quality (3)

    [ https://issues.apache.org/jira/browse/PDFBOX-4071?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16394589#comment-16394589 ] 

Maruan Sahyoun edited comment on PDFBOX-4071 at 3/11/18 6:08 PM:
-----------------------------------------------------------------

[~tilman] [~lehmi] Could you take a look at the following code from {{FileSystemProvide}} L296

{code}
            File file = getDiskCacheFile();
            try
            {
                writer = new BufferedWriter(new FileWriter(file));
            }
            catch (SecurityException e)
            {
                LOG.debug("Couldn't create writer for " + file.getAbsolutePath(), e);
                return;
            }
{code}

Shouldn't the line {{File file = getDiskCacheFile();}} be within the {{try}} as {{getDiskCacheFile()}} is the method which might throw a {{SecurityException}}

Would change it and also use {{try-with}} but haven't dealt with this part of the code before.  If you agree we should add that to {{2.0.9}} (without the {{try-with}} part obviously).

There is another call to {{getDiscCacheFile()}} at L381 which will be affected too


was (Author: msahyoun):
[~tilman] [~lehmi] Could you take a look at the following code from {{FileSystemProvide}} L296

{code}
            File file = getDiskCacheFile();
            try
            {
                writer = new BufferedWriter(new FileWriter(file));
            }
            catch (SecurityException e)
            {
                LOG.debug("Couldn't create writer for " + file.getAbsolutePath(), e);
                return;
            }
{code}

Shouldn't the line {{File file = getDiskCacheFile();}} be within the {{try}} as {{getDiskCacheFile()}} is the method which might throw a {{SecurityException}}

Would change it and also use {{try-with}} but haven't dealt with this part of the code before.  If you agree we should add that to {{2.0.9}} (without the {{try-with}} part obviously)

> Improve code quality (3)
> ------------------------
>
>                 Key: PDFBOX-4071
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-4071
>             Project: PDFBox
>          Issue Type: Task
>    Affects Versions: 2.0.8
>            Reporter: Tilman Hausherr
>            Priority: Major
>
> This is a longterm issue for the task to improve code quality, by using the [SonarQube report|https://analysis.apache.org/dashboard/index/org.apache.pdfbox:pdfbox-reactor], hints in different IDEs, the FindBugs tool and other code quality tools.
> This is a follow-up of PDFBOX-2852, which was getting too long.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org