提交 ba71264b 编写于 作者: K Kohsuke Kawaguchi

Fixed a bug in the auto-overwrite of bundled plugins.

Bundled plugins should be laid down as *.jpi, with proper measure to
migrate existing bits.
上级 79e6d157
......@@ -62,8 +62,10 @@ Upcoming changes</a>
<li class=bug>
month should not be 0.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-12356">issue 12356</a>)
<li class=rfe>
Upgrade to maven artifacts 3.0.4
<li class=bug>
Fixed a bug in the auto-overwrite of bundled plugins.
<li class=rfe>
Upgrade to maven artifacts 3.0.4
</ul>
</div><!--=TRUNK-END=-->
......
......@@ -396,10 +396,19 @@ public abstract class PluginManager extends AbstractModelObject {
* with a reasonable up-to-date check. A convenience method to be used by the {@link #loadBundledPlugins()}.
*/
protected void copyBundledPlugin(URL src, String fileName) throws IOException {
fileName = fileName.replace(".hpi",".jpi"); // normalize fileNames to have the correct suffix
String legacyName = fileName.replace(".jpi",".hpi");
long lastModified = src.openConnection().getLastModified();
File file = new File(rootDir, fileName);
File pinFile = new File(rootDir, fileName+".pinned");
{// normalization first
File legacyFile = new File(rootDir,legacyName);
if (legacyFile.exists()) legacyFile.renameTo(file);
File legacyPinFile = new File(rootDir,legacyName+".pinned");
if (legacyPinFile.exists()) legacyPinFile.renameTo(pinFile);
}
// update file if:
// - no file exists today
// - bundled version and current version differs (by timestamp), and the file isn't pinned.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册