Skip to content
Permalink
Browse files

[JENKINS-12586] cvs-plugin fails to read old changelog files

test and fix for the issue, old files contain date with yyyy-mm-DD and HH:mm, but the parser uses yyyy/mm/DD and HH:mm:ss
  • Loading branch information...
alexlehm committed Feb 12, 2012
1 parent 1ccef67 commit be6dd95edca7b4dbaf0125c6df0587d4b3c41e14
@@ -149,9 +149,9 @@ public static CVSChangeLogSet parse(final AbstractBuild<?, ?> build,
private static final DateFormat CHANGE_DATE_FORMATTER = new SimpleDateFormat(
"yyyy-MM-dd HH:mm:ss");
private static final DateFormat DATE_FORMATTER = new SimpleDateFormat(
"yyyy/MM/dd");
"yyyy-MM-dd");
private static final DateFormat TIME_FORMATTER = new SimpleDateFormat(
"HH:mm:ss");
"HH:mm");

private User author;
private String msg;
@@ -0,0 +1,22 @@
package hudson.scm;

import java.io.File;
import java.net.URISyntaxException;

import org.junit.Test;
import org.jvnet.hudson.test.HudsonTestCase;

public class CVSChangeLogParserTest extends HudsonTestCase {

// borrowed from core/test/.../TestResultTest
private File getDataFile(String name) throws URISyntaxException {
return new File(CVSChangeLogParserTest.class.getResource(name).toURI());
}

// verify fix for JENKINS-12586
@Test
public void testParseOldFile() throws Exception {
CVSChangeLogSet result = new CVSChangeLogParser().parse(null, getDataFile("changelogOldFormat.xml"));
assertNotNull(result);
}
}
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
example changelog.xml from 1.6 plugin, the format has changed in 2.0
but the old format is still read.
The file is used to check parsing the old format to verify this issue:
https://issues.jenkins-ci.org/browse/JENKINS-12586
the old format uses yyyy-mm-DD and HH:mm for date and time
-->
<changelog>
<entry>
<date>2011-12-14</date>
<time>23:26</time>
<author><![CDATA[user]]></author>
<file>
<name><![CDATA[file]]></name>
<fullName><![CDATA[/cvs/file1]]></fullName>
<revision>1.1.2.1</revision>
</file>
<msg><![CDATA[example entry]]></msg>
</entry>
</changelog>

0 comments on commit be6dd95

Please sign in to comment.
You can’t perform that action at this time.