/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code 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 General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/* @test
@bug 4122961
@summary Verify that converters don't drop characters on buffer boundaries
This is a slightly modified version of the attachment supplied with the
bug report.
*/
public class TestConverterDroppedCharacters {
{
/* Try misc. encodings, many are broken. */
tryEncoding("Big5");
tryEncoding("CNS11643");
tryEncoding("Cp1006");
tryEncoding("Cp1381");
tryEncoding("Cp33722");
tryEncoding("GB2312");
tryEncoding("KSC5601");
tryEncoding("SJIS");
tryEncoding("UTF8");
}
{
int goesBadAfter = 8193;
int i;
/* Create some data */
for(i = 0; i < goesBadAfter; i++) {
}
/* Write the data out to a file. */
/* Now read it back with the same encoding. */
/* And check to see if what we wrote is what we got back. */
for(i = 0; i < goesBadAfter; i++) {
+ ": Data wrong at position " + i + " "
+ "out: " + (int)buf[i]);
throw new RuntimeException();
}
}
}
}