提交 8b13914c 编写于 作者: I igerasim

8074657: Missing space on a boundary of concatenated strings

Summary: Added missing spaces, fixed indentation, replaced StringBuffer with StringBuilder
Reviewed-by: martin, rriggs
上级 370fb4a4
/*
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -66,7 +66,7 @@ public class SerialBlob implements Blob, Serializable, Cloneable {
* value of this <code>SerialBlob</code> object.
* @serial
*/
private byte buf[];
private byte[] buf;
/**
* The internal representation of the <code>Blob</code> object on which this
......@@ -102,7 +102,8 @@ public class SerialBlob implements Blob, Serializable, Cloneable {
* @throws SerialException if an error occurs during serialization
* @throws SQLException if a SQL errors occurs
*/
public SerialBlob(byte[] b) throws SerialException, SQLException {
public SerialBlob(byte[] b)
throws SerialException, SQLException {
len = b.length;
buf = new byte[(int)len];
......@@ -132,19 +133,17 @@ public class SerialBlob implements Blob, Serializable, Cloneable {
* to this constructor is a <code>null</code>.
* @see java.sql.Blob
*/
public SerialBlob (Blob blob) throws SerialException, SQLException {
public SerialBlob (Blob blob)
throws SerialException, SQLException {
if (blob == null) {
throw new SQLException("Cannot instantiate a SerialBlob " +
"object with a null Blob object");
throw new SQLException(
"Cannot instantiate a SerialBlob object with a null Blob object");
}
len = blob.length();
buf = blob.getBytes(1, (int)len );
this.blob = blob;
//if ( len < 10240000)
// len = 10240000;
origLen = len;
}
......@@ -246,6 +245,7 @@ public class SerialBlob implements Blob, Serializable, Cloneable {
*/
public long position(byte[] pattern, long start)
throws SerialException, SQLException {
isValid();
if (start < 1 || start > len) {
return -1;
......@@ -317,7 +317,7 @@ public class SerialBlob implements Blob, Serializable, Cloneable {
*/
public int setBytes(long pos, byte[] bytes)
throws SerialException, SQLException {
return (setBytes(pos, bytes, 0, bytes.length));
return setBytes(pos, bytes, 0, bytes.length);
}
/**
......@@ -403,6 +403,7 @@ public class SerialBlob implements Blob, Serializable, Cloneable {
*/
public java.io.OutputStream setBinaryStream(long pos)
throws SerialException, SQLException {
isValid();
if (this.blob != null) {
return this.blob.setBinaryStream(pos);
......@@ -425,11 +426,10 @@ public class SerialBlob implements Blob, Serializable, Cloneable {
* if {@code free} had previously been called on this object
*/
public void truncate(long length) throws SerialException {
isValid();
if (length > len) {
throw new SerialException
("Length more than what can be truncated");
throw new SerialException(
"Length more than what can be truncated");
} else if((int)length == 0) {
buf = new byte[0];
len = length;
......@@ -466,8 +466,8 @@ public class SerialBlob implements Blob, Serializable, Cloneable {
throw new SerialException("Invalid position in BLOB object set");
}
if (length < 1 || length > len - pos + 1) {
throw new SerialException("length is < 1 or pos + length >"
+ "total number of bytes");
throw new SerialException(
"length is < 1 or pos + length > total number of bytes");
}
return new ByteArrayInputStream(buf, (int) pos - 1, (int) length);
}
......@@ -543,7 +543,6 @@ public class SerialBlob implements Blob, Serializable, Cloneable {
// this shouldn't happen, since we are Cloneable
throw new InternalError();
}
}
/**
......@@ -590,8 +589,8 @@ public class SerialBlob implements Blob, Serializable, Cloneable {
*/
private void isValid() throws SerialException {
if (buf == null) {
throw new SerialException("Error: You cannot call a method on a "
+ "SerialBlob instance once free() has been called.");
throw new SerialException("Error: You cannot call a method on a " +
"SerialBlob instance once free() has been called.");
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册