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 49166
Collapse All | Expand All

(-)src/org/netbeans/modules/j2ee/deployment/devmodules/spi/J2eeModuleProvider.java (-5 / +34 lines)
Lines 13-18 Link Here
13
13
14
package org.netbeans.modules.j2ee.deployment.devmodules.spi;
14
package org.netbeans.modules.j2ee.deployment.devmodules.spi;
15
15
16
import java.io.File;
17
import java.io.IOException;
16
import org.netbeans.modules.j2ee.deployment.config.*;
18
import org.netbeans.modules.j2ee.deployment.config.*;
17
import org.netbeans.modules.j2ee.deployment.devmodules.api.*;
19
import org.netbeans.modules.j2ee.deployment.devmodules.api.*;
18
import org.netbeans.modules.j2ee.deployment.impl.Server;
20
import org.netbeans.modules.j2ee.deployment.impl.Server;
Lines 21-27 Link Here
21
import org.netbeans.modules.j2ee.deployment.impl.ServerString;
23
import org.netbeans.modules.j2ee.deployment.impl.ServerString;
22
import org.netbeans.modules.j2ee.deployment.plugins.api.ServerDebugInfo;
24
import org.netbeans.modules.j2ee.deployment.plugins.api.ServerDebugInfo;
23
import org.netbeans.modules.j2ee.deployment.common.api.SourceFileMap;
25
import org.netbeans.modules.j2ee.deployment.common.api.SourceFileMap;
26
import org.openide.ErrorManager;
24
import org.openide.filesystems.FileObject;
27
import org.openide.filesystems.FileObject;
28
import org.openide.filesystems.FileSystem;
29
import org.openide.filesystems.FileStateInvalidException;
30
import org.openide.filesystems.FileUtil;
25
import org.openide.util.WeakListeners;
31
import org.openide.util.WeakListeners;
26
32
27
/** This object must be implemented by J2EE module support and an instance 
33
/** This object must be implemented by J2EE module support and an instance 
Lines 192-208 Link Here
192
        if (oldServer != null && !oldServer.equals (newServer)) {
198
        if (oldServer != null && !oldServer.equals (newServer)) {
193
199
194
            if (J2eeModule.WAR.equals(getJ2eeModule().getModuleType())) {
200
            if (J2eeModule.WAR.equals(getJ2eeModule().getModuleType())) {
195
                String oldCtxPath = getConfigSupportImpl().getWebContextRoot();
201
                FileSystem fs = getMasterFileSystem();
196
                confSupp = null;
202
                try {
197
                String ctx = getConfigSupportImpl().getWebContextRoot ();
203
                    fs.runAtomicAction(new FileSystem.AtomicAction() {
198
                if (ctx == null || ctx.equals ("")) {
204
                        public void run() {
199
                    getConfigSupportImpl().setWebContextRoot(oldCtxPath);
205
                            String oldCtxPath = getConfigSupportImpl().getWebContextRoot();
206
                            confSupp = null;
207
                            String ctx = getConfigSupportImpl().getWebContextRoot ();
208
                            if (ctx == null || ctx.equals ("")) {
209
                                getConfigSupportImpl().setWebContextRoot(oldCtxPath);
210
                            }
211
                        }
212
                    });
213
                }
214
                catch (IOException e) {
215
                    ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, e);
200
                }
216
                }
201
            } else {
217
            } else {
202
                J2eeModuleProvider.this.confSupp = null;
218
                J2eeModuleProvider.this.confSupp = null;
203
                ServerString newServerString = new ServerString(newServer);
219
                ServerString newServerString = new ServerString(newServer);
204
                ConfigSupportImpl.createInitialConfiguration(this, newServerString);
220
                ConfigSupportImpl.createInitialConfiguration(this, newServerString);
205
            }
221
            }
222
        }
223
    }
224
    
225
    // HACK - there should be an API method to retrieve MasterFS
226
    private FileSystem getMasterFileSystem() {
227
        try {
228
            File nbUser = new File(System.getProperty("netbeans.user"));
229
            FileObject userFO = FileUtil.toFileObject(nbUser);
230
            return userFO.getFileSystem();
231
        }
232
        catch (FileStateInvalidException e) {
233
            ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, e);
234
            return null;
206
        }
235
        }
207
    }
236
    }
208
    
237
    
(-)src/org/netbeans/modules/tomcat5/ide/TomcatPlanSplitter.java (-3 / +12 lines)
Lines 53-62 Link Here
53
            org.openide.ErrorManager.getDefault ().log ("Tomcat is asked to write DeploymentConfiguration of another plugin");
53
            org.openide.ErrorManager.getDefault ().log ("Tomcat is asked to write DeploymentConfiguration of another plugin");
54
        }
54
        }
55
        try {
55
        try {
56
new Exception ("saving file " + files[0]).printStackTrace();
56
            OutputStream os = new BufferedOutputStream (new FileOutputStream (files[0]), 4086);
57
            OutputStream os = new BufferedOutputStream (new FileOutputStream (files[0]), 4086);
57
            config.save (os);
58
            try {
58
        } catch (FileNotFoundException e) {
59
                config.save (os);
59
            throw new ConfigurationException (e.getLocalizedMessage ());
60
            }
61
            finally {
62
                if (os != null) os.close();
63
            }
64
System.err.println("wrote depl plan file size=" + files[0].length() + " timestamp= " + files[0].lastModified());
65
        } catch (IOException e) {
66
            ConfigurationException e2 = new ConfigurationException (e.getLocalizedMessage ());
67
            e2.initCause(e);
68
            throw e2;
60
        }
69
        }
61
    }
70
    }
62
    
71
    

Return to bug 49166