diff options
author | Marc Laukien <marc@zeroc.com> | 2002-06-23 21:17:04 +0000 |
---|---|---|
committer | Marc Laukien <marc@zeroc.com> | 2002-06-23 21:17:04 +0000 |
commit | 59788b8663f1f05a95b7afbbc6d2846dae11c96a (patch) | |
tree | c3ed292df270f11157decb83827d9af4144db52d /java/src | |
parent | file run.py was initially added on branch location. (diff) | |
download | ice-59788b8663f1f05a95b7afbbc6d2846dae11c96a.tar.bz2 ice-59788b8663f1f05a95b7afbbc6d2846dae11c96a.tar.xz ice-59788b8663f1f05a95b7afbbc6d2846dae11c96a.zip |
removed spaces after keywords
Diffstat (limited to 'java/src')
57 files changed, 997 insertions, 997 deletions
diff --git a/java/src/Freeze/Application.java b/java/src/Freeze/Application.java index 4a2843d0532..0bef7e3b197 100644 --- a/java/src/Freeze/Application.java +++ b/java/src/Freeze/Application.java @@ -51,7 +51,7 @@ public abstract class Application extends Ice.Application status = 1; } - if (dbEnv != null) + if(dbEnv != null) { try { diff --git a/java/src/Freeze/DBCursorI.java b/java/src/Freeze/DBCursorI.java index 573011e139b..bb6893425dd 100644 --- a/java/src/Freeze/DBCursorI.java +++ b/java/src/Freeze/DBCursorI.java @@ -22,7 +22,7 @@ class DBCursorI implements DBCursor synchronized public void curr(KeyHolder k, ValueHolder v) { - if (_cursor == null) + if(_cursor == null) { DBException ex = new DBException(); ex.message = _errorPrefix + "\"" + _name + "\" has been closed"; @@ -32,7 +32,7 @@ class DBCursorI implements DBCursor com.sleepycat.db.Dbt dbKey = new com.sleepycat.db.Dbt(); com.sleepycat.db.Dbt dbData = new com.sleepycat.db.Dbt(); - if (_trace >= 1) + if(_trace >= 1) { _communicator.getLogger().trace("DB", "reading current value from database \"" + _name + "\""); } @@ -40,7 +40,7 @@ class DBCursorI implements DBCursor try { int rc = _cursor.get(dbKey, dbData, com.sleepycat.db.Db.DB_CURRENT); - if (rc == com.sleepycat.db.Db.DB_NOTFOUND) + if(rc == com.sleepycat.db.Db.DB_NOTFOUND) { DBNotFoundException ex = new DBNotFoundException(); ex.message = _errorPrefix + "Dbc.get: DB_NOTFOUND"; @@ -65,7 +65,7 @@ class DBCursorI implements DBCursor synchronized public void set(byte[] v) { - if (_cursor == null) + if(_cursor == null) { DBException ex = new DBException(); ex.message = _errorPrefix + "\"" + _name + "\" has been closed"; @@ -75,7 +75,7 @@ class DBCursorI implements DBCursor com.sleepycat.db.Dbt dbKey = null; com.sleepycat.db.Dbt dbData = new com.sleepycat.db.Dbt(v); - if (_trace >= 1) + if(_trace >= 1) { _communicator.getLogger().trace("DB", "setting current value in database \"" + _name + "\""); } @@ -85,7 +85,7 @@ class DBCursorI implements DBCursor int rc = _cursor.put(dbKey, dbData, com.sleepycat.db.Db.DB_CURRENT); /* Since the underlying data is btree this cannot occur. * - if (rc == com.sleepycat.db.Db.DB_NOTFOUND) + if(rc == com.sleepycat.db.Db.DB_NOTFOUND) { DBNotFoundException ex = new DBNotFoundException(); ex.message = _errorPrefix + "Dbc.put: DB_NOTFOUND"; @@ -105,7 +105,7 @@ class DBCursorI implements DBCursor synchronized public boolean next() { - if (_cursor == null) + if(_cursor == null) { DBException ex = new DBException(); ex.message = _errorPrefix + "\"" + _name + "\" has been closed"; @@ -117,7 +117,7 @@ class DBCursorI implements DBCursor com.sleepycat.db.Dbt dbData = new com.sleepycat.db.Dbt(); dbData.set_flags(com.sleepycat.db.Db.DB_DBT_PARTIAL); - if (_trace >= 1) + if(_trace >= 1) { _communicator.getLogger().trace("DB", "moving to next value in database \"" + _name + "\""); } @@ -125,7 +125,7 @@ class DBCursorI implements DBCursor try { int rc = _cursor.get(dbKey, dbData, com.sleepycat.db.Db.DB_NEXT); - if (rc == com.sleepycat.db.Db.DB_NOTFOUND) + if(rc == com.sleepycat.db.Db.DB_NOTFOUND) { return false; } @@ -144,7 +144,7 @@ class DBCursorI implements DBCursor synchronized public boolean prev() { - if (_cursor == null) + if(_cursor == null) { DBException ex = new DBException(); ex.message = _errorPrefix + "\"" + _name + "\" has been closed"; @@ -156,7 +156,7 @@ class DBCursorI implements DBCursor com.sleepycat.db.Dbt dbData = new com.sleepycat.db.Dbt(); dbData.set_flags(com.sleepycat.db.Db.DB_DBT_PARTIAL); - if (_trace >= 1) + if(_trace >= 1) { _communicator.getLogger().trace("DB", "moving to previous value in database \"" + _name + "\""); } @@ -164,7 +164,7 @@ class DBCursorI implements DBCursor try { int rc = _cursor.get(dbKey, dbData, com.sleepycat.db.Db.DB_PREV); - if (rc == com.sleepycat.db.Db.DB_NOTFOUND) + if(rc == com.sleepycat.db.Db.DB_NOTFOUND) { return false; } @@ -183,14 +183,14 @@ class DBCursorI implements DBCursor synchronized public void del() { - if (_cursor == null) + if(_cursor == null) { DBException ex = new DBException(); ex.message = _errorPrefix + "\"" + _name + "\" has been closed"; throw ex; } - if (_trace >= 1) + if(_trace >= 1) { _communicator.getLogger().trace("DB", "removing the current element in database \"" + _name + "\""); } @@ -198,7 +198,7 @@ class DBCursorI implements DBCursor try { int rc = _cursor.del(0); - if (rc == com.sleepycat.db.Db.DB_KEYEMPTY) + if(rc == com.sleepycat.db.Db.DB_KEYEMPTY) { DBException ex = new DBException(); ex.message = _errorPrefix + "Dbc.del: DB_KEYEMPTY"; @@ -217,7 +217,7 @@ class DBCursorI implements DBCursor synchronized public DBCursor _clone() { - if (_cursor == null) + if(_cursor == null) { DBException ex = new DBException(); ex.message = _errorPrefix + "\"" + _name + "\" has been closed"; @@ -242,12 +242,12 @@ class DBCursorI implements DBCursor synchronized public void close() { - if (_cursor == null) + if(_cursor == null) { return; } - if (_trace >= 1) + if(_trace >= 1) { _communicator.getLogger().trace("DB", "closing cursor \"" + _name + "\""); } @@ -282,7 +282,7 @@ class DBCursorI implements DBCursor _errorPrefix = "Freeze::DBCursor(\"" + _name + "\"): "; _trace = _communicator.getProperties().getPropertyAsInt("Freeze.Trace.DB"); - if (_trace >= 1) + if(_trace >= 1) { _communicator.getLogger().trace("DB", "creating cursor for \"" + _name + "\""); } diff --git a/java/src/Freeze/DBEnvironmentI.java b/java/src/Freeze/DBEnvironmentI.java index fca27d839d3..eef377798cb 100644 --- a/java/src/Freeze/DBEnvironmentI.java +++ b/java/src/Freeze/DBEnvironmentI.java @@ -29,7 +29,7 @@ class DBEnvironmentI implements DBEnvironment synchronized public DB openDB(String name, boolean create) { - if (_dbEnv == null) + if(_dbEnv == null) { DBException ex = new DBException(); ex.message = _errorPrefix + "\"" + _name + "\" has been closed"; @@ -37,7 +37,7 @@ class DBEnvironmentI implements DBEnvironment } DB p = (DB)_dbMap.get(name); - if (p != null) + if(p != null) { return p; } @@ -67,7 +67,7 @@ class DBEnvironmentI implements DBEnvironment // errors. // p = (DB)_dbMap.get(name); - if (p != null) + if(p != null) { _dbMap.remove(name); } @@ -91,7 +91,7 @@ class DBEnvironmentI implements DBEnvironment synchronized public void close() { - if (_dbEnv == null) + if(_dbEnv == null) { return; } @@ -104,19 +104,19 @@ class DBEnvironmentI implements DBEnvironment // java.util.List dbs = new java.util.ArrayList(); java.util.Iterator p = _dbMap.values().iterator(); - while (p.hasNext()) + while(p.hasNext()) { dbs.add(p.next()); } p = dbs.iterator(); - while (p.hasNext()) + while(p.hasNext()) { DB db = (DB)p.next(); db.close(); } - if (_trace >= 1) + if(_trace >= 1) { _communicator.getLogger().trace("DB", "closing database environment \"" + _name + "\""); } @@ -203,7 +203,7 @@ class DBEnvironmentI implements DBEnvironment _trace = getCommunicator().getProperties().getPropertyAsInt("Freeze.Trace.DB"); _dbEnv = new com.sleepycat.db.DbEnv(0); - if (_trace >= 1) + if(_trace >= 1) { _communicator.getLogger().trace("DB", "opening database environment \"" + _name + "\""); } diff --git a/java/src/Freeze/DBI.java b/java/src/Freeze/DBI.java index cd199ef2b49..9f1a01428b5 100644 --- a/java/src/Freeze/DBI.java +++ b/java/src/Freeze/DBI.java @@ -30,7 +30,7 @@ class DBI implements DB synchronized public long getNumberOfRecords() { - if (_db == null) + if(_db == null) { DBException ex = new DBException(); ex.message = _errorPrefix + "\"" + _name + "\" has been closed"; @@ -58,7 +58,7 @@ class DBI implements DB synchronized public DBCursor getCursor() { - if (_db == null) + if(_db == null) { DBException ex = new DBException(); ex.message = _errorPrefix + "\"" + _name + "\" has been closed"; @@ -94,7 +94,7 @@ class DBI implements DB try { int rc = cursor.get(dbKey, dbData, com.sleepycat.db.Db.DB_FIRST); - if (rc == com.sleepycat.db.Db.DB_NOTFOUND) + if(rc == com.sleepycat.db.Db.DB_NOTFOUND) { DBNotFoundException ex = new DBNotFoundException(); ex.message = _errorPrefix + "Dbc.get: DB_NOTFOUND"; @@ -131,7 +131,7 @@ class DBI implements DB synchronized public DBCursor getCursorAtKey(byte[] key) { - if (_db == null) + if(_db == null) { DBException ex = new DBException(); ex.message = _errorPrefix + "\"" + _name + "\" has been closed"; @@ -170,7 +170,7 @@ class DBI implements DB try { int rc = cursor.get(dbKey, dbData, com.sleepycat.db.Db.DB_SET); - if (rc == com.sleepycat.db.Db.DB_NOTFOUND) + if(rc == com.sleepycat.db.Db.DB_NOTFOUND) { DBNotFoundException ex = new DBNotFoundException(); ex.message = _errorPrefix + "Dbc.get: DB_NOTFOUND"; @@ -207,7 +207,7 @@ class DBI implements DB synchronized public void put(byte[] key, byte[] value) { - if (_db == null) + if(_db == null) { DBException ex = new DBException(); ex.message = _errorPrefix + "\"" + _name + "\" has been closed"; @@ -221,7 +221,7 @@ class DBI implements DB com.sleepycat.db.Dbt dbKey = new com.sleepycat.db.Dbt(key); com.sleepycat.db.Dbt dbData = new com.sleepycat.db.Dbt(value); - if (_trace >= 1) + if(_trace >= 1) { _communicator.getLogger().trace("DB", "writing value in database \"" + _name + "\""); } @@ -249,7 +249,7 @@ class DBI implements DB synchronized public boolean contains(byte[] key) { - if (_db == null) + if(_db == null) { DBException ex = new DBException(); ex.message = _errorPrefix + "\"" + _name + "\" has been closed"; @@ -261,7 +261,7 @@ class DBI implements DB com.sleepycat.db.Dbt dbData = new com.sleepycat.db.Dbt(); dbData.set_flags(com.sleepycat.db.Db.DB_DBT_PARTIAL); - if (_trace >= 1) + if(_trace >= 1) { _communicator.getLogger().trace("DB", "checking key in database \"" + _name + "\""); } @@ -269,7 +269,7 @@ class DBI implements DB try { int rc =_db.get(null, dbKey, dbData, 0); - if (rc == com.sleepycat.db.Db.DB_NOTFOUND) + if(rc == com.sleepycat.db.Db.DB_NOTFOUND) { return false; } @@ -298,7 +298,7 @@ class DBI implements DB synchronized public byte[] get(byte[] key) { - if (_db == null) + if(_db == null) { DBException ex = new DBException(); ex.message = _errorPrefix + "\"" + _name + "\" has been closed"; @@ -308,7 +308,7 @@ class DBI implements DB com.sleepycat.db.Dbt dbKey = new com.sleepycat.db.Dbt(key); com.sleepycat.db.Dbt dbData = new com.sleepycat.db.Dbt(); - if (_trace >= 1) + if(_trace >= 1) { _communicator.getLogger().trace("DB", "reading value from database \"" + _name + "\""); } @@ -316,7 +316,7 @@ class DBI implements DB try { int rc =_db.get(null, dbKey, dbData, 0); - if (rc == com.sleepycat.db.Db.DB_NOTFOUND) + if(rc == com.sleepycat.db.Db.DB_NOTFOUND) { DBNotFoundException ex = new DBNotFoundException(); ex.message = _errorPrefix + "Db.get: DB_NOTFOUND"; @@ -344,7 +344,7 @@ class DBI implements DB synchronized public void del(byte[] key) { - if (_db == null) + if(_db == null) { DBException ex = new DBException(); ex.message = _errorPrefix + "\"" + _name + "\" has been closed"; @@ -353,7 +353,7 @@ class DBI implements DB com.sleepycat.db.Dbt dbKey = new com.sleepycat.db.Dbt(key); - if (_trace >= 1) + if(_trace >= 1) { _communicator.getLogger().trace("DB", "deleting value from database \"" + _name + "\""); } @@ -361,7 +361,7 @@ class DBI implements DB try { int rc =_db.del(null, dbKey, 0); - if (rc == com.sleepycat.db.Db.DB_NOTFOUND) + if(rc == com.sleepycat.db.Db.DB_NOTFOUND) { DBNotFoundException ex = new DBNotFoundException(); ex.message = _errorPrefix + "Db.del: DB_NOTFOUND"; @@ -387,7 +387,7 @@ class DBI implements DB synchronized public void clear() { - if (_db == null) + if(_db == null) { DBException ex = new DBException(); ex.message = _errorPrefix + "\"" + _name + "\" has been closed"; @@ -411,12 +411,12 @@ class DBI implements DB synchronized public void close() { - if (_db == null) + if(_db == null) { return; } - if (_trace >= 1) + if(_trace >= 1) { _communicator.getLogger().trace("DB", "closing database \"" + _name + "\""); } @@ -441,12 +441,12 @@ class DBI implements DB synchronized public void remove() { - if (_db == null) + if(_db == null) { return; } - if (_trace >= 1) + if(_trace >= 1) { _communicator.getLogger().trace("DB", "removing database \"" + _name + "\""); } @@ -485,7 +485,7 @@ class DBI implements DB synchronized public Evictor createEvictor(EvictorPersistenceMode persistenceMode) { - if (_db == null) + if(_db == null) { DBException ex = new DBException(); ex.message = _errorPrefix + "\"" + _name + "\" has been closed"; @@ -504,7 +504,7 @@ class DBI implements DB _errorPrefix = "Freeze::DB(\"" + _name + "\"): "; _trace = _communicator.getProperties().getPropertyAsInt("Freeze.Trace.DB"); - if (_trace >= 1) + if(_trace >= 1) { _communicator.getLogger().trace("DB","opening database \"" + _name + "\" in environment \"" + _dbEnvObj.getName() + "\""); diff --git a/java/src/Freeze/DBTransactionI.java b/java/src/Freeze/DBTransactionI.java index 4e5e680b1a9..0e8b4befec2 100644 --- a/java/src/Freeze/DBTransactionI.java +++ b/java/src/Freeze/DBTransactionI.java @@ -15,7 +15,7 @@ class DBTransactionI implements DBTransaction public synchronized void commit() { - if (_tid == null) + if(_tid == null) { String s = _errorPrefix + "transaction has already been committed or aborted"; DBException ex = new DBException(); @@ -23,7 +23,7 @@ class DBTransactionI implements DBTransaction throw ex; } - if (_trace >= 2) + if(_trace >= 2) { _communicator.getLogger().trace("DB", "committing transaction for environment \"" + _name + "\""); } @@ -53,7 +53,7 @@ class DBTransactionI implements DBTransaction public synchronized void abort() { - if (_tid == null) + if(_tid == null) { String s = _errorPrefix + "transaction has already been committed or aborted"; DBException ex = new DBException(); @@ -61,7 +61,7 @@ class DBTransactionI implements DBTransaction throw ex; } - if (_trace >= 2) + if(_trace >= 2) { _communicator.getLogger().trace("DB", "aborting transaction for environment \"" + _name + "\" due to deadlock"); @@ -89,7 +89,7 @@ class DBTransactionI implements DBTransaction _errorPrefix = "Freeze::DBTransaction(\"" + _name + "\"): "; _trace = _communicator.getProperties().getPropertyAsInt("Freeze.Trace.DB"); - if (_trace >= 2) + if(_trace >= 2) { _communicator.getLogger().trace("DB", "starting transaction for environment \"" + _name + "\""); } diff --git a/java/src/Freeze/EvictorI.java b/java/src/Freeze/EvictorI.java index 3094f49f141..4d99cdf630e 100644 --- a/java/src/Freeze/EvictorI.java +++ b/java/src/Freeze/EvictorI.java @@ -15,7 +15,7 @@ class EvictorI implements Evictor synchronized public DB getDB() { - if (_deactivated) + if(_deactivated) { throw new EvictorDeactivatedException(); } @@ -26,7 +26,7 @@ class EvictorI implements Evictor synchronized public void setSize(int evictorSize) { - if (_deactivated) + if(_deactivated) { throw new EvictorDeactivatedException(); } @@ -34,7 +34,7 @@ class EvictorI implements Evictor // // Ignore requests to set the evictor size to values smaller than zero. // - if (evictorSize < 0) + if(evictorSize < 0) { return; } @@ -53,7 +53,7 @@ class EvictorI implements Evictor synchronized public int getSize() { - if (_deactivated) + if(_deactivated) { throw new EvictorDeactivatedException(); } @@ -64,7 +64,7 @@ class EvictorI implements Evictor synchronized public void createObject(Ice.Identity ident, Ice.Object servant) { - if (_deactivated) + if(_deactivated) { throw new EvictorDeactivatedException(); } @@ -82,7 +82,7 @@ class EvictorI implements Evictor _dict.put(identCopy, servant); add(identCopy, servant); - if (_trace >= 1) + if(_trace >= 1) { _db.getCommunicator().getLogger().trace("Evictor", "created \"" + Ice.Util.identityToString(ident) + "\""); } @@ -96,7 +96,7 @@ class EvictorI implements Evictor synchronized public void destroyObject(Ice.Identity ident) { - if (_deactivated) + if(_deactivated) { throw new EvictorDeactivatedException(); } @@ -107,7 +107,7 @@ class EvictorI implements Evictor _dict.remove(ident); remove(ident); - if (_trace >= 1) + if(_trace >= 1) { _db.getCommunicator().getLogger().trace("Evictor", "destroyed \"" + Ice.Util.identityToString(ident) + "\""); @@ -117,7 +117,7 @@ class EvictorI implements Evictor synchronized public void installServantInitializer(ServantInitializer initializer) { - if (_deactivated) + if(_deactivated) { throw new EvictorDeactivatedException(); } @@ -128,7 +128,7 @@ class EvictorI implements Evictor synchronized public EvictorIterator getIterator() { - if (_deactivated) + if(_deactivated) { throw new EvictorDeactivatedException(); } @@ -139,7 +139,7 @@ class EvictorI implements Evictor synchronized public boolean hasObject(Ice.Identity ident) { - if (_deactivated) + if(_deactivated) { throw new EvictorDeactivatedException(); } @@ -168,9 +168,9 @@ class EvictorI implements Evictor ident.category = current.identity.category; EvictorElement element = (EvictorElement)_evictorMap.get(ident); - if (element != null) + if(element != null) { - if (_trace >= 2) + if(_trace >= 2) { _db.getCommunicator().getLogger().trace("Evictor", "found \"" + Ice.Util.identityToString(ident) + @@ -192,7 +192,7 @@ class EvictorI implements Evictor } else { - if (_trace >= 2) + if(_trace >= 2) { _db.getCommunicator().getLogger().trace( "Evictor", @@ -205,7 +205,7 @@ class EvictorI implements Evictor // Servant for it. // Ice.Object servant = (Ice.Object)_dict.get(ident); - if (servant == null) + if(servant == null) { // // The Ice Object with the given identity does not exist, @@ -223,7 +223,7 @@ class EvictorI implements Evictor // // If an initializer is installed, call it now. // - if (_initializer != null) + if(_initializer != null) { _initializer.initialize(adapter, ident, servant); } @@ -269,9 +269,9 @@ class EvictorI implements Evictor // If we are in SaveAfterMutatingOperation mode, we must save the // Ice Object if this was a mutating call. // - if (_persistenceMode == EvictorPersistenceMode.SaveAfterMutatingOperation) + if(_persistenceMode == EvictorPersistenceMode.SaveAfterMutatingOperation) { - if (!current.nonmutating) + if(!current.nonmutating) { _dict.put(current.identity, servant); } @@ -286,11 +286,11 @@ class EvictorI implements Evictor synchronized public void deactivate() { - if (!_deactivated) + if(!_deactivated) { _deactivated = true; - if (_trace >= 1) + if(_trace >= 1) { _db.getCommunicator().getLogger().trace("Evictor", "deactivating, saving unsaved Ice Objects to the database"); @@ -317,7 +317,7 @@ class EvictorI implements Evictor evict() { java.util.Iterator p = _evictorList.riterator(); - while (p.hasNext() && _evictorList.size() > _evictorSize) + while(p.hasNext() && _evictorList.size() > _evictorSize) { // // Get the last unused element from the evictor queue. @@ -325,7 +325,7 @@ class EvictorI implements Evictor Ice.Identity ident = (Ice.Identity)p.next(); EvictorElement element = (EvictorElement)_evictorMap.get(ident); assert(element != null); - if (element.usageCount == 0) + if(element.usageCount == 0) { // // Fine, Servant is not in use. @@ -337,7 +337,7 @@ class EvictorI implements Evictor // save the Ice Object that is about to be // evicted to persistent store. // - if (_persistenceMode == EvictorPersistenceMode.SaveUponEviction) + if(_persistenceMode == EvictorPersistenceMode.SaveUponEviction) { _dict.put(ident, element.servant); } @@ -348,7 +348,7 @@ class EvictorI implements Evictor p.remove(); _evictorMap.remove(ident); - if (_trace >= 2) + if(_trace >= 2) { _db.getCommunicator().getLogger().trace( "Evictor", @@ -374,7 +374,7 @@ class EvictorI implements Evictor // Ignore the request if the Ice Object is already in the queue. // EvictorElement element = (EvictorElement)_evictorMap.get(ident); - if (element != null) + if(element != null) { return element; } @@ -405,7 +405,7 @@ class EvictorI implements Evictor // If the Ice Object is currently in the evictor, remove it. // EvictorElement element = (EvictorElement)_evictorMap.remove(ident); - if (element != null) + if(element != null) { element.position.remove(); } diff --git a/java/src/Freeze/LinkedList.java b/java/src/Freeze/LinkedList.java index 93dbe30f163..a8d7b8e4ab0 100644 --- a/java/src/Freeze/LinkedList.java +++ b/java/src/Freeze/LinkedList.java @@ -32,7 +32,7 @@ class LinkedList public Object getFirst() { - if (_size == 0) + if(_size == 0) { throw new java.util.NoSuchElementException(); } @@ -81,14 +81,14 @@ class LinkedList public Object next() { - if (_next == null) + if(_next == null) { throw new java.util.NoSuchElementException(); } _current = _next; - if (_next.next != _header) + if(_next.next != _header) { _next = _next.next; } @@ -102,7 +102,7 @@ class LinkedList public void remove() { - if (_current == null) + if(_current == null) { throw new IllegalStateException(); } @@ -112,7 +112,7 @@ class LinkedList ForwardIterator() { - if (_header.next == _header) + if(_header.next == _header) { _next = null; } @@ -138,14 +138,14 @@ class LinkedList public Object next() { - if (_next == null) + if(_next == null) { throw new java.util.NoSuchElementException(); } _current = _next; - if (_next.previous != _header) + if(_next.previous != _header) { _next = _next.previous; } @@ -159,7 +159,7 @@ class LinkedList public void remove() { - if (_current == null) + if(_current == null) { throw new IllegalStateException(); } @@ -169,7 +169,7 @@ class LinkedList ReverseIterator() { - if (_header.next == _header) + if(_header.next == _header) { _next = null; } @@ -211,7 +211,7 @@ class LinkedList private void remove(Entry e) { - if (e == _header) + if(e == _header) { throw new java.util.NoSuchElementException(); } diff --git a/java/src/Freeze/Map.java b/java/src/Freeze/Map.java index a500d55ef34..904f588895b 100644 --- a/java/src/Freeze/Map.java +++ b/java/src/Freeze/Map.java @@ -176,7 +176,7 @@ public abstract class Map extends java.util.AbstractMap public java.util.Set entrySet() { - if (_entrySet == null) + if(_entrySet == null) { _entrySet = new java.util.AbstractSet() { @@ -191,7 +191,7 @@ public abstract class Map extends java.util.AbstractMap public boolean contains(Object o) { - if (!(o instanceof Map.Entry)) + if(!(o instanceof Map.Entry)) { return false; } @@ -205,7 +205,7 @@ public abstract class Map extends java.util.AbstractMap public boolean remove(Object o) { - if (!(o instanceof Map.Entry)) + if(!(o instanceof Map.Entry)) { return false; } @@ -213,7 +213,7 @@ public abstract class Map extends java.util.AbstractMap Object value = entry.getValue(); Entry p = getEntry(entry.getKey()); - if (p != null && valEquals(p.getValue(), value)) + if(p != null && valEquals(p.getValue(), value)) { closeIterators(); byte[] k = encodeKey(p.getKey(), _db.getCommunicator()); @@ -252,7 +252,7 @@ public abstract class Map extends java.util.AbstractMap closeIterators() { java.util.Iterator p = _iterators.iterator(); - while (p.hasNext()) + while(p.hasNext()) { EntryIterator q = (EntryIterator)p.next(); q.close(); @@ -299,7 +299,7 @@ public abstract class Map extends java.util.AbstractMap } catch(DBException e) { - if (_cursor != null) + if(_cursor != null) { try { @@ -329,7 +329,7 @@ public abstract class Map extends java.util.AbstractMap public void remove() { - if (_current == null) + if(_current == null) { throw new IllegalStateException(); } @@ -345,7 +345,7 @@ public abstract class Map extends java.util.AbstractMap // If _next is null then the iterator is currently at // the end. // - if (_next != null) + if(_next != null) { clone.prev(); } @@ -354,7 +354,7 @@ public abstract class Map extends java.util.AbstractMap } finally { - if (clone != null) + if(clone != null) { try { @@ -385,7 +385,7 @@ public abstract class Map extends java.util.AbstractMap _next = null; _current = null; - if (copy != null) + if(copy != null) { copy.close(); } @@ -394,14 +394,14 @@ public abstract class Map extends java.util.AbstractMap private Entry nextEntry() { - if (_next == null) + if(_next == null) { throw new java.util.NoSuchElementException(); } _current = _next; - if (_cursor.next()) + if(_cursor.next()) { _next = getCurr(); } @@ -467,7 +467,7 @@ public abstract class Map extends java.util.AbstractMap public boolean equals(Object o) { - if (!(o instanceof Map.Entry)) + if(!(o instanceof Map.Entry)) { return false; } diff --git a/java/src/Ice/Application.java b/java/src/Ice/Application.java index becb2c1a1da..af17189492d 100644 --- a/java/src/Ice/Application.java +++ b/java/src/Ice/Application.java @@ -34,7 +34,7 @@ public abstract class Application public final int main(String appName, String[] args, String configFile) { - if (_communicator != null) + if(_communicator != null) { System.err.println(appName + ": only one instance of the " + "Application class can be used"); @@ -48,7 +48,7 @@ public abstract class Application try { StringSeqHolder argHolder = new StringSeqHolder(args); - if (configFile != null) + if(configFile != null) { Properties properties = Util.createProperties(argHolder); properties.load(configFile); @@ -73,7 +73,7 @@ public abstract class Application status = 1; } - if (_communicator != null) + if(_communicator != null) { try { diff --git a/java/src/Ice/Blobject.java b/java/src/Ice/Blobject.java index ee6531e2ac7..4e3a188880c 100644 --- a/java/src/Ice/Blobject.java +++ b/java/src/Ice/Blobject.java @@ -25,7 +25,7 @@ public abstract class Blobject extends Ice.Object inParams = in.is().readBlob(sz); boolean ok = ice_invoke(inParams, outParams, current); in.os().writeBlob(outParams.value); - if (ok) + if(ok) { return IceInternal.DispatchStatus.DispatchOK; } diff --git a/java/src/Ice/CommunicatorI.java b/java/src/Ice/CommunicatorI.java index 6e46032ffef..2df75819d06 100644 --- a/java/src/Ice/CommunicatorI.java +++ b/java/src/Ice/CommunicatorI.java @@ -15,7 +15,7 @@ class CommunicatorI implements Communicator public synchronized void destroy() { - if (_instance != null) + if(_instance != null) { _instance.objectAdapterFactory().shutdown(); _instance.destroy(); @@ -29,7 +29,7 @@ class CommunicatorI implements Communicator // // No mutex locking here! // - if (_serverThreadPool != null) + if(_serverThreadPool != null) { _serverThreadPool.initiateShutdown(); } @@ -42,7 +42,7 @@ class CommunicatorI implements Communicator // No mutex locking here, otherwise the communicator is blocked // while waiting for shutdown. // - if (_serverThreadPool != null) + if(_serverThreadPool != null) { _serverThreadPool.waitUntilFinished(); } @@ -51,7 +51,7 @@ class CommunicatorI implements Communicator public synchronized Ice.ObjectPrx stringToProxy(String s) { - if (_instance == null) + if(_instance == null) { throw new CommunicatorDestroyedException(); } @@ -61,7 +61,7 @@ class CommunicatorI implements Communicator public synchronized String proxyToString(Ice.ObjectPrx proxy) { - if (_instance == null) + if(_instance == null) { throw new CommunicatorDestroyedException(); } @@ -71,7 +71,7 @@ class CommunicatorI implements Communicator public synchronized ObjectAdapter createObjectAdapter(String name) { - if (_instance == null) + if(_instance == null) { throw new CommunicatorDestroyedException(); } @@ -79,12 +79,12 @@ class CommunicatorI implements Communicator ObjectAdapter adapter = createObjectAdapterFromProperty(name, "Ice.Adapter." + name + ".Endpoints"); String router = _instance.properties().getProperty("Ice.Adapter." + name + ".Router"); - if (router.length() > 0) + if(router.length() > 0) { adapter.addRouter(RouterPrxHelper.uncheckedCast(_instance.proxyFactory().stringToProxy(router))); } - if (_serverThreadPool == null) // Lazy initialization of _serverThreadPool. + if(_serverThreadPool == null) // Lazy initialization of _serverThreadPool. { _serverThreadPool = _instance.serverThreadPool(); } @@ -95,7 +95,7 @@ class CommunicatorI implements Communicator public synchronized ObjectAdapter createObjectAdapterFromProperty(String name, String property) { - if (_instance == null) + if(_instance == null) { throw new CommunicatorDestroyedException(); } @@ -108,14 +108,14 @@ class CommunicatorI implements Communicator public synchronized ObjectAdapter createObjectAdapterWithEndpoints(String name, String endpts) { - if (_instance == null) + if(_instance == null) { throw new CommunicatorDestroyedException(); } ObjectAdapter adapter = _instance.objectAdapterFactory().createObjectAdapter(name, endpts); - if (_serverThreadPool == null) // Lazy initialization of _serverThreadPool. + if(_serverThreadPool == null) // Lazy initialization of _serverThreadPool. { _serverThreadPool = _instance.serverThreadPool(); } @@ -126,7 +126,7 @@ class CommunicatorI implements Communicator public synchronized void addObjectFactory(ObjectFactory factory, String id) { - if (_instance == null) + if(_instance == null) { throw new CommunicatorDestroyedException(); } @@ -136,7 +136,7 @@ class CommunicatorI implements Communicator public synchronized void removeObjectFactory(String id) { - if (_instance == null) + if(_instance == null) { throw new CommunicatorDestroyedException(); } @@ -146,7 +146,7 @@ class CommunicatorI implements Communicator public synchronized ObjectFactory findObjectFactory(String id) { - if (_instance == null) + if(_instance == null) { throw new CommunicatorDestroyedException(); } @@ -156,7 +156,7 @@ class CommunicatorI implements Communicator public synchronized void addUserExceptionFactory(UserExceptionFactory factory, String id) { - if (_instance == null) + if(_instance == null) { throw new CommunicatorDestroyedException(); } @@ -166,7 +166,7 @@ class CommunicatorI implements Communicator public synchronized void removeUserExceptionFactory(String id) { - if (_instance == null) + if(_instance == null) { throw new CommunicatorDestroyedException(); } @@ -176,7 +176,7 @@ class CommunicatorI implements Communicator public synchronized UserExceptionFactory findUserExceptionFactory(String id) { - if (_instance == null) + if(_instance == null) { throw new CommunicatorDestroyedException(); } @@ -186,7 +186,7 @@ class CommunicatorI implements Communicator public synchronized Properties getProperties() { - if (_instance == null) + if(_instance == null) { throw new CommunicatorDestroyedException(); } @@ -196,7 +196,7 @@ class CommunicatorI implements Communicator public synchronized Logger getLogger() { - if (_instance == null) + if(_instance == null) { throw new CommunicatorDestroyedException(); } @@ -206,7 +206,7 @@ class CommunicatorI implements Communicator public synchronized void setLogger(Logger logger) { - if (_instance == null) + if(_instance == null) { throw new CommunicatorDestroyedException(); } @@ -234,7 +234,7 @@ class CommunicatorI implements Communicator finalize() throws Throwable { - if (_instance != null) + if(_instance != null) { _instance.logger().warning("communicator has not been destroyed"); } diff --git a/java/src/Ice/Object.java b/java/src/Ice/Object.java index 2f627066b51..b402b900f9d 100644 --- a/java/src/Ice/Object.java +++ b/java/src/Ice/Object.java @@ -139,12 +139,12 @@ public class Object __dispatch(IceInternal.Incoming in, Current current) { int pos = java.util.Arrays.binarySearch(__all, current.operation); - if (pos < 0) + if(pos < 0) { return IceInternal.DispatchStatus.DispatchOperationNotExist; } - switch (pos) + switch(pos) { case 0: { @@ -183,7 +183,7 @@ public class Object java.util.Set set = _activeFacetMap.keySet(); String[] keys = new String[sz]; set.toArray(keys); - for (int i = 0; i < sz; i++) + for(int i = 0; i < sz; i++) { __os.writeString(keys[i]); __os.writeObject((Object)_activeFacetMap.get(keys[i])); @@ -200,7 +200,7 @@ public class Object _activeFacetMap.clear(); - while (sz-- > 0) + while(sz-- > 0) { String key = __is.readString(); Object value = __is.readObject("", null); @@ -220,7 +220,7 @@ public class Object java.util.Set set = _activeFacetMap.keySet(); String[] keys = new String[sz]; set.toArray(keys); - for (int i = 0; i < sz; i++) + for(int i = 0; i < sz; i++) { __os.startWriteDictionaryElement(); __os.writeString("key", keys[i]); @@ -244,7 +244,7 @@ public class Object _activeFacetMap.clear(); - while (sz-- > 0) + while(sz-- > 0) { __is.startReadDictionaryElement(); String key = __is.readString(keyName); diff --git a/java/src/Ice/ObjectAdapterI.java b/java/src/Ice/ObjectAdapterI.java index b1451a7352d..f9dfaaf8dd0 100644 --- a/java/src/Ice/ObjectAdapterI.java +++ b/java/src/Ice/ObjectAdapterI.java @@ -27,22 +27,22 @@ public class ObjectAdapterI implements ObjectAdapter public synchronized void activate() { - if (_instance == null) + if(_instance == null) { throw new ObjectAdapterDeactivatedException(); } final int sz = _incomingConnectionFactories.size(); - for (int i = 0; i < sz; ++i) + for(int i = 0; i < sz; ++i) { IceInternal.IncomingConnectionFactory factory = (IceInternal.IncomingConnectionFactory)_incomingConnectionFactories.get(i); factory.activate(); } - if (!_printAdapterReadyDone) + if(!_printAdapterReadyDone) { - if (_instance.properties().getPropertyAsInt("Ice.PrintAdapterReady") > 0) + if(_instance.properties().getPropertyAsInt("Ice.PrintAdapterReady") > 0) { System.out.println(_name + " ready"); } @@ -54,13 +54,13 @@ public class ObjectAdapterI implements ObjectAdapter public synchronized void hold() { - if (_instance == null) + if(_instance == null) { throw new ObjectAdapterDeactivatedException(); } final int sz = _incomingConnectionFactories.size(); - for (int i = 0; i < sz; ++i) + for(int i = 0; i < sz; ++i) { IceInternal.IncomingConnectionFactory factory = (IceInternal.IncomingConnectionFactory)_incomingConnectionFactories.get(i); @@ -71,7 +71,7 @@ public class ObjectAdapterI implements ObjectAdapter public synchronized void deactivate() { - if (_instance == null) + if(_instance == null) { // // Ignore deactivation requests if the Object Adapter has @@ -81,7 +81,7 @@ public class ObjectAdapterI implements ObjectAdapter } final int sz = _incomingConnectionFactories.size(); - for (int i = 0; i < sz; ++i) + for(int i = 0; i < sz; ++i) { IceInternal.IncomingConnectionFactory factory = (IceInternal.IncomingConnectionFactory)_incomingConnectionFactories.get(i); @@ -93,7 +93,7 @@ public class ObjectAdapterI implements ObjectAdapter _activeServantMap.clear(); java.util.Iterator p = _locatorMap.values().iterator(); - while (p.hasNext()) + while(p.hasNext()) { ServantLocator locator = (ServantLocator)p.next(); locator.deactivate(); @@ -112,7 +112,7 @@ public class ObjectAdapterI implements ObjectAdapter // as there would be a deadlock with upcalls.) // final int sz = _incomingConnectionFactories.size(); - for (int i = 0; i < sz; ++i) + for(int i = 0; i < sz; ++i) { IceInternal.IncomingConnectionFactory factory = (IceInternal.IncomingConnectionFactory)_incomingConnectionFactories.get(i); @@ -123,7 +123,7 @@ public class ObjectAdapterI implements ObjectAdapter public synchronized ObjectPrx add(Ice.Object servant, Identity ident) { - if (_instance == null) + if(_instance == null) { throw new ObjectAdapterDeactivatedException(); } @@ -143,7 +143,7 @@ public class ObjectAdapterI implements ObjectAdapter public synchronized ObjectPrx addWithUUID(Ice.Object servant) { - if (_instance == null) + if(_instance == null) { throw new ObjectAdapterDeactivatedException(); } @@ -161,7 +161,7 @@ public class ObjectAdapterI implements ObjectAdapter public synchronized void remove(Identity ident) { - if (_instance == null) + if(_instance == null) { throw new ObjectAdapterDeactivatedException(); } @@ -172,7 +172,7 @@ public class ObjectAdapterI implements ObjectAdapter public synchronized void addServantLocator(ServantLocator locator, String prefix) { - if (_instance == null) + if(_instance == null) { throw new ObjectAdapterDeactivatedException(); } @@ -183,13 +183,13 @@ public class ObjectAdapterI implements ObjectAdapter public synchronized void removeServantLocator(String prefix) { - if (_instance == null) + if(_instance == null) { throw new ObjectAdapterDeactivatedException(); } ServantLocator locator = (ServantLocator)_locatorMap.remove(prefix); - if (locator != null) + if(locator != null) { locator.deactivate(); } @@ -198,7 +198,7 @@ public class ObjectAdapterI implements ObjectAdapter public synchronized ServantLocator findServantLocator(String prefix) { - if (_instance == null) + if(_instance == null) { throw new ObjectAdapterDeactivatedException(); } @@ -222,7 +222,7 @@ public class ObjectAdapterI implements ObjectAdapter public synchronized ObjectPrx createProxy(Identity ident) { - if (_instance == null) + if(_instance == null) { throw new ObjectAdapterDeactivatedException(); } @@ -233,7 +233,7 @@ public class ObjectAdapterI implements ObjectAdapter public synchronized ObjectPrx createReverseProxy(Identity ident) { - if (_instance == null) + if(_instance == null) { throw new ObjectAdapterDeactivatedException(); } @@ -252,13 +252,13 @@ public class ObjectAdapterI implements ObjectAdapter public synchronized void addRouter(RouterPrx router) { - if (_instance == null) + if(_instance == null) { throw new ObjectAdapterDeactivatedException(); } IceInternal.RouterInfo routerInfo = _instance.routerManager().get(router); - if (routerInfo != null) + if(routerInfo != null) { // // Add the router's server proxy endpoints to this object @@ -266,16 +266,16 @@ public class ObjectAdapterI implements ObjectAdapter // ObjectPrxHelper proxy = (ObjectPrxHelper)routerInfo.getServerProxy(); IceInternal.Endpoint[] endpoints = proxy.__reference().endpoints; - for (int i = 0; i < endpoints.length; ++i) + for(int i = 0; i < endpoints.length; ++i) { _routerEndpoints.add(endpoints[i]); } java.util.Collections.sort(_routerEndpoints); // Must be sorted. - for (int i = 0; i < _routerEndpoints.size() - 1; ++i) + for(int i = 0; i < _routerEndpoints.size() - 1; ++i) { java.lang.Object o1 = _routerEndpoints.get(i); java.lang.Object o2 = _routerEndpoints.get(i + 1); - if (o1.equals(o2)) + if(o1.equals(o2)) { _routerEndpoints.remove(i); } @@ -306,12 +306,12 @@ public class ObjectAdapterI implements ObjectAdapter // java.util.ArrayList connections = new java.util.ArrayList(); final int sz = _incomingConnectionFactories.size(); - for (int i = 0; i < sz; ++i) + for(int i = 0; i < sz; ++i) { IceInternal.IncomingConnectionFactory factory = (IceInternal.IncomingConnectionFactory)_incomingConnectionFactories.get(i); IceInternal.Connection[] cons = factory.connections(); - for (int j = 0; j < cons.length; j++) + for(int j = 0; j < cons.length; j++) { connections.add(cons[j]); } @@ -338,15 +338,15 @@ public class ObjectAdapterI implements ObjectAdapter try { - while (true) + while(true) { end = s.indexOf(':', beg); - if (end == -1) + if(end == -1) { end = s.length(); } - if (end == beg) + if(end == beg) { break; } @@ -361,7 +361,7 @@ public class ObjectAdapterI implements ObjectAdapter IceInternal.Endpoint endp = instance.endpointFactoryManager().create(es); _incomingConnectionFactories.add(new IceInternal.IncomingConnectionFactory(instance, endp, this)); - if (end == s.length()) + if(end == s.length()) { break; } @@ -381,7 +381,7 @@ public class ObjectAdapterI implements ObjectAdapter // router. (See addRouter.) // /* - if (_incomingConnectionFactories.isEmpty()) + if(_incomingConnectionFactories.isEmpty()) { throw new EndpointParseException(); } @@ -392,7 +392,7 @@ public class ObjectAdapterI implements ObjectAdapter finalize() throws Throwable { - if (_instance != null) + if(_instance != null) { _instance.logger().warning("object adapter has not been deactivated"); } @@ -411,7 +411,7 @@ public class ObjectAdapterI implements ObjectAdapter // factories. // int sz = _incomingConnectionFactories.size(); - for (int i = 0; i < sz; ++i) + for(int i = 0; i < sz; ++i) { IceInternal.IncomingConnectionFactory factory = (IceInternal.IncomingConnectionFactory)_incomingConnectionFactories.get(i); @@ -424,7 +424,7 @@ public class ObjectAdapterI implements ObjectAdapter // will also point to the router's server proxy endpoints. // sz = _routerEndpoints.size(); - for (int i = 0; i < sz; ++i) + for(int i = 0; i < sz; ++i) { endpoints[_incomingConnectionFactories.size() + i] = (IceInternal.Endpoint)_routerEndpoints.get(i); } @@ -450,14 +450,14 @@ public class ObjectAdapterI implements ObjectAdapter // endpoints used by this object adapter's incoming connection // factories are considered local. // - for (int i = 0; i < endpoints.length; ++i) + for(int i = 0; i < endpoints.length; ++i) { final int sz = _incomingConnectionFactories.size(); - for (int j = 0; j < sz; j++) + for(int j = 0; j < sz; j++) { IceInternal.IncomingConnectionFactory factory = (IceInternal.IncomingConnectionFactory)_incomingConnectionFactories.get(j); - if (factory.equivalent(endpoints[i])) + if(factory.equivalent(endpoints[i])) { return true; } @@ -477,10 +477,10 @@ public class ObjectAdapterI implements ObjectAdapter // router's server proxy endpoints (if any), are also considered // local. // - for (int i = 0; i < endpoints.length; ++i) + for(int i = 0; i < endpoints.length; ++i) { // _routerEndpoints is sorted. - if (java.util.Collections.binarySearch(_routerEndpoints, endpoints[i]) >= 0) + if(java.util.Collections.binarySearch(_routerEndpoints, endpoints[i]) >= 0) { return true; } diff --git a/java/src/Ice/ObjectPrxHelper.java b/java/src/Ice/ObjectPrxHelper.java index 8f0e853f32f..f3847df04e2 100644 --- a/java/src/Ice/ObjectPrxHelper.java +++ b/java/src/Ice/ObjectPrxHelper.java @@ -34,7 +34,7 @@ public class ObjectPrxHelper implements ObjectPrx ice_isA(String __id, java.util.Map __context) { int __cnt = 0; - while (true) + while(true) { try { @@ -66,7 +66,7 @@ public class ObjectPrxHelper implements ObjectPrx ice_ping(java.util.Map __context) { int __cnt = 0; - while (true) + while(true) { try { @@ -99,7 +99,7 @@ public class ObjectPrxHelper implements ObjectPrx ice_ids(java.util.Map __context) { int __cnt = 0; - while (true) + while(true) { try { @@ -131,7 +131,7 @@ public class ObjectPrxHelper implements ObjectPrx ice_id(java.util.Map __context) { int __cnt = 0; - while (true) + while(true) { try { @@ -163,7 +163,7 @@ public class ObjectPrxHelper implements ObjectPrx ice_facets(java.util.Map __context) { int __cnt = 0; - while (true) + while(true) { try { @@ -196,7 +196,7 @@ public class ObjectPrxHelper implements ObjectPrx java.util.Map __context) { int __cnt = 0; - while (true) + while(true) { try { @@ -209,7 +209,7 @@ public class ObjectPrxHelper implements ObjectPrx } catch (IceInternal.NonRepeatable __ex) { - if (nonmutating) + if(nonmutating) { __cnt = __handleException(__ex.get(), __cnt); } @@ -234,7 +234,7 @@ public class ObjectPrxHelper implements ObjectPrx public final ObjectPrx ice_newIdentity(Identity newIdentity) { - if (newIdentity.equals(_reference.identity)) + if(newIdentity.equals(_reference.identity)) { return this; } @@ -255,7 +255,7 @@ public class ObjectPrxHelper implements ObjectPrx public final ObjectPrx ice_newFacet(String newFacet) { - if (newFacet.equals(_reference.facet)) + if(newFacet.equals(_reference.facet)) { return this; } @@ -271,7 +271,7 @@ public class ObjectPrxHelper implements ObjectPrx ice_twoway() { IceInternal.Reference ref = _reference.changeMode(IceInternal.Reference.ModeTwoway); - if (ref.equals(_reference)) + if(ref.equals(_reference)) { return this; } @@ -287,7 +287,7 @@ public class ObjectPrxHelper implements ObjectPrx ice_oneway() { IceInternal.Reference ref = _reference.changeMode(IceInternal.Reference.ModeOneway); - if (ref.equals(_reference)) + if(ref.equals(_reference)) { return this; } @@ -303,7 +303,7 @@ public class ObjectPrxHelper implements ObjectPrx ice_batchOneway() { IceInternal.Reference ref = _reference.changeMode(IceInternal.Reference.ModeBatchOneway); - if (ref.equals(_reference)) + if(ref.equals(_reference)) { return this; } @@ -319,7 +319,7 @@ public class ObjectPrxHelper implements ObjectPrx ice_datagram() { IceInternal.Reference ref = _reference.changeMode(IceInternal.Reference.ModeDatagram); - if (ref.equals(_reference)) + if(ref.equals(_reference)) { return this; } @@ -335,7 +335,7 @@ public class ObjectPrxHelper implements ObjectPrx ice_batchDatagram() { IceInternal.Reference ref = _reference.changeMode(IceInternal.Reference.ModeBatchDatagram); - if (ref.equals(_reference)) + if(ref.equals(_reference)) { return this; } @@ -351,7 +351,7 @@ public class ObjectPrxHelper implements ObjectPrx ice_secure(boolean b) { IceInternal.Reference ref = _reference.changeSecure(b); - if (ref.equals(_reference)) + if(ref.equals(_reference)) { return this; } @@ -367,7 +367,7 @@ public class ObjectPrxHelper implements ObjectPrx ice_timeout(int t) { IceInternal.Reference ref = _reference.changeTimeout(t); - if (ref.equals(_reference)) + if(ref.equals(_reference)) { return this; } @@ -383,7 +383,7 @@ public class ObjectPrxHelper implements ObjectPrx ice_router(Ice.RouterPrx router) { IceInternal.Reference ref = _reference.changeRouter(router); - if (ref.equals(_reference)) + if(ref.equals(_reference)) { return this; } @@ -399,7 +399,7 @@ public class ObjectPrxHelper implements ObjectPrx ice_default() { IceInternal.Reference ref = _reference.changeDefault(); - if (ref.equals(_reference)) + if(ref.equals(_reference)) { return this; } @@ -465,13 +465,13 @@ public class ObjectPrxHelper implements ObjectPrx _reference = ref; - if (delegateD != null) + if(delegateD != null) { _ObjectDelD delegate = __createDelegateD(); delegate.__copyFrom(delegateD); _delegate = delegate; } - else if (delegateM != null) + else if(delegateM != null) { _ObjectDelM delegate = __createDelegateM(); delegate.__copyFrom(delegateM); @@ -514,9 +514,9 @@ public class ObjectPrxHelper implements ObjectPrx IceInternal.TraceLevels traceLevels = _reference.instance.traceLevels(); Logger logger = _reference.instance.logger(); - if (cnt > max) + if(cnt > max) { - if (traceLevels.retry >= 1) + if(traceLevels.retry >= 1) { String s = "cannot retry operation call because retry limit has been exceeded\n" + ex; logger.trace(traceLevels.retryCat, s); @@ -524,7 +524,7 @@ public class ObjectPrxHelper implements ObjectPrx throw ex; } - if (traceLevels.retry >= 1) + if(traceLevels.retry >= 1) { String s = "re-trying operation call because of exception\n" + ex; logger.trace(traceLevels.retryCat, s); @@ -552,7 +552,7 @@ public class ObjectPrxHelper implements ObjectPrx _delegate = null; ObjectPrxHelper h = (ObjectPrxHelper)ex._prx; - if (!_reference.identity.equals(h.__reference().identity)) + if(!_reference.identity.equals(h.__reference().identity)) { throw new LocationForwardIdentityException(); } @@ -564,7 +564,7 @@ public class ObjectPrxHelper implements ObjectPrx _reference.instance.traceLevels(); Logger logger = _reference.instance.logger(); - if (traceLevels.locationForward >= 1) + if(traceLevels.locationForward >= 1) { String s = "location forward for object with identity `" + _reference.identity + "'"; logger.trace(traceLevels.locationForwardCat, s); @@ -575,10 +575,10 @@ public class ObjectPrxHelper implements ObjectPrx public final synchronized _ObjectDel __getDelegate() { - if (_delegate == null) + if(_delegate == null) { ObjectAdapter adapter = _reference.instance.objectAdapterFactory().findObjectAdapter(this); - if (adapter != null) + if(adapter != null) { _ObjectDelD delegate = __createDelegateD(); delegate.setup(_reference, adapter); @@ -595,7 +595,7 @@ public class ObjectPrxHelper implements ObjectPrx // using a router, then add this proxy to the router info // object. // - if (_reference.routerInfo != null) + if(_reference.routerInfo != null) { _reference.routerInfo.addProxy(this); } diff --git a/java/src/Ice/PluginManagerI.java b/java/src/Ice/PluginManagerI.java index 862d0e55d28..f1450372612 100644 --- a/java/src/Ice/PluginManagerI.java +++ b/java/src/Ice/PluginManagerI.java @@ -16,7 +16,7 @@ public final class PluginManagerI implements PluginManager getPlugin(String name) { Plugin p = (Plugin)_plugins.get(name); - if (p != null) + if(p != null) { return p; } @@ -26,7 +26,7 @@ public final class PluginManagerI implements PluginManager public synchronized void addPlugin(String name, Plugin plugin) { - if (_plugins.containsKey(name)) + if(_plugins.containsKey(name)) { throw new PluginExistsException(); } @@ -37,7 +37,7 @@ public final class PluginManagerI implements PluginManager destroy() { java.util.Iterator i = _plugins.entrySet().iterator(); - while (i.hasNext()) + while(i.hasNext()) { Plugin p = (Plugin)i.next(); p.destroy(); @@ -64,7 +64,7 @@ public final class PluginManagerI implements PluginManager Ice.Properties properties = _instance.properties(); java.util.Map plugins = properties.getPropertiesForPrefix(prefix); java.util.Iterator p = plugins.entrySet().iterator(); - while (p.hasNext()) + while(p.hasNext()) { java.util.Map.Entry entry = (java.util.Map.Entry)p.next(); String name = ((String)entry.getKey()).substring(prefix.length()); @@ -76,15 +76,15 @@ public final class PluginManagerI implements PluginManager String className; String[] args; int pos = value.indexOf(' '); - if (pos == -1) + if(pos == -1) { pos = value.indexOf('\t'); } - if (pos == -1) + if(pos == -1) { pos = value.indexOf('\n'); } - if (pos == -1) + if(pos == -1) { className = value; args = new String[0]; diff --git a/java/src/Ice/PropertiesI.java b/java/src/Ice/PropertiesI.java index 82c7faf2ef2..67560da00b1 100644 --- a/java/src/Ice/PropertiesI.java +++ b/java/src/Ice/PropertiesI.java @@ -16,11 +16,11 @@ class PropertiesI implements Properties getProperty(String key) { String result = (String)_properties.get(key); - if (result == null) + if(result == null) { result = System.getProperty(key); } - if (result == null) + if(result == null) { result = ""; } @@ -31,11 +31,11 @@ class PropertiesI implements Properties getPropertyWithDefault(String key, String value) { String result = (String)_properties.get(key); - if (result == null) + if(result == null) { result = System.getProperty(key); } - if (result == null) + if(result == null) { result = value; } @@ -52,11 +52,11 @@ class PropertiesI implements Properties getPropertyAsIntWithDefault(String key, int value) { String result = (String)_properties.get(key); - if (result == null) + if(result == null) { result = System.getProperty(key); } - if (result == null) + if(result == null) { return value; } @@ -76,12 +76,12 @@ class PropertiesI implements Properties { java.util.HashMap result = new java.util.HashMap(); java.util.Iterator p = _properties.entrySet().iterator(); - while (p.hasNext()) + while(p.hasNext()) { java.util.Map.Entry entry = (java.util.Map.Entry)p.next(); String key = (String)entry.getKey(); String value = (String)entry.getValue(); - if (prefix.length() == 0 || key.startsWith(prefix)) + if(prefix.length() == 0 || key.startsWith(prefix)) { result.put(key, value); } @@ -101,7 +101,7 @@ class PropertiesI implements Properties String[] result = new String[_properties.size()]; java.util.Iterator p = _properties.entrySet().iterator(); int i = 0; - while (p.hasNext()) + while(p.hasNext()) { java.util.Map.Entry entry = (java.util.Map.Entry)p.next(); result[i++] = "--" + entry.getKey() + "=" + entry.getValue(); @@ -114,12 +114,12 @@ class PropertiesI implements Properties parseCommandLineOptions(String prefix, String[] options) { java.util.ArrayList result = new java.util.ArrayList(); - for (int i = 0; i < options.length; i++) + for(int i = 0; i < options.length; i++) { String opt = options[i]; - if (opt.startsWith("--" + prefix + ".")) + if(opt.startsWith("--" + prefix + ".")) { - if (opt.indexOf('=') == -1) + if(opt.indexOf('=') == -1) { opt += "=1"; } @@ -167,12 +167,12 @@ class PropertiesI implements Properties PropertiesI(String[] args) { - for (int i = 0; i < args.length; i++) + for(int i = 0; i < args.length; i++) { - if (args[i].startsWith("--Ice.Config")) + if(args[i].startsWith("--Ice.Config")) { String line = args[i]; - if (line.indexOf('=') == -1) + if(line.indexOf('=') == -1) { line += "=1"; } @@ -185,19 +185,19 @@ class PropertiesI implements Properties PropertiesI(StringSeqHolder args) { - for (int i = 0; i < args.value.length; i++) + for(int i = 0; i < args.value.length; i++) { - if (args.value[i].startsWith("--Ice.Config")) + if(args.value[i].startsWith("--Ice.Config")) { String line = args.value[i]; - if (line.indexOf('=') == -1) + if(line.indexOf('=') == -1) { line += "=1"; } parseLine(line.substring(2)); String[] arr = new String[args.value.length - 1]; System.arraycopy(args.value, 0, arr, 0, i); - if (i < args.value.length - 1) + if(i < args.value.length - 1) { System.arraycopy(args.value, i + 1, arr, i, args.value.length - i - 1); } @@ -214,7 +214,7 @@ class PropertiesI implements Properties try { String line; - while ((line = in.readLine()) != null) + while((line = in.readLine()) != null) { parseLine(line); } @@ -233,11 +233,11 @@ class PropertiesI implements Properties String s = line; int hash = s.indexOf('#'); - if (hash == 0) + if(hash == 0) { return; // ignore comment lines } - else if (hash != -1) + else if(hash != -1) { s = s.substring(0, hash); } @@ -246,15 +246,15 @@ class PropertiesI implements Properties final char[] arr = s.toCharArray(); int end = -1; - for (int i = 0; i < arr.length; i++) + for(int i = 0; i < arr.length; i++) { - if (arr[i] == ' ' || arr[i] == '\t' || arr[i] == '\r' || arr[i] == '\n' || arr[i] == '=') + if(arr[i] == ' ' || arr[i] == '\t' || arr[i] == '\r' || arr[i] == '\n' || arr[i] == '=') { end = i; break; } } - if (end == -1) + if(end == -1) { return; } @@ -262,14 +262,14 @@ class PropertiesI implements Properties String key = s.substring(0, end); end = s.indexOf('=', end); - if (end == -1) + if(end == -1) { return; } ++end; String value = ""; - if (end < s.length()) + if(end < s.length()) { value = s.substring(end).trim(); } @@ -282,15 +282,15 @@ class PropertiesI implements Properties { String value = getProperty("Ice.Config"); - if (value.equals("1")) + if(value.equals("1")) { value = ""; } - if (value.length() > 0) + if(value.length() > 0) { String[] files = value.split(","); - for (int i = 0; i < files.length; i++) + for(int i = 0; i < files.length; i++) { load(files[i]); } diff --git a/java/src/Ice/RoutingTable.java b/java/src/Ice/RoutingTable.java index 929ff17c79c..e78a9660c6f 100644 --- a/java/src/Ice/RoutingTable.java +++ b/java/src/Ice/RoutingTable.java @@ -23,7 +23,7 @@ public final class RoutingTable public boolean add(ObjectPrx prx) { - if (prx == null) + if(prx == null) { return false; } @@ -32,7 +32,7 @@ public final class RoutingTable synchronized (this) { - if (!_table.containsKey(proxy.ice_getIdentity())) + if(!_table.containsKey(proxy.ice_getIdentity())) { _table.put(proxy.ice_getIdentity(), proxy); return true; @@ -50,7 +50,7 @@ public final class RoutingTable public ObjectPrx get(Identity ident) { - if (ident.name.length() == 0) + if(ident.name.length() == 0) { return null; } diff --git a/java/src/Ice/Util.java b/java/src/Ice/Util.java index c29e3061172..3fb786a3505 100644 --- a/java/src/Ice/Util.java +++ b/java/src/Ice/Util.java @@ -15,7 +15,7 @@ public final class Util public static Properties getDefaultProperties() { - if (_defaultProperties == null) + if(_defaultProperties == null) { _defaultProperties = createProperties(); } @@ -25,7 +25,7 @@ public final class Util public static Properties getDefaultProperties(String[] args) { - if (_defaultProperties == null) + if(_defaultProperties == null) { _defaultProperties = createProperties(args); } @@ -35,7 +35,7 @@ public final class Util public static Properties getDefaultProperties(StringSeqHolder args) { - if (_defaultProperties == null) + if(_defaultProperties == null) { _defaultProperties = createProperties(args); } @@ -108,7 +108,7 @@ public final class Util { Identity ident = new Identity(); int pos = s.indexOf('/'); - if (pos != -1) + if(pos != -1) { ident.category = s.substring(0, pos); ident.name = s.substring(pos + 1); @@ -124,7 +124,7 @@ public final class Util public static String identityToString(Identity ident) { - if (ident.category.length() == 0) + if(ident.category.length() == 0) { return ident.name; } @@ -139,7 +139,7 @@ public final class Util { java.rmi.server.UID uid = new java.rmi.server.UID(); - if (_localAddress == null) + if(_localAddress == null) { java.net.InetAddress addr = null; try @@ -152,9 +152,9 @@ public final class Util } byte[] ip = addr.getAddress(); _localAddress = ""; - for (int i = 0; i < ip.length; i++) + for(int i = 0; i < ip.length; i++) { - if (i > 0) + if(i > 0) { _localAddress += ":"; } diff --git a/java/src/Ice/_ObjectDelD.java b/java/src/Ice/_ObjectDelD.java index 598320d2257..f860f2bdc55 100644 --- a/java/src/Ice/_ObjectDelD.java +++ b/java/src/Ice/_ObjectDelD.java @@ -18,7 +18,7 @@ public class _ObjectDelD implements _ObjectDel { Current __current = new Current(); __initCurrent(__current, "ice_isA", true, __context); - while (true) + while(true) { IceInternal.Direct __direct = new IceInternal.Direct(__adapter, __current); try @@ -53,7 +53,7 @@ public class _ObjectDelD implements _ObjectDel { Current __current = new Current(); __initCurrent(__current, "ice_ping", true, __context); - while (true) + while(true) { IceInternal.Direct __direct = new IceInternal.Direct(__adapter, __current); try @@ -89,7 +89,7 @@ public class _ObjectDelD implements _ObjectDel { Current __current = new Current(); __initCurrent(__current, "ice_ids", true, __context); - while (true) + while(true) { IceInternal.Direct __direct = new IceInternal.Direct(__adapter, __current); try @@ -124,7 +124,7 @@ public class _ObjectDelD implements _ObjectDel { Current __current = new Current(); __initCurrent(__current, "ice_id", true, __context); - while (true) + while(true) { IceInternal.Direct __direct = new IceInternal.Direct(__adapter, __current); try @@ -159,7 +159,7 @@ public class _ObjectDelD implements _ObjectDel { Current __current = new Current(); __initCurrent(__current, "ice_facets", true, __context); - while (true) + while(true) { IceInternal.Direct __direct = new IceInternal.Direct(__adapter, __current); try @@ -194,7 +194,7 @@ public class _ObjectDelD implements _ObjectDel { Current current = new Current(); __initCurrent(current, operation, nonmutating, context); - while (true) + while(true) { IceInternal.Direct __direct = new IceInternal.Direct(__adapter, current); try diff --git a/java/src/Ice/_ObjectDelM.java b/java/src/Ice/_ObjectDelM.java index 675a592501f..b32f08ee23e 100644 --- a/java/src/Ice/_ObjectDelM.java +++ b/java/src/Ice/_ObjectDelM.java @@ -22,7 +22,7 @@ public class _ObjectDelM implements _ObjectDel IceInternal.BasicStream __is = __out.is(); IceInternal.BasicStream __os = __out.os(); __os.writeString(__id); - if (!__out.invoke()) + if(!__out.invoke()) { throw new UnknownUserException(); } @@ -41,7 +41,7 @@ public class _ObjectDelM implements _ObjectDel IceInternal.Outgoing __out = getOutgoing("ice_ping", true, __context); try { - if (!__out.invoke()) + if(!__out.invoke()) { throw new UnknownUserException(); } @@ -60,7 +60,7 @@ public class _ObjectDelM implements _ObjectDel try { IceInternal.BasicStream __is = __out.is(); - if (!__out.invoke()) + if(!__out.invoke()) { throw new UnknownUserException(); } @@ -80,7 +80,7 @@ public class _ObjectDelM implements _ObjectDel try { IceInternal.BasicStream __is = __out.is(); - if (!__out.invoke()) + if(!__out.invoke()) { throw new UnknownUserException(); } @@ -100,7 +100,7 @@ public class _ObjectDelM implements _ObjectDel try { IceInternal.BasicStream __is = __out.is(); - if (!__out.invoke()) + if(!__out.invoke()) { throw new UnknownUserException(); } @@ -123,7 +123,7 @@ public class _ObjectDelM implements _ObjectDel IceInternal.BasicStream __os = __out.os(); __os.writeBlob(inParams); boolean ok = __out.invoke(); - if (__reference.mode == IceInternal.Reference.ModeTwoway) + if(__reference.mode == IceInternal.Reference.ModeTwoway) { IceInternal.BasicStream __is = __out.is(); int sz = __is.getReadEncapsSize(); @@ -176,7 +176,7 @@ public class _ObjectDelM implements _ObjectDel // __reference = ref; - if (__reference.reverseAdapter != null) + if(__reference.reverseAdapter != null) { // // If we have a reverse object adapter, we use the incoming @@ -186,21 +186,21 @@ public class _ObjectDelM implements _ObjectDel IceInternal.Connection[] connections = adapter.getIncomingConnections(); IceInternal.Endpoint[] endpoints = new IceInternal.Endpoint[connections.length]; - for (int i = 0; i < connections.length; i++) + for(int i = 0; i < connections.length; i++) { endpoints[i] = connections[i].endpoint(); } endpoints = filterEndpoints(endpoints); - if (endpoints.length == 0) + if(endpoints.length == 0) { throw new NoEndpointException(); } int j; - for (j = 0; j < connections.length; j++) + for(j = 0; j < connections.length; j++) { - if (connections[j].endpoint().equals(endpoints[0])) + if(connections[j].endpoint().equals(endpoints[0])) { break; } @@ -212,7 +212,7 @@ public class _ObjectDelM implements _ObjectDel else { IceInternal.Endpoint[] endpoints = null; - if (__reference.routerInfo != null) + if(__reference.routerInfo != null) { // // If we route, we send everything to the router's client @@ -226,7 +226,7 @@ public class _ObjectDelM implements _ObjectDel endpoints = filterEndpoints(__reference.endpoints); } - if (endpoints.length == 0) + if(endpoints.length == 0) { throw new NoEndpointException(); } @@ -242,7 +242,7 @@ public class _ObjectDelM implements _ObjectDel // callbacks from the router can be received over this new // connection. // - if (__reference.routerInfo != null) + if(__reference.routerInfo != null) { __connection.setAdapter(__reference.routerInfo.getAdapter()); } @@ -257,15 +257,15 @@ public class _ObjectDelM implements _ObjectDel // // Filter out unknown endpoints. // - for (int i = 0; i < allEndpoints.length; i++) + for(int i = 0; i < allEndpoints.length; i++) { - if (!allEndpoints[i].unknown()) + if(!allEndpoints[i].unknown()) { endpoints.add(allEndpoints[i]); } } - switch (__reference.mode) + switch(__reference.mode) { case IceInternal.Reference.ModeTwoway: case IceInternal.Reference.ModeOneway: @@ -275,10 +275,10 @@ public class _ObjectDelM implements _ObjectDel // Filter out datagram endpoints. // java.util.Iterator i = endpoints.iterator(); - while (i.hasNext()) + while(i.hasNext()) { IceInternal.Endpoint endpoint = (IceInternal.Endpoint)i.next(); - if (endpoint.datagram()) + if(endpoint.datagram()) { i.remove(); } @@ -293,10 +293,10 @@ public class _ObjectDelM implements _ObjectDel // Filter out non-datagram endpoints. // java.util.Iterator i = endpoints.iterator(); - while (i.hasNext()) + while(i.hasNext()) { IceInternal.Endpoint endpoint = (IceInternal.Endpoint)i.next(); - if (!endpoint.datagram()) + if(!endpoint.datagram()) { i.remove(); } @@ -316,13 +316,13 @@ public class _ObjectDelM implements _ObjectDel // secure endpoints by partitioning the endpoint vector, so that // non-secure endpoints come first. // - if (__reference.secure) + if(__reference.secure) { java.util.Iterator i = endpoints.iterator(); - while (i.hasNext()) + while(i.hasNext()) { IceInternal.Endpoint endpoint = (IceInternal.Endpoint)i.next(); - if (!endpoint.secure()) + if(!endpoint.secure()) { i.remove(); } @@ -347,11 +347,11 @@ public class _ObjectDelM implements _ObjectDel IceInternal.Endpoint re = (IceInternal.Endpoint)r; boolean ls = le.secure(); boolean rs = re.secure(); - if ((ls && rs) || (!ls && !rs)) + if((ls && rs) || (!ls && !rs)) { return 0; } - else if (!ls && rs) + else if(!ls && rs) { return -1; } @@ -370,7 +370,7 @@ public class _ObjectDelM implements _ObjectDel synchronized (__outgoingMutex) { - if (__outgoingCache == null) + if(__outgoingCache == null) { out = new IceInternal.Outgoing(__connection, __reference, operation, nonmutating, context); } @@ -399,12 +399,12 @@ public class _ObjectDelM implements _ObjectDel finalize() throws Throwable { - if (__connection != null) + if(__connection != null) { __connection.decProxyUsageCount(); } - while (__outgoingCache != null) + while(__outgoingCache != null) { IceInternal.Outgoing next = __outgoingCache.next; __outgoingCache.destroy(); diff --git a/java/src/IceBox/Admin.java b/java/src/IceBox/Admin.java index b9bddd5ecb0..f838e6ea8c1 100644 --- a/java/src/IceBox/Admin.java +++ b/java/src/IceBox/Admin.java @@ -36,14 +36,14 @@ public final class Admin java.util.ArrayList commands = new java.util.ArrayList(); int idx = 0; - while (idx < args.length) + while(idx < args.length) { - if (args[idx].equals("-h") || args[idx].equals("--help")) + if(args[idx].equals("-h") || args[idx].equals("--help")) { usage(); return 1; } - else if (args[idx].charAt(0) == '-') + else if(args[idx].charAt(0) == '-') { System.err.println(appName() + ": unknown option `" + args[idx] + "'"); usage(); @@ -56,7 +56,7 @@ public final class Admin } } - if (commands.isEmpty()) + if(commands.isEmpty()) { usage(); return 0; @@ -64,7 +64,7 @@ public final class Admin final String managerEndpointsProperty = "IceBox.ServiceManager.Endpoints"; String managerEndpoints = properties.getProperty(managerEndpointsProperty); - if (managerEndpoints.length() == 0) + if(managerEndpoints.length() == 0) { System.err.println(appName() + ": property `" + managerEndpointsProperty + "' is not set"); return 1; @@ -72,16 +72,16 @@ public final class Admin Ice.ObjectPrx base = communicator().stringToProxy("ServiceManager:" + managerEndpoints); IceBox.ServiceManagerPrx manager = IceBox.ServiceManagerPrxHelper.checkedCast(base); - if (manager == null) + if(manager == null) { System.err.println(appName() + ": `" + managerEndpoints + "' is not running"); return 1; } - for (int i = 0; i < commands.size(); i++) + for(int i = 0; i < commands.size(); i++) { String command = (String)commands.get(i); - if (command.equals("shutdown")) + if(command.equals("shutdown")) { manager.shutdown(); } diff --git a/java/src/IceBox/Server.java b/java/src/IceBox/Server.java index bbe013e9c2e..192fa494f8a 100644 --- a/java/src/IceBox/Server.java +++ b/java/src/IceBox/Server.java @@ -36,14 +36,14 @@ public final class Server Ice.Properties properties = communicator.getProperties(); argsH.value = properties.parseCommandLineOptions("IceBox", argsH.value); - for (int i = 1; i < argsH.value.length; ++i) + for(int i = 1; i < argsH.value.length; ++i) { - if (argsH.value[i].equals("-h") || argsH.value[i].equals("--help")) + if(argsH.value[i].equals("-h") || argsH.value[i].equals("--help")) { usage(); System.exit(0); } - else if (!argsH.value[i].startsWith("--")) + else if(!argsH.value[i].startsWith("--")) { System.err.println("Server: unknown option `" + argsH.value[i] + "'"); usage(); @@ -60,7 +60,7 @@ public final class Server status = 1; } - if (communicator != null) + if(communicator != null) { try { diff --git a/java/src/IceBox/ServiceManagerI.java b/java/src/IceBox/ServiceManagerI.java index fb91d31d683..f11a442872b 100644 --- a/java/src/IceBox/ServiceManagerI.java +++ b/java/src/IceBox/ServiceManagerI.java @@ -55,7 +55,7 @@ public final class ServiceManagerI extends _ServiceManagerDisp Ice.Properties properties = _communicator.getProperties(); java.util.Map services = properties.getPropertiesForPrefix(prefix); java.util.Iterator p = services.entrySet().iterator(); - while (p.hasNext()) + while(p.hasNext()) { java.util.Map.Entry entry = (java.util.Map.Entry)p.next(); String name = ((String)entry.getKey()).substring(prefix.length()); @@ -67,15 +67,15 @@ public final class ServiceManagerI extends _ServiceManagerDisp String className; String[] args; int pos = value.indexOf(' '); - if (pos == -1) + if(pos == -1) { pos = value.indexOf('\t'); } - if (pos == -1) + if(pos == -1) { pos = value.indexOf('\n'); } - if (pos == -1) + if(pos == -1) { className = value; args = new String[0]; @@ -93,7 +93,7 @@ public final class ServiceManagerI extends _ServiceManagerDisp // Invoke start() on the services. // java.util.Iterator r = _services.entrySet().iterator(); - while (r.hasNext()) + while(r.hasNext()) { java.util.Map.Entry entry = (java.util.Map.Entry)r.next(); String name = (String)entry.getKey(); @@ -128,7 +128,7 @@ public final class ServiceManagerI extends _ServiceManagerDisp // services. // String bundleName = properties.getProperty("IceBox.PrintServicesReady"); - if (bundleName.length() > 0) + if(bundleName.length() > 0) { System.out.println(bundleName + " ready"); } @@ -197,20 +197,20 @@ public final class ServiceManagerI extends _ServiceManagerDisp // We'll compose an array of arguments in the above order. // java.util.ArrayList l = new java.util.ArrayList(); - for (int j = 0; j < _options.length; j++) + for(int j = 0; j < _options.length; j++) { - if (_options[j].startsWith("--" + service + ".")) + if(_options[j].startsWith("--" + service + ".")) { l.add(_options[j]); } } - for (int j = 0; j < args.length; j++) + for(int j = 0; j < args.length; j++) { l.add(args[j]); } - for (int j = 0; j < _argv.length; j++) + for(int j = 0; j < _argv.length; j++) { - if (_argv[j].startsWith("--" + service + ".")) + if(_argv[j].startsWith("--" + service + ".")) { l.add(_argv[j]); } @@ -314,7 +314,7 @@ public final class ServiceManagerI extends _ServiceManagerDisp stopAll() { java.util.Iterator r = _services.entrySet().iterator(); - while (r.hasNext()) + while(r.hasNext()) { java.util.Map.Entry e = (java.util.Map.Entry)r.next(); String name = (String)e.getKey(); diff --git a/java/src/IceInternal/BasicStream.java b/java/src/IceInternal/BasicStream.java index c71a17ffc79..0694347ea6a 100644 --- a/java/src/IceInternal/BasicStream.java +++ b/java/src/IceInternal/BasicStream.java @@ -37,7 +37,7 @@ public class BasicStream finalize() throws Throwable { - if (_buf != null) + if(_buf != null) { _bufferManager.reclaim(_buf); } @@ -53,13 +53,13 @@ public class BasicStream _buf.limit(_capacity); _buf.position(0); - if (_readEncapsStack != null) + if(_readEncapsStack != null) { assert(_readEncapsStack.next == null); _readEncapsStack.next = _readEncapsCache; _readEncapsCache = _readEncapsStack; _readEncapsStack = null; - if (_readEncapsCache.objectsRead != null) + if(_readEncapsCache.objectsRead != null) { _readEncapsCache.objectsRead.clear(); } @@ -118,11 +118,11 @@ public class BasicStream public void resize(int total, boolean reading) { - if (total > MAX) + if(total > MAX) { throw new Ice.MemoryLimitException(); } - if (total > _capacity) + if(total > _capacity) { final int cap2 = _capacity << 1; int newCapacity = cap2 > total ? cap2 : total; @@ -138,7 +138,7 @@ public class BasicStream // is used for writing, then we must set the buffer's limit // to the buffer's capacity. // - if (reading) + if(reading) { _buf.limit(total); } @@ -170,7 +170,7 @@ public class BasicStream writeByte((byte)0); // Encoding writeInt(0); // Placeholder for the encapsulation length WriteEncaps curr = _writeEncapsCache; - if (curr != null) + if(curr != null) { _writeEncapsCache = _writeEncapsCache.next; } @@ -193,7 +193,7 @@ public class BasicStream _writeEncapsStack = curr.next; curr.next = _writeEncapsCache; _writeEncapsCache = curr; - if (_writeEncapsCache.objectsWritten != null) + if(_writeEncapsCache.objectsWritten != null) { _writeEncapsCache.objectsWritten.clear(); } @@ -205,7 +205,7 @@ public class BasicStream startReadEncaps() { byte encoding = readByte(); - if (encoding != 0) + if(encoding != 0) { throw new Ice.UnsupportedEncodingException(); } @@ -217,12 +217,12 @@ public class BasicStream // readSize()/writeSize(), it could be 1 or 5 bytes. // int sz = readInt(); - if (sz < 0) + if(sz < 0) { throw new Ice.NegativeSizeException(); } ReadEncaps curr = _readEncapsCache; - if (curr != null) + if(curr != null) { assert(curr.objectsRead == null || curr.objectsRead.size() == 0); _readEncapsCache = _readEncapsCache.next; @@ -246,12 +246,12 @@ public class BasicStream _readEncapsStack = curr.next; curr.next = _readEncapsCache; _readEncapsCache = curr; - if (_readEncapsCache.objectsRead != null) + if(_readEncapsCache.objectsRead != null) { _readEncapsCache.objectsRead.clear(); } final int sz = _buf.getInt(start - 4); - if (sz < 0) + if(sz < 0) { throw new Ice.NegativeSizeException(); } @@ -270,11 +270,11 @@ public class BasicStream { assert(_readEncapsStack != null); final int sz = _buf.getInt(_readEncapsStack.start - 4); - if (sz < 0) + if(sz < 0) { throw new Ice.NegativeSizeException(); } - if (sz != _buf.position() - _readEncapsStack.start) + if(sz != _buf.position() - _readEncapsStack.start) { throw new Ice.EncapsulationException(); } @@ -285,7 +285,7 @@ public class BasicStream { assert(_readEncapsStack != null); int sz = _buf.getInt(_readEncapsStack.start - 4); - if (sz < 0) + if(sz < 0) { throw new Ice.NegativeSizeException(); } @@ -296,12 +296,12 @@ public class BasicStream skipEncaps() { byte encoding = readByte(); - if (encoding != 0) + if(encoding != 0) { throw new Ice.UnsupportedEncodingException(); } int sz = readInt(); - if (sz < 0) + if(sz < 0) { throw new Ice.NegativeSizeException(); } @@ -318,7 +318,7 @@ public class BasicStream public void writeSize(int v) { - if (v > 127) + if(v > 127) { expand(5); _buf.put((byte)-1); @@ -337,10 +337,10 @@ public class BasicStream try { byte b = _buf.get(); - if (b < 0) + if(b < 0) { int v = _buf.getInt(); - if (v < 0) + if(v < 0) { throw new Ice.NegativeSizeException(); } @@ -435,7 +435,7 @@ public class BasicStream { writeSize(v.length); expand(v.length); - for (int i = 0; i < v.length; i++) + for(int i = 0; i < v.length; i++) { _buf.put(v[i] ? (byte)1 : (byte)0); } @@ -461,7 +461,7 @@ public class BasicStream { final int sz = readSize(); boolean[] v = new boolean[sz]; - for (int i = 0; i < sz; i++) + for(int i = 0; i < sz; i++) { v[i] = _buf.get() == 1; } @@ -716,14 +716,14 @@ public class BasicStream public void writeString(String v) { - if (v == null) + if(v == null) { writeSize(0); } else { final int len = v.length(); - if (len > 0) + if(len > 0) { try { @@ -748,7 +748,7 @@ public class BasicStream writeStringSeq(String[] v) { writeSize(v.length); - for (int i = 0; i < v.length; i++) + for(int i = 0; i < v.length; i++) { writeString(v[i]); } @@ -759,7 +759,7 @@ public class BasicStream { final int len = readSize(); - if (len == 0) + if(len == 0) { return ""; } @@ -771,7 +771,7 @@ public class BasicStream // We reuse the _stringBytes array to avoid creating // excessive garbage // - if (_stringBytes == null || len > _stringBytes.length) + if(_stringBytes == null || len > _stringBytes.length) { _stringBytes = new byte[len]; _stringChars = new char[len]; @@ -783,9 +783,9 @@ public class BasicStream // character array instead of a byte array, because // byte arrays require conversion. // - for (int i = 0; i < len; i++) + for(int i = 0; i < len; i++) { - if (_stringBytes[i] < 0) + if(_stringBytes[i] < 0) { // // Multi-byte character found - we must @@ -819,7 +819,7 @@ public class BasicStream // Don't use v.resize(sz) or v.reserve(sz) here, as it cannot be // checked whether sz is a reasonable value String[] v = new String[sz]; - for (int i = 0; i < sz; i++) + for(int i = 0; i < sz; i++) { v[i] = readString(); } @@ -841,10 +841,10 @@ public class BasicStream public void writeObject(Ice.Object v) { - if (_writeEncapsStack == null) // Lazy initialization + if(_writeEncapsStack == null) // Lazy initialization { _writeEncapsStack = _writeEncapsCache; - if (_writeEncapsStack != null) + if(_writeEncapsStack != null) { _writeEncapsCache = _writeEncapsCache.next; } @@ -855,11 +855,11 @@ public class BasicStream } Integer pos = null; - if (_writeEncapsStack.objectsWritten != null) // Lazy creation + if(_writeEncapsStack.objectsWritten != null) // Lazy creation { pos = (Integer)_writeEncapsStack.objectsWritten.get(v); } - if (pos != null) + if(pos != null) { writeInt(pos.intValue()); } @@ -867,9 +867,9 @@ public class BasicStream { writeInt(-1); - if (v != null) + if(v != null) { - if (_writeEncapsStack.objectsWritten == null) + if(_writeEncapsStack.objectsWritten == null) { _writeEncapsStack.objectsWritten = new java.util.IdentityHashMap(); } @@ -890,10 +890,10 @@ public class BasicStream { Ice.Object v = null; - if (_readEncapsStack == null) // Lazy initialization + if(_readEncapsStack == null) // Lazy initialization { _readEncapsStack = _readEncapsCache; - if (_readEncapsStack != null) + if(_readEncapsStack != null) { _readEncapsCache = _readEncapsCache.next; } @@ -905,9 +905,9 @@ public class BasicStream final int pos = readInt(); - if (pos >= 0) + if(pos >= 0) { - if (_readEncapsStack.objectsRead == null || // Lazy creation + if(_readEncapsStack.objectsRead == null || // Lazy creation pos >= _readEncapsStack.objectsRead.size()) { throw new Ice.IllegalIndirectionException(); @@ -918,44 +918,44 @@ public class BasicStream { String id = readString(); - if (id.length() == 0) + if(id.length() == 0) { return null; } - else if (id.equals("::Ice::Object")) + else if(id.equals("::Ice::Object")) { v = new Ice.Object(); } else { Ice.ObjectFactory userFactory = _instance.servantFactoryManager().find(id); - if (userFactory != null) + if(userFactory != null) { v = userFactory.create(id); } - if (v == null && id.equals(signatureType)) + if(v == null && id.equals(signatureType)) { assert(factory != null); v = factory.create(id); assert(v != null); } - if (v == null) + if(v == null) { userFactory = loadObjectFactory(id); - if (userFactory != null) + if(userFactory != null) { v = userFactory.create(id); } } - if (v == null) + if(v == null) { throw new Ice.NoObjectFactoryException(); } } - if (_readEncapsStack.objectsRead == null) // Lazy creation + if(_readEncapsStack.objectsRead == null) // Lazy creation { _readEncapsStack.objectsRead = new java.util.ArrayList(10); } @@ -980,21 +980,21 @@ public class BasicStream String id = readString(); Ice.UserExceptionFactory factory = _instance.userExceptionFactoryManager().find(id); - if (factory == null) + if(factory == null) { int pos = java.util.Arrays.binarySearch(ids, id); - if (pos >= 0) + if(pos >= 0) { return pos; } } - if (factory == null) + if(factory == null) { factory = loadUserExceptionFactory(id); } - if (factory != null) + if(factory != null) { try { @@ -1003,9 +1003,9 @@ public class BasicStream catch (Ice.UserException ex) { String[] arr = ex.__getExceptionIds(); - for (int i = 0; !arr[i].equals("::Ice::UserException"); i++) + for(int i = 0; !arr[i].equals("::Ice::UserException"); i++) { - if (java.util.Arrays.binarySearch(ids, arr[i]) >= 0) + if(java.util.Arrays.binarySearch(ids, arr[i]) >= 0) { ex.__read(this); throw ex; @@ -1040,15 +1040,15 @@ public class BasicStream private void expand(int size) { - if (_buf.position() == _limit) + if(_buf.position() == _limit) { int oldLimit = _limit; _limit += size; - if (_limit > MAX) + if(_limit > MAX) { throw new Ice.MemoryLimitException(); } - if (_limit > _capacity) + if(_limit > _capacity) { final int cap2 = _capacity << 1; int newCapacity = cap2 > _limit ? cap2 : _limit; @@ -1108,7 +1108,7 @@ public class BasicStream // 0x400 = abstract). // int modifiers = c.getModifiers(); - if ((modifiers & 0x200) == 0 && (modifiers & 0x400) == 0) + if((modifiers & 0x200) == 0 && (modifiers & 0x400) == 0) { factory = new DynamicObjectFactory(c); _instance.servantFactoryManager().add(factory, id); diff --git a/java/src/IceInternal/BufferManager.java b/java/src/IceInternal/BufferManager.java index 3c513577dc3..f4bcb16762a 100644 --- a/java/src/IceInternal/BufferManager.java +++ b/java/src/IceInternal/BufferManager.java @@ -21,7 +21,7 @@ final class BufferManager allocate(int size) { java.nio.ByteBuffer buf = getBuffer(size); - if (buf == null) + if(buf == null) { try { @@ -43,7 +43,7 @@ final class BufferManager reallocate(java.nio.ByteBuffer old, int size) { java.nio.ByteBuffer buf = getBuffer(size); - if (buf == null) + if(buf == null) { try { @@ -68,7 +68,7 @@ final class BufferManager reclaim(java.nio.ByteBuffer buf) { BufferNode node; - if (_nodeCache == null) + if(_nodeCache == null) { node = new BufferNode(); } @@ -88,18 +88,18 @@ final class BufferManager { BufferNode node = _head; BufferNode prev = null; - while (node != null) + while(node != null) { - if (size <= node.capacity) + if(size <= node.capacity) { break; } prev = node; node = node.next; } - if (node != null) + if(node != null) { - if (prev != null) + if(prev != null) { prev.next = node.next; } diff --git a/java/src/IceInternal/Connection.java b/java/src/IceInternal/Connection.java index e2db85ffec9..2d33d022687 100644 --- a/java/src/IceInternal/Connection.java +++ b/java/src/IceInternal/Connection.java @@ -77,7 +77,7 @@ public final class Connection extends EventHandler { assert(_proxyUsageCount > 0); --_proxyUsageCount; - if (_proxyUsageCount == 0 && _adapter == null) + if(_proxyUsageCount == 0 && _adapter == null) { assert(_requests.isEmpty()); setState(StateClosing, new Ice.CloseConnectionException()); @@ -111,7 +111,7 @@ public final class Connection extends EventHandler _mutex.lock(); try { - if (_exception != null) + if(_exception != null) { throw _exception; } @@ -128,10 +128,10 @@ public final class Connection extends EventHandler // Fill in the message size and request ID. // os.writeInt(os.size()); - if (!_endpoint.datagram() && !oneway) + if(!_endpoint.datagram() && !oneway) { requestId = _nextRequestId++; - if (requestId <= 0) + if(requestId <= 0) { _nextRequestId = 1; requestId = _nextRequestId++; @@ -151,7 +151,7 @@ public final class Connection extends EventHandler // Only add to the request map if there was no exception, and if // the operation is not oneway. // - if (!_endpoint.datagram() && !oneway) + if(!_endpoint.datagram() && !oneway) { _requests.put(requestId, out); } @@ -175,7 +175,7 @@ public final class Connection extends EventHandler { _mutex.lock(); - if (_exception != null) + if(_exception != null) { _mutex.unlock(); throw _exception; @@ -187,7 +187,7 @@ public final class Connection extends EventHandler // called. // - if (_batchStream.size() == 0) + if(_batchStream.size() == 0) { _batchStream.writeBlob(_batchRequestHdr); } @@ -202,7 +202,7 @@ public final class Connection extends EventHandler public void finishBatchRequest(Outgoing out) { - if (_exception != null) + if(_exception != null) { _mutex.unlock(); throw _exception; @@ -226,7 +226,7 @@ public final class Connection extends EventHandler _mutex.lock(); try { - if (_exception != null) + if(_exception != null) { throw _exception; } @@ -234,7 +234,7 @@ public final class Connection extends EventHandler try { - if (_batchStream.size() == 0) + if(_batchStream.size() == 0) { return; // Nothing to send. } @@ -291,9 +291,9 @@ public final class Connection extends EventHandler // mode. However, we only change subscription if we're in active // mode, and thus ignore closing mode here. // - if (_state == StateActive) + if(_state == StateActive) { - if (adapter != null && _adapter == null) + if(adapter != null && _adapter == null) { // // Client is now server. @@ -301,7 +301,7 @@ public final class Connection extends EventHandler unregisterWithPool(); } - if (adapter == null && _adapter != null) + if(adapter == null && _adapter != null) { // // Server is now client. @@ -372,7 +372,7 @@ public final class Connection extends EventHandler { threadPool.promoteFollower(); - if (_state == StateClosed) + if(_state == StateClosed) { Thread.yield(); return; @@ -385,7 +385,7 @@ public final class Connection extends EventHandler byte messageType = stream.readByte(); stream.pos(Protocol.headerSize); - switch (messageType) + switch(messageType) { case Protocol.compressedRequestMsg: case Protocol.compressedRequestBatchMsg: @@ -396,7 +396,7 @@ public final class Connection extends EventHandler case Protocol.requestMsg: { - if (_state == StateClosing) + if(_state == StateClosing) { TraceUtil.traceRequest("received request during closing\n" + "(ignored by server, client will retry)", @@ -412,7 +412,7 @@ public final class Connection extends EventHandler case Protocol.requestBatchMsg: { - if (_state == StateClosing) + if(_state == StateClosing) { TraceUtil.traceBatchRequest("received batch request during closing\n" + "(ignored by server, client will retry)", @@ -432,7 +432,7 @@ public final class Connection extends EventHandler TraceUtil.traceReply("received reply", stream, _logger, _traceLevels); int requestId = stream.readInt(); Outgoing out = (Outgoing)_requests.remove(requestId); - if (out == null) + if(out == null) { throw new Ice.UnknownRequestIdException(); } @@ -443,9 +443,9 @@ public final class Connection extends EventHandler case Protocol.closeConnectionMsg: { TraceUtil.traceHeader("received close connection", stream, _logger, _traceLevels); - if (_endpoint.datagram()) + if(_endpoint.datagram()) { - if (_warn) + if(_warn) { _logger.warning("ignoring close connection message for datagram connection:\n" + _transceiver.toString()); @@ -482,7 +482,7 @@ public final class Connection extends EventHandler // Method invocation must be done outside the thread // synchronization, so that nested callbacks are possible. // - if (in != null) + if(in != null) { try { @@ -494,10 +494,10 @@ public final class Connection extends EventHandler try { - if (!batch) + if(!batch) { int requestId = is.readInt(); - if (!_endpoint.datagram() && requestId != 0) // 0 means oneway. + if(!_endpoint.datagram() && requestId != 0) // 0 means oneway. { response = true; ++_responseCount; @@ -519,7 +519,7 @@ public final class Connection extends EventHandler in = null; try { - if (_warn) + if(_warn) { warning("connection exception", ex); } @@ -536,7 +536,7 @@ public final class Connection extends EventHandler in = null; try { - if (_warn) + if(_warn) { warning("unknown exception", ex); } @@ -547,7 +547,7 @@ public final class Connection extends EventHandler } } } - while (batch && is.pos() < is.size()); + while(batch && is.pos() < is.size()); } catch (Ice.LocalException ex) { @@ -565,14 +565,14 @@ public final class Connection extends EventHandler } } - if (response) + if(response) { _mutex.lock(); try { try { - if (_state == StateClosed) + if(_state == StateClosed) { return; } @@ -589,7 +589,7 @@ public final class Connection extends EventHandler --_responseCount; - if (_state == StateClosing && _responseCount == 0 && !_endpoint.datagram()) + if(_state == StateClosing && _responseCount == 0 && !_endpoint.datagram()) { closeConnection(); } @@ -602,7 +602,7 @@ public final class Connection extends EventHandler } finally { - if (in != null) + if(in != null) { reclaimIncoming(in); in = null; @@ -613,7 +613,7 @@ public final class Connection extends EventHandler } finally { - if (in != null) + if(in != null) { _mutex.lock(); reclaimIncoming(in); @@ -631,11 +631,11 @@ public final class Connection extends EventHandler { threadPool.promoteFollower(); - if (_state == StateActive || _state == StateClosing) + if(_state == StateActive || _state == StateClosing) { registerWithPool(); } - else if (_state == StateClosed) + else if(_state == StateClosed) { _transceiver.close(); } @@ -665,7 +665,7 @@ public final class Connection extends EventHandler tryDestroy(ThreadPool threadPool) { boolean isLocked = _mutex.trylock(); - if (!isLocked) + if(!isLocked) { return false; } @@ -728,7 +728,7 @@ public final class Connection extends EventHandler { _batchStream.destroy(); - switch (reason) + switch(reason) { case ObjectAdapterDeactivated: { @@ -757,21 +757,21 @@ public final class Connection extends EventHandler private void setState(int state, Ice.LocalException ex) { - if (_state == state) // Don't switch twice. + if(_state == state) // Don't switch twice. { return; } - if (_exception == null) + if(_exception == null) { _exception = ex; - if (_warn) + if(_warn) { // // Don't warn about certain expected exceptions. // - if (!(ex instanceof Ice.CloseConnectionException || + if(!(ex instanceof Ice.CloseConnectionException || ex instanceof Ice.CommunicatorDestroyedException || ex instanceof Ice.ObjectAdapterDeactivatedException || (ex instanceof Ice.ConnectionLostException && _state == StateClosing))) @@ -782,7 +782,7 @@ public final class Connection extends EventHandler } java.util.Iterator i = _requests.entryIterator(); - while (i.hasNext()) + while(i.hasNext()) { IntMap.Entry e = (IntMap.Entry)i.next(); Outgoing out = (Outgoing)e.getValue(); @@ -800,21 +800,21 @@ public final class Connection extends EventHandler // We don't want to send close connection messages if the endpoint // only supports oneway transmission from client to server. // - if (_endpoint.datagram() && state == StateClosing) + if(_endpoint.datagram() && state == StateClosing) { state = StateClosed; } - if (_state == state) // Don't switch twice. + if(_state == state) // Don't switch twice. { return; } - switch (state) + switch(state) { case StateActive: { - if (_state != StateHolding) // Can only switch from holding to active. + if(_state != StateHolding) // Can only switch from holding to active. { return; } @@ -824,7 +824,7 @@ public final class Connection extends EventHandler case StateHolding: { - if (_state != StateActive) // Can only switch from active to holding. + if(_state != StateActive) // Can only switch from active to holding. { return; } @@ -834,11 +834,11 @@ public final class Connection extends EventHandler case StateClosing: { - if (_state == StateClosed) // Can't change back from closed. + if(_state == StateClosed) // Can't change back from closed. { return; } - if (_state == StateHolding) + if(_state == StateHolding) { // // We need to continue to read data in closing state. @@ -850,7 +850,7 @@ public final class Connection extends EventHandler case StateClosed: { - if (_state == StateHolding) + if(_state == StateHolding) { // // If we come from holding state, we first need to @@ -866,7 +866,7 @@ public final class Connection extends EventHandler _state = state; - if (_state == StateClosing && _responseCount == 0 && !_endpoint.datagram()) + if(_state == StateClosing && _responseCount == 0 && !_endpoint.datagram()) { try { @@ -894,11 +894,11 @@ public final class Connection extends EventHandler private void registerWithPool() { - if (!_registeredWithPool) + if(!_registeredWithPool) { - if (_adapter != null) + if(_adapter != null) { - if (_serverThreadPool == null) + if(_serverThreadPool == null) { _serverThreadPool = _instance.serverThreadPool(); assert(_serverThreadPool != null); @@ -907,7 +907,7 @@ public final class Connection extends EventHandler } else { - if (_clientThreadPool == null) + if(_clientThreadPool == null) { _clientThreadPool = _instance.clientThreadPool(); assert(_clientThreadPool != null); @@ -922,9 +922,9 @@ public final class Connection extends EventHandler private void unregisterWithPool() { - if (_registeredWithPool) + if(_registeredWithPool) { - if (_adapter != null) + if(_adapter != null) { assert(_serverThreadPool != null); _serverThreadPool.unregister(_transceiver.fd()); @@ -949,12 +949,12 @@ public final class Connection extends EventHandler { t.printStackTrace(pw); t = t.getCause(); - if (t != null) + if(t != null) { pw.println("Caused by:\n"); } } - while (t != null); + while(t != null); pw.flush(); String s = msg + ":\n" + sw.toString() + _transceiver.toString(); _logger.warning(s); @@ -964,7 +964,7 @@ public final class Connection extends EventHandler getIncoming() { Incoming in; - if (_incomingCache == null) + if(_incomingCache == null) { in = new Incoming(_instance, _adapter); } diff --git a/java/src/IceInternal/DefaultsAndOverrides.java b/java/src/IceInternal/DefaultsAndOverrides.java index 070c40b9300..64fb4824439 100644 --- a/java/src/IceInternal/DefaultsAndOverrides.java +++ b/java/src/IceInternal/DefaultsAndOverrides.java @@ -19,7 +19,7 @@ public final class DefaultsAndOverrides defaultProtocol = properties.getPropertyWithDefault("Ice.Default.Protocol", "tcp"); value = properties.getProperty("Ice.Default.Host"); - if (value.length() != 0) + if(value.length() != 0) { defaultHost = value; } @@ -31,7 +31,7 @@ public final class DefaultsAndOverrides defaultRouter = properties.getProperty("Ice.Default.Router"); value = properties.getProperty("Ice.Override.Timeout"); - if (value.length() > 0) + if(value.length() > 0) { overrideTimeout = true; overrideTimeoutValue = properties.getPropertyAsInt("Ice.Override.Timeout"); @@ -43,7 +43,7 @@ public final class DefaultsAndOverrides } value = properties.getProperty("Ice.Override.Compress"); - if (value.length() > 0) + if(value.length() > 0) { overrideComppress = true; overrideComppressValue = properties.getPropertyAsInt("Ice.Override.Compress") != 0; diff --git a/java/src/IceInternal/Direct.java b/java/src/IceInternal/Direct.java index 95f27db92b8..bdcdd3e0f91 100644 --- a/java/src/IceInternal/Direct.java +++ b/java/src/IceInternal/Direct.java @@ -22,30 +22,30 @@ public final class Direct { _servant = _adapter.identityToServant(_current.identity); - if (_servant == null && _current.identity.category.length() > 0) + if(_servant == null && _current.identity.category.length() > 0) { _locator = _adapter.findServantLocator(_current.identity.category); - if (_locator != null) + if(_locator != null) { _cookie = new Ice.LocalObjectHolder(); // Lazy creation _servant = _locator.locate(_adapter, _current, _cookie); } } - if (_servant == null) + if(_servant == null) { _locator = _adapter.findServantLocator(""); - if (_locator != null) + if(_locator != null) { _cookie = new Ice.LocalObjectHolder(); // Lazy creation _servant = _locator.locate(_adapter, _current, _cookie); } } - if (_servant != null && _current.facet.length() > 0) + if(_servant != null && _current.facet.length() > 0) { _facetServant = _servant.ice_findFacet(_current.facet); - if (_facetServant == null) + if(_facetServant == null) { Ice.FacetNotExistException ex = new Ice.FacetNotExistException(); ex.facet = _current.facet; @@ -55,14 +55,14 @@ public final class Direct } catch (RuntimeException ex) { - if (_locator != null && _servant != null) + if(_locator != null && _servant != null) { _locator.finished(_adapter, _current, _servant, _cookie.value); } throw ex; } - if (_servant == null) + if(_servant == null) { Ice.ObjectNotExistException ex = new Ice.ObjectNotExistException(); ex.identity = _current.identity; @@ -73,7 +73,7 @@ public final class Direct public void destroy() { - if (_locator != null && _servant != null) + if(_locator != null && _servant != null) { _locator.finished(_adapter, _current, _servant, _cookie.value); } @@ -82,7 +82,7 @@ public final class Direct public Ice.Object facetServant() { - if (_facetServant != null) + if(_facetServant != null) { return _facetServant; } diff --git a/java/src/IceInternal/EndpointFactoryManager.java b/java/src/IceInternal/EndpointFactoryManager.java index 8156a8c0afb..4258d68afa2 100644 --- a/java/src/IceInternal/EndpointFactoryManager.java +++ b/java/src/IceInternal/EndpointFactoryManager.java @@ -20,10 +20,10 @@ public final class EndpointFactoryManager public synchronized void add(EndpointFactory factory) { - for (int i = 0; i < _factories.size(); i++) + for(int i = 0; i < _factories.size(); i++) { EndpointFactory f = (EndpointFactory)_factories.get(i); - if (f.type() == factory.type()) + if(f.type() == factory.type()) { assert(false); } @@ -34,10 +34,10 @@ public final class EndpointFactoryManager public synchronized EndpointFactory get(short type) { - for (int i = 0; i < _factories.size(); i++) + for(int i = 0; i < _factories.size(); i++) { EndpointFactory f = (EndpointFactory)_factories.get(i); - if (f.type() == type) + if(f.type() == type) { return f; } @@ -49,7 +49,7 @@ public final class EndpointFactoryManager create(String str) { String s = str.trim(); - if (s.length() == 0) + if(s.length() == 0) { throw new Ice.EndpointParseException(); } @@ -61,15 +61,15 @@ public final class EndpointFactoryManager String protocol = s.substring(0, m.start()); - if (protocol.equals("default")) + if(protocol.equals("default")) { protocol = _instance.defaultsAndOverrides().defaultProtocol; } - for (int i = 0; i < _factories.size(); i++) + for(int i = 0; i < _factories.size(); i++) { EndpointFactory f = (EndpointFactory)_factories.get(i); - if (f.protocol().equals(protocol)) + if(f.protocol().equals(protocol)) { return f.create(s.substring(m.end())); } @@ -84,10 +84,10 @@ public final class EndpointFactoryManager Endpoint v; short type = s.readShort(); - for (int i = 0; i < _factories.size(); i++) + for(int i = 0; i < _factories.size(); i++) { EndpointFactory f = (EndpointFactory)_factories.get(i); - if (f.type() == type) + if(f.type() == type) { return f.read(s); } @@ -99,7 +99,7 @@ public final class EndpointFactoryManager void destroy() { - for (int i = 0; i < _factories.size(); i++) + for(int i = 0; i < _factories.size(); i++) { EndpointFactory f = (EndpointFactory)_factories.get(i); f.destroy(); diff --git a/java/src/IceInternal/Incoming.java b/java/src/IceInternal/Incoming.java index 659b0eb84aa..9feb52157fa 100644 --- a/java/src/IceInternal/Incoming.java +++ b/java/src/IceInternal/Incoming.java @@ -31,11 +31,11 @@ public class Incoming _current.operation = _is.readString(); _current.nonmutating = _is.readBool(); int sz = _is.readSize(); - while (sz-- > 0) + while(sz-- > 0) { String first = _is.readString(); String second = _is.readString(); - if (_current.context == null) + if(_current.context == null) { _current.context = new java.util.HashMap(); } @@ -43,7 +43,7 @@ public class Incoming } int statusPos = 0; - if (response) + if(response) { statusPos = _os.size(); _os.writeByte((byte)0); @@ -55,7 +55,7 @@ public class Incoming // blobs. // _is.startReadEncaps(); - if (response) + if(response) { _os.startWriteEncaps(); } @@ -66,23 +66,23 @@ public class Incoming try { - if (_adapter != null) + if(_adapter != null) { servant = _adapter.identityToServant(_current.identity); - if (servant == null && _current.identity.category.length() > 0) + if(servant == null && _current.identity.category.length() > 0) { locator = _adapter.findServantLocator(_current.identity.category); - if (locator != null) + if(locator != null) { servant = locator.locate(_adapter, _current, _cookie); } } - if (servant == null) + if(servant == null) { locator = _adapter.findServantLocator(""); - if (locator != null) + if(locator != null) { servant = locator.locate(_adapter, _current, _cookie); } @@ -91,16 +91,16 @@ public class Incoming DispatchStatus status; - if (servant == null) + if(servant == null) { status = DispatchStatus.DispatchObjectNotExist; } else { - if (_current.facet.length() > 0) + if(_current.facet.length() > 0) { Ice.Object facetServant = servant.ice_findFacet(_current.facet); - if (facetServant == null) + if(facetServant == null) { status = DispatchStatus.DispatchFacetNotExist; } @@ -115,23 +115,23 @@ public class Incoming } } - if (locator != null && servant != null) + if(locator != null && servant != null) { assert(_adapter != null); locator.finished(_adapter, _current, servant, _cookie.value); } _is.endReadEncaps(); - if (response) + if(response) { _os.endWriteEncaps(); - if (status != DispatchStatus.DispatchOK && status != DispatchStatus.DispatchUserException) + if(status != DispatchStatus.DispatchOK && status != DispatchStatus.DispatchUserException) { _os.resize(statusPos, false); _os.writeByte((byte)status.value()); - if (status == DispatchStatus.DispatchObjectNotExist) + if(status == DispatchStatus.DispatchObjectNotExist) { _current.identity.__write(_os); } @@ -155,14 +155,14 @@ public class Incoming } catch (Ice.LocationForward ex) { - if (locator != null && servant != null) + if(locator != null && servant != null) { assert(_adapter != null); locator.finished(_adapter, _current, servant, _cookie.value); } _is.endReadEncaps(); - if (response) + if(response) { _os.endWriteEncaps(); _os.resize(statusPos, false); @@ -172,14 +172,14 @@ public class Incoming } catch (Ice.ObjectNotExistException ex) { - if (locator != null && servant != null) + if(locator != null && servant != null) { assert(_adapter != null); locator.finished(_adapter, _current, servant, _cookie.value); } _is.endReadEncaps(); - if (response) + if(response) { _os.endWriteEncaps(); _os.resize(statusPos, false); @@ -194,14 +194,14 @@ public class Incoming } catch (Ice.FacetNotExistException ex) { - if (locator != null && servant != null) + if(locator != null && servant != null) { assert(_adapter != null); locator.finished(_adapter, _current, servant, _cookie.value); } _is.endReadEncaps(); - if (response) + if(response) { _os.endWriteEncaps(); _os.resize(statusPos, false); @@ -216,14 +216,14 @@ public class Incoming } catch (Ice.OperationNotExistException ex) { - if (locator != null && servant != null) + if(locator != null && servant != null) { assert(_adapter != null); locator.finished(_adapter, _current, servant, _cookie.value); } _is.endReadEncaps(); - if (response) + if(response) { _os.endWriteEncaps(); _os.resize(statusPos, false); @@ -238,14 +238,14 @@ public class Incoming } catch (Ice.LocalException ex) { - if (locator != null && servant != null) + if(locator != null && servant != null) { assert(_adapter != null); locator.finished(_adapter, _current, servant, _cookie.value); } _is.endReadEncaps(); - if (response) + if(response) { _os.endWriteEncaps(); _os.resize(statusPos, false); @@ -259,14 +259,14 @@ public class Incoming /* Not possible in Java - UserExceptions are checked exceptions catch (Ice.UserException ex) { - if (locator != null && servant != null) + if(locator != null && servant != null) { assert(_adapter != null); locator.finished(_adapter, _current, servant, _cookie.value); } _is.endReadEncaps(); - if (response) + if(response) { _os.endWriteEncaps(); _os.resize(statusPos, false); @@ -279,14 +279,14 @@ public class Incoming */ catch (RuntimeException ex) { - if (locator != null && servant != null) + if(locator != null && servant != null) { assert(_adapter != null); locator.finished(_adapter, _current, servant, _cookie.value); } _is.endReadEncaps(); - if (response) + if(response) { _os.endWriteEncaps(); _os.resize(statusPos, false); @@ -318,7 +318,7 @@ public class Incoming { _is.reset(); _os.reset(); - if (_current.context != null) + if(_current.context != null) { _current.context.clear(); } diff --git a/java/src/IceInternal/IncomingConnectionFactory.java b/java/src/IceInternal/IncomingConnectionFactory.java index 5ef462b063b..459b4248a45 100644 --- a/java/src/IceInternal/IncomingConnectionFactory.java +++ b/java/src/IceInternal/IncomingConnectionFactory.java @@ -34,7 +34,7 @@ public class IncomingConnectionFactory extends EventHandler public boolean equivalent(Endpoint endp) { - if (_transceiver != null) + if(_transceiver != null) { return endp.equivalent(_transceiver); } @@ -50,10 +50,10 @@ public class IncomingConnectionFactory extends EventHandler // Reap destroyed connections. // java.util.ListIterator iter = _connections.listIterator(); - while (iter.hasNext()) + while(iter.hasNext()) { Connection connection = (Connection)iter.next(); - if (connection.destroyed()) + if(connection.destroyed()) { iter.remove(); } @@ -91,7 +91,7 @@ public class IncomingConnectionFactory extends EventHandler { threadPool.promoteFollower(); - if (_state != StateActive) + if(_state != StateActive) { Thread.yield(); return; @@ -101,10 +101,10 @@ public class IncomingConnectionFactory extends EventHandler // Reap destroyed connections. // java.util.ListIterator iter = _connections.listIterator(); - while (iter.hasNext()) + while(iter.hasNext()) { Connection connection = (Connection)iter.next(); - if (connection.destroyed()) + if(connection.destroyed()) { iter.remove(); } @@ -126,7 +126,7 @@ public class IncomingConnectionFactory extends EventHandler } catch (Ice.LocalException ex) { - if (_warn) + if(_warn) { warning(ex); } @@ -139,11 +139,11 @@ public class IncomingConnectionFactory extends EventHandler { threadPool.promoteFollower(); - if (_state == StateActive) + if(_state == StateActive) { registerWithPool(); } - else if (_state == StateClosed) + else if(_state == StateClosed) { try { @@ -151,7 +151,7 @@ public class IncomingConnectionFactory extends EventHandler // Clear listen() backlog properly by accepting all queued // connections, and then shutting them down. // - while (true) + while(true) { try { @@ -167,7 +167,7 @@ public class IncomingConnectionFactory extends EventHandler } catch (Ice.LocalException ex) { - if (_warn) + if(_warn) { warning(ex); } @@ -210,7 +210,7 @@ public class IncomingConnectionFactory extends EventHandler super(instance); _endpoint = endpoint; DefaultsAndOverrides defaultsAndOverrides = _instance.defaultsAndOverrides(); - if (defaultsAndOverrides.overrideTimeout) + if(defaultsAndOverrides.overrideTimeout) { _endpoint = _endpoint.timeout(defaultsAndOverrides.overrideTimeoutValue); } @@ -224,7 +224,7 @@ public class IncomingConnectionFactory extends EventHandler EndpointHolder h = new EndpointHolder(); h.value = _endpoint; _transceiver = _endpoint.serverTransceiver(h); - if (_transceiver != null) + if(_transceiver != null) { _endpoint = h.value; Connection connection = new Connection(_instance, _transceiver, _endpoint, _adapter); @@ -271,7 +271,7 @@ public class IncomingConnectionFactory extends EventHandler public synchronized void waitUntilFinished() { - while (_adapter != null) + while(_adapter != null) { try { @@ -290,23 +290,23 @@ public class IncomingConnectionFactory extends EventHandler private void setState(int state) { - if (_state == state) // Don't switch twice. + if(_state == state) // Don't switch twice. { return; } - switch (state) + switch(state) { case StateActive: { - if (_state != StateHolding) // Can only switch from holding to active. + if(_state != StateHolding) // Can only switch from holding to active. { return; } registerWithPool(); java.util.ListIterator iter = _connections.listIterator(); - while (iter.hasNext()) + while(iter.hasNext()) { Connection connection = (Connection)iter.next(); connection.activate(); @@ -316,14 +316,14 @@ public class IncomingConnectionFactory extends EventHandler case StateHolding: { - if (_state != StateActive) // Can only switch from active to holding + if(_state != StateActive) // Can only switch from active to holding { return; } unregisterWithPool(); java.util.ListIterator iter = _connections.listIterator(); - while (iter.hasNext()) + while(iter.hasNext()) { Connection connection = (Connection)iter.next(); connection.hold(); @@ -337,14 +337,14 @@ public class IncomingConnectionFactory extends EventHandler // If we come from holding state, we first need to // register again before we unregister. // - if (_state == StateHolding) + if(_state == StateHolding) { registerWithPool(); } unregisterWithPool(); java.util.ListIterator iter = _connections.listIterator(); - while (iter.hasNext()) + while(iter.hasNext()) { Connection connection = (Connection)iter.next(); connection.destroy(Connection.ObjectAdapterDeactivated); @@ -361,11 +361,11 @@ public class IncomingConnectionFactory extends EventHandler private void registerWithPool() { - if (_acceptor != null) + if(_acceptor != null) { - if (!_registeredWithPool) + if(!_registeredWithPool) { - if (_serverThreadPool == null) + if(_serverThreadPool == null) { _serverThreadPool = _instance.serverThreadPool(); assert(_serverThreadPool != null); @@ -379,9 +379,9 @@ public class IncomingConnectionFactory extends EventHandler private void unregisterWithPool() { - if (_acceptor != null) + if(_acceptor != null) { - if (_registeredWithPool) + if(_registeredWithPool) { assert(_serverThreadPool != null); _serverThreadPool.unregister(_acceptor.fd()); diff --git a/java/src/IceInternal/Instance.java b/java/src/IceInternal/Instance.java index ab8025c0388..3db91129ca6 100644 --- a/java/src/IceInternal/Instance.java +++ b/java/src/IceInternal/Instance.java @@ -96,9 +96,9 @@ public class Instance public synchronized ThreadPool clientThreadPool() { - if (_communicator != null) // Not destroyed? + if(_communicator != null) // Not destroyed? { - if (_clientThreadPool == null) // Lazy initialization. + if(_clientThreadPool == null) // Lazy initialization. { _clientThreadPool = new ThreadPool(this, false, "ClientThreadPool"); } @@ -110,9 +110,9 @@ public class Instance public synchronized ThreadPool serverThreadPool() { - if (_communicator != null) // Not destroyed? + if(_communicator != null) // Not destroyed? { - if (_serverThreadPool == null) // Lazy initialization. + if(_serverThreadPool == null) // Lazy initialization. { _serverThreadPool = new ThreadPool(this, true, "ServerThreadPool"); } @@ -176,7 +176,7 @@ public class Instance _pluginManager = new Ice.PluginManagerI(this); - if (_defaultsAndOverrides.defaultRouter.length() > 0) + if(_defaultsAndOverrides.defaultRouter.length() > 0) { _referenceFactory.setDefaultRouter(Ice.RouterPrxHelper.uncheckedCast( _proxyFactory.stringToProxy(_defaultsAndOverrides.defaultRouter))); @@ -251,58 +251,58 @@ public class Instance // to avoid cyclic object dependencies. // - if (_communicator != null) + if(_communicator != null) { // Don't destroy the communicator -- the communicator destroys // this object, not the other way. _communicator = null; } - if (_objectAdapterFactory != null) + if(_objectAdapterFactory != null) { // Don't shut down the object adapters -- the communicator // must do this before it destroys this object. _objectAdapterFactory = null; } - if (_servantFactoryManager != null) + if(_servantFactoryManager != null) { _servantFactoryManager.destroy(); _servantFactoryManager = null; } - if (_userExceptionFactoryManager != null) + if(_userExceptionFactoryManager != null) { _userExceptionFactoryManager.destroy(); _userExceptionFactoryManager = null; } - if (_referenceFactory != null) + if(_referenceFactory != null) { _referenceFactory.destroy(); _referenceFactory = null; } - if (_proxyFactory != null) + if(_proxyFactory != null) { // No destroy function defined // _proxyFactory.destroy(); _proxyFactory = null; } - if (_outgoingConnectionFactory != null) + if(_outgoingConnectionFactory != null) { _outgoingConnectionFactory.destroy(); _outgoingConnectionFactory = null; } - if (_routerManager != null) + if(_routerManager != null) { _routerManager.destroy(); _routerManager = null; } - if (_endpointFactoryManager != null) + if(_endpointFactoryManager != null) { _endpointFactoryManager.destroy(); _endpointFactoryManager = null; @@ -324,21 +324,21 @@ public class Instance _pluginManager = null; } - if (clientThreadPool != null) + if(clientThreadPool != null) { clientThreadPool.waitUntilFinished(); clientThreadPool.destroy(); clientThreadPool.joinWithAllThreads(); } - if (serverThreadPool != null) + if(serverThreadPool != null) { serverThreadPool.waitUntilFinished(); serverThreadPool.destroy(); serverThreadPool.joinWithAllThreads(); } - if (pluginManager != null) + if(pluginManager != null) { pluginManager.destroy(); } diff --git a/java/src/IceInternal/IntMap.java b/java/src/IceInternal/IntMap.java index 24cd7dd9ac4..0eb2d9265be 100755 --- a/java/src/IceInternal/IntMap.java +++ b/java/src/IceInternal/IntMap.java @@ -15,14 +15,14 @@ public class IntMap public IntMap(int initialCapacity, float loadFactor) { - if (initialCapacity > MAXIMUM_CAPACITY) + if(initialCapacity > MAXIMUM_CAPACITY) { initialCapacity = MAXIMUM_CAPACITY; } // Find a power of 2 >= initialCapacity int capacity = 1; - while (capacity < initialCapacity) + while(capacity < initialCapacity) { capacity <<= 1; } @@ -63,13 +63,13 @@ public class IntMap { int i = indexFor(key, _table.length); Entry e = _table[i]; - while (true) + while(true) { - if (e == null) + if(e == null) { return e; } - if (key == e.key) + if(key == e.key) { return e.value; } @@ -82,9 +82,9 @@ public class IntMap { int i = indexFor(key, _table.length); Entry e = _table[i]; - while (e != null) + while(e != null) { - if (key == e.key) + if(key == e.key) { return true; } @@ -98,9 +98,9 @@ public class IntMap { int i = indexFor(key, _table.length); - for (Entry e = _table[i]; e != null; e = e.next) + for(Entry e = _table[i]; e != null; e = e.next) { - if (key == e.key) + if(key == e.key) { Object oldValue = e.value; e.value = value; @@ -120,14 +120,14 @@ public class IntMap Entry prev = _table[i]; Entry e = prev; - while (e != null) + while(e != null) { Entry next = e.next; - if (key == e.key) + if(key == e.key) { _modCount++; _size--; - if (prev == e) + if(prev == e) { _table[i] = next; } @@ -151,7 +151,7 @@ public class IntMap { _modCount++; Entry tab[] = _table; - for (int i = 0; i < tab.length; i++) + for(int i = 0; i < tab.length; i++) { tab[i] = null; } @@ -208,7 +208,7 @@ public class IntMap addEntry(int key, Object value, int bucketIndex) { Entry e; - if (_entryCache != null) + if(_entryCache != null) { e = _entryCache; _entryCache = _entryCache.next; @@ -221,7 +221,7 @@ public class IntMap e = new Entry(key, value, _table[bucketIndex]); } _table[bucketIndex] = e; - if (_size++ >= _threshold) + if(_size++ >= _threshold) { resize(2 * _table.length); } @@ -235,7 +235,7 @@ public class IntMap int oldCapacity = oldTable.length; // check if needed - if (_size < _threshold || oldCapacity > newCapacity) + if(_size < _threshold || oldCapacity > newCapacity) { return; } @@ -251,10 +251,10 @@ public class IntMap { Entry[] src = _table; int newCapacity = newTable.length; - for (int j = 0; j < src.length; j++) + for(int j = 0; j < src.length; j++) { Entry e = src[j]; - if (e != null) + if(e != null) { src[j] = null; do @@ -265,7 +265,7 @@ public class IntMap newTable[i] = e; e = next; } - while (e != null); + while(e != null); } } } @@ -278,9 +278,9 @@ public class IntMap Entry[] t = _table; int i = t.length; Entry n = null; - if (_size != 0) // advance to first entry + if(_size != 0) // advance to first entry { - while (i > 0 && (n = t[--i]) == null) + while(i > 0 && (n = t[--i]) == null) ; } _next = n; @@ -296,12 +296,12 @@ public class IntMap public Object next() { - if (_modCount != _expectedModCount) + if(_modCount != _expectedModCount) { throw new java.util.ConcurrentModificationException(); } Entry e = _next; - if (e == null) + if(e == null) { throw new java.util.NoSuchElementException(); } @@ -309,7 +309,7 @@ public class IntMap Entry n = e.next; Entry[] t = _table; int i = _index; - while (n == null && i > 0) + while(n == null && i > 0) { n = t[--i]; } @@ -321,11 +321,11 @@ public class IntMap public void remove() { - if (_current == null) + if(_current == null) { throw new IllegalStateException(); } - if (_modCount != _expectedModCount) + if(_modCount != _expectedModCount) { throw new java.util.ConcurrentModificationException(); } diff --git a/java/src/IceInternal/Network.java b/java/src/IceInternal/Network.java index 81b4ac36426..41f30210120 100644 --- a/java/src/IceInternal/Network.java +++ b/java/src/IceInternal/Network.java @@ -23,7 +23,7 @@ public final class Network // String msg = ex.getMessage(); - if (msg != null) + if(msg != null) { final String[] msgs = { @@ -34,9 +34,9 @@ public final class Network "An existing connection was forcibly closed" // unknown }; - for (int i = 0; i < msgs.length; i++) + for(int i = 0; i < msgs.length; i++) { - if (msg.indexOf(msgs[i]) != -1) + if(msg.indexOf(msgs[i]) != -1) { return true; } @@ -157,10 +157,10 @@ public final class Network { try { - if (!fd.connect(addr)) + if(!fd.connect(addr)) { int delay; - if (timeout > 0 && timeout < 100) + if(timeout > 0 && timeout < 100) { delay = timeout; } @@ -170,9 +170,9 @@ public final class Network } int timer = 0; - while (!fd.finishConnect()) + while(!fd.finishConnect()) { - if (timeout > 0 && timer >= timeout) + if(timeout > 0 && timer >= timeout) { fd.close(); throw new Ice.ConnectTimeoutException(); @@ -259,30 +259,30 @@ public final class Network doAccept(java.nio.channels.ServerSocketChannel fd, int timeout) { java.nio.channels.SocketChannel result = null; - while (result == null) + while(result == null) { try { result = fd.accept(); - if (result == null) + if(result == null) { java.nio.channels.Selector selector = java.nio.channels.Selector.open(); try { - while (true) + while(true) { try { java.nio.channels.SelectionKey key = fd.register(selector, java.nio.channels.SelectionKey.OP_ACCEPT); int n; - if (timeout > 0) + if(timeout > 0) { n = selector.select(timeout); } - else if (timeout == 0) + else if(timeout == 0) { n = selector.selectNow(); } @@ -291,7 +291,7 @@ public final class Network n = selector.select(); } - if (n == 0) + if(n == 0) { throw new Ice.TimeoutException(); } @@ -381,7 +381,7 @@ public final class Network try { - if (!numeric) + if(!numeric) { host = java.net.InetAddress.getLocalHost().getHostName(); } @@ -465,7 +465,7 @@ public final class Network public static String fdToString(java.nio.channels.SelectableChannel fd) { - if (fd == null) + if(fd == null) { return "<closed>"; } @@ -473,7 +473,7 @@ public final class Network java.net.InetAddress localAddr = null, remoteAddr = null; int localPort = -1, remotePort = -1; - if (fd instanceof java.nio.channels.SocketChannel) + if(fd instanceof java.nio.channels.SocketChannel) { java.nio.channels.SocketChannel socketChannel = (java.nio.channels.SocketChannel)fd; java.net.Socket socket = socketChannel.socket(); @@ -482,7 +482,7 @@ public final class Network remoteAddr = socket.getInetAddress(); remotePort = socket.getPort(); } - else if (fd instanceof java.nio.channels.DatagramChannel) + else if(fd instanceof java.nio.channels.DatagramChannel) { java.nio.channels.DatagramChannel datagramChannel = (java.nio.channels.DatagramChannel)fd; java.net.DatagramSocket socket = datagramChannel.socket(); @@ -501,7 +501,7 @@ public final class Network s.append(localAddr.getHostAddress()); s.append(':'); s.append(localPort); - if (remoteAddr == null) + if(remoteAddr == null) { s.append("\nremote address = <not connected>"); } diff --git a/java/src/IceInternal/ObjectAdapterFactory.java b/java/src/IceInternal/ObjectAdapterFactory.java index d1cdb73164b..a6b9bbd558d 100644 --- a/java/src/IceInternal/ObjectAdapterFactory.java +++ b/java/src/IceInternal/ObjectAdapterFactory.java @@ -16,7 +16,7 @@ public final class ObjectAdapterFactory shutdown() { java.util.Iterator i = _adapters.values().iterator(); - while (i.hasNext()) + while(i.hasNext()) { Ice.ObjectAdapter adapter = (Ice.ObjectAdapter)i.next(); adapter.deactivate(); @@ -28,7 +28,7 @@ public final class ObjectAdapterFactory createObjectAdapter(String name, String endpts) { Ice.ObjectAdapter adapter = (Ice.ObjectAdapter)_adapters.get(name); - if (adapter != null) + if(adapter != null) { return adapter; } @@ -42,10 +42,10 @@ public final class ObjectAdapterFactory findObjectAdapter(Ice.ObjectPrx proxy) { java.util.Iterator i = _adapters.values().iterator(); - while (i.hasNext()) + while(i.hasNext()) { Ice.ObjectAdapterI adapter = (Ice.ObjectAdapterI)i.next(); - if (adapter.isLocal(proxy)) + if(adapter.isLocal(proxy)) { return adapter; } diff --git a/java/src/IceInternal/ObjectFactoryManager.java b/java/src/IceInternal/ObjectFactoryManager.java index b5da71f9c27..34874a6fc01 100644 --- a/java/src/IceInternal/ObjectFactoryManager.java +++ b/java/src/IceInternal/ObjectFactoryManager.java @@ -41,7 +41,7 @@ public final class ObjectFactoryManager destroy() { java.util.Iterator i = _factoryMap.values().iterator(); - while (i.hasNext()) + while(i.hasNext()) { Ice.ObjectFactory factory = (Ice.ObjectFactory)i.next(); factory.destroy(); diff --git a/java/src/IceInternal/Outgoing.java b/java/src/IceInternal/Outgoing.java index 3581303a34c..6e241f56ba6 100644 --- a/java/src/IceInternal/Outgoing.java +++ b/java/src/IceInternal/Outgoing.java @@ -40,7 +40,7 @@ public final class Outgoing public void destroy() { - if (_state == StateUnsent && + if(_state == StateUnsent && (_reference.mode == Reference.ModeBatchOneway || _reference.mode == Reference.ModeBatchDatagram)) { @@ -58,7 +58,7 @@ public final class Outgoing { _os.endWriteEncaps(); - switch (_reference.mode) + switch(_reference.mode) { case Reference.ModeTwoway: { @@ -70,14 +70,14 @@ public final class Outgoing _state = StateInProgress; int timeout = _connection.timeout(); - while (_state == StateInProgress) + while(_state == StateInProgress) { try { - if (timeout >= 0) + if(timeout >= 0) { wait(timeout); - if (_state == StateInProgress) + if(_state == StateInProgress) { timedOut = true; _state = StateLocalException; @@ -95,7 +95,7 @@ public final class Outgoing } } - if (timedOut) + if(timedOut) { // // Must be called outside the synchronization of @@ -104,7 +104,7 @@ public final class Outgoing _connection.exception(_exception); } - if (_exception != null) + if(_exception != null) { // // A CloseConnectionException indicates graceful @@ -114,7 +114,7 @@ public final class Outgoing // guarantees that all outstanding requests can safely // be repeated. // - if (_exception instanceof Ice.CloseConnectionException) + if(_exception instanceof Ice.CloseConnectionException) { throw _exception; } @@ -124,7 +124,7 @@ public final class Outgoing // the exception's stack trace to reflect the calling // thread. // - if (_fillStackTrace) + if(_fillStackTrace) { _exception.fillInStackTrace(); } @@ -137,12 +137,12 @@ public final class Outgoing throw new NonRepeatable(_exception); } - if (_state == StateUserException) + if(_state == StateUserException) { return false; } - if (_state == StateLocationForward) + if(_state == StateLocationForward) { Ice.ObjectPrx p = _is.readProxy(); throw new Ice.LocationForward(p); @@ -183,11 +183,11 @@ public final class Outgoing public synchronized void finished(BasicStream is) { - if (_state == StateInProgress) + if(_state == StateInProgress) { _is.swap(is); byte status = _is.readByte(); - switch ((int)status) + switch((int)status) { case DispatchStatus._DispatchOK: { @@ -289,7 +289,7 @@ public final class Outgoing public synchronized void finished(Ice.LocalException ex) { - if (_state == StateInProgress) + if(_state == StateInProgress) { _state = StateLocalException; _exception = ex; @@ -312,7 +312,7 @@ public final class Outgoing private void writeHeader(String operation, boolean nonmutating, java.util.Map context) { - switch (_reference.mode) + switch(_reference.mode) { case Reference.ModeTwoway: case Reference.ModeOneway: @@ -334,7 +334,7 @@ public final class Outgoing _os.writeString(_reference.facet); _os.writeString(operation); _os.writeBool(nonmutating); - if (context == null) + if(context == null) { _os.writeSize(0); } @@ -342,10 +342,10 @@ public final class Outgoing { final int sz = context.size(); _os.writeSize(sz); - if (sz > 0) + if(sz > 0) { java.util.Iterator i = context.entrySet().iterator(); - while (i.hasNext()) + while(i.hasNext()) { java.util.Map.Entry entry = (java.util.Map.Entry)i.next(); _os.writeString((String)entry.getKey()); diff --git a/java/src/IceInternal/OutgoingConnectionFactory.java b/java/src/IceInternal/OutgoingConnectionFactory.java index 1680185fcc0..2a67400bc74 100644 --- a/java/src/IceInternal/OutgoingConnectionFactory.java +++ b/java/src/IceInternal/OutgoingConnectionFactory.java @@ -15,7 +15,7 @@ public class OutgoingConnectionFactory public synchronized Connection create(Endpoint[] endpoints) { - if (_instance == null) + if(_instance == null) { throw new Ice.CommunicatorDestroyedException(); } @@ -26,10 +26,10 @@ public class OutgoingConnectionFactory // Reap destroyed connections. // java.util.Iterator p = _connections.values().iterator(); - while (p.hasNext()) + while(p.hasNext()) { Connection connection = (Connection)p.next(); - if (connection.destroyed()) + if(connection.destroyed()) { p.remove(); } @@ -39,16 +39,16 @@ public class OutgoingConnectionFactory // Search for existing connections. // DefaultsAndOverrides defaultsAndOverrides = _instance.defaultsAndOverrides(); - for (int i = 0; i < endpoints.length; i++) + for(int i = 0; i < endpoints.length; i++) { Endpoint endpoint = endpoints[i]; - if (defaultsAndOverrides.overrideTimeout) + if(defaultsAndOverrides.overrideTimeout) { endpoint = endpoint.timeout(defaultsAndOverrides.overrideTimeoutValue); } Connection connection = (Connection)_connections.get(endpoint); - if (connection != null) + if(connection != null) { return connection; } @@ -62,10 +62,10 @@ public class OutgoingConnectionFactory Connection connection = null; Ice.LocalException exception = null; - for (int i = 0; i < endpoints.length; i++) + for(int i = 0; i < endpoints.length; i++) { Endpoint endpoint = endpoints[i]; - if (defaultsAndOverrides.overrideTimeout) + if(defaultsAndOverrides.overrideTimeout) { endpoint = endpoint.timeout(defaultsAndOverrides.overrideTimeoutValue); } @@ -73,7 +73,7 @@ public class OutgoingConnectionFactory try { Transceiver transceiver = endpoint.clientTransceiver(); - if (transceiver == null) + if(transceiver == null) { Connector connector = endpoint.connector(); assert(connector != null); @@ -98,11 +98,11 @@ public class OutgoingConnectionFactory exception = ex; } - if (traceLevels.retry >= 2) + if(traceLevels.retry >= 2) { StringBuffer s = new StringBuffer(); s.append("connection to endpoint failed"); - if (i < endpoints.length - 1) + if(i < endpoints.length - 1) { s.append(", trying next endpoint\n"); } @@ -115,7 +115,7 @@ public class OutgoingConnectionFactory } } - if (connection == null) + if(connection == null) { assert(exception != null); throw exception; @@ -127,13 +127,13 @@ public class OutgoingConnectionFactory public synchronized void setRouter(Ice.RouterPrx router) { - if (_instance == null) + if(_instance == null) { throw new Ice.CommunicatorDestroyedException(); } RouterInfo routerInfo = _instance.routerManager().get(router); - if (routerInfo != null) + if(routerInfo != null) { // // Search for connections to the router's client proxy @@ -145,16 +145,16 @@ public class OutgoingConnectionFactory Ice.ObjectAdapter adapter = routerInfo.getAdapter(); DefaultsAndOverrides defaultsAndOverrides = _instance.defaultsAndOverrides(); Endpoint[] endpoints = ((Ice.ObjectPrxHelper)proxy).__reference().endpoints; - for (int i = 0; i < endpoints.length; i++) + for(int i = 0; i < endpoints.length; i++) { Endpoint endpoint = endpoints[i]; - if (defaultsAndOverrides.overrideTimeout) + if(defaultsAndOverrides.overrideTimeout) { endpoint = endpoint.timeout(defaultsAndOverrides.overrideTimeoutValue); } Connection connection = (Connection)_connections.get(endpoint); - if (connection != null) + if(connection != null) { connection.setAdapter(adapter); } @@ -165,16 +165,16 @@ public class OutgoingConnectionFactory public synchronized void removeAdapter(Ice.ObjectAdapter adapter) { - if (_instance == null) + if(_instance == null) { throw new Ice.CommunicatorDestroyedException(); } java.util.Iterator p = _connections.values().iterator(); - while (p.hasNext()) + while(p.hasNext()) { Connection connection = (Connection)p.next(); - if (connection.getAdapter() == adapter) + if(connection.getAdapter() == adapter) { connection.setAdapter(null); } @@ -201,13 +201,13 @@ public class OutgoingConnectionFactory public synchronized void destroy() { - if (_instance == null) + if(_instance == null) { return; } java.util.Iterator p = _connections.values().iterator(); - while (p.hasNext()) + while(p.hasNext()) { Connection connection = (Connection)p.next(); connection.destroy(Connection.CommunicatorDestroyed); diff --git a/java/src/IceInternal/ProxyFactory.java b/java/src/IceInternal/ProxyFactory.java index ed12373b305..dcf25adeccc 100644 --- a/java/src/IceInternal/ProxyFactory.java +++ b/java/src/IceInternal/ProxyFactory.java @@ -15,7 +15,7 @@ public final class ProxyFactory public Ice.ObjectPrx stringToProxy(String str) { - if (str.length() == 0) + if(str.length() == 0) { return null; } @@ -29,7 +29,7 @@ public final class ProxyFactory public String proxyToString(Ice.ObjectPrx proxy) { - if (proxy != null) + if(proxy != null) { Ice.ObjectPrxHelper h = (Ice.ObjectPrxHelper)proxy; return h.__reference().toString(); @@ -46,7 +46,7 @@ public final class ProxyFactory Ice.Identity ident = new Ice.Identity(); ident.__read(s); - if (ident.name.length() == 0) + if(ident.name.length() == 0) { return null; } @@ -68,7 +68,7 @@ public final class ProxyFactory public void proxyToStream(Ice.ObjectPrx proxy, BasicStream s) { - if (proxy != null) + if(proxy != null) { Ice.ObjectPrxHelper h = (Ice.ObjectPrxHelper)proxy; Reference ref = h.__reference(); diff --git a/java/src/IceInternal/RecursiveMutex.java b/java/src/IceInternal/RecursiveMutex.java index 60d20443ef9..a662b384c7b 100644 --- a/java/src/IceInternal/RecursiveMutex.java +++ b/java/src/IceInternal/RecursiveMutex.java @@ -23,13 +23,13 @@ public class RecursiveMutex public synchronized void lock() { - if (_locked && Thread.currentThread() == _owner) + if(_locked && Thread.currentThread() == _owner) { _count++; return; } - while (_locked) + while(_locked) { try { @@ -49,7 +49,7 @@ public class RecursiveMutex public synchronized boolean trylock() { - if (_owner == null) + if(_owner == null) { _owner = Thread.currentThread(); _count = 1; @@ -57,7 +57,7 @@ public class RecursiveMutex return true; } - if (_owner == Thread.currentThread()) + if(_owner == Thread.currentThread()) { assert(_count > 0); _count++; @@ -72,7 +72,7 @@ public class RecursiveMutex { assert(_owner == Thread.currentThread() && _count > 0 && _locked); _count--; - if (_count <= 0) + if(_count <= 0) { _locked = false; _owner = null; diff --git a/java/src/IceInternal/Reference.java b/java/src/IceInternal/Reference.java index 763447e19a8..4f1a8df27e5 100644 --- a/java/src/IceInternal/Reference.java +++ b/java/src/IceInternal/Reference.java @@ -30,68 +30,68 @@ public final class Reference { Reference r = (Reference)obj; - if (r == null) + if(r == null) { return false; } - if (this == r) + if(this == r) { return true; } - if (!identity.category.equals(r.identity.category)) + if(!identity.category.equals(r.identity.category)) { return false; } - if (!identity.name.equals(r.identity.name)) + if(!identity.name.equals(r.identity.name)) { return false; } - if (facet != null && !facet.equals(r.facet)) + if(facet != null && !facet.equals(r.facet)) { return false; } - if (mode != r.mode) + if(mode != r.mode) { return false; } - if (secure != r.secure) + if(secure != r.secure) { return false; } - if (compress != r.compress) + if(compress != r.compress) { return false; } - if (!compare(origEndpoints, r.origEndpoints)) + if(!compare(origEndpoints, r.origEndpoints)) { return false; } - if (!compare(endpoints, r.endpoints)) + if(!compare(endpoints, r.endpoints)) { return false; } - if (routerInfo != r.routerInfo) + if(routerInfo != r.routerInfo) { return false; } - if (routerInfo != null && r.routerInfo != null && + if(routerInfo != null && r.routerInfo != null && !routerInfo.equals(r.routerInfo)) { return false; } - if (reverseAdapter != r.reverseAdapter) + if(reverseAdapter != r.reverseAdapter) { return false; } @@ -119,12 +119,12 @@ public final class Reference s.writeBool(compress); s.writeSize(origEndpoints.length); - for (int i = 0; i < origEndpoints.length; i++) + for(int i = 0; i < origEndpoints.length; i++) { origEndpoints[i].streamWrite(s); } - if (endpointsEqual()) + if(endpointsEqual()) { s.writeBool(true); } @@ -132,7 +132,7 @@ public final class Reference { s.writeBool(false); s.writeSize(endpoints.length); - for (int i = 0; i < endpoints.length; i++) + for(int i = 0; i < endpoints.length; i++) { endpoints[i].streamWrite(s); } @@ -148,13 +148,13 @@ public final class Reference StringBuffer s = new StringBuffer(); s.append(Ice.Util.identityToString(identity)); - if (facet.length() > 0) + if(facet.length() > 0) { s.append(" -f "); s.append(facet); } - switch (mode) + switch(mode) { case ModeTwoway: { @@ -187,26 +187,26 @@ public final class Reference } } - if (secure) + if(secure) { s.append(" -s"); } - if (compress) + if(compress) { s.append(" -c"); } - for (int i = 0; i < origEndpoints.length; i++) + for(int i = 0; i < origEndpoints.length; i++) { s.append(':'); s.append(origEndpoints[i].toString()); } - if (!endpointsEqual()) + if(!endpointsEqual()) { s.append(':'); - for (int i = 0; i < endpoints.length; i++) + for(int i = 0; i < endpoints.length; i++) { s.append(':'); s.append(endpoints[i].toString()); @@ -238,7 +238,7 @@ public final class Reference public Reference changeIdentity(Ice.Identity newIdentity) { - if (newIdentity.equals(identity)) + if(newIdentity.equals(identity)) { return this; } @@ -253,7 +253,7 @@ public final class Reference public Reference changeFacet(String newFacet) { - if (newFacet.equals(facet)) + if(newFacet.equals(facet)) { return this; } @@ -272,13 +272,13 @@ public final class Reference // We change the timeout settings in all endpoints. // Endpoint[] newOrigEndpoints = new Endpoint[origEndpoints.length]; - for (int i = 0; i < origEndpoints.length; i++) + for(int i = 0; i < origEndpoints.length; i++) { newOrigEndpoints[i] = origEndpoints[i].timeout(timeout); } Endpoint[] newEndpoints = new Endpoint[endpoints.length]; - for (int i = 0; i < endpoints.length; i++) + for(int i = 0; i < endpoints.length; i++) { newEndpoints[i] = endpoints[i].timeout(timeout); } @@ -288,7 +288,7 @@ public final class Reference // router and the router's client proxy. // RouterInfo newRouterInfo = null; - if (routerInfo != null) + if(routerInfo != null) { try { @@ -312,7 +312,7 @@ public final class Reference public Reference changeMode(int newMode) { - if (newMode == mode) + if(newMode == mode) { return this; } @@ -327,7 +327,7 @@ public final class Reference public Reference changeSecure(boolean newSecure) { - if (newSecure == secure) + if(newSecure == secure) { return this; } @@ -342,7 +342,7 @@ public final class Reference public Reference changeCompress(boolean newCompress) { - if (newCompress == compress) + if(newCompress == compress) { return this; } @@ -357,7 +357,7 @@ public final class Reference public Reference changeEndpoints(Endpoint[] newEndpoints) { - if (compare(newEndpoints, endpoints)) + if(compare(newEndpoints, endpoints)) { return this; } @@ -374,7 +374,7 @@ public final class Reference { RouterInfo newRouterInfo = instance.routerManager().get(newRouter); - if ((routerInfo == newRouterInfo) || + if((routerInfo == newRouterInfo) || (routerInfo != null && newRouterInfo != null && newRouterInfo.equals(routerInfo))) { return this; @@ -423,19 +423,19 @@ public final class Reference int h = 0; int sz = identity.name.length(); - for (int i = 0; i < sz; i++) + for(int i = 0; i < sz; i++) { h = 5 * h + (int)identity.name.charAt(i); } sz = identity.category.length(); - for (int i = 0; i < sz; i++) + for(int i = 0; i < sz; i++) { h = 5 * h + (int)identity.category.charAt(i); } sz = facet.length(); - for (int i = 0; i < sz; i++) + for(int i = 0; i < sz; i++) { h = 5 * h + (int)facet.charAt(i); } @@ -461,7 +461,7 @@ public final class Reference private boolean endpointsEqual() { - if (_checkEndpointsEqual) + if(_checkEndpointsEqual) { _endpointsEqual = compare(origEndpoints, endpoints); _checkEndpointsEqual = false; @@ -473,16 +473,16 @@ public final class Reference private boolean compare(Endpoint[] arr1, Endpoint[] arr2) { - if (arr1 == arr2) + if(arr1 == arr2) { return true; } - if (arr1.length == arr2.length) + if(arr1.length == arr2.length) { - for (int i = 0; i < arr1.length; i++) + for(int i = 0; i < arr1.length; i++) { - if (!arr1[i].equals(arr2[i])) + if(!arr1[i].equals(arr2[i])) { return false; } diff --git a/java/src/IceInternal/ReferenceFactory.java b/java/src/IceInternal/ReferenceFactory.java index 876bd466a97..0c4ba06f836 100644 --- a/java/src/IceInternal/ReferenceFactory.java +++ b/java/src/IceInternal/ReferenceFactory.java @@ -23,7 +23,7 @@ public final class ReferenceFactory RouterInfo routerInfo, Ice.ObjectAdapter reverseAdapter) { - if (_instance == null) + if(_instance == null) { throw new Ice.CommunicatorDestroyedException(); } @@ -47,10 +47,10 @@ public final class ReferenceFactory // key, and we use a weak reference for the value as well. // java.lang.ref.WeakReference w = (java.lang.ref.WeakReference)_references.get(ref); - if (w != null) + if(w != null) { Reference r = (Reference)w.get(); - if (r != null) + if(r != null) { ref = r; } @@ -71,14 +71,14 @@ public final class ReferenceFactory create(String str) { String s = str.trim(); - if (s.length() == 0) + if(s.length() == 0) { throw new Ice.ProxyParseException(); } int colon = s.indexOf(':'); String init; - if (colon == -1) + if(colon == -1) { init = s; } @@ -95,16 +95,16 @@ public final class ReferenceFactory boolean compress = false; int i = 1; - while (i < arr.length) + while(i < arr.length) { String option = arr[i++]; - if (option.length() != 2 || option.charAt(0) != '-') + if(option.length() != 2 || option.charAt(0) != '-') { throw new Ice.ProxyParseException(); } String argument = null; - if (i < arr.length && arr[i].charAt(0) != '-') + if(i < arr.length && arr[i].charAt(0) != '-') { argument = arr[i++]; } @@ -113,11 +113,11 @@ public final class ReferenceFactory // If any new options are added here, // IceInternal::Reference::toString() must be updated as well. // - switch (option.charAt(1)) + switch(option.charAt(1)) { case 'f': { - if (argument == null) + if(argument == null) { throw new Ice.EndpointParseException(); } @@ -128,7 +128,7 @@ public final class ReferenceFactory case 't': { - if (argument != null) + if(argument != null) { throw new Ice.EndpointParseException(); } @@ -139,7 +139,7 @@ public final class ReferenceFactory case 'o': { - if (argument != null) + if(argument != null) { throw new Ice.EndpointParseException(); } @@ -150,7 +150,7 @@ public final class ReferenceFactory case 'O': { - if (argument != null) + if(argument != null) { throw new Ice.EndpointParseException(); } @@ -161,7 +161,7 @@ public final class ReferenceFactory case 'd': { - if (argument != null) + if(argument != null) { throw new Ice.EndpointParseException(); } @@ -172,7 +172,7 @@ public final class ReferenceFactory case 'D': { - if (argument != null) + if(argument != null) { throw new Ice.EndpointParseException(); } @@ -183,7 +183,7 @@ public final class ReferenceFactory case 's': { - if (argument != null) + if(argument != null) { throw new Ice.EndpointParseException(); } @@ -194,7 +194,7 @@ public final class ReferenceFactory case 'c': { - if (argument != null) + if(argument != null) { throw new Ice.EndpointParseException(); } @@ -216,19 +216,19 @@ public final class ReferenceFactory boolean orig = true; final int len = s.length(); int end = colon; - while (end < len && s.charAt(end) == ':') + while(end < len && s.charAt(end) == ':') { int beg = end + 1; end = s.indexOf(':', beg); - if (end == -1) + if(end == -1) { end = len; } - if (beg == end) // "::" + if(beg == end) // "::" { - if (!orig) + if(!orig) { throw new Ice.ProxyParseException(); } @@ -240,7 +240,7 @@ public final class ReferenceFactory String es = s.substring(beg, end); Endpoint endp = _instance.endpointFactoryManager().create(es); - if (orig) + if(orig) { origEndpoints.add(endp); } @@ -250,12 +250,12 @@ public final class ReferenceFactory } } - if (orig) + if(orig) { endpoints = origEndpoints; } - if (origEndpoints.size() == 0 || endpoints.size() == 0) + if(origEndpoints.size() == 0 || endpoints.size() == 0) { throw new Ice.ProxyParseException(); } @@ -280,7 +280,7 @@ public final class ReferenceFactory String facet = s.readString(); int mode = (int)s.readByte(); - if (mode < 0 || mode > Reference.ModeLast) + if(mode < 0 || mode > Reference.ModeLast) { throw new Ice.ProxyUnmarshalException(); } @@ -294,13 +294,13 @@ public final class ReferenceFactory int sz = s.readSize(); origEndpoints = new Endpoint[sz]; - for (int i = 0; i < sz; i++) + for(int i = 0; i < sz; i++) { origEndpoints[i] = _instance.endpointFactoryManager().read(s); } boolean same = s.readBool(); - if (same) // origEndpoints == endpoints + if(same) // origEndpoints == endpoints { endpoints = origEndpoints; } @@ -308,7 +308,7 @@ public final class ReferenceFactory { sz = s.readSize(); endpoints = new Endpoint[sz]; - for (int i = 0; i < sz; i++) + for(int i = 0; i < sz; i++) { endpoints[i] = _instance.endpointFactoryManager().read(s); } @@ -341,7 +341,7 @@ public final class ReferenceFactory synchronized void destroy() { - if (_instance == null) + if(_instance == null) { throw new Ice.CommunicatorDestroyedException(); } diff --git a/java/src/IceInternal/RouterInfo.java b/java/src/IceInternal/RouterInfo.java index f569cd519a0..2cdde7c1040 100644 --- a/java/src/IceInternal/RouterInfo.java +++ b/java/src/IceInternal/RouterInfo.java @@ -48,10 +48,10 @@ public final class RouterInfo public synchronized Ice.ObjectPrx getClientProxy() { - if (_clientProxy == null) // Lazy initialization. + if(_clientProxy == null) // Lazy initialization. { _clientProxy = _router.getClientProxy(); - if (_clientProxy == null) + if(_clientProxy == null) { throw new Ice.NoEndpointException(); } @@ -70,10 +70,10 @@ public final class RouterInfo public Ice.ObjectPrx getServerProxy() { - if (_serverProxy == null) // Lazy initialization. + if(_serverProxy == null) // Lazy initialization. { _serverProxy = _router.getServerProxy(); - if (_serverProxy == null) + if(_serverProxy == null) { throw new Ice.NoEndpointException(); } @@ -96,7 +96,7 @@ public final class RouterInfo // No mutex lock necessary, _routingTable is immutable, and // RoutingTable is mutex protected. // - if (_routingTable.add(proxy)) // Only add the proxy to the router if it's not already in the routing table. + if(_routingTable.add(proxy)) // Only add the proxy to the router if it's not already in the routing table. { _router.addProxy(proxy); } diff --git a/java/src/IceInternal/RouterManager.java b/java/src/IceInternal/RouterManager.java index 5058792565f..ae1c1d716ca 100644 --- a/java/src/IceInternal/RouterManager.java +++ b/java/src/IceInternal/RouterManager.java @@ -29,7 +29,7 @@ public final class RouterManager public RouterInfo get(Ice.RouterPrx rtr) { - if (rtr == null) + if(rtr == null) { return null; } @@ -39,7 +39,7 @@ public final class RouterManager synchronized (this) { RouterInfo info = (RouterInfo)_table.get(router); - if (info == null) + if(info == null) { info = new RouterInfo(router); _table.put(router, info); diff --git a/java/src/IceInternal/TcpAcceptor.java b/java/src/IceInternal/TcpAcceptor.java index 53761d0c731..700fdcca587 100644 --- a/java/src/IceInternal/TcpAcceptor.java +++ b/java/src/IceInternal/TcpAcceptor.java @@ -21,14 +21,14 @@ class TcpAcceptor implements Acceptor public void close() { - if (_traceLevels.network >= 1) + if(_traceLevels.network >= 1) { String s = "stopping to accept tcp connections at " + toString(); _logger.trace(_traceLevels.networkCat, s); } java.nio.channels.ServerSocketChannel fd = _fd; - if (fd != null) + if(fd != null) { _fd = null; try @@ -47,7 +47,7 @@ class TcpAcceptor implements Acceptor { // Nothing to do. - if (_traceLevels.network >= 1) + if(_traceLevels.network >= 1) { String s = "accepting tcp connections at " + toString(); _logger.trace(_traceLevels.networkCat, s); @@ -60,7 +60,7 @@ class TcpAcceptor implements Acceptor java.nio.channels.SocketChannel fd = Network.doAccept(_fd, timeout); Network.setBlock(fd, false); - if (_traceLevels.network >= 1) + if(_traceLevels.network >= 1) { String s = "accepted tcp connection\n" + Network.fdToString(fd); _logger.trace(_traceLevels.networkCat, s); @@ -95,7 +95,7 @@ class TcpAcceptor implements Acceptor _logger = instance.logger(); _backlog = 0; - if (_backlog <= 0) + if(_backlog <= 0) { _backlog = 5; } diff --git a/java/src/IceInternal/TcpConnector.java b/java/src/IceInternal/TcpConnector.java index 3361f9745b3..204dd23c9cb 100644 --- a/java/src/IceInternal/TcpConnector.java +++ b/java/src/IceInternal/TcpConnector.java @@ -15,7 +15,7 @@ final class TcpConnector implements Connector public Transceiver connect(int timeout) { - if (_traceLevels.network >= 2) + if(_traceLevels.network >= 2) { String s = "trying to establish tcp connection to " + toString(); _logger.trace(_traceLevels.networkCat, s); @@ -25,7 +25,7 @@ final class TcpConnector implements Connector Network.setBlock(fd, false); Network.doConnect(fd, _addr, timeout); - if (_traceLevels.network >= 1) + if(_traceLevels.network >= 1) { String s = "tcp connection established\n" + Network.fdToString(fd); _logger.trace(_traceLevels.networkCat, s); diff --git a/java/src/IceInternal/TcpEndpoint.java b/java/src/IceInternal/TcpEndpoint.java index a40adcd5ffb..5b2cd4b8105 100644 --- a/java/src/IceInternal/TcpEndpoint.java +++ b/java/src/IceInternal/TcpEndpoint.java @@ -35,31 +35,31 @@ final class TcpEndpoint implements Endpoint String[] arr = str.split("[ \t\n\r]+"); int i = 0; - while (i < arr.length) + while(i < arr.length) { - if (arr[i].length() == 0) + if(arr[i].length() == 0) { i++; continue; } String option = arr[i++]; - if (option.length() != 2 || option.charAt(0) != '-') + if(option.length() != 2 || option.charAt(0) != '-') { throw new Ice.EndpointParseException(); } String argument = null; - if (i < arr.length && arr[i].charAt(0) != '-') + if(i < arr.length && arr[i].charAt(0) != '-') { argument = arr[i++]; } - switch (option.charAt(1)) + switch(option.charAt(1)) { case 'h': { - if (argument == null) + if(argument == null) { throw new Ice.EndpointParseException(); } @@ -70,7 +70,7 @@ final class TcpEndpoint implements Endpoint case 'p': { - if (argument == null) + if(argument == null) { throw new Ice.EndpointParseException(); } @@ -89,7 +89,7 @@ final class TcpEndpoint implements Endpoint case 't': { - if (argument == null) + if(argument == null) { throw new Ice.EndpointParseException(); } @@ -113,7 +113,7 @@ final class TcpEndpoint implements Endpoint } } - if (_host == null) + if(_host == null) { _host = _instance.defaultsAndOverrides().defaultHost; } @@ -154,7 +154,7 @@ final class TcpEndpoint implements Endpoint toString() { String s = "tcp -h " + _host + " -p " + _port; - if (_timeout != -1) + if(_timeout != -1) { s += " -t " + _timeout; } @@ -188,7 +188,7 @@ final class TcpEndpoint implements Endpoint public Endpoint timeout(int timeout) { - if (timeout == _timeout) + if(timeout == _timeout) { return this; } @@ -328,30 +328,30 @@ final class TcpEndpoint implements Endpoint return 1; } - if (this == p) + if(this == p) { return 0; } - if (_port < p._port) + if(_port < p._port) { return -1; } - else if (p._port < _port) + else if(p._port < _port) { return 1; } - if (_timeout < p._timeout) + if(_timeout < p._timeout) { return -1; } - else if (p._timeout < _timeout) + else if(p._timeout < _timeout) { return 1; } - if (!_host.equals(p._host)) + if(!_host.equals(p._host)) { // // We do the most time-consuming part of the comparison last. @@ -363,13 +363,13 @@ final class TcpEndpoint implements Endpoint byte[] larr = laddr.getAddress().getAddress(); byte[] rarr = raddr.getAddress().getAddress(); assert(larr.length == rarr.length); - for (int i = 0; i < larr.length; i++) + for(int i = 0; i < larr.length; i++) { - if (larr[i] < rarr[i]) + if(larr[i] < rarr[i]) { return -1; } - else if (rarr[i] < larr[i]) + else if(rarr[i] < larr[i]) { return 1; } diff --git a/java/src/IceInternal/TcpTransceiver.java b/java/src/IceInternal/TcpTransceiver.java index e343b3f6c66..07c2b355909 100644 --- a/java/src/IceInternal/TcpTransceiver.java +++ b/java/src/IceInternal/TcpTransceiver.java @@ -21,7 +21,7 @@ final class TcpTransceiver implements Transceiver public void close() { - if (_traceLevels.network >= 1) + if(_traceLevels.network >= 1) { String s = "closing tcp connection\n" + toString(); _logger.trace(_traceLevels.networkCat, s); @@ -56,7 +56,7 @@ final class TcpTransceiver implements Transceiver public void shutdown() { - if (_traceLevels.network >= 1) + if(_traceLevels.network >= 1) { String s = "shutting down tcp connection\n" + toString(); _logger.trace(_traceLevels.networkCat, s); @@ -76,20 +76,20 @@ final class TcpTransceiver implements Transceiver write(BasicStream stream, int timeout) { java.nio.ByteBuffer buf = stream.prepareWrite(); - while (buf.hasRemaining()) + while(buf.hasRemaining()) { try { int ret = _fd.write(buf); /* TODO: Review - if (ret == 0) + if(ret == 0) { throw new Ice.ConnectionLostException(); } */ - if (_traceLevels.network >= 3) + if(_traceLevels.network >= 3) { String s = "sent " + ret + " of " + buf.limit() + " bytes via tcp\n" + toString(); @@ -115,23 +115,23 @@ final class TcpTransceiver implements Transceiver java.nio.ByteBuffer buf = stream.prepareRead(); int remaining = 0; - if (_traceLevels.network >= 3) + if(_traceLevels.network >= 3) { remaining = buf.remaining(); } - while (true) + while(true) { try { int ret = _fd.read(buf); - if (ret == -1) + if(ret == -1) { throw new Ice.ConnectionLostException(); } - if (ret > 0 && _traceLevels.network >= 3) + if(ret > 0 && _traceLevels.network >= 3) { String s = "received " + ret + " of " + remaining + " bytes via tcp\n" + toString(); _logger.trace(_traceLevels.networkCat, s); @@ -145,7 +145,7 @@ final class TcpTransceiver implements Transceiver } catch (java.io.IOException ex) { - if (Network.connectionLost(ex)) + if(Network.connectionLost(ex)) { Ice.ConnectionLostException se = new Ice.ConnectionLostException(); se.initCause(ex); @@ -167,43 +167,43 @@ final class TcpTransceiver implements Transceiver java.nio.ByteBuffer buf = stream.prepareRead(); int remaining = 0; - if (_traceLevels.network >= 3) + if(_traceLevels.network >= 3) { remaining = buf.remaining(); } - while (buf.hasRemaining()) + while(buf.hasRemaining()) { try { int ret = _fd.read(buf); - if (ret == -1) + if(ret == -1) { throw new Ice.ConnectionLostException(); } - if (ret == 0) + if(ret == 0) { // Copy fd, in case another thread calls close() java.nio.channels.SocketChannel fd = _fd; - if (_selector == null) + if(_selector == null) { _selector = java.nio.channels.Selector.open(); fd.register(_selector, java.nio.channels.SelectionKey.OP_READ, null); } - while (true) + while(true) { try { int n; - if (timeout == 0) + if(timeout == 0) { n = _selector.selectNow(); } - else if (timeout > 0) + else if(timeout > 0) { n = _selector.select(timeout); } @@ -212,7 +212,7 @@ final class TcpTransceiver implements Transceiver n = _selector.select(); } - if (n == 0 && timeout > 0) + if(n == 0 && timeout > 0) { throw new Ice.TimeoutException(); } @@ -226,7 +226,7 @@ final class TcpTransceiver implements Transceiver } } - if (ret > 0 && _traceLevels.network >= 3) + if(ret > 0 && _traceLevels.network >= 3) { String s = "received " + ret + " of " + remaining + " bytes via tcp\n" + toString(); _logger.trace(_traceLevels.networkCat, s); @@ -238,7 +238,7 @@ final class TcpTransceiver implements Transceiver } catch (java.io.IOException ex) { - if (Network.connectionLost(ex)) + if(Network.connectionLost(ex)) { Ice.ConnectionLostException se = new Ice.ConnectionLostException(); se.initCause(ex); @@ -275,7 +275,7 @@ final class TcpTransceiver implements Transceiver { assert(_fd == null); - if (_selector != null) + if(_selector != null) { try { diff --git a/java/src/IceInternal/ThreadPool.java b/java/src/IceInternal/ThreadPool.java index 6d0d8de2529..dc6ccc9a1d6 100644 --- a/java/src/IceInternal/ThreadPool.java +++ b/java/src/IceInternal/ThreadPool.java @@ -23,7 +23,7 @@ public final class ThreadPool public synchronized void _register(java.nio.channels.SelectableChannel fd, EventHandler handler) { - if (TRACE_REGISTRATION) + if(TRACE_REGISTRATION) { trace("adding handler of type " + handler.getClass().getName() + " for channel " + fd + ", handler count = " + (_handlers + 1)); @@ -37,9 +37,9 @@ public final class ThreadPool public synchronized void unregister(java.nio.channels.SelectableChannel fd) { - if (TRACE_REGISTRATION) + if(TRACE_REGISTRATION) { - if (TRACE_STACK_TRACE) + if(TRACE_STACK_TRACE) { java.io.StringWriter sw = new java.io.StringWriter(); try @@ -67,7 +67,7 @@ public final class ThreadPool public void promoteFollower() { - if (_multipleThreads) + if(_multipleThreads) { _threadMutex.unlock(); } @@ -76,7 +76,7 @@ public final class ThreadPool public void initiateShutdown() { - if (TRACE_SHUTDOWN) + if(TRACE_SHUTDOWN) { trace("initiate server shutdown"); } @@ -87,12 +87,12 @@ public final class ThreadPool public synchronized void waitUntilFinished() { - if (TRACE_SHUTDOWN) + if(TRACE_SHUTDOWN) { trace("waiting until finished..."); } - while (_handlers != 0 && _threadNum != 0) + while(_handlers != 0 && _threadNum != 0) { try { @@ -103,7 +103,7 @@ public final class ThreadPool } } - if (_handlers != 0) + if(_handlers != 0) { _instance.logger().error("can't wait for graceful application termination in thread pool\n" + "since all threads have vanished"); @@ -113,7 +113,7 @@ public final class ThreadPool assert(_handlerMap.isEmpty()); } - if (TRACE_SHUTDOWN) + if(TRACE_SHUTDOWN) { trace("finished."); } @@ -128,9 +128,9 @@ public final class ThreadPool // needed. (Synchronization wouldn't be possible here anyway, // because otherwise the other threads would never terminate.) // - for (int i = 0; i < _threads.length; i++) + for(int i = 0; i < _threads.length; i++) { - while (true) + while(true) { try { @@ -179,7 +179,7 @@ public final class ThreadPool // _keys = _selector.selectedKeys(); - if (server) + if(server) { _timeout = _instance.properties().getPropertyAsInt("Ice.ServerIdleTime"); _timeoutMillis = _timeout * 1000; @@ -190,12 +190,12 @@ public final class ThreadPool _threadNum = _instance.properties().getPropertyAsIntWithDefault("Ice.ClientThreadPool.Size", 1); } - if (_threadNum < 1) + if(_threadNum < 1) { _threadNum = 1; } - if (_threadNum > 1) + if(_threadNum > 1) { _multipleThreads = true; } @@ -203,7 +203,7 @@ public final class ThreadPool try { _threads = new EventHandlerThread[_threadNum]; - for (int i = 0; i < _threadNum; i++) + for(int i = 0; i < _threadNum; i++) { _threads[i] = new EventHandlerThread(_name + "-" + i); _threads[i].start(); @@ -229,7 +229,7 @@ public final class ThreadPool throws Throwable { assert(_destroyed); - if (_selector != null) + if(_selector != null) { try { @@ -239,7 +239,7 @@ public final class ThreadPool { } } - if (_fdIntrWrite != null) + if(_fdIntrWrite != null) { try { @@ -249,7 +249,7 @@ public final class ThreadPool { } } - if (_fdIntrRead != null) + if(_fdIntrRead != null) { try { @@ -269,7 +269,7 @@ public final class ThreadPool synchronized void destroy() { - if (TRACE_SHUTDOWN) + if(TRACE_SHUTDOWN) { trace("destroy"); } @@ -282,10 +282,10 @@ public final class ThreadPool private boolean clearInterrupt() { - if (TRACE_INTERRUPT) + if(TRACE_INTERRUPT) { trace("clearInterrupt"); - if (TRACE_STACK_TRACE) + if(TRACE_STACK_TRACE) { try { @@ -303,15 +303,15 @@ public final class ThreadPool java.nio.ByteBuffer buf = java.nio.ByteBuffer.allocate(1); try { - while (true) + while(true) { buf.rewind(); - if (_fdIntrRead.read(buf) != 1) + if(_fdIntrRead.read(buf) != 1) { break; } - if (TRACE_INTERRUPT) + if(TRACE_INTERRUPT) { trace("clearInterrupt got byte " + (int)buf.get(0)); } @@ -333,10 +333,10 @@ public final class ThreadPool private void setInterrupt(int b) { - if (TRACE_INTERRUPT) + if(TRACE_INTERRUPT) { trace("setInterrupt(" + b + ")"); - if (TRACE_STACK_TRACE) + if(TRACE_STACK_TRACE) { try { @@ -351,7 +351,7 @@ public final class ThreadPool java.nio.ByteBuffer buf = java.nio.ByteBuffer.allocate(1); buf.put(0, (byte)b); - while (buf.hasRemaining()) + while(buf.hasRemaining()) { try { @@ -375,13 +375,13 @@ public final class ThreadPool { boolean shutdown = false; - while (true) + while(true) { - if (_multipleThreads) + if(_multipleThreads) { _threadMutex.lock(); - if (TRACE_THREAD) + if(TRACE_THREAD) { trace("thread " + Thread.currentThread() + " has the lock"); } @@ -389,29 +389,29 @@ public final class ThreadPool repeatSelect: - while (true) + while(true) { - if (shutdown) // Shutdown has been initiated. + if(shutdown) // Shutdown has been initiated. { - if (TRACE_SHUTDOWN) + if(TRACE_SHUTDOWN) { trace("shutdown detected"); } shutdown = false; ObjectAdapterFactory factory = _instance.objectAdapterFactory(); - if (factory != null) + if(factory != null) { factory.shutdown(); } } - if (TRACE_REGISTRATION) + if(TRACE_REGISTRATION) { java.util.Set keys = _selector.keys(); trace("selecting on " + keys.size() + " channels:"); java.util.Iterator i = keys.iterator(); - while (i.hasNext()) + while(i.hasNext()) { java.nio.channels.SelectionKey key = (java.nio.channels.SelectionKey)i.next(); trace(" " + key.channel()); @@ -442,12 +442,12 @@ public final class ThreadPool // block until a new event is ready. // selectNonBlocking(); - if (_keys.size() == 0) + if(_keys.size() == 0) { int ret = select(); - if (ret == 0) // Timeout. + if(ret == 0) // Timeout. { - if (TRACE_SELECT) + if(TRACE_SELECT) { trace("timeout"); } @@ -462,9 +462,9 @@ public final class ThreadPool synchronized (this) { - if (_keys.contains(_fdIntrReadKey) && _fdIntrReadKey.isReadable()) + if(_keys.contains(_fdIntrReadKey) && _fdIntrReadKey.isReadable()) { - if (TRACE_SELECT || TRACE_INTERRUPT) + if(TRACE_SELECT || TRACE_INTERRUPT) { trace("detected interrupt"); } @@ -482,9 +482,9 @@ public final class ThreadPool // // Thread pool destroyed? // - if (_destroyed) + if(_destroyed) { - if (TRACE_SHUTDOWN) + if(TRACE_SHUTDOWN) { trace("destroyed, thread id = " + Thread.currentThread()); } @@ -506,7 +506,7 @@ public final class ThreadPool // // Server shutdown? // - if (shutdown) + if(shutdown) { continue repeatSelect; } @@ -518,10 +518,10 @@ public final class ThreadPool assert(!_changes.isEmpty()); FdHandlerPair change = (FdHandlerPair)_changes.removeFirst(); - if (change.handler != null) // Addition if handler is set. + if(change.handler != null) // Addition if handler is set. { int op; - if ((change.fd.validOps() & java.nio.channels.SelectionKey.OP_READ) > 0) + if((change.fd.validOps() & java.nio.channels.SelectionKey.OP_READ) > 0) { op = java.nio.channels.SelectionKey.OP_READ; } @@ -541,7 +541,7 @@ public final class ThreadPool } _handlerMap.put(change.fd, new HandlerKeyPair(change.handler, key)); - if (TRACE_REGISTRATION) + if(TRACE_REGISTRATION) { trace("added handler (" + change.handler.getClass().getName() + ") for fd " + change.fd); @@ -557,7 +557,7 @@ public final class ThreadPool finished = true; pair.key.cancel(); - if (TRACE_REGISTRATION) + if(TRACE_REGISTRATION) { trace("removed handler (" + handler.getClass().getName() + ") for fd " + change.fd); } @@ -571,16 +571,16 @@ public final class ThreadPool { java.nio.channels.SelectionKey key = null; java.util.Iterator iter = _keys.iterator(); - while (iter.hasNext()) + while(iter.hasNext()) { // // Ignore selection keys that have been cancelled // java.nio.channels.SelectionKey k = (java.nio.channels.SelectionKey)iter.next(); iter.remove(); - if (k.isValid() && key != _fdIntrReadKey) + if(k.isValid() && key != _fdIntrReadKey) { - if (TRACE_SELECT) + if(TRACE_SELECT) { trace("found a key: " + keyToString(k)); } @@ -590,9 +590,9 @@ public final class ThreadPool } } - if (key == null) + if(key == null) { - if (TRACE_SELECT) + if(TRACE_SELECT) { trace("didn't find a valid key"); } @@ -606,7 +606,7 @@ public final class ThreadPool assert(handler != null); - if (finished) + if(finished) { // // Notify a handler about it's removal from the thread @@ -617,7 +617,7 @@ public final class ThreadPool synchronized (this) { assert(_handlers > 0); - if (--_handlers == 0) + if(--_handlers == 0) { notifyAll(); // For waitUntilFinished(). } @@ -634,13 +634,13 @@ public final class ThreadPool // try { - if (handler.readable()) + if(handler.readable()) { try { - if (!read(handler)) // No data available. + if(!read(handler)) // No data available. { - if (TRACE_SELECT) + if(TRACE_SELECT) { trace("no input"); } @@ -654,7 +654,7 @@ public final class ThreadPool } catch (Ice.LocalException ex) { - if (TRACE_EXCEPTION) + if(TRACE_EXCEPTION) { trace("informing handler (" + handler.getClass().getName() + ") about exception " + ex); @@ -687,13 +687,13 @@ public final class ThreadPool { BasicStream stream = handler._stream; - if (stream.size() == 0) + if(stream.size() == 0) { stream.resize(Protocol.headerSize, true); stream.pos(0); } - if (stream.pos() != stream.size()) + if(stream.pos() != stream.size()) { // // On Win32 platforms, the selector may select a channel for @@ -702,11 +702,11 @@ public final class ThreadPool // data, we ignore the read event. // boolean doRead = handler.tryRead(stream); - if (stream.pos() == 0) + if(stream.pos() == 0) { return false; } - if (doRead) + if(doRead) { handler.read(stream); } @@ -717,32 +717,32 @@ public final class ThreadPool assert(pos >= Protocol.headerSize); stream.pos(0); byte protVer = stream.readByte(); - if (protVer != Protocol.protocolVersion) + if(protVer != Protocol.protocolVersion) { throw new Ice.UnsupportedProtocolException(); } byte encVer = stream.readByte(); - if (encVer != Protocol.encodingVersion) + if(encVer != Protocol.encodingVersion) { throw new Ice.UnsupportedEncodingException(); } byte messageType = stream.readByte(); int size = stream.readInt(); - if (size < Protocol.headerSize) + if(size < Protocol.headerSize) { throw new Ice.IllegalMessageSizeException(); } - if (size > 1024 * 1024) // TODO: Configurable + if(size > 1024 * 1024) // TODO: Configurable { throw new Ice.MemoryLimitException(); } - if (size > stream.size()) + if(size > stream.size()) { stream.resize(size, true); } stream.pos(pos); - if (stream.pos() != stream.size()) + if(stream.pos() != stream.size()) { handler.read(stream); assert(stream.pos() == stream.size()); @@ -754,11 +754,11 @@ public final class ThreadPool private void selectNonBlocking() { - while (true) + while(true) { try { - if (TRACE_SELECT) + if(TRACE_SELECT) { trace("non-blocking select on " + _selector.keys().size() + " keys, thread id = " + Thread.currentThread()); @@ -766,13 +766,13 @@ public final class ThreadPool _selector.selectNow(); - if (TRACE_SELECT) + if(TRACE_SELECT) { - if (_keys.size() > 0) + if(_keys.size() > 0) { trace("after selectNow, there are " + _keys.size() + " selected keys:"); java.util.Iterator i = _keys.iterator(); - while (i.hasNext()) + while(i.hasNext()) { java.nio.channels.SelectionKey key = (java.nio.channels.SelectionKey)i.next(); trace(" " + keyToString(key)); @@ -794,7 +794,7 @@ public final class ThreadPool // for that special case here and ignore it. // Hopefully we're not masking something important! // - if (ex.getMessage().indexOf("Interrupted system call") != -1) + if(ex.getMessage().indexOf("Interrupted system call") != -1) { continue; } @@ -821,16 +821,16 @@ public final class ThreadPool int timeoutMillis = _timeoutMillis; - while (true) + while(true) { try { - if (TRACE_SELECT) + if(TRACE_SELECT) { trace("select on " + _selector.keys().size() + " keys, thread id = " + Thread.currentThread()); } - if (_timeout > 0 && nextTimeout == 0) + if(_timeout > 0 && nextTimeout == 0) { nextTimeout = System.currentTimeMillis() + _timeoutMillis; } @@ -849,7 +849,7 @@ public final class ThreadPool // for that special case here and ignore it. // Hopefully we're not masking something important! // - if (ex.getMessage().indexOf("Interrupted system call") != -1) + if(ex.getMessage().indexOf("Interrupted system call") != -1) { continue; } @@ -859,23 +859,23 @@ public final class ThreadPool throw se; } - if (TRACE_SELECT) + if(TRACE_SELECT) { trace("select() returned " + ret + ", _keys.size() = " + _keys.size()); } - if (ret == 0) // Potential timeout. + if(ret == 0) // Potential timeout. { - if (_timeout > 0) + if(_timeout > 0) { long now = System.currentTimeMillis(); - if (now >= nextTimeout) // Timeout. + if(now >= nextTimeout) // Timeout. { break; } timeoutMillis -= (nextTimeout - now); - if (TRACE_SELECT) + if(TRACE_SELECT) { trace("timeout workaround"); } @@ -900,19 +900,19 @@ public final class ThreadPool keyToString(java.nio.channels.SelectionKey key) { String ops = "["; - if (key.isAcceptable()) + if(key.isAcceptable()) { ops += " OP_ACCEPT"; } - if (key.isReadable()) + if(key.isReadable()) { ops += " OP_READ"; } - if (key.isConnectable()) + if(key.isConnectable()) { ops += " OP_CONNECT"; } - if (key.isWritable()) + if(key.isWritable()) { ops += " OP_WRITE"; } @@ -1008,13 +1008,13 @@ public final class ThreadPool // "defensive" programming approach when it comes to // multithreading. // - if (_threadNum == 0) + if(_threadNum == 0) { ThreadPool.this.notifyAll(); // For waitUntil...Finished() methods. } } - if (TRACE_THREAD) + if(TRACE_THREAD) { trace("run() terminated - promoting follower"); } diff --git a/java/src/IceInternal/TraceUtil.java b/java/src/IceInternal/TraceUtil.java index 0d7eeb1213f..5f6ffd81b72 100644 --- a/java/src/IceInternal/TraceUtil.java +++ b/java/src/IceInternal/TraceUtil.java @@ -15,7 +15,7 @@ final class TraceUtil static void traceHeader(String heading, BasicStream str, Ice.Logger logger, TraceLevels tl) { - if (tl.protocol >= 1) + if(tl.protocol >= 1) { int p = str.pos(); str.pos(0); @@ -30,7 +30,7 @@ final class TraceUtil static void traceRequest(String heading, BasicStream str, Ice.Logger logger, TraceLevels tl) { - if (tl.protocol >= 1) + if(tl.protocol >= 1) { int p = str.pos(); str.pos(0); @@ -39,7 +39,7 @@ final class TraceUtil printHeader(s, str); int requestId = str.readInt(); s.write("\nrequest id = " + requestId); - if (requestId == 0) + if(requestId == 0) { s.write(" (oneway)"); } @@ -52,7 +52,7 @@ final class TraceUtil static void traceBatchRequest(String heading, BasicStream str, Ice.Logger logger, TraceLevels tl) { - if (tl.protocol >= 1) + if(tl.protocol >= 1) { int p = str.pos(); str.pos(0); @@ -60,7 +60,7 @@ final class TraceUtil s.write(heading); printHeader(s, str); int cnt = 0; - while (str.pos() != str.size()) + while(str.pos() != str.size()) { s.write("\nrequest #" + cnt + ':'); cnt++; @@ -75,7 +75,7 @@ final class TraceUtil static void traceReply(String heading, BasicStream str, Ice.Logger logger, TraceLevels tl) { - if (tl.protocol >= 1) + if(tl.protocol >= 1) { int p = str.pos(); str.pos(0); @@ -86,7 +86,7 @@ final class TraceUtil s.write("\nrequest id = " + requestId); byte status = str.readByte(); s.write("\nreply status = " + (int)status + ' '); - switch (status) + switch(status) { case DispatchStatus._DispatchOK: { @@ -153,23 +153,23 @@ final class TraceUtil { final int inc = 8; - for (int i = 0; i < data.length; i += inc) + for(int i = 0; i < data.length; i += inc) { - for (int j = i; j - i < inc; j++) + for(int j = i; j - i < inc; j++) { - if (j < data.length) + if(j < data.length) { int n = (int)data[j]; - if (n < 0) + if(n < 0) { n += 256; } String s; - if (n < 10) + if(n < 10) { s = " " + n; } - else if (n < 100) + else if(n < 100) { s = " " + n; } @@ -187,9 +187,9 @@ final class TraceUtil System.out.print('"'); - for (int j = i; j < data.length && j - i < inc; j++) + for(int j = i; j < data.length && j - i < inc; j++) { - if (data[j] >= (byte)32 && data[j] < (byte)127) + if(data[j] >= (byte)32 && data[j] < (byte)127) { System.out.print((char)data[j]); } @@ -214,7 +214,7 @@ final class TraceUtil out.write("\nencoding version = " + (int)encVer); byte type = stream.readByte(); out.write("\nmessage type = " + (int)type + ' '); - switch (type) + switch(type) { case Protocol.requestMsg: { @@ -267,12 +267,12 @@ final class TraceUtil out.write("\nnonmutating = " + nonmutating); int sz = stream.readSize(); out.write("\ncontext = "); - while (sz-- > 0) + while(sz-- > 0) { String key = stream.readString(); String value = stream.readString(); out.write(key + '/'+ value); - if (sz > 0) + if(sz > 0) { out.write(", "); } diff --git a/java/src/IceInternal/UdpEndpoint.java b/java/src/IceInternal/UdpEndpoint.java index e1b06e7f656..8f2dde435d4 100644 --- a/java/src/IceInternal/UdpEndpoint.java +++ b/java/src/IceInternal/UdpEndpoint.java @@ -35,31 +35,31 @@ final class UdpEndpoint implements Endpoint String[] arr = str.split("[ \t\n\r]+"); int i = 0; - while (i < arr.length) + while(i < arr.length) { - if (arr[i].length() == 0) + if(arr[i].length() == 0) { i++; continue; } String option = arr[i++]; - if (option.length() != 2 || option.charAt(0) != '-') + if(option.length() != 2 || option.charAt(0) != '-') { throw new Ice.EndpointParseException(); } String argument = null; - if (i < arr.length && arr[i].charAt(0) != '-') + if(i < arr.length && arr[i].charAt(0) != '-') { argument = arr[i++]; } - switch (option.charAt(1)) + switch(option.charAt(1)) { case 'h': { - if (argument == null) + if(argument == null) { throw new Ice.EndpointParseException(); } @@ -70,7 +70,7 @@ final class UdpEndpoint implements Endpoint case 'p': { - if (argument == null) + if(argument == null) { throw new Ice.EndpointParseException(); } @@ -89,7 +89,7 @@ final class UdpEndpoint implements Endpoint case 'c': { - if (argument != null) + if(argument != null) { throw new Ice.EndpointParseException(); } @@ -105,7 +105,7 @@ final class UdpEndpoint implements Endpoint } } - if (_host == null) + if(_host == null) { _host = instance.defaultsAndOverrides().defaultHost; } @@ -149,7 +149,7 @@ final class UdpEndpoint implements Endpoint toString() { String s = "udp -h " + _host + " -p " + _port; - if (_connect) + if(_connect) { s += " -c"; } @@ -316,30 +316,30 @@ final class UdpEndpoint implements Endpoint return 1; } - if (this == p) + if(this == p) { return 0; } - if (_port < p._port) + if(_port < p._port) { return -1; } - else if (p._port < _port) + else if(p._port < _port) { return 1; } - if (!_connect && p._connect) + if(!_connect && p._connect) { return -1; } - else if (!p._connect && _connect) + else if(!p._connect && _connect) { return 1; } - if (!_host.equals(p._host)) + if(!_host.equals(p._host)) { // // We do the most time-consuming part of the comparison last. @@ -351,13 +351,13 @@ final class UdpEndpoint implements Endpoint byte[] larr = laddr.getAddress().getAddress(); byte[] rarr = raddr.getAddress().getAddress(); assert(larr.length == rarr.length); - for (int i = 0; i < larr.length; i++) + for(int i = 0; i < larr.length; i++) { - if (larr[i] < rarr[i]) + if(larr[i] < rarr[i]) { return -1; } - else if (rarr[i] < larr[i]) + else if(rarr[i] < larr[i]) { return 1; } diff --git a/java/src/IceInternal/UdpTransceiver.java b/java/src/IceInternal/UdpTransceiver.java index d165a29b082..cb0a6419a2a 100644 --- a/java/src/IceInternal/UdpTransceiver.java +++ b/java/src/IceInternal/UdpTransceiver.java @@ -21,7 +21,7 @@ final class UdpTransceiver implements Transceiver public void close() { - if (_traceLevels.network >= 1) + if(_traceLevels.network >= 1) { String s = "closing udp connection\n" + toString(); _logger.trace(_traceLevels.networkCat, s); @@ -53,13 +53,13 @@ final class UdpTransceiver implements Transceiver final int packetSize = 64 * 1024; // TODO: configurable assert(packetSize >= buf.limit()); // TODO: exception - while (buf.hasRemaining()) + while(buf.hasRemaining()) { try { int ret = _fd.write(buf); - if (_traceLevels.network >= 3) + if(_traceLevels.network >= 3) { String s = "sent " + ret + " bytes via udp\n" + toString(); _logger.trace(_traceLevels.networkCat, s); @@ -98,9 +98,9 @@ final class UdpTransceiver implements Transceiver buf.position(0); int ret = 0; - while (true) + while(true) { - if (_connect) + if(_connect) { // // If we must connect, then we connect to the first peer that @@ -113,7 +113,7 @@ final class UdpTransceiver implements Transceiver Network.doConnect(_fd, peerAddr, -1); _connect = false; // We're connected now - if (_traceLevels.network >= 1) + if(_traceLevels.network >= 1) { String s = "connected udp socket\n" + toString(); _logger.trace(_traceLevels.networkCat, s); @@ -152,7 +152,7 @@ final class UdpTransceiver implements Transceiver break; } - if (_traceLevels.network >= 3) + if(_traceLevels.network >= 3) { String s = "received " + ret + " bytes via udp\n" + toString(); _logger.trace(_traceLevels.networkCat, s); @@ -200,7 +200,7 @@ final class UdpTransceiver implements Transceiver Network.doConnect(_fd, _addr, -1); _connect = false; // We're connected now - if (_traceLevels.network >= 1) + if(_traceLevels.network >= 1) { String s = "starting to send udp packets\n" + toString(); _logger.trace(_traceLevels.networkCat, s); @@ -231,7 +231,7 @@ final class UdpTransceiver implements Transceiver java.net.InetSocketAddress addr = new java.net.InetSocketAddress(host, port); _addr = Network.doBind(_fd, addr); - if (_traceLevels.network >= 1) + if(_traceLevels.network >= 1) { String s = "starting to receive udp packets\n" + toString(); _logger.trace(_traceLevels.networkCat, s); diff --git a/java/src/IceInternal/UnknownEndpoint.java b/java/src/IceInternal/UnknownEndpoint.java index b8dcd180844..d9df9d3038f 100644 --- a/java/src/IceInternal/UnknownEndpoint.java +++ b/java/src/IceInternal/UnknownEndpoint.java @@ -195,35 +195,35 @@ final class UnknownEndpoint implements Endpoint return 1; } - if (this == p) + if(this == p) { return 0; } - if (_type < p._type) + if(_type < p._type) { return -1; } - else if (p._type < _type) + else if(p._type < _type) { return 1; } - if (_rawBytes.length < p._rawBytes.length) + if(_rawBytes.length < p._rawBytes.length) { return -1; } - else if (p._rawBytes.length < _rawBytes.length) + else if(p._rawBytes.length < _rawBytes.length) { return 1; } - for (int i = 0; i < _rawBytes.length; i++) + for(int i = 0; i < _rawBytes.length; i++) { - if (_rawBytes[i] < p._rawBytes[i]) + if(_rawBytes[i] < p._rawBytes[i]) { return -1; } - else if (p._rawBytes[i] < _rawBytes[i]) + else if(p._rawBytes[i] < _rawBytes[i]) { return 1; } @@ -236,7 +236,7 @@ final class UnknownEndpoint implements Endpoint calcHashValue() { _hashCode = _type; - for (int i = 0; i < _rawBytes.length; i++) + for(int i = 0; i < _rawBytes.length; i++) { _hashCode = 5 * _hashCode + _rawBytes[i]; } diff --git a/java/src/IceInternal/UserExceptionFactoryManager.java b/java/src/IceInternal/UserExceptionFactoryManager.java index d513f8b3243..b9ec059c74f 100644 --- a/java/src/IceInternal/UserExceptionFactoryManager.java +++ b/java/src/IceInternal/UserExceptionFactoryManager.java @@ -41,7 +41,7 @@ public final class UserExceptionFactoryManager destroy() { java.util.Iterator i = _factoryMap.values().iterator(); - while (i.hasNext()) + while(i.hasNext()) { Ice.UserExceptionFactory factory = (Ice.UserExceptionFactory)i.next(); diff --git a/java/src/IceUtil/OutputBase.java b/java/src/IceUtil/OutputBase.java index 80a7068ac82..938efc43d7c 100644 --- a/java/src/IceUtil/OutputBase.java +++ b/java/src/IceUtil/OutputBase.java @@ -65,9 +65,9 @@ public class OutputBase print(String s) { final char[] arr = s.toCharArray(); - for (int i = 0; i < arr.length; i++) + for(int i = 0; i < arr.length; i++) { - if (arr[i] == '\n') + if(arr[i] == '\n') { _pos = 0; } @@ -135,9 +135,9 @@ public class OutputBase int indent = _indent; - if (_useTab) + if(_useTab) { - while (indent >= 8) + while(indent >= 8) { indent -= 8; _out.print('\t'); @@ -146,7 +146,7 @@ public class OutputBase } else { - while (indent >= _indentSize) + while(indent >= _indentSize) { indent -= _indentSize; _out.print(" "); @@ -154,7 +154,7 @@ public class OutputBase } } - while (indent > 0) + while(indent > 0) { --indent; _out.print(' '); @@ -167,7 +167,7 @@ public class OutputBase public void sp() { - if (_separator) + if(_separator) { _out.println(); } diff --git a/java/src/IceUtil/XMLOutput.java b/java/src/IceUtil/XMLOutput.java index 139dd600ffe..e062cd80efa 100644 --- a/java/src/IceUtil/XMLOutput.java +++ b/java/src/IceUtil/XMLOutput.java @@ -45,7 +45,7 @@ public class XMLOutput extends OutputBase public void print(String s) { - if (!_printed) + if(!_printed) { _out.print('>'); _printed = true; @@ -65,20 +65,20 @@ public class XMLOutput extends OutputBase final String allReserved = "<>'\"&"; boolean hasReserved = false; char[] arr = s.toCharArray(); - for (int i = 0; i < arr.length; i++) + for(int i = 0; i < arr.length; i++) { - if (allReserved.indexOf(arr[i]) != -1) + if(allReserved.indexOf(arr[i]) != -1) { hasReserved = true; break; } } - if (hasReserved) + if(hasReserved) { // // First convert all & to & // - if (v.indexOf('&') != -1) + if(v.indexOf('&') != -1) { v = v.replaceAll("&", "&"); } @@ -86,19 +86,19 @@ public class XMLOutput extends OutputBase // // Next convert remaining reserved characters. // - if (v.indexOf('>') != -1) + if(v.indexOf('>') != -1) { v = v.replaceAll(">", ">"); } - if (v.indexOf('<') != -1) + if(v.indexOf('<') != -1) { v = v.replaceAll("<", "<"); } - if (v.indexOf('\'') != -1) + if(v.indexOf('\'') != -1) { v = v.replaceAll("'", "'"); } - if (v.indexOf('"') != -1) + if(v.indexOf('"') != -1) { v = v.replaceAll("\"", """); } @@ -109,7 +109,7 @@ public class XMLOutput extends OutputBase public void nl() { - if (!_printed) + if(!_printed) { _out.print('>'); _printed = true; @@ -129,7 +129,7 @@ public class XMLOutput extends OutputBase // _out.print('<'); _out.print(element); - if (_sgml) + if(_sgml) { _out.print('>'); } @@ -139,11 +139,11 @@ public class XMLOutput extends OutputBase } int pos = element.indexOf(' '); - if (pos == -1) + if(pos == -1) { pos = element.indexOf('\t'); } - if (pos == -1) + if(pos == -1) { _elementStack.addFirst(element); } @@ -163,7 +163,7 @@ public class XMLOutput extends OutputBase String element = (String)_elementStack.removeFirst(); dec(); - if (!_printed) + if(!_printed) { _out.print("/>"); } diff --git a/java/src/IceXML/StreamI.java b/java/src/IceXML/StreamI.java index afe70dfe452..156150a1723 100644 --- a/java/src/IceXML/StreamI.java +++ b/java/src/IceXML/StreamI.java @@ -56,7 +56,7 @@ public class StreamI implements Ice.Stream // needs to be generalized to support other implementations. // factory.setValidating(false); - if (schema) + if(schema) { factory.setNamespaceAware(true); //factory.setDoSchema(true); // TODO @@ -102,7 +102,7 @@ public class StreamI implements Ice.Stream errorsOccurred = true; } - if (errorsOccurred) + if(errorsOccurred) { throw new Ice.MarshalException(); } @@ -302,21 +302,21 @@ public class StreamI implements Ice.Stream startRead(name); org.w3c.dom.Node child = _current.getFirstChild(); - if (child == null || child.getNodeType() != org.w3c.dom.Node.TEXT_NODE) + if(child == null || child.getNodeType() != org.w3c.dom.Node.TEXT_NODE) { throw new Ice.MarshalException(); } String value = child.getNodeValue(); int ordinal; - for (ordinal = 0; ordinal < table.length; ordinal++) + for(ordinal = 0; ordinal < table.length; ordinal++) { - if (value.equals(table[ordinal])) + if(value.equals(table[ordinal])) { break; } } - if (ordinal == table.length) + if(ordinal == table.length) { throw new Ice.MarshalException(); } @@ -341,7 +341,7 @@ public class StreamI implements Ice.Stream writeByteSeq(String name, byte[] value) { startWrite(name); - for (int i = 0; i < value.length; i++) + for(int i = 0; i < value.length; i++) { _os.nl(); _os.print("<e>" + (int)value[i] + "</e>"); @@ -355,7 +355,7 @@ public class StreamI implements Ice.Stream startRead(name); org.w3c.dom.Node child = _current.getFirstChild(); - if (child == null || child.getNodeType() != org.w3c.dom.Node.TEXT_NODE) + if(child == null || child.getNodeType() != org.w3c.dom.Node.TEXT_NODE) { throw new Ice.MarshalException(); } @@ -385,10 +385,10 @@ public class StreamI implements Ice.Stream int size = readLength(); byte[] value = new byte[size]; - if (size > 0) + if(size > 0) { _current = _current.getFirstChild(); - for (int i = 0; i < size; i++) + for(int i = 0; i < size; i++) { value[i] = readByte(seqElementName); } @@ -412,7 +412,7 @@ public class StreamI implements Ice.Stream writeBoolSeq(String name, boolean[] value) { startWrite(name); - for (int i = 0; i < value.length; i++) + for(int i = 0; i < value.length; i++) { _os.nl(); _os.print("<e>" + (value[i] ? "true" : "false") + "</e>"); @@ -426,7 +426,7 @@ public class StreamI implements Ice.Stream startRead(name); org.w3c.dom.Node child = _current.getFirstChild(); - if (child == null || child.getNodeType() != org.w3c.dom.Node.TEXT_NODE) + if(child == null || child.getNodeType() != org.w3c.dom.Node.TEXT_NODE) { throw new Ice.MarshalException(); } @@ -446,10 +446,10 @@ public class StreamI implements Ice.Stream int size = readLength(); boolean[] value = new boolean[size]; - if (size > 0) + if(size > 0) { _current = _current.getFirstChild(); - for (int i = 0; i < size; i++) + for(int i = 0; i < size; i++) { value[i] = readBool(seqElementName); } @@ -473,7 +473,7 @@ public class StreamI implements Ice.Stream writeShortSeq(String name, short[] value) { startWrite(name); - for (int i = 0; i < value.length; i++) + for(int i = 0; i < value.length; i++) { _os.nl(); _os.print("<e>" + value[i] + "</e>"); @@ -487,7 +487,7 @@ public class StreamI implements Ice.Stream startRead(name); org.w3c.dom.Node child = _current.getFirstChild(); - if (child == null || child.getNodeType() != org.w3c.dom.Node.TEXT_NODE) + if(child == null || child.getNodeType() != org.w3c.dom.Node.TEXT_NODE) { throw new Ice.MarshalException(); } @@ -517,10 +517,10 @@ public class StreamI implements Ice.Stream int size = readLength(); short[] value = new short[size]; - if (size > 0) + if(size > 0) { _current = _current.getFirstChild(); - for (int i = 0; i < size; i++) + for(int i = 0; i < size; i++) { value[i] = readShort(seqElementName); } @@ -544,7 +544,7 @@ public class StreamI implements Ice.Stream writeIntSeq(String name, int[] value) { startWrite(name); - for (int i = 0; i < value.length; i++) + for(int i = 0; i < value.length; i++) { _os.nl(); _os.print("<e>" + value[i] + "</e>"); @@ -558,7 +558,7 @@ public class StreamI implements Ice.Stream startRead(name); org.w3c.dom.Node child = _current.getFirstChild(); - if (child == null || child.getNodeType() != org.w3c.dom.Node.TEXT_NODE) + if(child == null || child.getNodeType() != org.w3c.dom.Node.TEXT_NODE) { throw new Ice.MarshalException(); } @@ -588,10 +588,10 @@ public class StreamI implements Ice.Stream int size = readLength(); int[] value = new int[size]; - if (size > 0) + if(size > 0) { _current = _current.getFirstChild(); - for (int i = 0; i < size; i++) + for(int i = 0; i < size; i++) { value[i] = readInt(seqElementName); } @@ -615,7 +615,7 @@ public class StreamI implements Ice.Stream writeLongSeq(String name, long[] value) { startWrite(name); - for (int i = 0; i < value.length; i++) + for(int i = 0; i < value.length; i++) { _os.nl(); _os.print("<e>" + value[i] + "</e>"); @@ -629,7 +629,7 @@ public class StreamI implements Ice.Stream startRead(name); org.w3c.dom.Node child = _current.getFirstChild(); - if (child == null || child.getNodeType() != org.w3c.dom.Node.TEXT_NODE) + if(child == null || child.getNodeType() != org.w3c.dom.Node.TEXT_NODE) { throw new Ice.MarshalException(); } @@ -659,10 +659,10 @@ public class StreamI implements Ice.Stream int size = readLength(); long[] value = new long[size]; - if (size > 0) + if(size > 0) { _current = _current.getFirstChild(); - for (int i = 0; i < size; i++) + for(int i = 0; i < size; i++) { value[i] = readLong(seqElementName); } @@ -686,7 +686,7 @@ public class StreamI implements Ice.Stream writeFloatSeq(String name, float[] value) { startWrite(name); - for (int i = 0; i < value.length; i++) + for(int i = 0; i < value.length; i++) { _os.nl(); _os.print("<e>" + value[i] + "</e>"); @@ -700,7 +700,7 @@ public class StreamI implements Ice.Stream startRead(name); org.w3c.dom.Node child = _current.getFirstChild(); - if (child == null || child.getNodeType() != org.w3c.dom.Node.TEXT_NODE) + if(child == null || child.getNodeType() != org.w3c.dom.Node.TEXT_NODE) { throw new Ice.MarshalException(); } @@ -730,10 +730,10 @@ public class StreamI implements Ice.Stream int size = readLength(); float[] value = new float[size]; - if (size > 0) + if(size > 0) { _current = _current.getFirstChild(); - for (int i = 0; i < size; i++) + for(int i = 0; i < size; i++) { value[i] = readFloat(seqElementName); } @@ -757,7 +757,7 @@ public class StreamI implements Ice.Stream writeDoubleSeq(String name, double[] value) { startWrite(name); - for (int i = 0; i < value.length; i++) + for(int i = 0; i < value.length; i++) { _os.nl(); _os.print("<e>" + value[i] + "</e>"); @@ -771,7 +771,7 @@ public class StreamI implements Ice.Stream startRead(name); org.w3c.dom.Node child = _current.getFirstChild(); - if (child == null || child.getNodeType() != org.w3c.dom.Node.TEXT_NODE) + if(child == null || child.getNodeType() != org.w3c.dom.Node.TEXT_NODE) { throw new Ice.MarshalException(); } @@ -801,10 +801,10 @@ public class StreamI implements Ice.Stream int size = readLength(); double[] value = new double[size]; - if (size > 0) + if(size > 0) { _current = _current.getFirstChild(); - for (int i = 0; i < size; i++) + for(int i = 0; i < size; i++) { value[i] = readDouble(seqElementName); } @@ -830,7 +830,7 @@ public class StreamI implements Ice.Stream writeStringSeq(String name, String[] value) { startWrite(name); - for (int i = 0; i < value.length; i++) + for(int i = 0; i < value.length; i++) { _os.nl(); _os.print("<e>"); @@ -848,9 +848,9 @@ public class StreamI implements Ice.Stream startRead(name); org.w3c.dom.Node child = _current.getFirstChild(); - if (child != null) + if(child != null) { - if (child.getNodeType() != org.w3c.dom.Node.TEXT_NODE) + if(child.getNodeType() != org.w3c.dom.Node.TEXT_NODE) { throw new Ice.MarshalException(); } @@ -873,10 +873,10 @@ public class StreamI implements Ice.Stream int size = readLength(); String[] value = new String[size]; - if (size > 0) + if(size > 0) { _current = _current.getFirstChild(); - for (int i = 0; i < size; i++) + for(int i = 0; i < size; i++) { value[i] = readString(seqElementName); } @@ -906,9 +906,9 @@ public class StreamI implements Ice.Stream org.w3c.dom.Node child = _current.getFirstChild(); String s = ""; - if (child != null) + if(child != null) { - if (child.getNodeType() != org.w3c.dom.Node.TEXT_NODE) + if(child.getNodeType() != org.w3c.dom.Node.TEXT_NODE) { throw new Ice.MarshalException(); } @@ -935,14 +935,14 @@ public class StreamI implements Ice.Stream // If the object doesn't exist in the map add it. // ObjectInfo info = (ObjectInfo)_objects.get(value); - if (info == null) + if(info == null) { String s = "object" + _nextId++; info = new ObjectInfo(s, !writeReference); _objects.put(value, info); } - if (writeReference) + if(writeReference) { _os.nl(); _os.print("<" + name + " href =\"#" + info.id + "\"/>"); @@ -981,12 +981,12 @@ public class StreamI implements Ice.Stream // readObjects list. Otherwise, it should be in the object-set at // the top-level of the document. // - if (href.value != null && href.value.length() > 0) + if(href.value != null && href.value.length() > 0) { href.value = href.value.substring(1); // Skip the '#' value = (Ice.Object)_readObjects.get(href.value); - if (value != null) + if(value != null) { endRead(); return value; @@ -998,13 +998,13 @@ public class StreamI implements Ice.Stream // _current = _document.getFirstChild(); _current = _current.getFirstChild(); - while (_current != null) + while(_current != null) { - if (_current.getNodeType() == org.w3c.dom.Node.ELEMENT_NODE) + if(_current.getNodeType() == org.w3c.dom.Node.ELEMENT_NODE) { Ice.StringHolder dummy = new Ice.StringHolder(); readAttributes(id, type, dummy); - if (id.value.equals(href.value)) + if(id.value.equals(href.value)) { break; } @@ -1014,7 +1014,7 @@ public class StreamI implements Ice.Stream // // If the object isn't found, that's an error. // - if (_current == null) + if(_current == null) { throw new Ice.MarshalException(); } @@ -1023,13 +1023,13 @@ public class StreamI implements Ice.Stream // // Empty type indicates nil object. // - if (type.value.length() == 0) + if(type.value.length() == 0) { value = null; } else { - if (type.value.equals("::Ice::Object")) + if(type.value.equals("::Ice::Object")) { value = new Ice.Object(); } @@ -1043,19 +1043,19 @@ public class StreamI implements Ice.Stream // can be created then throw a NoObjectFactoryException. // Ice.ObjectFactory userFactory = _communicator.findObjectFactory(type.value); - if (userFactory != null) + if(userFactory != null) { value = userFactory.create(type.value); } - if (value == null && type.value.equals(signatureType)) + if(value == null && type.value.equals(signatureType)) { assert(factory != null); value = factory.create(type.value); assert(value != null); } - if (value == null) + if(value == null) { throw new Ice.NoObjectFactoryException(); } @@ -1089,7 +1089,7 @@ public class StreamI implements Ice.Stream _os.ee(); - if (_level == 0) + if(_level == 0) { dumpUnwrittenObjects(); } @@ -1098,11 +1098,11 @@ public class StreamI implements Ice.Stream private void startRead(String name) { - while (_current != null && _current.getNodeType() != org.w3c.dom.Node.ELEMENT_NODE) + while(_current != null && _current.getNodeType() != org.w3c.dom.Node.ELEMENT_NODE) { _current = _current.getNextSibling(); } - if (_current == null) + if(_current == null) { throw new Ice.MarshalException(); } @@ -1113,7 +1113,7 @@ public class StreamI implements Ice.Stream // final String facets = "facets"; final String facetsNS = "ice:facets"; - if ((!name.equals(facetsNS) || !nodeName.equals(facets)) && !name.equals(nodeName)) + if((!name.equals(facetsNS) || !nodeName.equals(facets)) && !name.equals(nodeName)) { throw new Ice.MarshalException(); } @@ -1147,12 +1147,12 @@ public class StreamI implements Ice.Stream { nwritten = 0; java.util.Iterator p = _objects.entrySet().iterator(); - while (p.hasNext()) + while(p.hasNext()) { java.util.Map.Entry e = (java.util.Map.Entry)p.next(); Ice.Object obj = (Ice.Object)e.getKey(); ObjectInfo info = (ObjectInfo)e.getValue(); - if (!info.written) + if(!info.written) { info.written = true; writeObjectData("ice:object", info.id, obj); @@ -1164,7 +1164,7 @@ public class StreamI implements Ice.Stream } } } - while (_objects.size() != nwritten); + while(_objects.size() != nwritten); } private void @@ -1173,7 +1173,7 @@ public class StreamI implements Ice.Stream String xsdType = ""; String typeId = ""; - if (obj != null) + if(obj != null) { // // Convert the type-id to the equivalent schema type @@ -1185,13 +1185,13 @@ public class StreamI implements Ice.Stream final String xsdSuffix = "Type"; xsdType += xsdPrefix; int i = 0; - if (typeId.charAt(0) == ':') // Skip the preceeding "::". + if(typeId.charAt(0) == ':') // Skip the preceeding "::". { i = 2; } - for (; i < typeId.length(); ++i) + for(; i < typeId.length(); ++i) { - if (typeId.charAt(i) == ':') + if(typeId.charAt(i) == ':') { xsdType += '.'; ++i; @@ -1210,13 +1210,13 @@ public class StreamI implements Ice.Stream String s = name + " id=\"" + id + "\" type=\"" + typeId + "\"" + " xsi:type=\"" + xsdType + "\""; - if (obj == null) + if(obj == null) { s += " xsi:nil=\"true\""; } startWrite(s); - if (obj != null) + if(obj != null) { obj.__marshal(this); } @@ -1232,19 +1232,19 @@ public class StreamI implements Ice.Stream org.w3c.dom.NamedNodeMap attributes = _current.getAttributes(); int attrCount = attributes.getLength(); - for (int i = 0; i < attrCount; i++) + for(int i = 0; i < attrCount; i++) { org.w3c.dom.Node attribute = attributes.item(i); String name = attribute.getNodeName(); - if (name.equals(idStr)) + if(name.equals(idStr)) { id.value = attribute.getNodeValue(); } - else if (name.equals(typeStr)) + else if(name.equals(typeStr)) { type.value = attribute.getNodeValue(); } - else if (name.equals(hrefStr)) + else if(name.equals(hrefStr)) { href.value = attribute.getNodeValue(); } @@ -1258,11 +1258,11 @@ public class StreamI implements Ice.Stream org.w3c.dom.NamedNodeMap attributes = _current.getAttributes(); int attrCount = attributes.getLength(); - for (int i = 0; i < attrCount; i++) + for(int i = 0; i < attrCount; i++) { org.w3c.dom.Node attribute = attributes.item(i); String name = attribute.getNodeName(); - if (name.equals(lengthStr)) + if(name.equals(lengthStr)) { try { |