The bool in hibernating lines is 0/1, not false/true.

This commit is contained in:
Karsten Loesing 2012-01-08 16:49:03 +01:00
parent a42848728f
commit 055e8fde32
2 changed files with 6 additions and 6 deletions

View File

@ -204,9 +204,9 @@ public class RelayServerDescriptorImpl extends DescriptorImpl
if (partsNoOpt.length != 2) {
throw new DescriptorParseException("Illegal line '" + line + "'.");
}
if (partsNoOpt[1].equals("true")) {
if (partsNoOpt[1].equals("1")) {
this.hibernating = true;
} else if (partsNoOpt[1].equals("false")) {
} else if (partsNoOpt[1].equals("0")) {
this.hibernating = false;
} else {
throw new DescriptorParseException("Illegal line '" + line + "'.");

View File

@ -316,7 +316,7 @@ public class RelayServerDescriptorImplTest {
@Test(expected = DescriptorParseException.class)
public void testRouterLinePrecedingHibernatingLine()
throws DescriptorParseException {
DescriptorBuilder.createWithRouterLine("hibernating true\nrouter "
DescriptorBuilder.createWithRouterLine("hibernating 1\nrouter "
+ "saberrider2008 94.134.192.243 9001 0 0");
}
@ -779,21 +779,21 @@ public class RelayServerDescriptorImplTest {
@Test()
public void testHibernatingOpt() throws DescriptorParseException {
RelayServerDescriptor descriptor = DescriptorBuilder.
createWithHibernatingLine("opt hibernating true");
createWithHibernatingLine("opt hibernating 1");
assertTrue(descriptor.isHibernating());
}
@Test()
public void testHibernatingFalse() throws DescriptorParseException {
RelayServerDescriptor descriptor = DescriptorBuilder.
createWithHibernatingLine("hibernating false");
createWithHibernatingLine("hibernating 0");
assertFalse(descriptor.isHibernating());
}
@Test()
public void testHibernatingTrue() throws DescriptorParseException {
RelayServerDescriptor descriptor = DescriptorBuilder.
createWithHibernatingLine("hibernating true");
createWithHibernatingLine("hibernating 1");
assertTrue(descriptor.isHibernating());
}