Skip to content

Commit

Permalink
Merge pull request #238 from tkalmar/spotbugs
Browse files Browse the repository at this point in the history
Use file api for reading parsing artifact names, Fix #34
  • Loading branch information
hazendaz authored Jul 8, 2020
2 parents bf0fbab + 1090999 commit 2e71189
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
11 changes: 6 additions & 5 deletions src/main/groovy/org/codehaus/mojo/spotbugs/ResourceHelper.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ import org.codehaus.plexus.resource.loader.FileResourceLoader
import org.codehaus.plexus.resource.ResourceManager
import org.codehaus.plexus.util.FileUtils

import java.nio.file.Paths

final class ResourceHelper {

Log log
Expand Down Expand Up @@ -53,12 +55,11 @@ final class ResourceHelper {
String location = null
String artifact = resource

if (resource.indexOf(SpotBugsInfo.FORWARD_SLASH) != -1) {
artifact = resource.substring(resource.lastIndexOf(SpotBugsInfo.FORWARD_SLASH) + 1)
}
def file = new File(resource)

if (resource.indexOf(SpotBugsInfo.FORWARD_SLASH) != -1) {
location = resource.substring(0, resource.lastIndexOf(SpotBugsInfo.FORWARD_SLASH))
if (file.exists()) {
artifact = file.getName()
location = file.getAbsolutePath()
}

// replace all occurrences of the following characters: ? : & =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,6 @@ interface SpotBugsInfo {

static final String COMMA = ","

static final String FORWARD_SLASH = '/'

/**
* The character to separate URL tokens.
*
Expand Down

0 comments on commit 2e71189

Please sign in to comment.