dev@glassfish.java.net

Re: duplicate message keys

From: Bobby Bissett <Robert.Bissett_at_Sun.COM>
Date: Fri, 15 Jan 2010 13:05:44 -0500

>
> I see that there are several duplicate message keys in two
> LogStrings.properties files. For example, j2eerunner.initError and
> enterprise.orb_reference_exception are message keys that both appear
> in two different LogStrings.properties files.

Is that a problem as long as they're in different packages?

> In each case, the duplicate message keys are associated to different
> messages. It is not a case where the text is simply copied and
> pasted into a different file.
>
> In addition, I noticed that these message keys are not in the Java
> files. My plan is to remove the message keys and messages unless I
> hear I should not.

I wrote a tool and sent it out to the dev alias some time ago that
reports unused keys and duplicate keys within a props file. As long as
you have Python installed, it takes less than a minute to set up and
~1 second to run. If anyone is interested, I can send it out again. It
has to be run on a submodule as it takes a single source root and
property file root (e.g. foo/src/main/java and foo/src/main/
resources), otherwise I'd just run it on the whole v3 workspace.

Cheers,
Bobby

p.s. Here's an example usage on v3/admin/server-mgmt (picked at
random). Note that there are a bunch of unused keys reported. They
could be used in some other module if it's using the same logger as in
this module. That's up to the module owner to figure out.

--- begin ---
hostname% python ~/work/ws/keychecker.py
Parsing resource files relative to /Users/bobby/work/ws/v3/admin/
server-mgmt/src/main/java
Parsing LocalStrings.properties in /com/sun/enterprise/admin/servermgmt
Parsing LocalStrings.properties in /com/sun/enterprise/admin/
servermgmt/pe
Parsing LocalStrings.properties in /com/sun/enterprise/admin/
servermgmt/services
WARNING: the following key appears more than once in /Users/bobby/work/
ws/v3/admin/server-mgmt/src/main/java/com/sun/enterprise/admin/
servermgmt/services
        noSuitableServiceImplementation

Finished property parsing. Checking source files relative to /Users/
bobby/work/ws/v3/admin/server-mgmt/src/main/java
The following directories were skipped because no keys were found:
        /com/sun/enterprise/admin/servermgmt/logging
        /com/sun/enterprise/admin/servermgmt/util

Results:
Keys not used in /com/sun/enterprise/admin/servermgmt
        serviceNameInvalid
        missingParamsInFile
        smfManifestExists
        runtimeStatusToStringStopCluster.alreadyStopped
        runtimeStatusToStringStartCluster.error
        runtimeStatusToStringStopCluster.success
        requiresRestartYes
        runtimeStatusToString
        keyStoreNotCreated
        requiresRestartNo
        runtimeStatusToStringStopCluster.stoppedToRunning
        jbiRegistryTemplateNotCopied
        noSuitableServiceImplementation
        doesNotExist
        invalidTO
        serviceTypeNotSet
        notSolaris10
        runtimeStatusToStringStartCluster.success
        noSmfAuth
        smfTokenNeeded
        serviceNameExists
        runtimeStatusToStringStopCluster.error
        serviceTemplateNotFound
        runtimeStatusToStringStartCluster.startedToStopped
        smfManifestFolderExists
        noPermissionToCreateManifest
        runtimeStatusToStringStartCluster.alreadyStarted
Keys not used in /com/sun/enterprise/admin/servermgmt/services
        timerWalNotCreated
        runtimeStatusToStringStopCluster.alreadyStopped
        runtimeStatusToStringStartCluster.error
        trustStoreNotCreated
        fileValidator.not_a_dir
        runtimeStatusToStringStopCluster.success
        requiresRestartYes
        runtimeStatusToString
        keyStoreNotCreated
        derbyEjbTimerDBNotCreated
        s1asKeyPasswordNotChanged
        noDerbyLog
        requiresRestartNo
        masterPasswordFileNotCreated
        passwordAliasPasswordNotChanged
        keyStorePasswordNotChanged
        runtimeStatusToStringStopCluster.stoppedToRunning
        jbiRegistryTemplateNotCopied
        domainConfig
        cannotDeleteJmsProviderInstance
        keyFileNotCreated
        portValidator.in_use
        windows.services.noTargetDir
        fileValidator.no_write
        fileValidator.no_read
        masterPasswordInvalid
        notSolaris10
        couldNotValidateMasterPassword
        runtimeStatusToStringStartCluster.success
        validator.invalid_type
        adminUserComment
        fileNotFound
        runtimeStatusToStringStopCluster.error
        timerDbnNotCreated
        masterPasswordFileNotRead
        validator.invalid_value
        runtimeStatusToStringStartCluster.startedToStopped
        serverPolicyNotCreated
        SomeProblemWithKeytool
        CertificateDN
        passwordAliasKeystoreNotCreated
        runtimeStatusToStringStartCluster.alreadyStarted
Keys not used in /com/sun/enterprise/admin/servermgmt/pe
        cannotStopInstance_invalidState
        portConflict
        cannotChangePassword_invalidState
        procExecError
        illegalDomainName
        notSupported
        wssServerConfigNotCreated
        cannotDeleteInstance_invalidState
        domainDoesntExist
        noPidsToKill
        startupFailed
        listDomainElement
        domainDirNotValid
        timeoutStarting
        domainName
        startInstanceTimeOut
        instanceStartupException
        cannotDeleteDomainDir
        cannotStartInstance_invalidState
        cannotStopInstance
        invalidDomainDir

Done
--- end ---