You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@archiva.apache.org by ecki <gi...@git.apache.org> on 2015/10/13 00:55:14 UTC

[GitHub] archiva pull request: Remove Sonar Dead Store Issues.

GitHub user ecki opened a pull request:

    https://github.com/apache/archiva/pull/18

    Remove Sonar Dead Store Issues.

    This is a proposed fix to resolve all dead store issues in Sonar. This is a draft request, the unclear points are annotated.
    
    https://analysis.apache.org/component_issues/index?id=org.apache.archiva%3Aarchiva#resolved=false|rules=findbugs%3ADLS_DEAD_LOCAL_STORE

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

    $ git pull https://github.com/ecki/archiva topic-sonar-deadstore

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

    https://github.com/apache/archiva/pull/18.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 #18
    
----
commit 495a7bf95fa56ec7b73fca2f2e94cc7fc61f68c2
Author: Bernd Eckenfels <be...@eckenfels.net>
Date:   2015-10-12T22:54:04Z

    Remove Sonar Dead Store Issues.

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] archiva pull request: Remove Sonar Dead Store Issues.

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/archiva/pull/18


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] archiva pull request: Remove Sonar Dead Store Issues.

Posted by ecki <gi...@git.apache.org>.
Github user ecki commented on a diff in the pull request:

    https://github.com/apache/archiva/pull/18#discussion_r41810121
  
    --- Diff: archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/dependency/tree/maven2/Maven3DependencyTreeBuilder.java ---
    @@ -280,12 +280,8 @@ private RepositorySystemSession newRepositorySystemSession( RepositorySystem sys
             DependencySelector depFilter = new AndDependencySelector( new ExclusionDependencySelector() );
             session.setDependencySelector( depFilter );
     
    -        LocalRepository localRepo = new LocalRepository( localRepoDir );
             session.setLocalRepositoryManager(
    -            new SimpleLocalRepositoryManager( localRepoDir ) );// system.newLocalRepositoryManager( localRepo ) );
    -
    -        //session.setTransferListener(  );
    -        //session.setRepositoryListener( n );
    +            new SimpleLocalRepositoryManager( localRepoDir ) );
    --- End diff --
    
    Other option is to remove `String msg` completely. Or should it be logged as INFO?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] archiva pull request: Remove Sonar Dead Store Issues.

Posted by ecki <gi...@git.apache.org>.
Github user ecki commented on a diff in the pull request:

    https://github.com/apache/archiva/pull/18#discussion_r41811949
  
    --- Diff: archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRepositoriesService.java ---
    @@ -482,6 +482,7 @@ public Boolean copyArtifact( ArtifactTransferRequest artifactTransferRequest )
                     "Artifact \'" + artifactTransferRequest.getGroupId() + ":" + artifactTransferRequest.getArtifactId()
                         + ":" + artifactTransferRequest.getVersion() + "\' was successfully deployed to repository \'"
                         + artifactTransferRequest.getTargetRepositoryId() + "\'";
    +            log.debug("copyArtifact {}", msg);
    --- End diff --
    
    Other option is to remove String msg completely. Or should it be logged as INFO?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] archiva pull request: Remove Sonar Dead Store Issues.

Posted by ecki <gi...@git.apache.org>.
Github user ecki commented on a diff in the pull request:

    https://github.com/apache/archiva/pull/18#discussion_r41810093
  
    --- Diff: archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRepositoriesService.java ---
    @@ -423,7 +423,7 @@ public Boolean copyArtifact( ArtifactTransferRequest artifactTransferRequest )
                 String timestamp = null;
     
                 File versionMetadataFile = new File( targetPath, MetadataTools.MAVEN_METADATA );
    -            ArchivaRepositoryMetadata versionMetadata = getMetadata( versionMetadataFile );
    +            /* unused */ getMetadata( versionMetadataFile );
    --- End diff --
    
    Probably can be removed as the metadata is not used. However since the method throws I kept it. Can if this is used to verify that meta data exists it should be probably documented.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] archiva pull request: Remove Sonar Dead Store Issues.

Posted by ecki <gi...@git.apache.org>.
Github user ecki commented on a diff in the pull request:

    https://github.com/apache/archiva/pull/18#discussion_r41810172
  
    --- Diff: archiva-modules/plugins/stage-repository-merge/src/main/java/org/apache/archiva/stagerepository/merge/Maven2RepositoryMerger.java ---
    @@ -194,9 +194,6 @@ private void createFolderStructure( String sourceRepoId, String targetRepoId, Ar
             copyFile( sourceArtifactFile, targetArtifactFile );
     
             // pom file copying
    -        String fileName = artifactMetadata.getProject() + "-" + artifactMetadata.getVersion() + ".pom";
    -
    -        // pom file copying
             // TODO need to use path translator to get the pom file path
    --- End diff --
    
    The assign is not used and seems to have not side effect. The code is commented out a bit lower ... should that dead code block be removed as well?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] archiva pull request: Remove Sonar Dead Store Issues.

Posted by olamy <gi...@git.apache.org>.
Github user olamy commented on the pull request:

    https://github.com/apache/archiva/pull/18#issuecomment-150911027
  
    @ecki  Thanks!


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---