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

ASF GitHub Bot commented on FOP-2788:
-------------------------------------

GitHub user BruceKuiLiu opened a pull request:

    https://github.com/apache/fop/pull/10

    FOP-2788: Change the two method names.

    The first method closes a stream, but its name is "writetoStream". The 
method name "closeStream" should be better.
    The second method just returns one field "params" of the current class, 
thus method name "getParams" should be better than "build".

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/BruceKuiLiu/fop trunk

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/fop/pull/10.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #10
    
----
commit eaf810bff084fb8507e9ee7d3ffc71559e8e0652
Author: Kui LIU <brucekuiliu@...>
Date:   2018-04-24T13:02:11Z

    FOP-2788: Change the method name.
    
    The method closes a stream, but its name is "writetoStream". The method 
name "closeStream" should be better.

commit 52fc34253fdf268a396ba0b07f553b0d5e7af034
Author: Kui LIU <brucekuiliu@...>
Date:   2018-04-24T13:03:41Z

    FOP-2788: Change the method name to "getParams".
    
    The method just returns one field "params" of the current class, thus 
method name "getParams" should be better than "build".

----


> [PATCH] Inconsistent method names
> ---------------------------------
>
>                 Key: FOP-2788
>                 URL: https://issues.apache.org/jira/browse/FOP-2788
>             Project: FOP
>          Issue Type: Improvement
>    Affects Versions: trunk
>            Reporter: KuiLIU
>            Priority: Major
>         Attachments: rename-methods.patch
>
>
> The method closes a stream, but its name is "writetoStream". The method name 
> "closeStream" should be better.
> {code:java}
>     /**
>       * Tells the streamer to write
>       *
>       * @throws IOException thrown if an I/O exception of some sort has 
> occurred.
>       */
>      public void writeToStream() throws IOException {
>          streamer.close();
>      }
> {code}
> The method body code seems to add a new attribute to the parameter "handler".
> Identifier "addSAX" should be better than "toSAX" since 'toSAX' is prone to 
> convert one thing to another.
> {code:java}
>     /** {@inheritDoc} */
>     public void toSAX(ContentHandler handler) throws SAXException {
>         AttributesImpl atts = new AttributesImpl();
>         if (name != null && name.length() > 0) {
>             atts.addAttribute("", ATT_NAME, ATT_NAME, "CDATA", name);
>         }
>         if (this.src != null) {
>             atts.addAttribute("", ATT_SRC, ATT_SRC, "CDATA", 
> this.src.toASCIIString());
>         }
>         handler.startElement(CATEGORY, elementName, elementName, atts);
>         handler.endElement(CATEGORY, elementName, elementName);
>     }
> {code}
> The method just returns one field "params" of the current class, thus method 
> name "getParams" should be better than "build".
> {code:java}
>       /**
>          * Returns the accumulated parameter map.
>          * @return the accumulated parameter map
>          */
>          public Map<String, Object> build() {
>              return this.params;
>          }
> {code}
> The method seems to find an appropriate "Property" related to the 
> fo.getNameId().
> Thus, identifier "find" should be better than "make".
> {code:java}
>   /**
>      * Set default precedence according to the parent FObj
>      *
>      * {@inheritDoc}
>      */
>      public Property make(PropertyList propertyList) throws PropertyException 
> {
>          FObj fo = propertyList.getFObj();
>          switch (fo.getNameId()) {
>          case Constants.FO_TABLE:
>              return num6;
>          case Constants.FO_TABLE_CELL:
>              return num5;
>          case Constants.FO_TABLE_COLUMN:
>              return num4;
>          case Constants.FO_TABLE_ROW:
>              return num3;
>          case Constants.FO_TABLE_BODY:
>              return num2;
>          case Constants.FO_TABLE_HEADER:
>              return num1;
>          case Constants.FO_TABLE_FOOTER:
>              return num0;
>          default:
>              return null;
>          }
>      }
> {code}



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

Reply via email to