diff options
author | Artur Signell <artur@vaadin.com> | 2014-12-29 14:11:12 +0200 |
---|---|---|
committer | Artur Signell <artur@vaadin.com> | 2014-12-29 14:12:27 +0200 |
commit | 32a5d8f3827fbf0ba2c0c3102f0d818d7b7a3873 (patch) | |
tree | a060131679bfeb133934c800b00a01f893feb1bd /server | |
parent | b89213ee880dd1197bc7696f6f5a1919c0ff02c1 (diff) | |
download | vaadin-framework-32a5d8f3827fbf0ba2c0c3102f0d818d7b7a3873.tar.gz vaadin-framework-32a5d8f3827fbf0ba2c0c3102f0d818d7b7a3873.zip |
Reformat project using Eclipse Luna SR1
Change-Id: I58748499c87d470e70304d882d3227cda5803481
Diffstat (limited to 'server')
14 files changed, 81 insertions, 67 deletions
diff --git a/server/src/com/vaadin/data/util/converter/StringToBigIntegerConverter.java b/server/src/com/vaadin/data/util/converter/StringToBigIntegerConverter.java index 6695aa71ac..adaa8c6111 100644 --- a/server/src/com/vaadin/data/util/converter/StringToBigIntegerConverter.java +++ b/server/src/com/vaadin/data/util/converter/StringToBigIntegerConverter.java @@ -56,7 +56,8 @@ public class StringToBigIntegerConverter extends BigDecimal bigDecimalValue = (BigDecimal) convertToNumber(value, BigDecimal.class, locale); - return (bigDecimalValue != null) ? bigDecimalValue.toBigInteger() : null; + return (bigDecimalValue != null) ? bigDecimalValue.toBigInteger() + : null; } @Override diff --git a/server/src/com/vaadin/data/util/sqlcontainer/query/generator/DefaultSQLGenerator.java b/server/src/com/vaadin/data/util/sqlcontainer/query/generator/DefaultSQLGenerator.java index 21a486a017..2fc7ebd544 100644 --- a/server/src/com/vaadin/data/util/sqlcontainer/query/generator/DefaultSQLGenerator.java +++ b/server/src/com/vaadin/data/util/sqlcontainer/query/generator/DefaultSQLGenerator.java @@ -262,7 +262,7 @@ public class DefaultSQLGenerator implements SQLGenerator { count++; } if (versionColumn != null) { - if(!item.getItemPropertyIds().contains(versionColumn)) { + if (!item.getItemPropertyIds().contains(versionColumn)) { throw new IllegalArgumentException(String.format( "Table '%s' does not contain version column '%s'.", tableName, versionColumn)); diff --git a/server/src/com/vaadin/server/ClientMethodInvocation.java b/server/src/com/vaadin/server/ClientMethodInvocation.java index 97caa7614a..33b88a168b 100644 --- a/server/src/com/vaadin/server/ClientMethodInvocation.java +++ b/server/src/com/vaadin/server/ClientMethodInvocation.java @@ -109,7 +109,8 @@ public class ClientMethodInvocation implements Serializable, if (type instanceof Class<?>) { Class<?> clazz = (Class<?>) type; if (JsonArray.class.isAssignableFrom(clazz)) { - parameters[i] = JsonUtil.stringify((JsonArray) parameters[i]); + parameters[i] = JsonUtil + .stringify((JsonArray) parameters[i]); } } } @@ -127,7 +128,8 @@ public class ClientMethodInvocation implements Serializable, Class<?> clazz = (Class<?>) type; if (JsonArray.class.isAssignableFrom(clazz)) { try { - parameters[i] = JsonUtil.<JsonArray>parse((String) parameters[i]); + parameters[i] = JsonUtil + .<JsonArray> parse((String) parameters[i]); } catch (JsonException e) { throw new IOException(e); } diff --git a/server/src/com/vaadin/server/JavaScriptCallbackHelper.java b/server/src/com/vaadin/server/JavaScriptCallbackHelper.java index 2552db6d13..ac4a586d00 100644 --- a/server/src/com/vaadin/server/JavaScriptCallbackHelper.java +++ b/server/src/com/vaadin/server/JavaScriptCallbackHelper.java @@ -94,7 +94,8 @@ public class JavaScriptCallbackHelper implements Serializable { + name + " on the client because a callback with the same name is registered on the server."); } - JsonArray args = (JsonArray) JsonCodec.encode(arguments, null, Object[].class, null).getEncodedValue(); + JsonArray args = (JsonArray) JsonCodec.encode(arguments, null, + Object[].class, null).getEncodedValue(); connector.addMethodInvocationToQueue( JavaScriptCallbackRpc.class.getName(), CALL_METHOD, new Object[] { name, args }); diff --git a/server/src/com/vaadin/server/JsonCodec.java b/server/src/com/vaadin/server/JsonCodec.java index 1e9438453a..1f7b4ead43 100644 --- a/server/src/com/vaadin/server/JsonCodec.java +++ b/server/src/com/vaadin/server/JsonCodec.java @@ -66,10 +66,12 @@ import elemental.json.impl.JreJsonArray; public class JsonCodec implements Serializable { /* Immutable Encode Result representing null */ - private static final EncodeResult ENCODE_RESULT_NULL = new EncodeResult(Json.createNull()); + private static final EncodeResult ENCODE_RESULT_NULL = new EncodeResult( + Json.createNull()); /* Immutable empty JSONArray */ - private static final JsonArray EMPTY_JSON_ARRAY = new JreJsonArray(Json.instance()) { + private static final JsonArray EMPTY_JSON_ARRAY = new JreJsonArray( + Json.instance()) { @Override public void set(int index, JsonValue value) { throw new UnsupportedOperationException( @@ -316,7 +318,8 @@ public class JsonCodec implements Serializable { .getGenericComponentType(); return decodeArray(componentType, (JsonArray) value, connectorTracker); - } else if (JsonValue.class.isAssignableFrom(getClassForType(targetType))) { + } else if (JsonValue.class + .isAssignableFrom(getClassForType(targetType))) { return value; } else if (Enum.class.isAssignableFrom(getClassForType(targetType))) { Class<?> classForType = getClassForType(targetType); @@ -479,8 +482,7 @@ public class JsonCodec implements Serializable { } private static Map<Object, Object> decodeObjectMap(Type keyType, - Type valueType, JsonArray jsonMap, ConnectorTracker connectorTracker) - { + Type valueType, JsonArray jsonMap, ConnectorTracker connectorTracker) { JsonArray keys = jsonMap.getArray(0); JsonArray values = jsonMap.getArray(1); @@ -766,7 +768,8 @@ public class JsonCodec implements Serializable { * @param referenceValue * @return */ - private static boolean jsonEquals(JsonValue fieldValue, JsonValue referenceValue) { + private static boolean jsonEquals(JsonValue fieldValue, + JsonValue referenceValue) { if (fieldValue instanceof JsonNull) { fieldValue = null; } @@ -795,13 +798,14 @@ public class JsonCodec implements Serializable { Collection<?> collection, ConnectorTracker connectorTracker) { JsonArray jsonArray = Json.createArray(); for (Object o : collection) { - jsonArray.set(jsonArray.length(), encodeChild(targetType, 0, o, connectorTracker)); + jsonArray.set(jsonArray.length(), + encodeChild(targetType, 0, o, connectorTracker)); } return jsonArray; } - private static JsonValue encodeChild(Type targetType, int typeIndex, Object o, - ConnectorTracker connectorTracker) { + private static JsonValue encodeChild(Type targetType, int typeIndex, + Object o, ConnectorTracker connectorTracker) { if (targetType instanceof ParameterizedType) { Type childType = ((ParameterizedType) targetType) .getActualTypeArguments()[typeIndex]; diff --git a/server/src/com/vaadin/server/LegacyCommunicationManager.java b/server/src/com/vaadin/server/LegacyCommunicationManager.java index e1beb1153c..485084b515 100644 --- a/server/src/com/vaadin/server/LegacyCommunicationManager.java +++ b/server/src/com/vaadin/server/LegacyCommunicationManager.java @@ -85,7 +85,8 @@ public class LegacyCommunicationManager implements Serializable { * @deprecated As of 7.1. See #11411. */ @Deprecated - public static JsonObject encodeState(ClientConnector connector, SharedState state) { + public static JsonObject encodeState(ClientConnector connector, + SharedState state) { UI uI = connector.getUI(); ConnectorTracker connectorTracker = uI.getConnectorTracker(); Class<? extends SharedState> stateType = connector.getStateType(); diff --git a/server/src/com/vaadin/server/communication/ClientRpcWriter.java b/server/src/com/vaadin/server/communication/ClientRpcWriter.java index 6631f6176d..2ecf81287e 100644 --- a/server/src/com/vaadin/server/communication/ClientRpcWriter.java +++ b/server/src/com/vaadin/server/communication/ClientRpcWriter.java @@ -67,7 +67,8 @@ public class ClientRpcWriter implements Serializable { // add invocation to rpcCalls try { JsonArray invocationJson = Json.createArray(); - invocationJson.set(0, invocation.getConnector().getConnectorId()); + invocationJson.set(0, invocation.getConnector() + .getConnectorId()); invocationJson.set(1, invocation.getInterfaceName()); invocationJson.set(2, invocation.getMethodName()); JsonArray paramJson = Json.createArray(); diff --git a/server/src/com/vaadin/server/communication/JSONSerializer.java b/server/src/com/vaadin/server/communication/JSONSerializer.java index e318b6b145..7f673d01e8 100644 --- a/server/src/com/vaadin/server/communication/JSONSerializer.java +++ b/server/src/com/vaadin/server/communication/JSONSerializer.java @@ -52,12 +52,13 @@ public interface JSONSerializer<T> { * the connector tracker instance for the UI * @return A deserialized object */ - T deserialize(Type type, JsonValue jsonValue, ConnectorTracker connectorTracker); + T deserialize(Type type, JsonValue jsonValue, + ConnectorTracker connectorTracker); /** * Serialize the given object into JSON. Must be compatible with - * {@link #deserialize(Type, JsonValue, ConnectorTracker)} and the client side - * com.vaadin.client.communication.JSONSerializer + * {@link #deserialize(Type, JsonValue, ConnectorTracker)} and the client + * side com.vaadin.client.communication.JSONSerializer * * @param value * The object to serialize diff --git a/server/src/com/vaadin/server/communication/ServerRpcHandler.java b/server/src/com/vaadin/server/communication/ServerRpcHandler.java index d1b1be6b97..450c11f5c4 100644 --- a/server/src/com/vaadin/server/communication/ServerRpcHandler.java +++ b/server/src/com/vaadin/server/communication/ServerRpcHandler.java @@ -93,7 +93,8 @@ public class ServerRpcHandler implements Serializable { if (request.getService().getDeploymentConfiguration() .isSyncIdCheckEnabled()) { - syncId = (int) json.getNumber(ApplicationConstants.SERVER_SYNC_ID); + syncId = (int) json + .getNumber(ApplicationConstants.SERVER_SYNC_ID); } else { syncId = -1; } @@ -373,7 +374,8 @@ public class ServerRpcHandler implements Serializable { String methodName = invocationJson.getString(2); if (connectorTracker.getConnector(connectorId) == null - && !connectorId.equals(ApplicationConstants.DRAG_AND_DROP_CONNECTOR_ID)) { + && !connectorId + .equals(ApplicationConstants.DRAG_AND_DROP_CONNECTOR_ID)) { if (!connectorTracker.connectorWasPresentAsRequestWasSent( connectorId, lastSyncIdSeenByClient)) { diff --git a/server/src/com/vaadin/server/communication/UIInitHandler.java b/server/src/com/vaadin/server/communication/UIInitHandler.java index 1216d2b689..018274330f 100644 --- a/server/src/com/vaadin/server/communication/UIInitHandler.java +++ b/server/src/com/vaadin/server/communication/UIInitHandler.java @@ -80,7 +80,8 @@ public abstract class UIInitHandler extends SynchronizedRequestHandler { String initialUIDL = getInitialUidl(request, uI); params.put("uidl", initialUIDL); - return commitJsonResponse(request, response, JsonUtil.stringify(params)); + return commitJsonResponse(request, response, + JsonUtil.stringify(params)); } catch (JsonException e) { throw new IOException("Error producing initial UIDL", e); } diff --git a/server/src/com/vaadin/ui/UI.java b/server/src/com/vaadin/ui/UI.java index 4bd4b67259..66f893e04a 100644 --- a/server/src/com/vaadin/ui/UI.java +++ b/server/src/com/vaadin/ui/UI.java @@ -1164,7 +1164,7 @@ public abstract class UI extends AbstractSingleComponentContainer implements * The new theme name */ public void setTheme(String theme) { - if(theme == null) { + if (theme == null) { getState().theme = null; } else { getState().theme = VaadinServlet.stripSpecialChars(theme); diff --git a/server/tests/src/com/vaadin/data/util/sqlcontainer/SQLContainerTableQueryTest.java b/server/tests/src/com/vaadin/data/util/sqlcontainer/SQLContainerTableQueryTest.java index 2d66b728a7..bef57fd7d1 100644 --- a/server/tests/src/com/vaadin/data/util/sqlcontainer/SQLContainerTableQueryTest.java +++ b/server/tests/src/com/vaadin/data/util/sqlcontainer/SQLContainerTableQueryTest.java @@ -70,8 +70,7 @@ public class SQLContainerTableQueryTest { } @Test - public void itemWithExistingVersionColumnIsRemoved() - throws SQLException { + public void itemWithExistingVersionColumnIsRemoved() throws SQLException { container.setAutoCommit(true); peopleQuery.setVersionColumn("ID"); @@ -79,7 +78,8 @@ public class SQLContainerTableQueryTest { } @Test(expected = IllegalArgumentException.class) - public void itemWithNonExistingVersionColumnCannotBeRemoved() throws SQLException { + public void itemWithNonExistingVersionColumnCannotBeRemoved() + throws SQLException { peopleQuery.setVersionColumn("version"); container.removeItem(container.lastItemId()); @@ -99,33 +99,32 @@ public class SQLContainerTableQueryTest { SQLContainer container = new SQLContainer(new TableQuery("people", connectionPool, SQLTestsConstants.sqlGen)); - assertTrue(container.containsId(new RowId( - new Object[]{1 + offset}))); + assertTrue(container.containsId(new RowId(new Object[] { 1 + offset }))); Assert.assertTrue(container.containsId(new RowId( new Object[] { 1 + offset }))); assertTrue(this.container.containsId(new RowId( - new Object[]{1 + offset}))); + new Object[] { 1 + offset }))); } @Test public void containsId_withTableQueryAndNonexistingId_returnsFalse() throws SQLException { Assert.assertFalse(container.containsId(new RowId( - new Object[]{1337 + offset}))); + new Object[] { 1337 + offset }))); } @Test public void getContainerProperty_tableExistingItemIdAndNonexistingPropertyId_returnsNull() throws SQLException { Assert.assertNull(container.getContainerProperty(new RowId( - new Object[]{1 + offset}), "asdf")); + new Object[] { 1 + offset }), "asdf")); } @Test public void getContainerProperty_tableNonexistingItemId_returnsNull() throws SQLException { Assert.assertNull(container.getContainerProperty(new RowId( - new Object[]{1337 + offset}), "NAME")); + new Object[] { 1337 + offset }), "NAME")); } @Test @@ -156,24 +155,23 @@ public class SQLContainerTableQueryTest { "Ville", container .getContainerProperty( - new RowId(new Object[]{new BigDecimal( - 0 + offset)}), "NAME").getValue()); + new RowId(new Object[] { new BigDecimal( + 0 + offset) }), "NAME").getValue()); } else { Assert.assertEquals( "Ville", container.getContainerProperty( - new RowId(new Object[]{0 + offset}), "NAME") + new RowId(new Object[] { 0 + offset }), "NAME") .getValue()); } } - @Test public void getContainerPropertyIds_table_returnsIDAndNAME() throws SQLException { Collection<?> propertyIds = container.getContainerPropertyIds(); Assert.assertEquals(3, propertyIds.size()); - Assert.assertArrayEquals(new String[]{"ID", "NAME", "AGE"}, + Assert.assertArrayEquals(new String[] { "ID", "NAME", "AGE" }, propertyIds.toArray()); } @@ -288,10 +286,10 @@ public class SQLContainerTableQueryTest { throws SQLException { if (SQLTestsConstants.db == DB.ORACLE) { Assert.assertEquals(3, container.indexOfId(new RowId( - new Object[]{new BigDecimal(3 + offset)}))); + new Object[] { new BigDecimal(3 + offset) }))); } else { Assert.assertEquals(3, - container.indexOfId(new RowId(new Object[]{3 + offset}))); + container.indexOfId(new RowId(new Object[] { 3 + offset }))); } } @@ -301,14 +299,14 @@ public class SQLContainerTableQueryTest { DataGenerator.addFiveThousandPeople(connectionPool); if (SQLTestsConstants.db == DB.ORACLE) { - container.getItem(new RowId(new Object[]{new BigDecimal( - 1337 + offset)})); + container.getItem(new RowId(new Object[] { new BigDecimal( + 1337 + offset) })); Assert.assertEquals(1337, container.indexOfId(new RowId( - new Object[]{new BigDecimal(1337 + offset)}))); + new Object[] { new BigDecimal(1337 + offset) }))); } else { - container.getItem(new RowId(new Object[]{1337 + offset})); + container.getItem(new RowId(new Object[] { 1337 + offset })); Assert.assertEquals(1337, container.indexOfId(new RowId( - new Object[]{1337 + offset}))); + new Object[] { 1337 + offset }))); } } @@ -332,7 +330,7 @@ public class SQLContainerTableQueryTest { throws SQLException { DataGenerator.addFiveThousandPeople(connectionPool); - Object itemId = container.getIdByIndex(1337); + Object itemId = container.getIdByIndex(1337); if (SQLTestsConstants.db == DB.ORACLE) { Assert.assertEquals( new RowId(new Object[] { 1337 + offset }).toString(), @@ -367,10 +365,10 @@ public class SQLContainerTableQueryTest { Object itemId = container.getIdByIndex(1337); if (SQLTestsConstants.db == DB.ORACLE) { Assert.assertEquals( - new RowId(new Object[]{1336 + offset}).toString(), + new RowId(new Object[] { 1336 + offset }).toString(), container.prevItemId(itemId).toString()); } else { - Assert.assertEquals(new RowId(new Object[]{1336 + offset}), + Assert.assertEquals(new RowId(new Object[] { 1336 + offset }), container.prevItemId(itemId)); } } @@ -379,10 +377,10 @@ public class SQLContainerTableQueryTest { public void firstItemId_table_returnsItemId0() throws SQLException { if (SQLTestsConstants.db == DB.ORACLE) { Assert.assertEquals( - new RowId(new Object[]{0 + offset}).toString(), + new RowId(new Object[] { 0 + offset }).toString(), container.firstItemId().toString()); } else { - Assert.assertEquals(new RowId(new Object[]{0 + offset}), + Assert.assertEquals(new RowId(new Object[] { 0 + offset }), container.firstItemId()); } } @@ -394,10 +392,10 @@ public class SQLContainerTableQueryTest { if (SQLTestsConstants.db == DB.ORACLE) { Assert.assertEquals( - new RowId(new Object[]{4999 + offset}).toString(), + new RowId(new Object[] { 4999 + offset }).toString(), container.lastItemId().toString()); } else { - Assert.assertEquals(new RowId(new Object[]{4999 + offset}), + Assert.assertEquals(new RowId(new Object[] { 4999 + offset }), container.lastItemId()); } } @@ -406,10 +404,10 @@ public class SQLContainerTableQueryTest { public void isFirstId_tableActualFirstId_returnsTrue() throws SQLException { if (SQLTestsConstants.db == DB.ORACLE) { assertTrue(container.isFirstId(new RowId( - new Object[]{new BigDecimal(0 + offset)}))); + new Object[] { new BigDecimal(0 + offset) }))); } else { assertTrue(container.isFirstId(new RowId( - new Object[]{0 + offset}))); + new Object[] { 0 + offset }))); } } @@ -417,10 +415,10 @@ public class SQLContainerTableQueryTest { public void isFirstId_tableSecondId_returnsFalse() throws SQLException { if (SQLTestsConstants.db == DB.ORACLE) { Assert.assertFalse(container.isFirstId(new RowId( - new Object[]{new BigDecimal(1 + offset)}))); + new Object[] { new BigDecimal(1 + offset) }))); } else { Assert.assertFalse(container.isFirstId(new RowId( - new Object[]{1 + offset}))); + new Object[] { 1 + offset }))); } } @@ -428,10 +426,10 @@ public class SQLContainerTableQueryTest { public void isLastId_tableSecondId_returnsFalse() throws SQLException { if (SQLTestsConstants.db == DB.ORACLE) { Assert.assertFalse(container.isLastId(new RowId( - new Object[]{new BigDecimal(1 + offset)}))); + new Object[] { new BigDecimal(1 + offset) }))); } else { Assert.assertFalse(container.isLastId(new RowId( - new Object[]{1 + offset}))); + new Object[] { 1 + offset }))); } } @@ -439,10 +437,10 @@ public class SQLContainerTableQueryTest { public void isLastId_tableLastId_returnsTrue() throws SQLException { if (SQLTestsConstants.db == DB.ORACLE) { assertTrue(container.isLastId(new RowId( - new Object[]{new BigDecimal(3 + offset)}))); + new Object[] { new BigDecimal(3 + offset) }))); } else { - assertTrue(container.isLastId(new RowId( - new Object[]{3 + offset}))); + assertTrue(container + .isLastId(new RowId(new Object[] { 3 + offset }))); } } @@ -451,10 +449,10 @@ public class SQLContainerTableQueryTest { DataGenerator.addFiveThousandPeople(connectionPool); if (SQLTestsConstants.db == DB.ORACLE) { assertTrue(container.isLastId(new RowId( - new Object[]{new BigDecimal(4999 + offset)}))); + new Object[] { new BigDecimal(4999 + offset) }))); } else { assertTrue(container.isLastId(new RowId( - new Object[]{4999 + offset}))); + new Object[] { 4999 + offset }))); } } @@ -862,6 +860,7 @@ public class SQLContainerTableQueryTest { assertTrue(garbageContainer.removeItem(first)); Assert.assertSame(second, garbageContainer.firstItemId()); } + @Test public void lastItemId_tableLastItemRemoved_resultChanges() throws SQLException { diff --git a/server/tests/src/com/vaadin/server/JSONSerializerTest.java b/server/tests/src/com/vaadin/server/JSONSerializerTest.java index 393cea1c4c..6c57445564 100644 --- a/server/tests/src/com/vaadin/server/JSONSerializerTest.java +++ b/server/tests/src/com/vaadin/server/JSONSerializerTest.java @@ -57,8 +57,8 @@ public class JSONSerializerTest extends TestCase { stringToStateMap.put("string - state 1", s); stringToStateMap.put("String - state 2", s2); - JsonValue encodedMap = JsonCodec.encode(stringToStateMap, null, mapType, - null).getEncodedValue(); + JsonValue encodedMap = JsonCodec.encode(stringToStateMap, null, + mapType, null).getEncodedValue(); ensureDecodedCorrectly(stringToStateMap, encodedMap, mapType); } @@ -74,8 +74,8 @@ public class JSONSerializerTest extends TestCase { stateToStringMap.put(s, "string - state 1"); stateToStringMap.put(s2, "String - state 2"); - JsonValue encodedMap = JsonCodec.encode(stateToStringMap, null, mapType, - null).getEncodedValue(); + JsonValue encodedMap = JsonCodec.encode(stateToStringMap, null, + mapType, null).getEncodedValue(); ensureDecodedCorrectly(stateToStringMap, encodedMap, mapType); } diff --git a/server/tests/src/com/vaadin/tests/server/TestClientMethodSerialization.java b/server/tests/src/com/vaadin/tests/server/TestClientMethodSerialization.java index ad70024af4..d6a71028db 100644 --- a/server/tests/src/com/vaadin/tests/server/TestClientMethodSerialization.java +++ b/server/tests/src/com/vaadin/tests/server/TestClientMethodSerialization.java @@ -71,7 +71,8 @@ public class TestClientMethodSerialization extends TestCase { ClientMethodInvocation copy = (ClientMethodInvocation) serializeAndDeserialize(original); JsonArray copyArray = (JsonArray) copy.getParameters()[1]; - assertEquals(JsonUtil.stringify(originalArray), JsonUtil.stringify(copyArray)); + assertEquals(JsonUtil.stringify(originalArray), + JsonUtil.stringify(copyArray)); } public void testClientMethodSerialization_WithBasicParams_NoChanges() |