1*dff3f235SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*dff3f235SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*dff3f235SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*dff3f235SAndrew Rist * distributed with this work for additional information 6*dff3f235SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*dff3f235SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*dff3f235SAndrew Rist * "License"); you may not use this file except in compliance 9*dff3f235SAndrew Rist * with the License. You may obtain a copy of the License at 10*dff3f235SAndrew Rist * 11*dff3f235SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*dff3f235SAndrew Rist * 13*dff3f235SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*dff3f235SAndrew Rist * software distributed under the License is distributed on an 15*dff3f235SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*dff3f235SAndrew Rist * KIND, either express or implied. See the License for the 17*dff3f235SAndrew Rist * specific language governing permissions and limitations 18*dff3f235SAndrew Rist * under the License. 19*dff3f235SAndrew Rist * 20*dff3f235SAndrew Rist *************************************************************/ 21*dff3f235SAndrew Rist 22*dff3f235SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #include "jvmaccess/virtualmachine.hxx" 25cdf0e10cSrcweir 26cdf0e10cSrcweir #include <iostream> 27cdf0e10cSrcweir 28cdf0e10cSrcweir // Modify source/virtualmachine.cxx before running this test, by letting the 29cdf0e10cSrcweir // AttachGuard ctor directly throw a CreationExcepiton (without even setting the 30cdf0e10cSrcweir // m_xMachine member). 31cdf0e10cSrcweir main()32cdf0e10cSrcweirint main() 33cdf0e10cSrcweir { 34cdf0e10cSrcweir try 35cdf0e10cSrcweir { 36cdf0e10cSrcweir jvmaccess::VirtualMachine::AttachGuard aGuard(0); 37cdf0e10cSrcweir } 38cdf0e10cSrcweir catch (...) 39cdf0e10cSrcweir { 40cdf0e10cSrcweir std::cout << "Exception caught" << std::endl; 41cdf0e10cSrcweir } 42cdf0e10cSrcweir } 43