cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r683391 - in /cxf/trunk/rt/bindings/corba/src: main/java/org/apache/cxf/binding/corba/runtime/ main/java/org/apache/cxf/binding/corba/types/ test/java/org/apache/cxf/binding/corba/runtime/
Date Wed, 06 Aug 2008 20:16:29 GMT
Author: dkulp
Date: Wed Aug  6 13:16:28 2008
New Revision: 683391

URL: http://svn.apache.org/viewvc?rev=683391&view=rev
Log:
ULongs can map to a java long, not BigInteger.  Thus, avoid creating 
BigInteger objects if we can.

Modified:
    cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/runtime/CorbaObjectReader.java
    cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/runtime/CorbaObjectWriter.java
    cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/types/CorbaPrimitiveHandler.java
    cxf/trunk/rt/bindings/corba/src/test/java/org/apache/cxf/binding/corba/runtime/CorbaObjectReaderTest.java
    cxf/trunk/rt/bindings/corba/src/test/java/org/apache/cxf/binding/corba/runtime/CorbaObjectWriterTest.java

Modified: cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/runtime/CorbaObjectReader.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/runtime/CorbaObjectReader.java?rev=683391&r1=683390&r2=683391&view=diff
==============================================================================
--- cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/runtime/CorbaObjectReader.java
(original)
+++ cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/runtime/CorbaObjectReader.java
Wed Aug  6 13:16:28 2008
@@ -212,11 +212,11 @@
         }
     }
 
-    public BigInteger readULong() throws CorbaBindingException {
+    public long readULong() throws CorbaBindingException {
         try {
             long l = stream.read_ulong();
             l &= 0xffffffffL;
-            return BigInteger.valueOf(l);
+            return l;
         } catch (org.omg.CORBA.MARSHAL ex) {
             LOG.log(Level.SEVERE, "CorbaObjectReader: could not read unsigned long");
             throw new CorbaBindingException("CorbaObjectReader: readULong MARSHAL exception",
ex);

Modified: cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/runtime/CorbaObjectWriter.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/runtime/CorbaObjectWriter.java?rev=683391&r1=683390&r2=683391&view=diff
==============================================================================
--- cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/runtime/CorbaObjectWriter.java
(original)
+++ cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/runtime/CorbaObjectWriter.java
Wed Aug  6 13:16:28 2008
@@ -76,7 +76,7 @@
             this.writeLong((Integer)((CorbaPrimitiveHandler)obj).getValue());
             break;
         case TCKind._tk_ulong:
-            this.writeULong((BigInteger)((CorbaPrimitiveHandler)obj).getValue());
+            this.writeULong((Long)((CorbaPrimitiveHandler)obj).getValue());
             break;
         case TCKind._tk_longlong:
             this.writeLongLong((Long)((CorbaPrimitiveHandler)obj).getValue());
@@ -187,7 +187,7 @@
         }
     }
 
-    public void writeULong(java.math.BigInteger l) throws CorbaBindingException {
+    public void writeULong(Long l) throws CorbaBindingException {
         if (l == null) {
             stream.write_ulong((int)0);
         } else {

Modified: cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/types/CorbaPrimitiveHandler.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/types/CorbaPrimitiveHandler.java?rev=683391&r1=683390&r2=683391&view=diff
==============================================================================
--- cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/types/CorbaPrimitiveHandler.java
(original)
+++ cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/types/CorbaPrimitiveHandler.java
Wed Aug  6 13:16:28 2008
@@ -72,7 +72,7 @@
                 any.insert_longlong(((Long)value).longValue());
                 break;
             case TCKind._tk_ulong:
-                any.insert_ulong((int)((java.math.BigInteger)value).longValue());
+                any.insert_ulong((int)((Long)value).longValue());
                 break;
             case TCKind._tk_ulonglong:
                 any.insert_ulonglong(((java.math.BigInteger)value).longValue());
@@ -141,6 +141,8 @@
             data = ((Long)value).toString();
             break;
         case TCKind._tk_ulong:
+            data = ((Long)value).toString();
+            break;
         case TCKind._tk_ulonglong:
             data = ((java.math.BigInteger)value).toString();
             break;
@@ -206,6 +208,8 @@
             obj = new Long(data);
             break;
         case TCKind._tk_ulong:
+            obj = new Long(data);
+            break;
         case TCKind._tk_ulonglong:
             obj = new java.math.BigInteger(data);
             break;
@@ -269,9 +273,11 @@
         case TCKind._tk_longlong:
             data = Long.toString(any.extract_longlong());
             break;
-        case TCKind._tk_ulong:
-            data = Long.toString(any.extract_ulong());
+        case TCKind._tk_ulong: {
+            long l = any.extract_ulong();
+            data = Long.toString(l & 0xFFFFFFFFL);
             break;
+        }
         case TCKind._tk_ulonglong:
             data = java.math.BigInteger.valueOf(any.extract_ulonglong()).toString();
             break;

Modified: cxf/trunk/rt/bindings/corba/src/test/java/org/apache/cxf/binding/corba/runtime/CorbaObjectReaderTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/bindings/corba/src/test/java/org/apache/cxf/binding/corba/runtime/CorbaObjectReaderTest.java?rev=683391&r1=683390&r2=683391&view=diff
==============================================================================
--- cxf/trunk/rt/bindings/corba/src/test/java/org/apache/cxf/binding/corba/runtime/CorbaObjectReaderTest.java
(original)
+++ cxf/trunk/rt/bindings/corba/src/test/java/org/apache/cxf/binding/corba/runtime/CorbaObjectReaderTest.java
Wed Aug  6 13:16:28 2008
@@ -171,8 +171,8 @@
         InputStream iStream = oStream.create_input_stream();
         CorbaObjectReader reader = new CorbaObjectReader(iStream);
         
-        BigInteger ulongValue = reader.readULong();
-        assertTrue(ulongValue.longValue() == 100000);
+        long ulongValue = reader.readULong();
+        assertTrue(ulongValue == 100000);
     }
     
     @Test

Modified: cxf/trunk/rt/bindings/corba/src/test/java/org/apache/cxf/binding/corba/runtime/CorbaObjectWriterTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/bindings/corba/src/test/java/org/apache/cxf/binding/corba/runtime/CorbaObjectWriterTest.java?rev=683391&r1=683390&r2=683391&view=diff
==============================================================================
--- cxf/trunk/rt/bindings/corba/src/test/java/org/apache/cxf/binding/corba/runtime/CorbaObjectWriterTest.java
(original)
+++ cxf/trunk/rt/bindings/corba/src/test/java/org/apache/cxf/binding/corba/runtime/CorbaObjectWriterTest.java
Wed Aug  6 13:16:28 2008
@@ -156,12 +156,12 @@
         OutputStream oStream = orb.create_output_stream();
         
         CorbaObjectWriter writer = new CorbaObjectWriter(oStream);
-        BigInteger ulongValue = new BigInteger("1234567");
+        long ulongValue = 1234567L;
         writer.writeULong(ulongValue);
         
         InputStream iStream = oStream.create_input_stream();
         long ul = iStream.read_ulong();
-        assertTrue(ul == ulongValue.longValue());
+        assertTrue(ul == ulongValue);
     }
     
     @Test



Mime
View raw message