-
-
Notifications
You must be signed in to change notification settings - Fork 9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Java cleanup #4034
Closed
+141
−180
Closed
Java cleanup #4034
Changes from 8 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
dfbe6b4
IntelliJ/Java: Duplicate declaration
jsoref 0e2b395
IntelliJ/Java: Duplicate declaration
jsoref 906ca05
IntelliJ/Java: Duplicate code
jsoref 311bdb5
IntelliJ/Java: Duplicate code
jsoref 41292ac
IntelliJ/Java: Duplicate code
jsoref 729e347
IntelliJ/Java: Duplicate code
jsoref 07e53b1
IntelliJ/Java: Duplicate code
jsoref e6ec9ba
IntelliJ/Java: Duplicate code
jsoref 4c251cc
Warn to check for null
jsoref File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package jenkins.mvn; | ||
|
||
import hudson.EnvVars; | ||
import hudson.FilePath; | ||
import hudson.Util; | ||
import hudson.model.AbstractBuild; | ||
import hudson.model.TaskListener; | ||
import hudson.util.IOUtils; | ||
import org.kohsuke.accmod.Restricted; | ||
import org.kohsuke.accmod.restrictions.NoExternalUse; | ||
|
||
import java.io.File; | ||
import java.io.IOException; | ||
|
||
@Restricted(NoExternalUse.class) | ||
class SettingsPathHelper { | ||
jsoref marked this conversation as resolved.
Show resolved
Hide resolved
|
||
static FilePath getSettings(AbstractBuild<?, ?> build, TaskListener listener, String path) throws IOException, InterruptedException { | ||
EnvVars env = build.getEnvironment(listener); | ||
String targetPath = Util.replaceMacro(path, build.getBuildVariableResolver()); | ||
targetPath = env.expand(targetPath); | ||
|
||
if (IOUtils.isAbsolute(targetPath)) { | ||
return new FilePath(new File(targetPath)); | ||
} else { | ||
FilePath mrSettings = build.getModuleRoot().child(targetPath); | ||
FilePath wsSettings = build.getWorkspace().child(targetPath); | ||
try { | ||
if (!wsSettings.exists() && mrSettings.exists()) { | ||
wsSettings = mrSettings; | ||
} | ||
} catch (Exception e) { | ||
throw new IllegalStateException("failed to find settings.xml at: " + wsSettings.getRemote()); | ||
} | ||
return wsSettings; | ||
} | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That could be even made a public API now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you want it to be, sure. I'm trying not to change public api surfaces in these PRs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
protected
is also a public API, so no big difference 🤷♂There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, well, if people are ok w/ switching to public, I don't mind, it seemed like a reasonable improvement, I'm just not terribly familiar w/ how jenkins does api design.