Commit Graph
316 Commits
Author SHA1 Message Date
Daniel Beck c5497c9a57 Merge branch 'security-stable-2.107' into security-master 2018-04-26 01:49:42 +02:00
Daniel Beck 7e6c0637b1 Merge branch 'security-stable-2.89' into security-stable-2.107 2018-04-26 01:20:01 +02:00
Daniel Beck f73b827973 Merge branch 'security-stable-2.73' into security-stable-2.89 2018-04-26 00:37:06 +02:00
Wadeck Follonier 5cf0a77d44 [SECURITY-788] 2018-04-25 23:42:19 +02:00
Jesse Glick 547fd6fe6e Removing VirtualFile.asRemotable in favor of toExternalURL. 2018-04-02 15:55:40 -04:00
Jesse Glick 7b9a3e4448 [JENKINS-50237] Pick up Remoting with automatic ProxyException; and avoid BuildException to begin with. 2018-03-19 16:57:15 -04:00
Jesse Glick 8492421ce1 FilePath.exists is apparently called from LogRecorderManagerTest.loggingOnSlaves (though I cannot reproduce this). 2018-03-09 15:03:33 -05:00
Jesse Glick 73b16084f9 [JENKINS-49994] Warn about Remoting serialization of anonymous inner classes and their ilk. 2018-03-07 14:52:34 -05:00
Oleg Nenashev e5fd7b7c90 Merge pull request #3265 from jglick/simple-build-steps-should-be-simple-JENKINS-47142
[JENKINS-47142] Simplifying the logic of ArtifactArchiver.perform, making it friendlier to Pipeline
2018-02-16 20:06:33 +01:00
Jesse Glick f4b78921e8 [JENKINS-27035] Gathering command read/write events (#3071)
* Slave.JnlpJar.getURL did not work in some modes when core had a snapshot dependency on Remoting.

* Starting to implement Channel.Listener.read/write.

* Now obtaining response timing statistics.

* For now, avoiding timestamped snapshots, as it caused problems for #3120 which I have asked for help from @stephenc diagnosing.

* Simplified logging a bit.

* onResponse

* hudson.FilePath$Mkdirs is a lot more readable than hudson.FilePath$13.

* Specific snapshot.

* onJar

* LoggingChannelListener

* remoting.version=3.17

* Making a few test assertions more lenient to adapt to https://github.com/jenkinsci/remoting/pull/247.
2018-02-06 09:40:24 +01:00
Jesse Glick 193855d1fb [JENKINS-47142] Simplifying the logic of ArtifactArchiver.perform, making it friendlier to Pipeline. 2018-01-25 17:05:37 -05:00
Larry Singleton 8e78ab1c66 [JENKINS-48227] Use "Files.createTempDirectory" to create temp directory (#3161)
* Use "Files.createTempDirectory" to create temp directory instead
See SonarQube critical vulnerability squid:S2976 (tag: owasp-a9)
https://next.sonarqube.com/sonarqube/coding_rules#rule_key=squid%3AS2976

* [JENKINS-48227]
Creating a utility "static Path toPath(File file) throws IOException" method,
which wraps InvalidPathException to IOException so that it will be checked.
- also fixed public static final reference
- fixed broken test cases
- added new test cases for toPath() and createTempDir()

* Revert back to public static int

* adjustments due to merges

* Add posix check to determine if Posix FileAttributes should be included
in call to Files.createTempDirectory()

* Remove reference to private element

* Updated to use explicit imports
2017-12-22 17:38:57 +01:00
Krishan Bhasin 09bcc5d653 [JENKINS-47324] - Reduce usage of File.mkdirs() in FilePath and IOUtils (#3173)
* Move an instance of renameTo() to Files.move()

* Replace an instance of File.toURI() with an instance of Path.toUri()

* Replace mkdirs() with Files.createDirectories()
Replace mkdir() with Files.createTempDirectory()

* Undo addition of createTempDirectory() as per review comments

* Return to use of FilePath#mkdirs(File) and instead modify it to use the new API.

* Undo addition of toPath() in a URI conversion as it brings no benefits.

* Replace new uses of toPath() with Util.fileToPath() to pre-handle runtime exceptions

* Remove * import.
move mkdirs() to using FilePath method instead of File method.

* Make IOUtils.mkdirs(File) use Java7 API calls

* Add back accidentally removed imports.

* Fixed use of wildcard import

* Use utility method fileToPath() to handle potential exception thrown
2017-12-14 20:52:56 +01:00
Devin Nusbaum fdccc0e838 [JENKINS-36088] Use NIO implementations of chmod and mode by default (#3135)
* Use NIO for FilePath#chmod and IOUtils#mode

* Add tests for NIO mode and chmod implementations

* Add test, remove new method, and update JavaDoc

* Provide system property to use native implementations of chmod and mode

* Revert unrelated whitespace modification

* Don't remove exception from throws and put imports in original location

* Fix broken JavaDoc links

* Ignore file type bits (above 0o7777) in Util#modeToPermission

* Use octal for constants and don't include file type bits

* Revert unnecessary changes to TarArchiverTest

* Add assertion that non-permission bits are ignored by chmod

* Use NIO copy with StandardCopyOption.COPY_ATTRIBUTES in copyToWithPermissions where possible

* Catch InvalidPathException and convert it to IOException

* Create utility method for File#toPath and use File#createDirectories after review

* Remove useless calls to toAbsolutePath and getAbsoluteFile

* Fix typos and use octal for constant after review

* Add test for behavior of copyToWithPermission with special bits
2017-12-01 10:01:34 +03:00
Kanstantsin Shautsou 1f476da2e1 Don't use onloadable things in remoting mkdirs calls.
mkdirs do remoting call by creating anonymous class.
Remoting on remote side must load outer FilePath class with imports.
FilePath had SystemProperties OnMaster.
2017-10-09 11:29:41 +03:00
Oliver Gondža fd08d75213 Merge branch 'master' into JENKINS-19473 2017-09-24 16:05:51 +02:00
Oliver Gondža 3f3e3b80a0 [JENKINS-21905] Take advantage of suppressed exceptions 2017-09-24 16:04:50 +02:00
Oliver Gondža 4948d60345 [JENKINS-21905] Do not rewrap possibly more specific exception into a less specific one 2017-09-24 16:04:45 +02:00
Oliver Gondža a9d7caa81f [JENKINS-21905] Unwrap the unnecessary ExecutionExceptions 2017-09-24 16:04:38 +02:00
Nicolas De Loof 6c5856ed21 prefer ‘agent.jar’ over ‘slave.jar’ 2017-09-07 09:46:10 +02:00
Oleg Nenashev 095310afdd Annotate and document methods of hudson.Launcher (#2920)
* Annotate and document methods of hudson.Launcher

* Fix newly introduced FindBugs issues in hudson.Launcher

* Remove brackets from FilePath#createLauncher() to avoid the merge conflict
2017-06-24 19:17:11 +02:00
Jesse Glick 064bdbbe09 FilePath.listDirectories() was documented to never be null, but this was not in fact so.
FilePath.list() did not specify, but at least DownloadFromUrlInstaller assumed it was non-null.
2017-06-12 13:27:02 -04:00
Stephen Connolly 3871d7778e [JENKINS-43531] Plugins may not be expecting InvalidPathException
- Plugins should really be expecting it, but as historically they have not, may as well convert to IOE for them
2017-04-19 14:04:33 +01:00
Jesse Glick 7c16d8dc46 Fix Javadoc generation on JDK 8. 2017-04-11 09:26:45 -04:00
Jesse Glick 23cb13aad0 Clean up usages of IOUtils.closeQuietly and related calls (#2830)
* Clean up usages of IOUtils.closeQuietly and related calls predating Java 7.

* Review comments from @oleg-nenashev.

* Noticed another place where try-with-resources would protect against a potential leak.
2017-04-08 00:41:27 +02:00
Stephen Connolly f0cd7ae8ff [JENKINS-42934] Avoid using new FileInputStream / new FileOutputStream 2017-03-20 12:50:46 +00:00
Josh Soref 496703d0fe Spelling fixes in changelogs, Javadoc, logs and UI (#2718)
* spelling: abstract

* spelling: about

* spelling: absolute

* spelling: across

* spelling: activity

* spelling: actually

* spelling: addition

* spelling: allocating

* spelling: ambiguous

* spelling: analyzes

* spelling: analysis

* spelling: another

* spelling: appear

* spelling: arbitrary

* spelling: artifact

* spelling: assignment

* spelling: associated

* spelling: augment

* spelling: authentication

* spelling: automatically

* spelling: available

* spelling: availability

* spelling: because

* spelling: background

* spelling: beginning

* spelling: boolean

* spelling: browsers

* spelling: building

* spelling: calculation

* spelling: channel

* spelling: column

* spelling: concatenation

* spelling: connect

* spelling: contribute

* spelling: convert

* spelling: copied

* spelling: couldn't

* spelling: scrambled

* spelling: creates-a

* spelling: curr-entry

* spelling: customize

* spelling: diagnostic

* spelling: contain

* spelling: default

* spelling: delimiter

* spelling: descriptor

* spelling: disambiguates

* spelling: different

* spelling: diligently

* spelling: disabled

* spelling: discovered

* spelling: display

* spelling: doesn't

* spelling: dollar

* spelling: downstream

* spelling: dynamically

* spelling: preemptively

* spelling: encrypt

* spelling: erroneous

* spelling: examine

* spelling: existence

* spelling: value

* spelling: february

* spelling: handling

* spelling: hostname

* spelling: convenient

* spelling: identify

* spelling: implementation

* spelling: incorrect

* spelling: individual

* spelling: initialization

* spelling: initialized

* spelling: inputstream

* spelling: instantiated

* spelling: instantiation

* spelling: intended

* spelling: interpreted

* spelling: interrupted

* spelling: invocations

* spelling: kern

* spelling: localization

* spelling: logger

* spelling: malfunctioning

* spelling: methods

* spelling: monitor

* spelling: mutator

* spelling: multiple

* spelling: object

* spelling: configured

* spelling: optionally

* spelling: option

* spelling: overridden

* spelling: parameterized

* spelling: parent

* spelling: permissions

* spelling: plugin

* spelling: potentially

* spelling: preferable

* spelling: problems like

* spelling: programmatically

* spelling: property

* spelling: reallocate

* spelling: recommended

* spelling: redirected

* spelling: registered

* spelling: reliable

* spelling: remember

* spelling: recurrence

* spelling: repeatable

* spelling: repeated

* spelling: resource

* spelling: retrieve

* spelling: returned

* spelling: revision

* spelling: sandwich

* spelling: separator

* spelling: serialization

* spelling: settings

* spelling: shadow

* spelling: should

* spelling: someone

* spelling: source

* spelling: specified

* spelling: style

* spelling: subversion

* spelling: sufficient

* spelling: supplementary

* spelling: suppressing

* spelling: synchronization

* spelling: synchronized

* spelling: this

* spelling: transitioning

* spelling: termination

* spelling: trying

* spelling: truncatable

* spelling: unknown

* spelling: undeployed

* spelling: unnecessary

* spelling: unparseable

* spelling: update

* spelling: upper

* spelling: verify

* spelling: visible

* spelling: warning

* spelling: we're

* spelling: whitespace

* spelling: wide

* spelling: with

* spelling: workspace

* spelling: yielding

* spelling: to

* spelling: by

* spelling: the

* spelling: hours
2017-02-12 13:38:30 +03:00
Jesse Glick 76aa0727f0 Functions.printStackTrace utility method. 2016-12-12 17:56:24 -05:00
Jesse Glick 24aa20635d Replaced other usages of printStackTrace. 2016-12-12 16:44:10 -05:00
Daniel Beck 72cb842b6c Cleaning up @since TODO / @since XXX 2016-10-15 23:22:20 +02:00
Andres Rodriguez b62ad15fef [JENKINS-38814] Use GREEDY RemoteInputStreams (#2583) 2016-10-12 08:45:38 -07:00
Nicolas De Loof 7b39424495 rely on try-with-resources 2016-10-03 15:12:48 +02:00
Oleg Nenashev fdabb52503 Merge branch 'master' into JENKINS-34755
Conflicts:
	core/src/main/java/hudson/FilePath.java
2016-05-13 23:00:17 +02:00
Vincent Latombe 0c16c8576b [JENKINS-23507] Make FilePath.installIfNecessaryFrom follow redirects (#2331) 2016-05-13 12:36:45 +02:00
Oleg Nenashev ce8922bd74 Merge branch 'master' into JENKINS-34755
Conflicts:
	core/src/main/java/hudson/Util.java
	core/src/main/java/hudson/WebAppMain.java
	core/src/main/java/hudson/model/Item.java
	core/src/main/java/hudson/model/Queue.java
	core/src/main/java/hudson/model/UpdateCenter.java
	core/src/main/java/hudson/security/csrf/DefaultCrumbIssuer.java
	core/src/main/java/hudson/slaves/NodeProvisioner.java
	core/src/main/java/jenkins/model/Jenkins.java
	core/src/main/java/jenkins/slaves/NioChannelSelector.java
	core/src/main/java/jenkins/util/xml/XMLUtils.java
2016-05-12 12:05:24 +02:00
Daniel Beck 869f66cc07 Merge branch 'master' of github.com:jenkinsci/jenkins into 2.0
Conflicts:
	changelog.html
	cli/pom.xml
	core/pom.xml
	core/src/main/java/hudson/ProxyConfiguration.java
	core/src/main/java/jenkins/model/Jenkins.java
	core/src/main/java/jenkins/slaves/JnlpSlaveHandshake.java
	core/src/main/resources/hudson/model/Messages_da.properties
	pom.xml
	test/pom.xml
	war/pom.xml
2016-03-16 19:00:40 +01:00
Stephen Connolly 96150d3a46 Jenkins.getInstance() will be @Nonnull in Jenkins 2.0+
- Code that is running from a plugin and on the master's JVM is guaranteed to never get null from this method (any cases where you do get null are bugs in core)
- Code that is running from a plugin and on a remote JVM should never be allowed to load the Jenkins class in their classloader, so should never use Jenkins.getInstance()... we are annotating the method with @Nullable so that such code can have some evolution time
- Code that is running in core and on one of two special paths should use the Jenkins.getInstanceOrNull() method so that the UI can be presented to users before the singleton has been instantiated / after the singleton has been destroyed
- The remaining 95% of uses in core (and 100% of uses in plugins) can safely assume that the instance is never null
2016-03-08 21:15:43 +00:00
Stephen Connolly d1dfbd2baf Revert "Jenkins.getInstance() should be non-null"
This reverts commit bb7c8fcedb.

Closes #2090, I'll redo this as a PR... though if that PR is subject to multiple rounds of review before being merged then I will take that of evidence of the exact problem that committing directly was supposed to resolve... namely exponentially multiplying the effort required to make actual improvements to the code base.
2016-03-08 21:09:28 +00:00
Stephen Connolly bb7c8fcedb Jenkins.getInstance() should be non-null
- It is never too late to do the right thing.
- The vast majority of usages of `Jenkins.getInstance()` in core currently assume that its return value is non-null
- This commit changes those that are written to correctly check for non-null values will call `Jenkins.getInstanceOrNull()`
- We deprecate the `Jenkins.getActiveInstance()` madness
- I checked with @kohsuke who said not to bother with a PR and just commit this strongly opinionated change direct to master as a PR will just degrade into a bikeshedding.
2016-03-07 22:08:36 +00:00
Antonio Muñiz 320e6c0702 Slave to Agent renaming - Javadocs and logs 2016-01-29 17:40:26 +01:00
Johannes Ernst 9303136c9d Incorporated pull request feedback:
* moved to jenkins.util.SystemProperties
* consistent naming getString/getInteger/getBoolean
* improved code formatting
Improved JavaDoc
2015-11-18 18:26:41 +00:00
Johannes Ernst 709fe5b9aa Allow setting of system properties from context.xml in addition to setting from command-line.
Accomplished by centralizing calls to System.getProperty(String) and related into new file SystemProperties.java.
There, we first check for existence of system property; if not, we look for property in context.xml
This is done for "application" properties (like hudson.DNSMultiCast.disabled) but not for java properties (like user.name)
2015-11-17 01:38:51 +00:00
Christopher Simons 7efb9090dd remove unused import statements
In addition to cluttering the namespace, unused imports generate
compiler warnings, introducing noise and obscuring more important
compiler warnings.  This change removes them.
2015-11-10 10:13:52 -05:00
Oleg Nenashev 4fd10ed723 Merge pull request #1429 from dominiquebrice/jenkins-5253b
[JENKINS-5253] Allow case insensitive patterns in Artifacts Archiving
2015-10-17 22:15:52 +03:00
Kanstantsin Shautsou 03bd5959cb Revert "Revert "[JENKINS-10629] - Migrate the Tar archives handling code to commons-compress""
This reverts commit 8f1280a85c.
2015-08-25 01:09:08 +03:00
Veres Lajos d58903558e typofix - https://github.com/vlajos/misspell_fixer 2015-08-11 16:34:13 +01:00
Oleg Nenashev ca21c65bf2 Merge pull request #1667 from oleg-nenashev/JENKINS-10629-FIX
[JENKINS-28013,JENKINS-28012] - Revert changes for JENKINS-10629
2015-04-23 09:07:34 -07:00
Oleg Nenashev 8f1280a85c Revert "[JENKINS-10629] - Migrate the Tar archives handling code to commons-compress"
This reverts commit b6c7b83e7b.
2015-04-22 17:22:44 -07:00
David Hoover 1709ed3a2e Add @Deprecated annotations to things documented as @deprecated. 2015-04-19 14:50:12 -07:00
Oleg Nenashev b6c7b83e7b [JENKINS-10629] - Migrate the Tar archives handling code to commons-compress 2015-04-14 19:02:32 +03:00