[
https://issues.apache.org/jira/browse/OFBIZ-9858?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Dennis Balkir updated OFBIZ-9858:
---------------------------------
Attachment: OFBIZ-No_org.apache.ofbiz.content_bugfixes.patch
class ContentManagementEvents:
- Line 186, 187: increased performance with the use of {{entrySet}}
- Line 161: removed the variable {{contentPurposeist}} because it has no real
reason to exist
- Line 243, 262: used null instead of the deleted variable, which was null, so
this does just the same without the useless variable
class ContentManagementServices:
- Line 237: removed the declaration of {{dataResourceTypeId}} because either it
will be declared later again or the method returns before its use
- Line 313: removed the unnecessary null-check
- Line 457: removed the declaration of {{permResults}} because it is declared
two lines after this line
- Line 498: removed the declaration of {{result}} because either it will be
declared later again or the method returns before its use
- Line 591: removed the unnecessary declaration of {{dataResource}} because it
is never used after this
- Line 979: added a default Locale to {{toLowerCase}}
- Line 1018: added a default Locale to {{toLowerCase}}
- Line 1355: removed the declaration of {{result}} because it is declared again
before it is used
- Line 1365-1368: removed the variable {{orderCreatedDate}} because it has no
use
class ContentManagementWorker:
- Line 287: removed the variable {{statusId}} because it us declared with null
and never declared with a different value, seems like is has no use
- Line 300: used null instead of {{statusId}} (which was null)
- Line 479: removed the variable {{nullObj}} because it is literally just used
to store null in it and it is only used one time
- Line 480: used null instead of {{nullObj}}
- Line 487: removed the variable {{obj}} because it is literally just used to
store null in it and it is only used one time
- Line 488: used null instead of {{obj}}
- Line 523, 524: increased performance with the use of {{entrySet}}
- Line 535: removed the variable {{contentTypes}} because it is literally just
used to store null in it and it is only used one time
- Line 535: used null instead of {{contentTypes}}
- Line 557: removed the variable {{statusId}} because it us declared with null
and never declared with a different value, seems like is has no use
- Line 569: used null instead of {{statusId}}
class ConvertTree:
- Line 83: changed the declaration of {{input}} so the encoding will happen
with a specific charset
- Line 157: removed {{&& contentNameMatch == false}} because it is known, that
{{contentNameMatch}} is null at this point
- Line 232: added a null-check for {{input}}, since {{input}} is possible to be
null at this point
> [FB] Package org.apache.ofbiz.content
> -------------------------------------
>
> Key: OFBIZ-9858
> URL: https://issues.apache.org/jira/browse/OFBIZ-9858
> Project: OFBiz
> Issue Type: Sub-task
> Components: content
> Affects Versions: Trunk
> Reporter: Dennis Balkir
> Priority: Minor
> Attachments: OFBIZ-9858_org.apache.ofbiz.content_bugfixes.patch,
> OFBIZ-No_org.apache.ofbiz.content_bugfixes.patch
>
>
> --- ContentManagementEvents.java:189, WMI_WRONG_MAP_ITERATOR
> WMI:
> org.apache.ofbiz.content.ContentManagementEvents.updatePublishLinks(HttpServletRequest,
> HttpServletResponse) makes inefficient use of keySet iterator instead of
> entrySet iterator
> This method accesses the value of a Map entry, using a key that was retrieved
> from a keySet iterator. It is more efficient to use an iterator on the
> entrySet of the map, to avoid the Map.get(key) lookup.
> --- ContentManagementEvents.java:241, NP_LOAD_OF_KNOWN_NULL_VALUE
> NP: Load of known null value in
> org.apache.ofbiz.content.ContentManagementEvents.updatePublishLinks(HttpServletRequest,
> HttpServletResponse)
> The variable referenced at this point is known to be null due to an earlier
> check against null. Although this is valid, it might be a mistake (perhaps
> you intended to refer to a different variable, or perhaps the earlier check
> to see if the variable is null should have been a check to see if it was
> non-null).
> --- ContentManagementServices.java:237, DLS_DEAD_LOCAL_STORE
> DLS: Dead store to dataResourceResult in
> org.apache.ofbiz.content.ContentManagementServices.persistContentAndAssoc(DispatchContext,
> Map)
> This instruction assigns a value to a local variable, but the value is not
> read or used in any subsequent instruction. Often, this indicates an error,
> because the value computed is never used.
> Note that Sun's javac compiler often generates dead stores for final local
> variables. Because FindBugs is a bytecode-based tool, there is no easy way to
> eliminate these false positives.
> --- ContentManagementServices.java:313,
> RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE
> RCN: Redundant nullcheck of contentPurposeList, which is known to be non-null
> in
> org.apache.ofbiz.content.ContentManagementServices.persistContentAndAssoc(DispatchContext,
> Map)
> This method contains a redundant check of a known non-null value against the
> constant null.
> --- ContentManagementServices.java:459, DLS_DEAD_LOCAL_STORE
> DLS: Dead store to permResults in
> org.apache.ofbiz.content.ContentManagementServices.updateSiteRoles(DispatchContext,
> Map)
> This instruction assigns a value to a local variable, but the value is not
> read or used in any subsequent instruction. Often, this indicates an error,
> because the value computed is never used.
> Note that Sun's javac compiler often generates dead stores for final local
> variables. Because FindBugs is a bytecode-based tool, there is no easy way to
> eliminate these false positives.
> --- ContentManagementServices.java:505, DLS_DEAD_LOCAL_STORE
> DLS: Dead store to result in
> org.apache.ofbiz.content.ContentManagementServices.persistDataResourceAndData(DispatchContext,
> Map)
> This instruction assigns a value to a local variable, but the value is not
> read or used in any subsequent instruction. Often, this indicates an error,
> because the value computed is never used.
> Note that Sun's javac compiler often generates dead stores for final local
> variables. Because FindBugs is a bytecode-based tool, there is no easy way to
> eliminate these false positives.
> --- ContentManagementServices.java:598, DLS_DEAD_LOCAL_STORE
> DLS: Dead store to dataResource in
> org.apache.ofbiz.content.ContentManagementServices.persistDataResourceAndDataMethod(DispatchContext,
> Map)
> This instruction assigns a value to a local variable, but the value is not
> read or used in any subsequent instruction. Often, this indicates an error,
> because the value computed is never used.
> Note that Sun's javac compiler often generates dead stores for final local
> variables. Because FindBugs is a bytecode-based tool, there is no easy way to
> eliminate these false positives.
> --- ContentManagementServices.java:987, DM_CONVERT_CASE
> Dm: Use of non-localized String.toUpperCase() or String.toLowerCase() in
> org.apache.ofbiz.content.ContentManagementServices.updatePageType(DispatchContext,
> Map)
> A String is being converted to upper or lowercase, using the platform's
> default encoding. This may result in improper conversions when used with
> international characters. Use the
> String.toUpperCase( Locale l )
> String.toLowerCase( Locale l )
> versions instead.
> --- ContentManagementServices.java:1026, DM_CONVERT_CASE
> Dm: Use of non-localized String.toUpperCase() or String.toLowerCase() in
> org.apache.ofbiz.content.ContentManagementServices.resetToOutlineMode(DispatchContext,
> Map)
> A String is being converted to upper or lowercase, using the platform's
> default encoding. This may result in improper conversions when used with
> international characters. Use the
> String.toUpperCase( Locale l )
> String.toLowerCase( Locale l )
> versions instead.
> --- ContentManagementServices.java:1363, DLS_DEAD_LOCAL_STORE
> DLS: Dead store to result in
> org.apache.ofbiz.content.ContentManagementServices.updateContentSubscriptionByProduct(DispatchContext,
> Map)
> This instruction assigns a value to a local variable, but the value is not
> read or used in any subsequent instruction. Often, this indicates an error,
> because the value computed is never used.
> Note that Sun's javac compiler often generates dead stores for final local
> variables. Because FindBugs is a bytecode-based tool, there is no easy way to
> eliminate these false positives.
> --- ContentManagementServices.java:1375, DLS_DEAD_LOCAL_STORE
> DLS: Dead store to orderCreatedDate in
> org.apache.ofbiz.content.ContentManagementServices.updateContentSubscriptionByProduct(DispatchContext,
> Map)
> This instruction assigns a value to a local variable, but the value is not
> read or used in any subsequent instruction. Often, this indicates an error,
> because the value computed is never used.
> Note that Sun's javac compiler often generates dead stores for final local
> variables. Because FindBugs is a bytecode-based tool, there is no easy way to
> eliminate these false positives.
> --- ContentManagementWorker.java:301, NP_LOAD_OF_KNOWN_NULL_VALUE
> NP: Load of known null value in
> org.apache.ofbiz.content.ContentManagementWorker.getPermittedPublishPoints(Delegator,
> List, GenericValue, Security, String, String, String)
> The variable referenced at this point is known to be null due to an earlier
> check against null. Although this is valid, it might be a mistake (perhaps
> you intended to refer to a different variable, or perhaps the earlier check
> to see if the variable is null should have been a check to see if it was
> non-null).
> --- ContentManagementWorker.java:481, NP_LOAD_OF_KNOWN_NULL_VALUE
> NP: Load of known null value in
> org.apache.ofbiz.content.ContentManagementWorker.getPublishedLinks(Delegator,
> String, String, GenericValue, Security, String, String, String)
> The variable referenced at this point is known to be null due to an earlier
> check against null. Although this is valid, it might be a mistake (perhaps
> you intended to refer to a different variable, or perhaps the earlier check
> to see if the variable is null should have been a check to see if it was
> non-null).
> --- ContentManagementWorker.java:490, NP_LOAD_OF_KNOWN_NULL_VALUE
> NP: Load of known null value in
> org.apache.ofbiz.content.ContentManagementWorker.getPublishedLinks(Delegator,
> String, String, GenericValue, Security, String, String, String)
> The variable referenced at this point is known to be null due to an earlier
> check against null. Although this is valid, it might be a mistake (perhaps
> you intended to refer to a different variable, or perhaps the earlier check
> to see if the variable is null should have been a check to see if it was
> non-null).
> --- ContentManagementWorker.java:526, WMI_WRONG_MAP_ITERATOR
> WMI:
> org.apache.ofbiz.content.ContentManagementWorker.getPublishedLinks(Delegator,
> String, String, GenericValue, Security, String, String, String) makes
> inefficient use of keySet iterator instead of entrySet iterator
> This method accesses the value of a Map entry, using a key that was retrieved
> from a keySet iterator. It is more efficient to use an iterator on the
> entrySet of the map, to avoid the Map.get(key) lookup.
> --- ContentManagementWorker.java:537, NP_LOAD_OF_KNOWN_NULL_VALUE
> NP: Load of known null value in
> org.apache.ofbiz.content.ContentManagementWorker.getAuthorContent(Delegator,
> String)
> The variable referenced at this point is known to be null due to an earlier
> check against null. Although this is valid, it might be a mistake (perhaps
> you intended to refer to a different variable, or perhaps the earlier check
> to see if the variable is null should have been a check to see if it was
> non-null).
> --- ContentManagementWorker.java:572, NP_LOAD_OF_KNOWN_NULL_VALUE
> NP: Load of known null value in
> org.apache.ofbiz.content.ContentManagementWorker.getPermittedDepartmentPoints(Delegator,
> List, GenericValue, Security, String, String, String)
> The variable referenced at this point is known to be null due to an earlier
> check against null. Although this is valid, it might be a mistake (perhaps
> you intended to refer to a different variable, or perhaps the earlier check
> to see if the variable is null should have been a check to see if it was
> non-null).
> --- ConvertTree.java:80, DM_DEFAULT_ENCODING
> Dm: Found reliance on default encoding in
> org.apache.ofbiz.content.ConvertTree.convertTree(DispatchContext, Map): new
> java.io.FileReader(String)
> Found a call to a method which will perform a byte to String (or String to
> byte) conversion, and will assume that the default platform encoding is
> suitable. This will cause the application behaviour to vary between
> platforms. Use an alternative API and specify a charset name or Charset
> object explicitly.
> --- ConvertTree.java:154, UC_USELESS_CONDITION
> Condition has no effect
> This condition always produces the same result as the value of the involved
> variable was narrowed before. Probably something else was meant or condition
> can be removed.
> --- ConvertTree.java:229, NP_NULL_ON_SOME_PATH
> NP: Possible null pointer dereference of input in
> org.apache.ofbiz.content.ConvertTree.convertTree(DispatchContext, Map)
> There is a branch of statement that, if executed, guarantees that a null
> value will be dereferenced, which would generate a NullPointerException when
> the code is executed. Of course, the problem might be that the branch or
> statement is infeasible and that the null pointer exception can't ever be
> executed; deciding that is beyond the ability of FindBugs.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)