geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject [45/51] [abbrv] geronimo-yoko git commit: Simplify conversion of unsigned short port numbers to int (convert via char)
Date Sun, 19 Feb 2017 01:50:02 GMT
Simplify conversion of unsigned short port numbers to int (convert via char)


Project: http://git-wip-us.apache.org/repos/asf/geronimo-yoko/repo
Commit: http://git-wip-us.apache.org/repos/asf/geronimo-yoko/commit/a7c5f0ea
Tree: http://git-wip-us.apache.org/repos/asf/geronimo-yoko/tree/a7c5f0ea
Diff: http://git-wip-us.apache.org/repos/asf/geronimo-yoko/diff/a7c5f0ea

Branch: refs/heads/master
Commit: a7c5f0ea1fe4e66948a202e889c70ca0bedc4645
Parents: 26c9402
Author: Neil GM Richards <neil_richards@uk.ibm.com>
Authored: Tue Jul 5 17:09:24 2016 +0100
Committer: Neil GM Richards <neil_richards@uk.ibm.com>
Committed: Tue Jul 5 17:09:24 2016 +0100

----------------------------------------------------------------------
 .../yoko/orb/OCI/IIOP/ConFactory_impl.java      | 22 ++++++++------------
 1 file changed, 9 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geronimo-yoko/blob/a7c5f0ea/yoko-core/src/main/java/org/apache/yoko/orb/OCI/IIOP/ConFactory_impl.java
----------------------------------------------------------------------
diff --git a/yoko-core/src/main/java/org/apache/yoko/orb/OCI/IIOP/ConFactory_impl.java b/yoko-core/src/main/java/org/apache/yoko/orb/OCI/IIOP/ConFactory_impl.java
index 7445215..5485bf9 100644
--- a/yoko-core/src/main/java/org/apache/yoko/orb/OCI/IIOP/ConFactory_impl.java
+++ b/yoko-core/src/main/java/org/apache/yoko/orb/OCI/IIOP/ConFactory_impl.java
@@ -98,11 +98,7 @@ final class ConFactory_impl extends org.omg.CORBA.LocalObject implements
         result.append("iiop_version: " + (int) body.iiop_version.major + '.'
                 + (int) body.iiop_version.minor + '\n');
         result.append("host: " + body.host + '\n');
-        int port;
-        if (body.port < 0)
-            port = 0xffff + (int) body.port + 1;
-        else
-            port = body.port;
+        final int port = ((char)body.port);
         result.append("port: " + port + '\n');
         result.append("object_key: (" + body.object_key.length + ")\n");
         IORUtil.dump_octets(body.object_key, 0, body.object_key.length, result);
@@ -111,9 +107,9 @@ final class ConFactory_impl extends org.omg.CORBA.LocalObject implements
         // Print IIOP 1.1 information (components)
         //
         if (body.iiop_version.major > 1 || body.iiop_version.minor >= 1) {
-            int l = in.read_ulong();
+            final int tcCount = in.read_ulong();
 
-            for (int i = 0; i < l; i++) {
+            for (int i = 0; i < tcCount; i++) {
                 TaggedComponent component = TaggedComponentHelper.read(in);
 
                 IORUtil.describe_component(component, result);
@@ -160,7 +156,7 @@ final class ConFactory_impl extends org.omg.CORBA.LocalObject implements
             //
             // Create new connector for this profile
             //
-            final int port = ((body.port < 0) ? (0xffff + (int) body.port + 1) : body.port);
+            final int port = ((char)body.port);
             ConnectCB[] cbs = info_._OB_getConnectCBSeq();
             logger.fine("Creating connector to host=" + body.host +", port=" + port);
             Codec codec = null;
@@ -181,10 +177,10 @@ final class ConFactory_impl extends org.omg.CORBA.LocalObject implements
                 //
                 // Unmarshal the tagged components
                 //
-                int len = in.read_ulong();
-                TaggedComponent[] components = new TaggedComponent[len];
-                for (int c = 0; c < len; c++)
-                    components[c] = TaggedComponentHelper.read(in);
+                final int tcCount = in.read_ulong();
+                List<TaggedComponent> components = new ArrayList<>(tcCount);
+                for (int c = 0; c < tcCount; c++)
+                    components.add(TaggedComponentHelper.read(in));
 
                 //
                 // Check for TAG_ALTERNATE_IIOP_ADDRESS
@@ -196,7 +192,7 @@ final class ConFactory_impl extends org.omg.CORBA.LocalObject implements
                         cin._OB_readEndian();
                         final String host = cin.read_string();
                         final short s = cin.read_ushort();
-                        final int cport = ((s < 0) ? (0xffff + (int) s + 1) : s);
+                        final int cport = ((char)s);
 
                         //
                         // Create new connector for this component


Mime
View raw message