/** * Previously we used to persist {@link Axis}, but now those are divided into subtypes. * So upon deserialization, resolve to the proper type. */ public Object readResolve() { if (getClass()!=Axis.class) return this; if (getName().equals("jdk")) return new JDKAxis(getValues()); if (getName().equals("label")) return new LabelAxis(getName(),getValues()); return new TextAxis(getName(),getValues()); }
/** * Previously we used to persist {@link Axis}, but now those are divided into subtypes. * So upon deserialization, resolve to the proper type. */ public Object readResolve() { if (getClass()!=Axis.class) return this; if (getName().equals("jdk")) return new JDKAxis(getValues()); if (getName().equals("label")) return new LabelAxis(getName(),getValues()); return new TextAxis(getName(),getValues()); }
/** * Previously we used to persist {@link Axis}, but now those are divided into subtypes. * So upon deserialization, resolve to the proper type. */ public Object readResolve() { if (getClass()!=Axis.class) return this; if (getName().equals("jdk")) return new JDKAxis(getValues()); if (getName().equals("label")) return new LabelAxis(getName(),getValues()); return new TextAxis(getName(),getValues()); }
/** * Previously we used to persist {@link Axis}, but now those are divided * into subtypes. So upon deserialization, resolve to the proper type. */ public Object readResolve() { if (getClass() != Axis.class) { return this; } if (getName().equals("jdk")) { return new JDKAxis(getValues()); } if (getName().equals("label")) { return new LabelAxis(getName(), getValues()); } return new TextAxis(getName(), getValues()); }
/** * Previously we used to persist {@link Axis}, but now those are divided into subtypes. * So upon deserialization, resolve to the proper type. */ public Object readResolve() { if (getClass()!=Axis.class) return this; /* This method is necessary only because earlier versions of Jenkins treated axis names "label" and "jdk" differently, plus Axis was a concrete class, and we need to be able to read that back. So this measure is not needed for newly added Axes. */ if (getName().equals("jdk")) return new JDKAxis(getValues()); if (getName().equals("label")) return new LabelAxis(getName(),getValues()); return new TextAxis(getName(),getValues()); }
@Test public void specialCharsInRelativePath() throws Exception { Assume.assumeFalse(Functions.isWindows()); final String ID_PREFIX = "test-../a=%3C%7C%23)/testReport/org.twia.vendor/VendorManagerTest/testCreateAdjustingFirm/"; final String EXPECTED = "org.twia.dao.DAOException: [S2001] Hibernate encountered an error updating Claim [null]"; MatrixProject p = j.jenkins.createProject(MatrixProject.class, "test-" + j.jenkins.getItems().size()); p.setAxes(new AxisList(new TextAxis("a", "<|#)"))); p.setScm(new SingleFileSCM("report.xml", getClass().getResource("junit-report-20090516.xml"))); p.getPublishersList().add(new JUnitResultArchiver("report.xml")); MatrixBuild b = p.scheduleBuild2(0).get(); j.assertBuildStatus(Result.UNSTABLE, b); WebClient wc = j.createWebClient(); HtmlPage page = wc.getPage(b, "testReport"); assertThat(page.asText(), not(containsString(EXPECTED))); ((HtmlAnchor) page.getElementById(ID_PREFIX + "-showlink")).click(); wc.waitForBackgroundJavaScript(10000L); assertThat(page.asText(), containsString(EXPECTED)); ((HtmlAnchor) page.getElementById(ID_PREFIX + "-hidelink")).click(); wc.waitForBackgroundJavaScript(10000L); assertThat(page.asText(), not(containsString(EXPECTED))); }