/*
 * This file is part of libbluray
 * Copyright (C) 2012  libbluray
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library 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
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library. If not, see
 * <http://www.gnu.org/licenses/>.
 */

package com.aacsla.bluray.online;

import java.io.File;
import java.io.FileInputStream;

public class ContentAttribute {
    public ContentAttribute() {
    }

    public byte[] getContentCertID() {
        try {
            FileInputStream is = new FileInputStream(
                System.getProperty("bluray.vfs.root") + File.separator + "AACS/Content000.cer");
            is.skip(14);
            byte[] bytes = new byte[6];
            is.read(bytes, 0, 6);
            is.close();
            return bytes;
        } catch (Throwable e) {
            e.printStackTrace();
            return null;
        }
    }
}

@@ -937,24 +937,59 @@
 tCertID() %7B%0A
+        FileInputStream is = null;%0A
         try 
@@ -1002,32 +1002,16 @@
         
-FileInputStream 
 is = new
@@ -1228,32 +1228,8 @@
 6);%0A
-            is.close();%0A
     
@@ -1315,16 +1315,16 @@
 race();%0A
-
         
@@ -1336,24 +1336,241 @@
 eturn null;%0A
+        %7D finally %7B%0A            if (is != null) %7B%0A                try %7B%0A                    is.close();%0A                %7D catch (Throwable e) %7B%0A                    e.printStackTrace();%0A                %7D%0A            %7D%0A
         %7D%0A  

Fix resource leak in error path