CE-57 added fixes

This commit is contained in:
Rob Austin
2015-06-19 16:13:23 +01:00
parent 39ce75db82
commit 57cfa271e8
@@ -1,17 +1,19 @@
/*
* Copyright (C) 2015 higherfrequencytrading.com
* Copyright 2014 Higher Frequency Trading
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License.
* http://www.higherfrequencytrading.com
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
* Licensed 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
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* 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.
*/
package net.openhft.chronicle.hash.serialization.internal;
@@ -26,7 +28,6 @@ import org.jetbrains.annotations.NotNull;
import java.io.IOException;
import java.io.ObjectStreamException;
import java.io.Serializable;
import java.io.UncheckedIOException;
public final class CharSequenceReader<S extends CharSequence>
implements BytesReader<S>, StatefulCopyable<CharSequenceReader<S>> {
@@ -84,9 +85,9 @@ public final class CharSequenceReader<S extends CharSequence>
public S read(Bytes bytes, long size) {
sb.setLength(0);
try {
((AbstractBytes) bytes).readUTF0(sb, (int) size);
AbstractBytes.readUTF0(bytes, sb, (int) size);
} catch (IOException e) {
throw new UncheckedIOException(e);
throw new IllegalStateException(e);
}
return interner.intern(sb);
}
@@ -106,9 +107,9 @@ public final class CharSequenceReader<S extends CharSequence>
appendable = sb;
}
try {
((AbstractBytes) bytes).readUTF0(appendable, (int) size);
AbstractBytes.readUTF0(bytes, appendable, (int) size);
} catch (IOException e) {
throw new UncheckedIOException(e);
throw new IllegalStateException(e);
}
if (appendable == toReuse)
return toReuse;