Skip to content

Instantly share code, notes, and snippets.

@stephentu
Created January 30, 2011 03:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stephentu/802493 to your computer and use it in GitHub Desktop.
Save stephentu/802493 to your computer and use it in GitHub Desktop.
diff --git a/src/jpdr/server/support/DatastoreEnvironment.java b/src/jpdr/server/support/DatastoreEnvironment.java
index 425fa30..7bb4ddb 100644
--- a/src/jpdr/server/support/DatastoreEnvironment.java
+++ b/src/jpdr/server/support/DatastoreEnvironment.java
@@ -16,8 +16,9 @@ import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.MalformedURLException;
import java.net.URL;
-import java.nio.file.FileAlreadyExistsException;
-import java.nio.file.Path;
+// disabled for java 1.6
+//import java.nio.file.FileAlreadyExistsException;
+//import java.nio.file.Path;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
@@ -377,12 +378,20 @@ public class DatastoreEnvironment
{
DatastoreEnvironment productionEnvironment = DatastoreEnvironment.getEnvironment("production");
if(this.equals(productionEnvironment)) throw new Error("This IS the production environment");
- Path productionTargetPath = new File(new File(productionEnvironment.home.getAbsoluteFile(), "classes"), name.replaceAll("\\.", File.separator)+".cla
- Path newLink = new File(new File(this.home, "classes"), name.replaceAll("\\.", File.separator)+".class").toPath();
- new File(newLink.getParent().toUri()).mkdirs();
- newLink.createSymbolicLink(productionTargetPath);
+
+ // commented out for 1.6 backport
+ //Path productionTargetPath = new File(new File(productionEnvironment.home.getAbsoluteFile(), "classes"), name.replaceAll("\\.", File.separator)+".c
+ //Path newLink = new File(new File(this.home, "classes"), name.replaceAll("\\.", File.separator)+".class").toPath();
+ //new File(newLink.getParent().toUri()).mkdirs();
+ // newLink.createSymbolicLink(productionTargetPath);
+
+ File productionTargetPath = new File(new File(productionEnvironment.home.getAbsoluteFile(), "classes"), name.replaceAll("\\.", File.separator)+".cla
+ File newLink = new File(new File(this.home, "classes"), name.replaceAll("\\.", File.separator)+".class");
+ newLink.getParentFile().mkdirs();
+ org.apache.commons.io.FileUtils.copyFile(productionTargetPath, newLink); // copy the prod class into the current env
+
}
- catch (FileAlreadyExistsException e) { return; }
+ //catch (FileAlreadyExistsException e) { return; }
catch (IOException e) { throw new Error(e); }
catch (UnsupportedOperationException e) { throw new Error("File system doesn't support symbolic links"); }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment