/*
* 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 6211220 6616825
* @summary Test that jmx.serial.form=1.0 works for ObjectName
* @author Eamonn McManus, Daniel Fuchs
* @run clean SerialCompatTest
* @run build SerialCompatTest
*/
public class SerialCompatTest {
// if the bug is present, these will get NullPointerException
for (int i = 0; i <= 11; i++) {
try {
switch (i) {
case 0:
break;
case 1:
break;
case 2:
.equals("b=c"));
break;
case 3:
.equals("b=c"));
break;
case 4:
break;
case 5:
break;
case 6:
break;
case 7:
break;
case 8:
break;
case 9:
break;
case 10:
break;
case 11:
break;
default:
}
} catch (Exception e) {
failed = true;
}
}
if (failed) {
throw new Exception("Some tests for 6211220 failed");
} else {
}
}
throws Exception {
// if the bug is present, these will get NullPointerException
for (int i = 0; i <= 11; i++) {
try {
switch (i) {
case 0:
break;
case 1:
break;
case 2:
break;
case 3:
break;
case 4:
}
}
case 5:
break;
case 6:
break;
case 7:
break;
case 8:
break;
case 9:
break;
case 10:
break;
case 11:
}
break;
default:
throw new Exception("Test incorrect: case: " + i);
}
} catch (Exception e) {
failed = true;
}
}
}
"a:b=c", "a:b=c,*", "*:*", ":*", ":b=c", ":b=c,*",
"a:*,b=c", ":*", ":*,b=c", "*x?:k=\"x\\*z\"", "*x?:k=\"x\\*z\",*",
"*x?:*,k=\"x\\*z\"", "*x?:k=\"x\\*z\",*,b=c"
};
for (String n : names6616825) {
final ObjectName on;
try {
on = new ObjectName(n);
} catch (Exception x) {
failed = true;
"]: " + x);
continue;
}
try {
} catch (Exception x) {
failed = true;
}
}
if (failed) {
throw new Exception("Some tests for 6616825 failed");
} else {
}
}
/* Check that we really are in jmx.serial.form=1.0 mode.
The property is frozen the first time the ObjectName class
is referenced so checking that it is set to the correct
value now is not enough. */
throw new Exception("Not using old serial form: fields: " +
// new serial form has no fields, uses writeObject
}
try {
check6211220();
} catch (Exception x) {
}
try {
check6616825();
} catch (Exception x) {
}
if (failed) {
throw new Exception("Some tests failed");
} else {
}
}
if (!condition) {
failed = true;
}
}
private static boolean failed;
}