4791N/A * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. 4791N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4791N/A * This code is free software; you can redistribute it and/or modify it 4791N/A * under the terms of the GNU General Public License version 2 only, as 4791N/A * published by the Free Software Foundation. 4791N/A * This code is distributed in the hope that it will be useful, but WITHOUT 4791N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 4791N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 4791N/A * version 2 for more details (a copy is included in the LICENSE file that 4791N/A * You should have received a copy of the GNU General Public License version 4791N/A * 2 along with this work; if not, write to the Free Software Foundation, 4791N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 4791N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 4791N/A * or visit www.oracle.com if you need additional information or have any 4791N/A * @summary Cipher.doFinal(ByteBuffer,ByteBuffer) fails to 4791N/A * process when in.remaining() == 0 4791N/A * Simple test case to show that Cipher.doFinal(ByteBuffer, ByteBuffer) fails to 4791N/A * process the data internally buffered inBB the cipher when input.remaining() 4791N/A * == 0 and at least one buffer is a direct buffer. 4791N/A * Iterate through various sizes to make sure that the code does empty 4791N/A * blocks, single partial blocks, 1 full block, full + partial blocks, 4791N/A * multiple full blocks, etc. 5 blocks (using DES) is probably overkill 4791N/A * but will feel more confident the fix isn't breaking anything. 4791N/A // If we got an exception, let's be safe for future 4791N/A // testing and reset the cipher to a known good state. 4791N/A // Process all data in one shot, but don't call doFinal() yet. 4791N/A // May store up to n-1 bytes (w/block size n) internally. 4791N/A // finish encryption and process all data buffered 4791N/A "incomplete encryption output, expected "