This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 154904
Collapse All | Expand All

(-)a/autoupdate.services/libsrc/org/netbeans/updater/UpdateTracking.java (-4 / +28 lines)
Lines 806-818 Link Here
806
            
806
            
807
            document.getDocumentElement().normalize();
807
            document.getDocumentElement().normalize();
808
808
809
            OutputStream os = null;
809
            try {
810
            try {
810
                OutputStream os = new FileOutputStream( file );
811
                os = new FileOutputStream(file);
811
                XMLUtil.write(document, os);            
812
                os.close();
813
            } catch (Exception e) {
812
            } catch (Exception e) {
814
                e.printStackTrace();
813
                e.printStackTrace();
815
            }        
814
                //#154904
815
                if (!file.delete()) {
816
                    new IOException("Corresponding update would not be installed since it is not possible to modify or delete update tracking file " + file).printStackTrace();
817
                } else {
818
                    new IOException("Update tracking file was deleted since permissions does not allow to modify it: " + file).printStackTrace();
819
                    try {
820
                        os = new FileOutputStream(file);
821
                    } catch (Exception ex) {
822
                        ex.printStackTrace();
823
                    }
824
                }
825
            }
826
827
            if (os != null) {
828
                try {
829
                    XMLUtil.write(document, os);
830
                } catch (IOException e) {
831
                    e.printStackTrace();
832
                } finally {
833
                    try {
834
                        os.close();
835
                    } catch (IOException e) {
836
                        e.printStackTrace();
837
                    }
838
                }
839
            }
816
        }
840
        }
817
841
818
        void deleteUnusedFiles() {
842
        void deleteUnusedFiles() {

Return to bug 154904