commit 055e8fde32db2fbaee86ba0352a457c07300724f Author: Karsten Loesing karsten.loesing@gmx.net Date: Sun Jan 8 16:49:03 2012 +0100
The bool in hibernating lines is 0/1, not false/true. --- .../descriptor/impl/RelayServerDescriptorImpl.java | 4 ++-- .../impl/RelayServerDescriptorImplTest.java | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/org/torproject/descriptor/impl/RelayServerDescriptorImpl.java b/src/org/torproject/descriptor/impl/RelayServerDescriptorImpl.java index a5374b6..aa984fe 100644 --- a/src/org/torproject/descriptor/impl/RelayServerDescriptorImpl.java +++ b/src/org/torproject/descriptor/impl/RelayServerDescriptorImpl.java @@ -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 + "'."); diff --git a/test/org/torproject/descriptor/impl/RelayServerDescriptorImplTest.java b/test/org/torproject/descriptor/impl/RelayServerDescriptorImplTest.java index acc2dbe..f806502 100644 --- a/test/org/torproject/descriptor/impl/RelayServerDescriptorImplTest.java +++ b/test/org/torproject/descriptor/impl/RelayServerDescriptorImplTest.java @@ -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()); }
tor-commits@lists.torproject.org