/*
 * Copyright (C) 2018 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import java.util.zip.ZipFile;

public class Main {
      public static void main(String[] args) throws Exception {
        // By throwing an exception when setting up arguments of
        // the constructor, we end up with a not fully constructed
        // ZipFile.
        try {
          new ZipFile(null, throwException(), null);
          throw new Error("Expected Exception");
        } catch (Exception e) {
          // expected
        }

        // Run finalizers. The golden file of this test checks
        // that no exception is thrown from finalizers.
        System.gc();
        System.runFinalization();
    }

    public static int throwException() throws Exception {
      throw new Exception();
    }
}
