提交 7e3bc36b 编写于 作者: J Jerome Lacoste

Revert "merge changelog.html fixes from kk"

Note that the above description is incorrect as to what the merge was about.
It is the message that I intended to make. It appears that I accidentaly merged multiple fixes waiting to be reviewed on my private fork.

This reverts commit dce0d2af, reversing
changes made to 63f67f30.
上级 dce0d2af
* check classes moved to stapler
* check why we can't just use IOUtil
* check cases where we don't want to closeQuietly. We should at least log. Why not having a global error handler instead ?
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html> <html>
<!-- <!--
...@@ -16,8 +15,7 @@ Some tips: ...@@ -16,8 +15,7 @@ Some tips:
- link to bugs in the issue tracker, e-mail thread in the archive, and so on if you can. - link to bugs in the issue tracker, e-mail thread in the archive, and so on if you can.
--> -->
<head> <head id="head">
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<title>Changelog</title> <title>Changelog</title>
<link rel="alternate" title="Hudson announcements" href="https://hudson.dev.java.net/servlets/ProjectNewsRSS" type="application/rss+xml"> <link rel="alternate" title="Hudson announcements" href="https://hudson.dev.java.net/servlets/ProjectNewsRSS" type="application/rss+xml">
<link rel="stylesheet" TYPE="text/css" href="changelog.css"> <link rel="stylesheet" TYPE="text/css" href="changelog.css">
...@@ -40,14 +38,14 @@ Some tips: ...@@ -40,14 +38,14 @@ Some tips:
<div id="ratings" style="display:none; font-size:120%; <div id="ratings" style="display:none; font-size:120%;
border:1px solid black; background-color:#eee; padding:0.5em; margin-bottom:1em"> border:1px solid black; background-color:#eee; padding:0.5em; margin-bottom:1em">
Help other Hudson users by letting the community know which releases you've used, Help other Hudson users by letting the community know which releases you've used,
and whether they had any significant issues. <br> and whether they had any significant issues. <br/>
Legend: <br> Legend: <br/>
<img src="http://ci.jenkins-ci.org/images/16x16/health-80plus.gif" width="16" height="16" <img src="http://ci.jenkins-ci.org/images/16x16/health-80plus.gif" width="16" height="16"
alt="Sunny"> = I use it on my production site without major issues. <br> alt="Sunny"/> = I use it on my production site without major issues. <br/>
<img src="http://ci.jenkins-ci.org/images/16x16/health-40to59.gif" width="16" height="16" <img src="http://ci.jenkins-ci.org/images/16x16/health-40to59.gif" width="16" height="16"
alt="Cloudy"> = I don't recommend it. <br> alt="Cloudy"/> = I don't recommend it. <br/>
<img src="http://ci.jenkins-ci.org/images/16x16/health-00to19.gif" width="16" height="16" <img src="http://ci.jenkins-ci.org/images/16x16/health-00to19.gif" width="16" height="16"
alt="Lightning"> = I tried it but rolled back to a previous version. <br> alt="Lightning"/> = I tried it but rolled back to a previous version. <br/>
View ratings below, and click one of the icons next to your version to provide your input. View ratings below, and click one of the icons next to your version to provide your input.
</div> </div>
...@@ -116,7 +114,7 @@ Upcoming changes</a> ...@@ -116,7 +114,7 @@ Upcoming changes</a>
If the JNLP-connected slave drops out without the master not noticing, allow the reconnection If the JNLP-connected slave drops out without the master not noticing, allow the reconnection
without rejecting it. without rejecting it.
(<a href="http://issues.jenkins-ci.org/browse/JENKINS-5055">issue 5055</a>) (<a href="http://issues.jenkins-ci.org/browse/JENKINS-5055">issue 5055</a>)
<li class='major rfe'> <li class'major rfe'>
Fixed a trademark bug that caused a considerable fiasco by renaming to Jenkins Fixed a trademark bug that caused a considerable fiasco by renaming to Jenkins
</ul> </ul>
<h3><a name=v1.395>What's new in 1.395</a> (2011/01/21)</h3> <h3><a name=v1.395>What's new in 1.395</a> (2011/01/21)</h3>
...@@ -326,7 +324,7 @@ Upcoming changes</a> ...@@ -326,7 +324,7 @@ Upcoming changes</a>
<li class=rfe> <li class=rfe>
Update bundled subversion plugin to version 1.20 and ssh-slaves to version 0.14. Update bundled subversion plugin to version 1.20 and ssh-slaves to version 0.14.
</ul> </ul>
<h4><s><a name=v1.385>What's new in 1.385</a> (2010/11/15)</s></h4> <s><h4><a name=v1.385>What's new in 1.385</a> (2010/11/15)</h4></s>
<ul class=image> <ul class=image>
<li class=rfe> Oops, same as 1.384 <li class=rfe> Oops, same as 1.384
</ul> </ul>
...@@ -387,7 +385,7 @@ Upcoming changes</a> ...@@ -387,7 +385,7 @@ Upcoming changes</a>
<li class=rfe> <li class=rfe>
Improved packet fragmentation in Winstone when writing out HTTP responses. Improved packet fragmentation in Winstone when writing out HTTP responses.
<li class=rfe><a href="http://wiki.jenkins-ci.org/display/JENKINS//Extension+Point+for+Project+Views+Navigation">Extension Point to provide alternate UI for Project Views implemented</a> <li class=rfe><a href="http://wiki.jenkins-ci.org/display/JENKINS//Extension+Point+for+Project+Views+Navigation">Extension Point to provide alternate UI for Project Views implemented</a>
(<a href="http://issues.jenkins-ci.org/browse/JENKINS-1467">issue 1467</a>) </l> (<a href="http://issues.jenkins-ci.org/browse/JENKINS-1467">issue 1467</a>)
</ul> </ul>
<h3><a name=v1.380>What's new in 1.380</a> (2010/10/09)</h3> <h3><a name=v1.380>What's new in 1.380</a> (2010/10/09)</h3>
<ul class=image> <ul class=image>
...@@ -662,7 +660,7 @@ Upcoming changes</a> ...@@ -662,7 +660,7 @@ Upcoming changes</a>
Fix redirect after login when return URL has characters that need encoding. Fix redirect after login when return URL has characters that need encoding.
(<a href="http://issues.jenkins-ci.org/browse/JENKINS-6960">issue 6960</a>) (<a href="http://issues.jenkins-ci.org/browse/JENKINS-6960">issue 6960</a>)
<li class=bug> <li class=bug>
&lt;input type='hidden'&gt; field shouldn't be getting the plain text password value. &lt;input type='hidden'> field shouldn't be getting the plain text password value.
<li class=rfe> <li class=rfe>
Added a mechanism to register CLI option handler as an extension point. Added a mechanism to register CLI option handler as an extension point.
<li class=rfe> <li class=rfe>
...@@ -1615,7 +1613,7 @@ Upcoming changes</a> ...@@ -1615,7 +1613,7 @@ Upcoming changes</a>
(<a href="http://issues.jenkins-ci.org/browse/JENKINS-4752">issue 4752</a>) (<a href="http://issues.jenkins-ci.org/browse/JENKINS-4752">issue 4752</a>)
<li class='major bug'> <li class='major bug'>
Fixed <tt>NotExportableException</tt> when making a remote API call on a project. Fixed <tt>NotExportableException</tt> when making a remote API call on a project.
(<a href="https://hudson.dev.java.net/servlets/BrowseList?list=users&amp;by=thread&amp;from=2222483">report</a>) (<a href="https://hudson.dev.java.net/servlets/BrowseList?list=users&by=thread&from=2222483">report</a>)
<li class=bug> <li class=bug>
Fixed <tt>IllegalArgumentException: name</tt> Fixed <tt>IllegalArgumentException: name</tt>
(<a href="http://old.nabble.com/bug-1.331-to26145963.html">report</a>) (<a href="http://old.nabble.com/bug-1.331-to26145963.html">report</a>)
......
...@@ -26,14 +26,12 @@ package hudson; ...@@ -26,14 +26,12 @@ package hudson;
import hudson.util.DualOutputStream; import hudson.util.DualOutputStream;
import hudson.util.EncodingStream; import hudson.util.EncodingStream;
import com.thoughtworks.xstream.core.util.Base64Encoder; import com.thoughtworks.xstream.core.util.Base64Encoder;
import hudson.util.IOUtils;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.io.OutputStreamWriter; import java.io.OutputStreamWriter;
import java.io.Writer; import java.io.Writer;
...@@ -176,19 +174,11 @@ public class Main { ...@@ -176,19 +174,11 @@ public class Main {
con.connect(); con.connect();
// send the data // send the data
FileInputStream in = new FileInputStream(tmpFile); FileInputStream in = new FileInputStream(tmpFile);
try { Util.copyStream(in,con.getOutputStream());
Util.copyStream(in,con.getOutputStream()); in.close();
} finally {
IOUtils.closeQuietly(in);
}
if(con.getResponseCode()!=200) { if(con.getResponseCode()!=200) {
InputStream errorStream = con.getErrorStream(); Util.copyStream(con.getErrorStream(),System.err);
try{
Util.copyStream(errorStream,System.err);
} finally{
IOUtils.closeQuietly(errorStream);
}
} }
return ret; return ret;
......
...@@ -306,7 +306,7 @@ public abstract class Proc { ...@@ -306,7 +306,7 @@ public abstract class Proc {
try { try {
byte[] buf = new byte[8192]; byte[] buf = new byte[8192];
int len; int len;
while ((len = in.read(buf)) >= 0) { while ((len = in.read(buf)) > 0) {
out.write(buf, 0, len); out.write(buf, 0, len);
out.flush(); out.flush();
} }
...@@ -315,7 +315,7 @@ public abstract class Proc { ...@@ -315,7 +315,7 @@ public abstract class Proc {
out.close(); out.close();
} }
} catch (IOException e) { } catch (IOException e) {
throw new RuntimeException(e); // TODO: what to do?
} }
} }
} }
...@@ -331,7 +331,7 @@ public abstract class Proc { ...@@ -331,7 +331,7 @@ public abstract class Proc {
} }
/** /**
* Remotely launched process via {@link hudson.remoting.Channel}. * Retemoly launched process via {@link Channel}.
*/ */
public static final class RemoteProc extends Proc { public static final class RemoteProc extends Proc {
private final Future<Integer> process; private final Future<Integer> process;
......
...@@ -61,13 +61,10 @@ public class UDPBroadcastThread extends Thread { ...@@ -61,13 +61,10 @@ public class UDPBroadcastThread extends Thread {
@Override @Override
public void run() { public void run() {
try { try {
try{
mcs.joinGroup(MULTICAST); mcs.joinGroup(MULTICAST);
} finally{
ready.signal(); ready.signal();
}
while(true) { while(true) {
byte[] buf = new byte[2048]; byte[] buf = new byte[2048];
DatagramPacket p = new DatagramPacket(buf,buf.length); DatagramPacket p = new DatagramPacket(buf,buf.length);
mcs.receive(p); mcs.receive(p);
......
...@@ -419,19 +419,17 @@ public class Util { ...@@ -419,19 +419,17 @@ public class Util {
} }
} }
// FIXME we are using 8k buffers instead of 4k in IOUtil. Do we really want to support our own version ? Or is it to avoid a dependency ?
public static void copyStream(InputStream in,OutputStream out) throws IOException { public static void copyStream(InputStream in,OutputStream out) throws IOException {
byte[] buf = new byte[8192]; byte[] buf = new byte[8192];
int len; int len;
while((len=in.read(buf))>=0) while((len=in.read(buf))>0)
out.write(buf,0,len); out.write(buf,0,len);
} }
// FIXME we are using 8k buffers instead of 4k in IOUtil. Do we really want to support our own version ? Or is it to avoid a dependency ?
public static void copyStream(Reader in, Writer out) throws IOException { public static void copyStream(Reader in, Writer out) throws IOException {
char[] buf = new char[8192]; char[] buf = new char[8192];
int len; int len;
while((len=in.read(buf))>=0) while((len=in.read(buf))>0)
out.write(buf,0,len); out.write(buf,0,len);
} }
...@@ -521,7 +519,7 @@ public class Util { ...@@ -521,7 +519,7 @@ public class Util {
DigestInputStream in =new DigestInputStream(source,md5); DigestInputStream in =new DigestInputStream(source,md5);
try { try {
while(in.read(garbage)>=0) while(in.read(garbage)>0)
; // simply discard the input ; // simply discard the input
} finally { } finally {
in.close(); in.close();
......
...@@ -113,16 +113,12 @@ public class LargeText { ...@@ -113,16 +113,12 @@ public class LargeText {
final Session session = source.open(); final Session session = source.open();
public int read() throws IOException { public int read() throws IOException {
byte[] buf = new byte[1]; byte[] buf = new byte[1];
int n; int n = session.read(buf);
while ((n = session.read(buf)) != -1) { if(n==1) return buf[0];
if (n > 0) { else return -1; // EOF
return buf[0];
}
}
return -1; // EOF
} }
public int read(byte[] buf, int off, int len) throws IOException { // CHECKED-CALLERS public int read(byte[] buf, int off, int len) throws IOException {
return session.read(buf,off,len); return session.read(buf,off,len);
} }
...@@ -365,11 +361,11 @@ public class LargeText { ...@@ -365,11 +361,11 @@ public class LargeText {
n -= in.skip(n); n -= in.skip(n);
} }
public int read(byte[] buf) throws IOException { // CHECKED-CALLERS public int read(byte[] buf) throws IOException {
return in.read(buf); return in.read(buf);
} }
public int read(byte[] buf, int offset, int length) throws IOException { // CHECKED-CALLERS public int read(byte[] buf, int offset, int length) throws IOException {
return in.read(buf,offset,length); return in.read(buf,offset,length);
} }
} }
......
...@@ -291,7 +291,7 @@ public class TarInputStream extends FilterInputStream { ...@@ -291,7 +291,7 @@ public class TarInputStream extends FilterInputStream {
* @throws IOException on error * @throws IOException on error
*/ */
public int read() throws IOException { public int read() throws IOException {
int num = this.read(this.oneBuf, 0, 1); // FIXME check if read() guarantees to return at least 1 character, otherwise bug lurking int num = this.read(this.oneBuf, 0, 1);
return num == -1 ? -1 : ((int) this.oneBuf[0]) & 0xFF; return num == -1 ? -1 : ((int) this.oneBuf[0]) & 0xFF;
} }
......
...@@ -138,7 +138,7 @@ public class ChunkedInputStream extends InputStream { ...@@ -138,7 +138,7 @@ public class ChunkedInputStream extends InputStream {
* @throws IOException if an IO problem occurs. * @throws IOException if an IO problem occurs.
*/ */
@Override @Override
public int read(byte[] b, int off, int len) throws IOException { // CHECKED-CALLERS public int read (byte[] b, int off, int len) throws IOException {
if (closed) { if (closed) {
throw new IOException("Attempted read from closed stream."); throw new IOException("Attempted read from closed stream.");
...@@ -168,7 +168,7 @@ public class ChunkedInputStream extends InputStream { ...@@ -168,7 +168,7 @@ public class ChunkedInputStream extends InputStream {
* @throws IOException if an IO problem occurs. * @throws IOException if an IO problem occurs.
*/ */
@Override @Override
public int read(byte[] b) throws IOException { // CHECKED-CALLERS public int read (byte[] b) throws IOException {
return read(b, 0, b.length); return read(b, 0, b.length);
} }
......
...@@ -140,8 +140,8 @@ public class CompressedFile { ...@@ -140,8 +140,8 @@ public class CompressedFile {
try { try {
Util.copyStream(in,out); Util.copyStream(in,out);
} finally { } finally {
IOUtils.closeQuietly(in); in.close();
IOUtils.closeQuietly(out); out.close();
} }
// if the compressed file is created successfully, remove the original // if the compressed file is created successfully, remove the original
file.delete(); file.delete();
......
...@@ -57,7 +57,7 @@ public class HeadBufferingStream extends FilterInputStream { ...@@ -57,7 +57,7 @@ public class HeadBufferingStream extends FilterInputStream {
} }
@Override @Override
public int read(byte b[], int off, int len) throws IOException { // CHECKED-CALLERS public int read(byte b[], int off, int len) throws IOException {
int r = in.read(b, off, len); int r = in.read(b, off, len);
if(r>0) { if(r>0) {
int sp = space(); int sp = space();
......
...@@ -57,7 +57,7 @@ public class StreamCopyThread extends Thread { ...@@ -57,7 +57,7 @@ public class StreamCopyThread extends Thread {
try { try {
byte[] buf = new byte[8192]; byte[] buf = new byte[8192];
int len; int len;
while ((len = in.read(buf)) >= 0) while ((len = in.read(buf)) > 0)
out.write(buf, 0, len); out.write(buf, 0, len);
} finally { } finally {
// it doesn't make sense not to close InputStream that's already EOF-ed, // it doesn't make sense not to close InputStream that's already EOF-ed,
...@@ -67,7 +67,7 @@ public class StreamCopyThread extends Thread { ...@@ -67,7 +67,7 @@ public class StreamCopyThread extends Thread {
out.close(); out.close();
} }
} catch (IOException e) { } catch (IOException e) {
throw new RuntimeException(e); // TODO: what to do?
} }
} }
} }
...@@ -57,13 +57,10 @@ final class ZipArchiver extends Archiver { ...@@ -57,13 +57,10 @@ final class ZipArchiver extends Archiver {
} else { } else {
zip.putNextEntry(new ZipEntry(relativePath)); zip.putNextEntry(new ZipEntry(relativePath));
FileInputStream in = new FileInputStream(f); FileInputStream in = new FileInputStream(f);
try { int len;
int len; while((len=in.read(buf))>0)
while((len=in.read(buf))>=0) zip.write(buf,0,len);
zip.write(buf,0,len); in.close();
} finally {
in.close();
}
zip.closeEntry(); zip.closeEntry();
} }
entriesWritten++; entriesWritten++;
......
...@@ -47,7 +47,7 @@ public class FilePathTest extends ChannelTestCase { ...@@ -47,7 +47,7 @@ public class FilePathTest extends ChannelTestCase {
* An attempt to reproduce the file descriptor leak. * An attempt to reproduce the file descriptor leak.
* If this operation leaks a file descriptor, 2500 should be enough, I think. * If this operation leaks a file descriptor, 2500 should be enough, I think.
*/ */
public void DISABLED_testCopyTo2() throws Exception { public void testCopyTo2() throws Exception {
for (int j=0; j<2500; j++) { for (int j=0; j<2500; j++) {
File tmp = File.createTempFile("testCopyFrom",""); File tmp = File.createTempFile("testCopyFrom","");
FilePath f = new FilePath(tmp); FilePath f = new FilePath(tmp);
......
...@@ -29,7 +29,6 @@ import org.apache.commons.io.IOUtils; ...@@ -29,7 +29,6 @@ import org.apache.commons.io.IOUtils;
import java.io.IOException; import java.io.IOException;
import java.net.URL; import java.net.URL;
import java.util.logging.Logger;
/** /**
* Quick test for {@link UpdateCenter}. * Quick test for {@link UpdateCenter}.
...@@ -37,13 +36,16 @@ import java.util.logging.Logger; ...@@ -37,13 +36,16 @@ import java.util.logging.Logger;
* @author Kohsuke Kawaguchi * @author Kohsuke Kawaguchi
*/ */
public class UpdateCenterTest extends TestCase { public class UpdateCenterTest extends TestCase {
private URL getDataFileURL(String name) {
return UpdateCenterTest.class.getResource(name);
}
public void testData() throws IOException { public void testData() throws IOException {
URL url = getDataFileURL("light_update-center.json?version=build"); // we use the "light" version to speed things up. // check if we have the internet connectivity. See HUDSON-2095
try {
new URL("http://updates.hudson-labs.org/").openStream();
} catch (IOException e) {
System.out.println("Skipping this test. No internet connectivity");
return;
}
URL url = new URL("http://updates.hudson-labs.org/update-center.json?version=build");
String jsonp = IOUtils.toString(url.openStream()); String jsonp = IOUtils.toString(url.openStream());
String json = jsonp.substring(jsonp.indexOf('(')+1,jsonp.lastIndexOf(')')); String json = jsonp.substring(jsonp.indexOf('(')+1,jsonp.lastIndexOf(')'));
...@@ -51,6 +53,6 @@ public class UpdateCenterTest extends TestCase { ...@@ -51,6 +53,6 @@ public class UpdateCenterTest extends TestCase {
UpdateSite.Data data = us.new Data(JSONObject.fromObject(json)); UpdateSite.Data data = us.new Data(JSONObject.fromObject(json));
assertTrue(data.core.url.startsWith("http://updates.hudson-labs.org/")); assertTrue(data.core.url.startsWith("http://updates.hudson-labs.org/"));
assertTrue(data.plugins.containsKey("rake")); assertTrue(data.plugins.containsKey("rake"));
Logger.getLogger(UpdateCenterTest.class.getName()).fine(data.core.url); System.out.println(data.core.url);
} }
} }
...@@ -28,7 +28,6 @@ import java.text.DateFormat; ...@@ -28,7 +28,6 @@ import java.text.DateFormat;
import java.util.Calendar; import java.util.Calendar;
import java.util.GregorianCalendar; import java.util.GregorianCalendar;
import java.util.Locale; import java.util.Locale;
import java.util.logging.Logger;
import junit.framework.TestCase; import junit.framework.TestCase;
import org.jvnet.hudson.test.Bug; import org.jvnet.hudson.test.Bug;
...@@ -157,9 +156,8 @@ public class CronTabTest extends TestCase { ...@@ -157,9 +156,8 @@ public class CronTabTest extends TestCase {
*/ */
private void compare(Calendar a, Calendar b) { private void compare(Calendar a, Calendar b) {
DateFormat f = DateFormat.getDateTimeInstance(); DateFormat f = DateFormat.getDateTimeInstance();
String msg = f.format(a.getTime()) + " vs " + f.format(b.getTime()); System.out.println(f.format(a.getTime())+" vs "+f.format(b.getTime()));
Logger.getLogger(CronTabTest.class.getName()).fine(msg); assertEquals(a,b);
assertEquals(msg, a,b);
} }
} }
...@@ -40,7 +40,6 @@ import hudson.util.DescribableList; ...@@ -40,7 +40,6 @@ import hudson.util.DescribableList;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.Set; import java.util.Set;
import java.util.logging.Logger;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
...@@ -123,7 +122,7 @@ public class NodeListTest extends TestCase { ...@@ -123,7 +122,7 @@ public class NodeListTest extends TestCase {
x.write(nl); x.write(nl);
String xml = FileUtils.readFileToString(tmp); String xml = FileUtils.readFileToString(tmp);
Logger.getLogger(NodeListTest.class.getName()).fine(xml); System.out.println(xml);
assertEquals(4,xml.split("\n").length); assertEquals(4,xml.split("\n").length);
NodeList back = (NodeList)x.read(); NodeList back = (NodeList)x.read();
......
...@@ -32,7 +32,6 @@ import java.util.Iterator; ...@@ -32,7 +32,6 @@ import java.util.Iterator;
import java.util.Set; import java.util.Set;
import java.util.HashSet; import java.util.HashSet;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.logging.Logger;
/** /**
* @author Kohsuke Kawaguchi * @author Kohsuke Kawaguchi
...@@ -47,7 +46,7 @@ public class ConsistentHashTest extends TestCase { ...@@ -47,7 +46,7 @@ public class ConsistentHashTest extends TestCase {
hash.add("data2"); hash.add("data2");
hash.add("data3"); hash.add("data3");
Logger.getLogger(ConsistentHashTest.class.getName()).fine(hash.lookup(0)); System.out.println(hash.lookup(0));
// there's one in 2^32 chance that this test fails, but these two query points are // there's one in 2^32 chance that this test fails, but these two query points are
// only off by one. // only off by one.
...@@ -83,9 +82,9 @@ public class ConsistentHashTest extends TestCase { ...@@ -83,9 +82,9 @@ public class ConsistentHashTest extends TestCase {
else odd++; else odd++;
} }
// again, there's a small chance tha this test fails. // again, there's a small chance tha this test fails.
String msg = ""+even+"/"+odd; System.out.printf("%d/%d\n",even,odd);
assertTrue(msg,even*8<odd); assertTrue(even*8<odd);
} }
/** /**
......
...@@ -5,7 +5,6 @@ import junit.framework.TestCase; ...@@ -5,7 +5,6 @@ import junit.framework.TestCase;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.TreeMap; import java.util.TreeMap;
import java.util.logging.Logger;
/** /**
* @author Kohsuke Kawaguchi * @author Kohsuke Kawaguchi
...@@ -27,7 +26,7 @@ public class PackedMapTest extends TestCase { ...@@ -27,7 +26,7 @@ public class PackedMapTest extends TestCase {
assertEquals("d", p.get("c")); assertEquals("d", p.get("c"));
assertEquals(p.size(),2); assertEquals(p.size(),2);
for (Entry<String,String> e : p.entrySet()) { for (Entry<String,String> e : p.entrySet()) {
Logger.getLogger(PackedMapTest.class.getName()).fine(e.getKey()+'='+e.getValue()); System.out.println(e.getKey()+'='+e.getValue());
} }
Holder h = new Holder(); Holder h = new Holder();
......
...@@ -33,7 +33,8 @@ import java.util.Arrays; ...@@ -33,7 +33,8 @@ import java.util.Arrays;
public class QuotedStringTokenizerTest extends TestCase { public class QuotedStringTokenizerTest extends TestCase {
private void check(String src, String... expected) { private void check(String src, String... expected) {
String[] r = QuotedStringTokenizer.tokenize(src); String[] r = QuotedStringTokenizer.tokenize(src);
assertTrue(Arrays.asList(r).toString(), Arrays.equals(r, expected)); System.out.println(Arrays.asList(r));
assertTrue(Arrays.equals(r, expected));
} }
public void test1() { public void test1() {
......
...@@ -51,7 +51,8 @@ public class SecretTest extends TestCase { ...@@ -51,7 +51,8 @@ public class SecretTest extends TestCase {
assertEquals("abc",secret.getPlainText()); assertEquals("abc",secret.getPlainText());
// make sure we got some encryption going // make sure we got some encryption going
assertNotSame("abc", secret.getEncryptedValue()); System.out.println(secret.getEncryptedValue());
assertTrue(!"abc".equals(secret.getEncryptedValue()));
// can we round trip? // can we round trip?
assertEquals(secret,Secret.fromString(secret.getEncryptedValue())); assertEquals(secret,Secret.fromString(secret.getEncryptedValue()));
......
...@@ -29,7 +29,6 @@ import hudson.model.Result; ...@@ -29,7 +29,6 @@ import hudson.model.Result;
import hudson.model.Run; import hudson.model.Run;
import java.util.Map; import java.util.Map;
import java.util.logging.Logger;
/** /**
* Tests for XML serialization of java objects. * Tests for XML serialization of java objects.
...@@ -37,9 +36,7 @@ import java.util.logging.Logger; ...@@ -37,9 +36,7 @@ import java.util.logging.Logger;
*/ */
public class XStream2Test extends TestCase { public class XStream2Test extends TestCase {
public static final Logger LOGGER = Logger.getLogger(XStream2Test.class.getName()); public static final class Foo {
public static final class Foo {
Result r1,r2; Result r1,r2;
} }
...@@ -147,7 +144,7 @@ public class XStream2Test extends TestCase { ...@@ -147,7 +144,7 @@ public class XStream2Test extends TestCase {
ImmutableMapHolder a = new ImmutableMapHolder(); ImmutableMapHolder a = new ImmutableMapHolder();
a.m = m; a.m = m;
String xml = xs.toXML(a); String xml = xs.toXML(a);
LOGGER.fine(xml); System.out.println(xml);
assertFalse("shouldn't contain the class name",xml.contains("google")); assertFalse("shouldn't contain the class name",xml.contains("google"));
assertFalse("shouldn't contain the class name",xml.contains("class")); assertFalse("shouldn't contain the class name",xml.contains("class"));
a = (ImmutableMapHolder)xs.fromXML(xml); a = (ImmutableMapHolder)xs.fromXML(xml);
...@@ -160,7 +157,7 @@ public class XStream2Test extends TestCase { ...@@ -160,7 +157,7 @@ public class XStream2Test extends TestCase {
MapHolder a = new MapHolder(); MapHolder a = new MapHolder();
a.m = m; a.m = m;
String xml = xs.toXML(a); String xml = xs.toXML(a);
LOGGER.fine(xml); System.out.println(xml);
assertTrue("XML should mention the class name",xml.contains('\"'+ImmutableMap.class.getName()+'\"')); assertTrue("XML should mention the class name",xml.contains('\"'+ImmutableMap.class.getName()+'\"'));
a = (MapHolder)xs.fromXML(xml); a = (MapHolder)xs.fromXML(xml);
......
updateCenter.post(
{
"connectionCheckUrl": "http://www.google.com/",
"core": {
"buildDate": "Jan 21, 2011",
"name": "core",
"url": "http://updates.hudson-labs.org/download/war/1.395/hudson.war",
"version": "1.395"
},
"id": "default",
"plugins": {
"rake": {
"buildDate": "Oct 30, 2010",
"dependencies": [],
"developers": [ {
"developerId": "david_calavera",
"email": "calavera@apache.org",
"name": "David Calavera"
}],
"excerpt": "This plugin allows Hudson to invoke <a href='http://rake.rubyforge.org'>Rake<\/a> tasks as build steps.",
"labels": ["builder"],
"name": "rake",
"previousTimestamp": "2010-10-28T22:18:02.00Z",
"previousVersion": "1.7.2",
"releaseTimestamp": "2010-10-30T16:33:22.00Z",
"requiredCore": "1.376",
"scm": "github.com",
"title": "Rake plugin",
"url": "http://updates.hudson-labs.org/download/plugins/rake/1.7.3/rake.hpi",
"version": "1.7.3",
"wiki": "http://wiki.hudson-ci.org//display/HUDSON/Rake+plugin"
},
"rebuild": {
"buildDate": "Sep 15, 2010",
"dependencies": [],
"developers": [ {
"developerId": "ragesh_nair",
"email": "ragesh.x.nair@sonyericsson.com",
"name": "Ragesh Nair"
}],
"excerpt": "This plugin allows the user to _rebuild_ a _parameterized build_ without entering the _parameters_ again.",
"labels": ["misc"],
"name": "rebuild",
"previousTimestamp": "2010-07-16T20:17:48.00Z",
"previousVersion": "1.1",
"releaseTimestamp": "2010-09-15T14:07:48.00Z",
"requiredCore": "1.354",
"scm": "svn.dev.java.net",
"title": "Rebuild Plugin",
"url": "http://updates.hudson-labs.org/download/plugins/rebuild/1.4/rebuild.hpi",
"version": "1.4",
"wiki": "http://wiki.hudson-ci.org//display/HUDSON/Rebuild+Plugin"
},
},
"signature": {
"certificates": ["MIIE8jCCA9qgAwIBAgIBBjANBgkqhkiG9w0BAQUFADCBojELMAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFDASBgNVBAcTC1NhbnRhIENsYXJhMRcwFQYDVQQKEw5IdWRzb24gcHJvamVjdDEXMBUGA1UECxMOSHVkc29uIFJvb3QgQ0ExFzAVBgNVBAMTDkh1ZHNvbiBSb290IENBMR0wGwYJKoZIhvcNAQkBFg5odWRzb25Ac3VuLmNvbTAeFw0xMDA0MTgyMzQzMzhaFw0xMTA0MTgyMzQzMzhaMIGVMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTERMA8GA1UEBxMIU2FuIEpvc2UxDzANBgNVBAoTBkh1ZHNvbjEPMA0GA1UECxMGSHVkc29uMR0wGwYDVQQDExRIdWRzb24gVXBkYXRlIENlbnRlcjEdMBsGCSqGSIb3DQEJARYOa2tAa29oc3VrZS5vcmcwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDUQ7uN/ZQvyHvi5UONr2CAmWfWiAPPqaF4SS7dTIaLM/sxRgnZY1k7zt/8MTce7gNOd2EyCru93EgMVY1ivEH4b9fYSlzSnu8Lx2RdMulW0iqinLY17Jv+J1qxq+tRUyMa9y3DN28sf7ydLcpEJog3Of6KL+zJlKQS0oNcgsju9LdfzccmMu8Qq3lNhtcdsPkcRWpHyGiyva99xXBR/pqxM0GR8aMZYNwLi59Vg8/fpkTLwhBGVOgEIdO4ARvH/HTlfaLdr2pJ5BfsODk7A3VHV2ObDYIa+skEy1PPvtLv3/TfI/nD9Owt/TlpyI5aAbd1lboUrsPNyKjiR6GIfOcFAgMBAAGjggE8MIIBODAJBgNVHRMEAjAAMB0GA1UdDgQWBBSMP/tadXU+XdrmlxxDSCZeyMAcbDCB1wYDVR0jBIHPMIHMgBRRpkLqhXylaDmRPhWgCQ0fl62cX6GBqKSBpTCBojELMAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFDASBgNVBAcTC1NhbnRhIENsYXJhMRcwFQYDVQQKEw5IdWRzb24gcHJvamVjdDEXMBUGA1UECxMOSHVkc29uIFJvb3QgQ0ExFzAVBgNVBAMTDkh1ZHNvbiBSb290IENBMR0wGwYJKoZIhvcNAQkBFg5odWRzb25Ac3VuLmNvbYIJAImLL4rgC+O7MDIGCWCGSAGG+EIBBAQlFiNodHRwOi8vaHVkc29uLWNpLm9yZy9odWRzb24tY3JsLnBlbTANBgkqhkiG9w0BAQUFAAOCAQEADs3NHx8j+x45msMgjHPoMb4yvz42vI1ea4UyYHrDZGlEsK7kfVbNHNpt+UGZaws0b+f6brL/3DA9w0niCTucHMd+ZqqFGpXHvV/IVVrR7omLgQ6EdinYYDXzIl/1Z97jeRDmL4/kckxxGyTyw/Y4/YatmVSM8ZESY3W9lYS9P90I+Jmo0e4W6tY+ztPrsw3C3ixmvfqG++YQTjZivr/5sCUd6UJHAz7XuX9Eqgyz2Od1wOazmtP7TEsQVEwiJXGB5HFLw7qtC51K3VdAj43nm+qgKe0U3yOw57EYKlntQzCWF24ucOZ1QhpvrIlzcD1q4AlIdlTD0OtuP9uGIYCTjA=="],
"digest": "5GfPwsLf4xDFFg4/g4r4WofnS70=",
"signature": "SKTyc4xy6OV2+ClP/4edsGGJv/E8qcR+gyAB/HUvfztB+9D2DiHLJAQVXx0PnPQZeHB1sZnNfEEH/gGg0cf7lfJBIU6fIMGrqzoAIQvTxG7ZNgjhba/+ojDjM222R8Sy19hGws4/pO4d+W9CwRSNNz8FZqGPxnV4k21IfQ9QF8lxCguetXzWX2edJT2fr4j32bFtbDxfsUdYNc4D6F8/8BScQpoHgBNVqLa8oWRUpn6qae2hfLXkAixeHlDDNbEZWuQ7g/kmXrn5COf0vVH4Jrr1L8QzVvifjrVbM55UZl2tv/EExUJXYeVUJMmA1wmvpwbr+6Pr9tIeKsq51sqTVw=="
},
"updateCenterVersion": "1"
}
);
...@@ -90,7 +90,7 @@ public class LaunchTest extends TestCase { ...@@ -90,7 +90,7 @@ public class LaunchTest extends TestCase {
public static void copyStream(InputStream in, OutputStream out) throws IOException { public static void copyStream(InputStream in, OutputStream out) throws IOException {
byte[] buf = new byte[8192]; byte[] buf = new byte[8192];
int len; int len;
while((len=in.read(buf))>=0) while((len=in.read(buf))>0)
out.write(buf,0,len); out.write(buf,0,len);
} }
} }
...@@ -186,10 +186,7 @@ public final class BinarySafeStream { ...@@ -186,10 +186,7 @@ public final class BinarySafeStream {
int avail = super.available(); int avail = super.available();
if(avail >0) { if(avail >0) {
byte[] buf = new byte[avail]; byte[] buf = new byte[avail];
int len2 = super.read(buf); baos.write(buf,0,super.read(buf));
if (len2 > 0) {
baos.write(buf,0,len2);
}
} }
StringBuilder buf = new StringBuilder("Invalid encoded sequence encountered:"); StringBuilder buf = new StringBuilder("Invalid encoded sequence encountered:");
for (byte ch : baos.toByteArray()) for (byte ch : baos.toByteArray())
......
...@@ -143,11 +143,11 @@ public class FastPipedInputStream extends InputStream { ...@@ -143,11 +143,11 @@ public class FastPipedInputStream extends InputStream {
public int read() throws IOException { public int read() throws IOException {
byte[] b = new byte[1]; byte[] b = new byte[1];
return read(b, 0, b.length) == -1 ? -1 : (255 & b[0]); // FIXME check if read() guarantees to return at least 1 character, otherwise bug lurking return read(b, 0, b.length) == -1 ? -1 : (255 & b[0]);
} }
@Override @Override
public int read(byte[] b) throws IOException { // CHECKED-CALLERS public int read(byte[] b) throws IOException {
return read(b, 0, b.length); return read(b, 0, b.length);
} }
......
...@@ -453,12 +453,9 @@ final class RemoteClassLoader extends URLClassLoader { ...@@ -453,12 +453,9 @@ final class RemoteClassLoader extends URLClassLoader {
byte[] buf = new byte[8192]; byte[] buf = new byte[8192];
int len; int len;
try { while((len=in.read(buf))>0)
while((len=in.read(buf))>=0) baos.write(buf,0,len);
baos.write(buf,0,len); in.close();
} finally {
in.close();
}
return baos.toByteArray(); return baos.toByteArray();
} }
......
...@@ -68,11 +68,11 @@ public class RemoteInputStream extends InputStream implements Serializable { ...@@ -68,11 +68,11 @@ public class RemoteInputStream extends InputStream implements Serializable {
return core.read(); return core.read();
} }
public int read(byte[] b) throws IOException { // CHECKED-CALLERS public int read(byte[] b) throws IOException {
return core.read(b); return core.read(b);
} }
public int read(byte[] b, int off, int len) throws IOException { // CHECKED-CALLERS public int read(byte[] b, int off, int len) throws IOException {
return core.read(b, off, len); return core.read(b, off, len);
} }
......
...@@ -24,14 +24,14 @@ final class CopyThread extends Thread { ...@@ -24,14 +24,14 @@ final class CopyThread extends Thread {
try { try {
byte[] buf = new byte[8192]; byte[] buf = new byte[8192];
int len; int len;
while ((len = in.read(buf)) >= 0) while ((len = in.read(buf)) > 0)
out.write(buf, 0, len); out.write(buf, 0, len);
} finally { } finally {
in.close(); in.close();
out.close(); out.close();
} }
} catch (IOException e) { } catch (IOException e) {
throw new RuntimeException(e); // TODO: what to do?
} }
} }
} }
...@@ -46,14 +46,11 @@ class Copier extends Thread { ...@@ -46,14 +46,11 @@ class Copier extends Thread {
try { try {
byte[] buf = new byte[8192]; byte[] buf = new byte[8192];
int len; int len;
try { while((len=in.read(buf))>0)
while((len=in.read(buf))>=0) out.write(buf,0,len);
out.write(buf,0,len); in.close();
} finally {
in.close();
}
} catch (IOException e) { } catch (IOException e) {
throw new RuntimeException(e); // TODO: what to do?
} }
} }
} }
...@@ -45,12 +45,9 @@ public class TestCallable implements Callable { ...@@ -45,12 +45,9 @@ public class TestCallable implements Callable {
byte[] buf = new byte[8192]; byte[] buf = new byte[8192];
int len; int len;
try { while((len=in.read(buf))>0)
while((len=in.read(buf))>=0) baos.write(buf,0,len);
baos.write(buf,0,len); in.close();
} finally {
in.close();
}
r[1] = baos.toByteArray(); r[1] = baos.toByteArray();
......
...@@ -294,7 +294,7 @@ public abstract class HudsonTestCase extends TestCase implements RootAction { ...@@ -294,7 +294,7 @@ public abstract class HudsonTestCase extends TestCase implements RootAction {
WebClient c = client.get(); WebClient c = client.get();
if(c==null) continue; if(c==null) continue;
// unload the page to cancel asynchronous operations // unload the page to cancel asynchronous operations
safeUnloadPage(c, 2); c.getPage("about:blank");
} }
clients.clear(); clients.clear();
} finally { } finally {
...@@ -315,16 +315,6 @@ public abstract class HudsonTestCase extends TestCase implements RootAction { ...@@ -315,16 +315,6 @@ public abstract class HudsonTestCase extends TestCase implements RootAction {
} }
} }
private void safeUnloadPage(WebClient c, int maxTries) {
if (maxTries == 0) return;
try{
c.getPage("about:blank");
} catch(Exception e){
e.printStackTrace();
safeUnloadPage(c, maxTries--);
}
}
@Override @Override
protected void runTest() throws Throwable { protected void runTest() throws Throwable {
System.out.println("=== Starting "+ getClass().getSimpleName() + "." + getName()); System.out.println("=== Starting "+ getClass().getSimpleName() + "." + getName());
......
...@@ -17,8 +17,6 @@ import java.io.IOException; ...@@ -17,8 +17,6 @@ import java.io.IOException;
* @author Kohsuke Kawaguchi * @author Kohsuke Kawaguchi
*/ */
public class UDPBroadcastThreadTest extends HudsonTestCase { public class UDPBroadcastThreadTest extends HudsonTestCase {
// FIXME these tests will fail if don't have a network link
/** /**
* Old unicast based clients should still be able to receive some reply, * Old unicast based clients should still be able to receive some reply,
* as we haven't changed the port. * as we haven't changed the port.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册