From 57cfa271e8c8408da7601cd6fa16ddb905807a71 Mon Sep 17 00:00:00 2001 From: Rob Austin Date: Fri, 19 Jun 2015 16:13:23 +0100 Subject: [PATCH] CE-57 added fixes --- .../internal/CharSequenceReader.java | 31 ++++++++++--------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/src/main/java/net/openhft/chronicle/hash/serialization/internal/CharSequenceReader.java b/src/main/java/net/openhft/chronicle/hash/serialization/internal/CharSequenceReader.java index 352e5b6ca..60eb7b516 100644 --- a/src/main/java/net/openhft/chronicle/hash/serialization/internal/CharSequenceReader.java +++ b/src/main/java/net/openhft/chronicle/hash/serialization/internal/CharSequenceReader.java @@ -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.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 implements BytesReader, StatefulCopyable> { @@ -84,9 +85,9 @@ public final class CharSequenceReader 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 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;