Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.1.2
    • Fix Version/s: 2.1.2
    • Component/s: None
    • Labels:
      None

      Description

      As reported by Dennis Dam on the mailing list, fix the "Findbugs" errors. I don't think we need a new issue for each bug, so Im listing all here:

      The other day I found a case in a particular class where an argument for a constructor was actually not used. I found that was really confusing. So I thought: is there not a way to find these kinds of "bugs" automatically?
      That's how I stumbled upon an open source (LGPL, I think) eclipse plugin which .. finds bugs for you! It's called 'findbugs' (http://findbugs.sourceforge.net/). Installation instructions are at http://findbugs.sourceforge.net/manual/eclipse.html.

      It works like this:

      • select project
      • select "find bugs"

      .. and off you go, it finds bugs. In the case of jetspeed it found 566 bugs to be exact, which it categorizes in degrees of seriousness. 73 are flagged as "high prio ". I attached these problems in a logfile attached to this mail. I would highly recommend installing that plugin from what I've seen so far.

      The nastiest bugs I found:

      • nullpointer dereference
      • possible infinite loop
      • comparing strings with the == operator

      These three are in the logfile.

      If anyone knows better plugins, or has suggestions I'm glad to hear about it.

      regards,

      Dennis Dam

      Severity and Description Path Resource Location Creation Time Id
      H B ES: Comparison of String parameter using == or != in org.apache.jetspeed.capabilities.impl.CapabilityMapImpl.hasCapability(String) jetspeed-2/components/capability/src/java/org/apache/jetspeed/capabilities/impl CapabilityMapImpl.java line 185 1180475631635 7871
      H B ES: Comparison of String parameter using == or != in org.apache.jetspeed.capabilities.impl.CapabilityMapImpl.supportsMediaType(String) jetspeed-2/components/capability/src/java/org/apache/jetspeed/capabilities/impl CapabilityMapImpl.java line 231 1180475631635 7872
      H B ES: Comparison of String parameter using == or != in org.apache.jetspeed.serializer.objects.JSPermission.getClassForType(String) jetspeed-2/components/serializer/src/java/org/apache/jetspeed/serializer/objects JSPermission.java line 80 1180475633214 8301
      H B HE: org.apache.jetspeed.capabilities.impl.ClientImpl defines equals and uses Object.hashCode() jetspeed-2/components/capability/src/java/org/apache/jetspeed/capabilities/impl ClientImpl.java line 58 1180475631635 7876
      H B HE: org.apache.jetspeed.capabilities.impl.MediaTypeImpl defines equals and uses Object.hashCode() jetspeed-2/components/capability/src/java/org/apache/jetspeed/capabilities/impl MediaTypeImpl.java line 67 1180475631635 7879
      H B HE: org.apache.jetspeed.cluster.NodeInformationImpl defines equals and uses Object.hashCode() jetspeed-2/components/portal/src/java/org/apache/jetspeed/cluster NodeInformationImpl.java line 90 1180475631651 7886
      H B HE: org.apache.jetspeed.components.portletregistry.MutablePortletApplicationProxy defines equals and uses Object.hashCode() jetspeed-2/components/registry/src/java/org/apache/jetspeed/components/portletregistry MutablePortletApplicationProxy.java line 30 1180475631823 7912
      H B HE: org.apache.jetspeed.i18n.KeyedMessage defines equals and uses Object.hashCode() jetspeed-2/jetspeed-api/src/java/org/apache/jetspeed/i18n KeyedMessage.java line 549 1180475632792 7994
      H B HE: org.apache.jetspeed.portlet.webcontent.WebContentHistoryPage defines equals and uses Object.hashCode() jetspeed-2/components/web-content/src/java/org/apache/jetspeed/portlet/webcontent WebContentHistoryPage.java line 65 1180475632948 8109
      H B HE: org.apache.jetspeed.portlets.layout.LayoutEvent defines equals and uses Object.hashCode() jetspeed-2/layout-portlets/src/java/org/apache/jetspeed/portlets/layout LayoutEvent.java line 119 1180475632964 8120
      H B HE: org.apache.jetspeed.prefs.om.impl.NodeImpl defines equals and uses Object.hashCode() jetspeed-2/components/prefs/src/java/org/apache/jetspeed/prefs/om/impl NodeImpl.java line 243 1180475633073 8211
      H B HE: org.apache.jetspeed.profiler.rules.impl.RuleCriterionImpl defines equals and uses Object.hashCode() jetspeed-2/components/profiler/src/java/org/apache/jetspeed/profiler/rules/impl RuleCriterionImpl.java line 56 1180475633104 8216
      H B HE: org.apache.jetspeed.security.om.impl.InternalCredentialImpl defines equals and uses Object.hashCode() jetspeed-2/components/security/src/java/org/apache/jetspeed/security/om/impl InternalCredentialImpl.java line 359 1180475633136 8243
      H B HE: org.apache.jetspeed.security.om.impl.InternalGroupPrincipalImpl defines equals and uses Object.hashCode() jetspeed-2/components/security/src/java/org/apache/jetspeed/security/om/impl InternalGroupPrincipalImpl.java line 96 1180475633136 8244
      H B HE: org.apache.jetspeed.security.om.impl.InternalPermissionImpl defines equals and uses Object.hashCode() jetspeed-2/components/security/src/java/org/apache/jetspeed/security/om/impl InternalPermissionImpl.java line 188 1180475633136 8245
      H B HE: org.apache.jetspeed.security.om.impl.InternalRolePrincipalImpl defines equals and uses Object.hashCode() jetspeed-2/components/security/src/java/org/apache/jetspeed/security/om/impl InternalRolePrincipalImpl.java line 96 1180475633136 8246
      H B HE: org.apache.jetspeed.security.om.impl.InternalUserPrincipalImpl defines equals and uses Object.hashCode() jetspeed-2/components/security/src/java/org/apache/jetspeed/security/om/impl InternalUserPrincipalImpl.java line 121 1180475633136 8247
      H B HE: org.apache.jetspeed.statistics.impl.UserStatsImpl defines equals and uses Object.hashCode() jetspeed-2/components/statistics/src/java/org/apache/jetspeed/statistics/impl UserStatsImpl.java line 112 1180475633261 8343
      H B HE: org.apache.jetspeed.util.MimeType defines equals and uses Object.hashCode() jetspeed-2/components/portal/src/java/org/apache/jetspeed/util MimeType.java line 131 1180475633276 8353
      H B HE: org.apache.jetspeed.webapp.logging.IsolatedLog4JLogger defines equals and uses Object.hashCode() jetspeed-2/components/webapp-logging/src/java/org/apache/jetspeed/webapp/logging IsolatedLog4JLogger.java line 180 1180475633292 8370
      H B Se: Class org.apache.jetspeed.om.impl.LanguageSetImpl defines non-transient non-serializable instance field classLoader jetspeed-2/components/registry/src/java/org/apache/jetspeed/om/impl LanguageSetImpl.java line 46 1180475632886 8040
      H B Se: Class org.apache.jetspeed.om.portlet.impl.PortletApplicationDefinitionImpl defines non-transient non-serializable instance field oid jetspeed-2/components/registry/src/java/org/apache/jetspeed/om/portlet/impl PortletApplicationDefinitionImpl.java line 64 1180475632901 8059
      H B Se: Class org.apache.jetspeed.om.portlet.impl.PortletDefinitionImpl defines non-transient non-serializable instance field oid jetspeed-2/components/registry/src/java/org/apache/jetspeed/om/portlet/impl PortletDefinitionImpl.java line 99 1180475632901 8064
      H B Se: Class org.apache.jetspeed.om.portlet.impl.PortletDefinitionImpl defines non-transient non-serializable instance field preferenceSet jetspeed-2/components/registry/src/java/org/apache/jetspeed/om/portlet/impl PortletDefinitionImpl.java line 133 1180475632901 8065
      H B Se: Class org.apache.jetspeed.om.servlet.impl.WebApplicationDefinitionImpl defines non-transient non-serializable instance field oid jetspeed-2/components/registry/src/java/org/apache/jetspeed/om/servlet/impl WebApplicationDefinitionImpl.java line 59 1180475632917 8072
      H B Se: Class org.apache.jetspeed.om.window.impl.PortletWindowImpl defines non-transient non-serializable instance field portletEntity jetspeed-2/components/registry/src/java/org/apache/jetspeed/om/window/impl PortletWindowImpl.java line 41 1180475632917 8075
      H B Se: Class org.apache.jetspeed.security.PolicyWrapper defines non-transient non-serializable instance field policy jetspeed-2/components/security/src/java/org/apache/jetspeed/security PolicyWrapper.java line 35 1180475633136 8238
      H B Se: The field org.apache.jetspeed.portalsite.impl.PortalSiteSessionContextImpl.folderPageHistory is transient but isn't set by deserialization jetspeed-2/components/portal-site/src/java/org/apache/jetspeed/portalsite/impl PortalSiteSessionContextImpl.java line 102 1180475632948 8101
      H B Se: The field org.apache.jetspeed.portlet.webcontent.WebContentResource.content is transient but isn't set by deserialization jetspeed-2/components/web-content/src/java/org/apache/jetspeed/portlet/webcontent WebContentResource.java line 32 1180475632964 8112
      H B Se: The field org.apache.jetspeed.portlets.profiler.ProfileCriterionForm.fallbackTypes is transient but isn't set by deserialization jetspeed-2/applications/j2-admin/src/java/org/apache/jetspeed/portlets/profiler ProfileCriterionForm.java line 73 1180475632979 8132
      H B Se: The field org.apache.jetspeed.portlets.profiler.ProfileCriterionForm.resolvers is transient but isn't set by deserialization jetspeed-2/applications/j2-admin/src/java/org/apache/jetspeed/portlets/profiler ProfileCriterionForm.java line 50 1180475632979 8133
      H B Se: The field org.apache.jetspeed.portlets.profiler.ProfileRuleForm.classnames is transient but isn't set by deserialization jetspeed-2/applications/j2-admin/src/java/org/apache/jetspeed/portlets/profiler ProfileRuleForm.java line 44 1180475632995 8136
      H B Se: The field org.apache.portals.gems.browser.DatabaseBrowserIterator.log is transient but isn't set by deserialization jetspeed-2/applications/gems/src/java/org/apache/portals/gems/browser DatabaseBrowserIterator.java line 37 1180475633308 8394
      H C EC: Call to equals() comparing unrelated class and interface in org.apache.jetspeed.decoration.DecorationFactoryImpl.getDecoration(Page, Fragment, RequestContext) jetspeed-2/components/portal/src/java/org/apache/jetspeed/decoration DecorationFactoryImpl.java line 142 1180475632120 7944
      H C EC: Call to equals() comparing unrelated class and interface in org.apache.jetspeed.portlets.rpad.RepositoryConfigHandler.endElement(String, String, String) jetspeed-2/applications/j2-admin/src/java/org/apache/jetspeed/portlets/rpad RepositoryConfigHandler.java line 129 1180475633011 8158
      H C HE: org.apache.jetspeed.webapp.logging.IsolatedLog4JLogger doesn't define a hashCode() method but is used in a hashed data structure jetspeed-2/components/webapp-logging/src/java/org/apache/jetspeed/webapp/logging IsolatedLog4JLogger.java line 143 1180475633292 8371
      H C IL: There is an apparent infinite recursive loop in org.apache.jetspeed.om.preference.impl.PrefsPreference.cloneValues() jetspeed-2/components/registry/src/java/org/apache/jetspeed/om/preference/impl PrefsPreference.java line 464 1180475632901 8068
      H C MF: Field GetPortletsAction.log masks field in superclass org.apache.jetspeed.layout.impl.BasePortletAction jetspeed-2/components/portal/src/java/org/apache/jetspeed/layout/impl GetPortletsAction.java line 58 1180475632792 7998
      H C MF: Field TestSSOComponent.gms masks field in superclass org.apache.jetspeed.security.util.test.AbstractSecurityTestcase jetspeed-2/components/sso/src/test/org/apache/jetspeed/sso TestSSOComponent.java line 76 1180475633245 8321
      H C MF: Field TestSSOComponent.ums masks field in superclass org.apache.jetspeed.security.util.test.AbstractSecurityTestcase jetspeed-2/components/sso/src/test/org/apache/jetspeed/sso TestSSOComponent.java line 73 1180475633245 8322
      H C Nm: VERY confusing to have methods org.apache.jetspeed.om.page.TestPageObjectModel.setup() and junit.framework.TestCase.setUp() jetspeed-2/components/page-manager/src/test/org/apache/jetspeed/om/page TestPageObjectModel.java line 60 1180475632886 8045
      H C NP: ? could be null and is guaranteed to be dereferenced in org.apache.jetspeed.locator.JetspeedTemplateLocator.locateTemplate(LocatorDescriptor, String) jetspeed-2/components/locator/src/java/org/apache/jetspeed/locator JetspeedTemplateLocator.java line 212 1180475632854 8010
      H C NP: Null pointer dereference of pa in org.apache.jetspeed.portlets.palm.PortletApplicationLifecycleManager.processAction(ActionRequest, ActionResponse) jetspeed-2/applications/j2-admin/src/java/org/apache/jetspeed/portlets/palm PortletApplicationLifecycleManager.java line 121 1180475632964 8125
      H C RCN: Nullcheck of document at line 505 of value previously dereferenced in org.apache.jetspeed.page.document.psml.CastorFileSystemDocumentHandler.unmarshallDocument(Class, String, String) jetspeed-2/components/page-manager/src/java/org/apache/jetspeed/page/document/psml CastorFileSystemDocumentHandler.java line 466 1180475632932 8088
      H C UMAC: Uncallable method org.apache.jetspeed.serializer.objects.JSNVPElement$1.isReferencable() defined in anonymous class jetspeed-2/components/serializer/src/java/org/apache/jetspeed/serializer/objects JSNVPElement.java line 1 1180475633214 8300
      H D DLS: Dead store to applicationScopeAttribute in org.apache.jetspeed.demo.simple.AttributeScopeServlet.processAction(ActionRequest, ActionResponse) jetspeed-2/applications/demo/src/java/org/apache/jetspeed/demo/simple AttributeScopeServlet.java line 120 1180475632464 7950
      H D DLS: Dead store to lastGuess in org.apache.jetspeed.demo.simple.PickANumberPortlet.doView(RenderRequest, RenderResponse) jetspeed-2/applications/demo/src/java/org/apache/jetspeed/demo/simple PickANumberPortlet.java line 151 1180475632526 7958
      H D ST: Write to static field org.apache.jetspeed.components.portletentity.PortletEntityImpl.pac from instance method org.apache.jetspeed.components.portletentity.PersistenceBrokerPortletEntityAccess.setEntityAccessProxy(PortletEntityAccessComponent) jetspeed-2/components/registry/src/java/org/apache/jetspeed/components/portletentity PersistenceBrokerPortletEntityAccess.java line 102 1180475631651 7900
      H D ST: Write to static field org.apache.jetspeed.components.portletentity.PortletEntityImpl.rcc from instance method org.apache.jetspeed.components.portletentity.PersistenceBrokerPortletEntityAccess.PersistenceBrokerPortletEntityAccess(PortletRegistry, RequestContextComponent, boolean) jetspeed-2/components/registry/src/java/org/apache/jetspeed/components/portletentity PersistenceBrokerPortletEntityAccess.java line 96 1180475631651 7898
      H D ST: Write to static field org.apache.jetspeed.components.portletentity.PortletEntityImpl.rcc from instance method org.apache.jetspeed.components.portletentity.PersistenceBrokerPortletEntityAccess.PersistenceBrokerPortletEntityAccess(PortletRegistry, RequestContextComponent) jetspeed-2/components/registry/src/java/org/apache/jetspeed/components/portletentity PersistenceBrokerPortletEntityAccess.java line 88 1180475631651 7896
      H D ST: Write to static field org.apache.jetspeed.components.portletentity.PortletEntityImpl.registry from instance method org.apache.jetspeed.components.portletentity.PersistenceBrokerPortletEntityAccess.PersistenceBrokerPortletEntityAccess(PortletRegistry, RequestContextComponent, boolean) jetspeed-2/components/registry/src/java/org/apache/jetspeed/components/portletentity PersistenceBrokerPortletEntityAccess.java line 95 1180475631651 7899
      H D ST: Write to static field org.apache.jetspeed.components.portletentity.PortletEntityImpl.registry from instance method org.apache.jetspeed.components.portletentity.PersistenceBrokerPortletEntityAccess.PersistenceBrokerPortletEntityAccess(PortletRegistry, RequestContextComponent) jetspeed-2/components/registry/src/java/org/apache/jetspeed/components/portletentity PersistenceBrokerPortletEntityAccess.java line 87 1180475631651 7897
      H D ST: Write to static field org.apache.jetspeed.components.portletentity.PortletEntityImpl.registry from instance method org.apache.jetspeed.components.portletentity.PersistenceBrokerPortletEntityAccess.PersistenceBrokerPortletEntityAccess(PortletRegistry) jetspeed-2/components/registry/src/java/org/apache/jetspeed/components/portletentity PersistenceBrokerPortletEntityAccess.java line 80 1180475631651 7895
      H D ST: Write to static field org.apache.jetspeed.prefs.impl.PreferencesFactoryImpl.prefsProvider from instance method org.apache.jetspeed.prefs.impl.PreferencesFactoryImpl.setPrefsProvider(PreferencesProvider) jetspeed-2/components/prefs/src/java/org/apache/jetspeed/prefs/impl PreferencesFactoryImpl.java line 97 1180475633073 8207
      H D ST: Write to static field org.apache.jetspeed.security.impl.LoginModuleProxyImpl.loginModuleProxy from instance method org.apache.jetspeed.security.impl.LoginModuleProxyImpl.LoginModuleProxyImpl(UserManager, String) jetspeed-2/components/security/src/java/org/apache/jetspeed/security/impl LoginModuleProxyImpl.java line 59 1180475633136 8239
      H D ST: Write to static field org.apache.jetspeed.services.JetspeedPortletServices.singleton from instance method org.apache.jetspeed.services.JetspeedPortletServices.JetspeedPortletServices(Map) jetspeed-2/commons/src/java/org/apache/jetspeed/services JetspeedPortletServices.java line 50 1180475633229 8314
      H D ST: Write to static field org.apache.jetspeed.sso.TestSSOComponent.ssoBroker from instance method org.apache.jetspeed.sso.TestSSOComponent.setUp() jetspeed-2/components/sso/src/test/org/apache/jetspeed/sso TestSSOComponent.java line 87 1180475633245 8323
      H P Dm: org.apache.jetspeed.engine.JetspeedEngine.shutdown() forces garbage collection; extremely dubious except in benchmarking code jetspeed-2/components/portal/src/java/org/apache/jetspeed/engine JetspeedEngine.java line 174 1180475632667 7975
      H V MS: org.apache.jetspeed.om.folder.psml.FolderMetaDataImpl.DOCUMENT_TYPE isn't final but should be jetspeed-2/components/page-manager/src/java/org/apache/jetspeed/om/folder/psml FolderMetaDataImpl.java line 41 1180475632886 8036
      H V MS: org.apache.jetspeed.page.impl.DatabasePageManagerCache.transactionedOperations isn't final but should be jetspeed-2/components/page-manager/src/java/org/apache/jetspeed/page/impl DatabasePageManagerCache.java line 428 1180475632932 8093
      H V MS: org.apache.jetspeed.page.PageManagerUtils.log isn't final but should be jetspeed-2/components/page-manager/src/java/org/apache/jetspeed/page PageManagerUtils.java line 46 1180475632932 8083
      H V MS: org.apache.jetspeed.security.spi.impl.PasswordHistoryInterceptor.HISTORICAL_PASSWORD_CREDENTIAL isn't final but should be jetspeed-2/components/security/src/java/org/apache/jetspeed/security/spi/impl PasswordHistoryInterceptor.java line 58 1180475633136 8249
      H V MS: org.apache.jetspeed.serializer.objects.JSPermission.TYPE_FOLDER isn't final but should be jetspeed-2/components/serializer/src/java/org/apache/jetspeed/serializer/objects JSPermission.java line 63 1180475633214 8302
      H V MS: org.apache.jetspeed.serializer.objects.JSPermission.TYPE_FRAGMENT isn't final but should be jetspeed-2/components/serializer/src/java/org/apache/jetspeed/serializer/objects JSPermission.java line 65 1180475633214 8303
      H V MS: org.apache.jetspeed.serializer.objects.JSPermission.TYPE_PAGE isn't final but should be jetspeed-2/components/serializer/src/java/org/apache/jetspeed/serializer/objects JSPermission.java line 67 1180475633214 8304
      H V MS: org.apache.jetspeed.serializer.objects.JSPermission.TYPE_PORTAL isn't final but should be jetspeed-2/components/serializer/src/java/org/apache/jetspeed/serializer/objects JSPermission.java line 74 1180475633214 8305
      H V MS: org.apache.jetspeed.serializer.objects.JSPermission.TYPE_PORTALRESOURCE isn't final but should be jetspeed-2/components/serializer/src/java/org/apache/jetspeed/serializer/objects JSPermission.java line 69 1180475633214 8306
      H V MS: org.apache.jetspeed.serializer.objects.JSPermission.TYPE_PORTALRESOURCECOLLECTION isn't final but should be jetspeed-2/components/serializer/src/java/org/apache/jetspeed/serializer/objects JSPermission.java line 71 1180475633214 8307
      H V MS: org.apache.jetspeed.serializer.objects.JSPermission.TYPE_UNKNOWN isn't final but should be jetspeed-2/components/serializer/src/java/org/apache/jetspeed/serializer/objects JSPermission.java line 76 1180475633214 8308
      H V MS: org.apache.portals.gems.util.ValidationHelper.AMERICAN_DATE_FORMAT isn't final but should be jetspeed-2/applications/gems/src/java/org/apache/portals/gems/util ValidationHelper.java line 35 1180475633308 8399
      H V MS: org.apache.portals.gems.util.ValidationHelper.AMERICAN_DATETIME_FORMAT isn't final but should be jetspeed-2/applications/gems/src/java/org/apache/portals/gems/util ValidationHelper.java line 36 1180475633308 8398
      H V MS: org.apache.portals.gems.util.ValidationHelper.EUROPEAN_DATE_FORMAT isn't final but should be jetspeed-2/applications/gems/src/java/org/apache/portals/gems/util ValidationHelper.java line 33 1180475633308 8401
      H V MS: org.apache.portals.gems.util.ValidationHelper.EUROPEAN_DATETIME_FORMAT isn't final but should be jetspeed-2/applications/gems/src/java/org/apache/portals/gems/util ValidationHelper.java line 34 1180475633308 8400

      1. findbugPatch-comments.txt
        5 kB
        Dennis Dam
      2. findBugs.patch
        30 kB
        Dennis Dam

        Activity

        David Sean Taylor created issue -
        Ate Douma made changes -
        Field Original Value New Value
        Fix Version/s 2.1.1 [ 12312462 ]
        Fix Version/s 2.1.1-RC [ 12312377 ]
        Dennis Dam made changes -
        Attachment findBugs.patch [ 12359367 ]
        Dennis Dam made changes -
        Attachment findbugPatch-comments.txt [ 12359368 ]
        Ate Douma made changes -
        Assignee David Sean Taylor [ taylor ] Ate Douma [ adouma ]
        Ate Douma made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Ate Douma made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            Ate Douma
            Reporter:
            David Sean Taylor
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development