Please use the Apache issue tracking system for new NetBeans issues (https://issues.apache.org/jira/projects/NETBEANS0/issues) !!
View | Details | Raw Unified | Return to bug 197657
Collapse All | Expand All

(-)a/java.source.ant/antsrc/org/netbeans/modules/java/source/ant/JavacTask.java (-4 / +38 lines)
 Lines 46-51    Link Here 
46
46
47
import java.io.File;
47
import java.io.File;
48
import java.io.IOException;
48
import java.io.IOException;
49
import java.lang.reflect.InvocationTargetException;
50
import java.lang.reflect.Method;
49
import java.net.MalformedURLException;
51
import java.net.MalformedURLException;
50
import java.util.Arrays;
52
import java.util.Arrays;
51
import java.util.Iterator;
53
import java.util.Iterator;
 Lines 62-71    Link Here 
62
 */
64
 */
63
public class JavacTask extends Javac {
65
public class JavacTask extends Javac {
64
66
67
    private static final String CLASS_ZIP_FILE_INDEX = "com.sun.tools.javac.zip.ZipFileIndex";  //NOI18N
68
    private static final String METHOD_CLOSE = "clearCache";    //NOI18N
69
65
    @Override
70
    @Override
66
    public void execute() throws BuildException {
71
    public void execute() throws BuildException {
67
        Project p = getProject();
72
        final Project p = getProject();
68
        
69
        p.log("Overridden Javac task called", Project.MSG_DEBUG);
73
        p.log("Overridden Javac task called", Project.MSG_DEBUG);
70
74
71
        boolean ensureBuilt =    p.getProperty("ensure.built.source.roots") != null
75
        boolean ensureBuilt =    p.getProperty("ensure.built.source.roots") != null
 Lines 105-111    Link Here 
105
            }
109
            }
106
110
107
            if (!wasBuilt) {
111
            if (!wasBuilt) {
108
                super.execute();
112
                try {
113
                    super.execute();
114
                } finally {
115
                    cleanUp(p);
116
                }
109
            }
117
            }
110
        } else {
118
        } else {
111
            if (CheckForCleanBuilds.cleanBuild.get() && getSrcdir() != null) {
119
            if (CheckForCleanBuilds.cleanBuild.get() && getSrcdir() != null) {
 Lines 132-139    Link Here 
132
                    }
140
                    }
133
                }
141
                }
134
            }
142
            }
143
            try {
144
                super.execute();
145
            } finally {
146
                cleanUp(p);
147
            }
148
        }
149
    }
135
150
136
            super.execute();
151
152
    private static void cleanUp (final Project p) {
153
        try {
154
            p.log("Cleaning ZipFileIndex cache", Project.MSG_DEBUG);    //NOI18N
155
            final Class<?> zipFileIndex = Class.forName(CLASS_ZIP_FILE_INDEX);
156
            final Method clean = zipFileIndex.getDeclaredMethod(METHOD_CLOSE);
157
            clean.invoke(null);
158
            p.log("ZipFileIndex cache cleaned", Project.MSG_DEBUG);    //NOI18N
159
        } catch (ClassNotFoundException e) {
160
            p.log("ZipFileIndex clearCache failed", e, Project.MSG_VERBOSE);    //NOI18N
161
        } catch (NoSuchMethodException e) {
162
            p.log("ZipFileIndex clearCache failed", e, Project.MSG_VERBOSE);    //NOI18N
163
        } catch (SecurityException e) {
164
            p.log("ZipFileIndex clearCache failed", e, Project.MSG_VERBOSE);    //NOI18N
165
        } catch (InvocationTargetException e) {
166
            p.log("ZipFileIndex clearCache failed", e, Project.MSG_VERBOSE);    //NOI18N
167
        } catch (IllegalArgumentException e) {
168
            p.log("ZipFileIndex clearCache failed", e, Project.MSG_VERBOSE);    //NOI18N
169
        } catch (IllegalAccessException e) {
170
            p.log("ZipFileIndex clearCache failed", e, Project.MSG_VERBOSE);    //NOI18N
137
        }
171
        }
138
    }
172
    }
139
173
(-)a/java.source/src/org/netbeans/modules/java/source/JBrowseModule.java (-10 / +1 lines)
 Lines 60-75    Link Here 
60
    /** Creates a new instance of JBrowseModule */
60
    /** Creates a new instance of JBrowseModule */
61
    public JBrowseModule() {
61
    public JBrowseModule() {
62
    }
62
    }
63
63
    
64
    public @Override void restored() {
65
        super.restored();        
66
        //XXX:
67
        //#143234: javac caches content of all jar files in a static map, which leads to memory leaks affecting the IDE
68
        //when "internal" execution of javac is used
69
        //the property below disables the caches
70
        //java.project might be a better place (currently does not have a ModuleInstall)
71
        System.setProperty("useJavaUtilZip", "true"); //NOI18N
72
    }   
73
    
64
    
74
    public @Override void close () {
65
    public @Override void close () {
75
        super.close();
66
        super.close();

Return to bug 197657
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo