Repository: incubator-ignite Updated Branches: refs/heads/ignite-141 2d5586e25 -> 75b231f74
IGNITE-141 - Marshallers refactoring Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/0147c4e1 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/0147c4e1 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/0147c4e1 Branch: refs/heads/ignite-141 Commit: 0147c4e1cb75f33ad1378b9b1b9e7ceb20abe7bd Parents: 2d5586e Author: Valentin Kulichenko <vkuliche...@gridgain.com> Authored: Tue Mar 3 18:29:38 2015 -0800 Committer: Valentin Kulichenko <vkuliche...@gridgain.com> Committed: Tue Mar 3 18:29:38 2015 -0800 ---------------------------------------------------------------------- .../ignite/internal/MarshallerContextImpl.java | 10 +++++++--- .../apache/ignite/internal/classnames.properties | 17 +++++++++++++++++ .../marshaller/MarshallerContextTestImpl.java | 9 ++++++--- 3 files changed, 30 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0147c4e1/modules/core/src/main/java/org/apache/ignite/internal/MarshallerContextImpl.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/MarshallerContextImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/MarshallerContextImpl.java index 0491aea..8d0e95a 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/MarshallerContextImpl.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/MarshallerContextImpl.java @@ -51,10 +51,14 @@ public class MarshallerContextImpl implements MarshallerContext { BufferedReader rdr = new BufferedReader(new InputStreamReader(ldr.getResourceAsStream(CLS_NAMES_FILE))); - String clsName; + String line; - while ((clsName = rdr.readLine()) != null) - clsNameById.put(clsName.hashCode(), clsName); + while ((line = rdr.readLine()) != null) { + if (line.isEmpty() || line.startsWith("#")) + continue; + + clsNameById.put(line.hashCode(), line.trim()); + } } catch (IOException e) { throw new IllegalStateException("Failed to initialize marshaller context.", e); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0147c4e1/modules/core/src/main/java/org/apache/ignite/internal/classnames.properties ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/classnames.properties b/modules/core/src/main/java/org/apache/ignite/internal/classnames.properties index 69ea7ed..c5480d6 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/classnames.properties +++ b/modules/core/src/main/java/org/apache/ignite/internal/classnames.properties @@ -1,3 +1,20 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + [B [C [D http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0147c4e1/modules/core/src/test/java/org/apache/ignite/marshaller/MarshallerContextTestImpl.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/marshaller/MarshallerContextTestImpl.java b/modules/core/src/test/java/org/apache/ignite/marshaller/MarshallerContextTestImpl.java index 594a022..2538f74 100644 --- a/modules/core/src/test/java/org/apache/ignite/marshaller/MarshallerContextTestImpl.java +++ b/modules/core/src/test/java/org/apache/ignite/marshaller/MarshallerContextTestImpl.java @@ -41,11 +41,14 @@ public class MarshallerContextTestImpl implements MarshallerContext { BufferedReader rdr = new BufferedReader(new InputStreamReader(ldr.getResourceAsStream(CLS_NAMES_FILE))); - String clsName; + String line; + + while ((line = rdr.readLine()) != null) { + if (line.isEmpty() || line.startsWith("#")) + continue; - while ((clsName = rdr.readLine()) != null) { try { - Class cls = U.forName(clsName, ldr); + Class cls = U.forName(line.trim(), ldr); map.put(cls.getName().hashCode(), cls); }