geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r1300568 - /geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/GeronimoServerBehaviourDelegate.java
Date Wed, 14 Mar 2012 14:47:41 GMT
Author: gawor
Date: Wed Mar 14 14:47:41 2012
New Revision: 1300568

URL: http://svn.apache.org/viewvc?rev=1300568&view=rev
Log:
GERONIMODEVTOOLS-787: Failed to hot deploy a resource file

Modified:
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/GeronimoServerBehaviourDelegate.java

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/GeronimoServerBehaviourDelegate.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/GeronimoServerBehaviourDelegate.java?rev=1300568&r1=1300567&r2=1300568&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/GeronimoServerBehaviourDelegate.java
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/GeronimoServerBehaviourDelegate.java
Wed Mar 14 14:47:41 2012
@@ -21,6 +21,7 @@ import java.io.FileInputStream;
 import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
 import java.io.IOException;
+import java.io.InputStream;
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.util.ArrayList;
@@ -69,6 +70,7 @@ import org.apache.geronimo.st.v30.core.o
 import org.apache.geronimo.st.v30.core.osgi.OSGiModuleHandler;
 import org.apache.geronimo.system.jmx.KernelDelegate;
 import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.resources.IFile;
 import org.eclipse.core.resources.IProject;
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IPath;
@@ -1091,13 +1093,19 @@ public class GeronimoServerBehaviourDele
                         return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Cannot create
target directory", null);
                     }
                 }
-                String rootFolder = GeronimoUtils.getVirtualComponent(module).getRootFolder().getProjectRelativePath().toOSString();
-                String sourceFile = module.getProject().getFile(rootFolder + ch + moduleFile.getModuleRelativePath()
+ ch + moduleFile.getName()).getLocation().toString();
                 
-                FileInputStream in = null;
+                String sourceFile = relativePath;
+                InputStream in = null;
                 FileOutputStream out = null;
                 try {
-                    in = new FileInputStream(sourceFile);
+                    IFile srcIFile = (IFile) moduleFile.getAdapter(IFile.class);
+                    if (srcIFile != null) {
+                        in = srcIFile.getContents();
+                    } else {
+                        File srcFile = (File) moduleFile.getAdapter(File.class);
+                        in = new FileInputStream(srcFile);
+                    }
+                
                     out = new FileOutputStream(file);
                     
                     while ((bytesRead = in.read(buffer)) > 0) {
@@ -1109,6 +1117,9 @@ public class GeronimoServerBehaviourDele
                 } catch (IOException e) {
                     Trace.trace(Trace.ERROR, "Cannot copy file: " + sourceFile, e, Activator.logCore);
                     return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Cannot copy file
" + sourceFile, e);
+                } catch (CoreException e) {
+                    Trace.trace(Trace.ERROR, "Cannot copy file: " + sourceFile, e, Activator.logCore);
+                    return e.getStatus();
                 } finally {
                     if (in != null) {
                         try { in.close(); } catch (IOException ignore) {}



Mime
View raw message