File tree Expand file tree Collapse file tree
src/main/groovy/org/codehaus/mojo/spotbugs Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -25,8 +25,6 @@ import org.codehaus.plexus.resource.loader.FileResourceLoader
2525import org.codehaus.plexus.resource.ResourceManager
2626import org.codehaus.plexus.util.FileUtils
2727
28- import java.nio.file.Paths
29-
3028final class ResourceHelper {
3129
3230 Log log
@@ -55,11 +53,22 @@ final class ResourceHelper {
5553 String location = null
5654 String artifact = resource
5755
58- def file = new File (resource)
56+ // Linux Checks
57+ if (resource. indexOf(SpotBugsInfo . FORWARD_SLASH ) != -1 ) {
58+ artifact = resource. substring(resource. lastIndexOf(SpotBugsInfo . FORWARD_SLASH ) + 1 )
59+ }
60+
61+ if (resource. indexOf(SpotBugsInfo . FORWARD_SLASH ) != -1 ) {
62+ location = resource. substring(0 , resource. lastIndexOf(SpotBugsInfo . FORWARD_SLASH ))
63+ }
64+
65+ // Windows Checks
66+ if (resource. indexOf(SpotBugsInfo . BACKWARD_SLASH ) != -1 ) {
67+ artifact = resource. substring(resource. lastIndexOf(SpotBugsInfo . BACKWARD_SLASH ) + 1 )
68+ }
5969
60- if (file. exists()) {
61- artifact = file. getName()
62- location = file. getAbsolutePath()
70+ if (resource. indexOf(SpotBugsInfo . BACKWARD_SLASH ) != -1 ) {
71+ location = resource. substring(0 , resource. lastIndexOf(SpotBugsInfo . BACKWARD_SLASH ))
6372 }
6473
6574 // replace all occurrences of the following characters: ? : & =
Original file line number Diff line number Diff line change @@ -77,6 +77,10 @@ interface SpotBugsInfo {
7777
7878 static final String COMMA = " ,"
7979
80+ static final String FORWARD_SLASH = ' /'
81+
82+ static final String BACKWARD_SLASH = ' \\ '
83+
8084 /**
8185 * The character to separate URL tokens.
8286 *
You can’t perform that action at this time.
0 commit comments