directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From erodrig...@apache.org
Subject svn commit: r604761 - in /directory/apacheds/branches/bigbang/protocol-dns/src: main/java/org/apache/directory/server/dns/io/decoder/ main/java/org/apache/directory/server/dns/messages/ test/java/org/apache/directory/server/dns/messages/
Date Mon, 17 Dec 2007 02:37:28 GMT
Author: erodriguez
Date: Sun Dec 16 18:37:26 2007
New Revision: 604761

URL: http://svn.apache.org/viewvc?rev=604761&view=rev
Log:
Bug fix for RecordClass decoding:
o  Fixed improper cast causing RecordClass values to truncate.
o  Test case for above.

Added:
    directory/apacheds/branches/bigbang/protocol-dns/src/test/java/org/apache/directory/server/dns/messages/
    directory/apacheds/branches/bigbang/protocol-dns/src/test/java/org/apache/directory/server/dns/messages/RecordClassTest.java
  (with props)
Modified:
    directory/apacheds/branches/bigbang/protocol-dns/src/main/java/org/apache/directory/server/dns/io/decoder/DnsMessageDecoder.java
    directory/apacheds/branches/bigbang/protocol-dns/src/main/java/org/apache/directory/server/dns/messages/RecordClass.java

Modified: directory/apacheds/branches/bigbang/protocol-dns/src/main/java/org/apache/directory/server/dns/io/decoder/DnsMessageDecoder.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-dns/src/main/java/org/apache/directory/server/dns/io/decoder/DnsMessageDecoder.java?rev=604761&r1=604760&r2=604761&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-dns/src/main/java/org/apache/directory/server/dns/io/decoder/DnsMessageDecoder.java
(original)
+++ directory/apacheds/branches/bigbang/protocol-dns/src/main/java/org/apache/directory/server/dns/io/decoder/DnsMessageDecoder.java
Sun Dec 16 18:37:26 2007
@@ -163,7 +163,7 @@
             String domainName = getDomainName( byteBuffer );
 
             RecordType recordType = RecordType.convert( byteBuffer.getShort() );
-            RecordClass recordClass = RecordClass.convert( ( byte ) byteBuffer.getShort()
);
+            RecordClass recordClass = RecordClass.convert( byteBuffer.getShort() );
 
             questions.add( new QuestionRecord( domainName, recordType, recordClass ) );
         }

Modified: directory/apacheds/branches/bigbang/protocol-dns/src/main/java/org/apache/directory/server/dns/messages/RecordClass.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-dns/src/main/java/org/apache/directory/server/dns/messages/RecordClass.java?rev=604761&r1=604760&r2=604761&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-dns/src/main/java/org/apache/directory/server/dns/messages/RecordClass.java
(original)
+++ directory/apacheds/branches/bigbang/protocol-dns/src/main/java/org/apache/directory/server/dns/messages/RecordClass.java
Sun Dec 16 18:37:26 2007
@@ -56,7 +56,7 @@
 
     private RecordClass( int value )
     {
-        this.value = ( byte ) value;
+        this.value = ( short ) value;
     }
 
 

Added: directory/apacheds/branches/bigbang/protocol-dns/src/test/java/org/apache/directory/server/dns/messages/RecordClassTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-dns/src/test/java/org/apache/directory/server/dns/messages/RecordClassTest.java?rev=604761&view=auto
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-dns/src/test/java/org/apache/directory/server/dns/messages/RecordClassTest.java
(added)
+++ directory/apacheds/branches/bigbang/protocol-dns/src/test/java/org/apache/directory/server/dns/messages/RecordClassTest.java
Sun Dec 16 18:37:26 2007
@@ -0,0 +1,43 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.server.dns.messages;
+
+
+import junit.framework.TestCase;
+
+
+/**
+ * Test case for the RecordClass class.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class RecordClassTest extends TestCase
+{
+    /**
+     * Tests conversion of ordinals to RecordClass enums.
+     */
+    public void testRecordClassConversion()
+    {
+        assertEquals( RecordClass.IN, RecordClass.convert( ( short ) 1 ) );
+        assertEquals( RecordClass.NONE, RecordClass.convert( ( short ) 254 ) );
+        assertEquals( RecordClass.ANY, RecordClass.convert( ( short ) 255 ) );
+    }
+}

Propchange: directory/apacheds/branches/bigbang/protocol-dns/src/test/java/org/apache/directory/server/dns/messages/RecordClassTest.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message