Sophie

Sophie

distrib > Fedora > 14 > x86_64 > by-pkgid > f454b1c192f4d577558edd61005ee3dc > files > 6

mars-sim-2.84-6.fc14.src.rpm

Replace paths with ones in %_javadir and and FHS compliant ones.
Saintize the classpaths. The xerces-j2 and use of its XMLSerializer
is not strictly needed with OpenJDK, but eliminates an annoying
warning.

Lubomir Rintel (Fedora Astronomy) <lkundrak@fedoraproject.org>

diff -urp mars-sim.orig/org/mars_sim/msp/simulation/mars/RandomMineralMap.java mars-sim/org/mars_sim/msp/simulation/mars/RandomMineralMap.java
--- mars-sim.orig/org/mars_sim/msp/simulation/mars/RandomMineralMap.java	2008-04-17 19:29:10.000000000 +0200
+++ mars-sim/org/mars_sim/msp/simulation/mars/RandomMineralMap.java	2008-07-26 10:03:47.000000000 +0200
@@ -149,7 +149,16 @@ public class RandomMineralMap implements
 	private Set<Coordinates> getTopoRegionSet(String imageMapName) {
 		Set<Coordinates> result = new HashSet<Coordinates>(3000);
 		
-		URL imageMapURL = ClassLoader.getSystemResource("images/" + imageMapName);
+		//URL imageMapURL = ClassLoader.getSystemResource("images/" + imageMapName);
+		URL imageMapURL;
+		try {
+		    imageMapURL = new URL ("file:///usr/share/mars-sim/images/" + imageMapName);
+		} catch (java.net.MalformedURLException e) {
+		    // This can not possibly happen
+		    e.printStackTrace();
+		    System.exit(1);
+		    return result;
+		}
 		ImageIcon mapIcon = new ImageIcon(imageMapURL);
 		Image mapImage = mapIcon.getImage();
 		int[] mapPixels = new int[300 * 150];
diff -urp mars-sim.orig/org/mars_sim/msp/ui/standard/ImageLoader.java mars-sim/org/mars_sim/msp/ui/standard/ImageLoader.java
--- mars-sim.orig/org/mars_sim/msp/ui/standard/ImageLoader.java	2008-02-29 18:04:50.000000000 +0100
+++ mars-sim/org/mars_sim/msp/ui/standard/ImageLoader.java	2008-07-26 10:03:47.000000000 +0200
@@ -48,7 +48,16 @@ public class ImageLoader {
         ImageIcon found = iconCache.get(name);
         if (found == null) {
             String fileName = IMAGE_DIR + name + ".gif";
-            URL resource = ClassLoader.getSystemResource(fileName);
+            //URL resource = ClassLoader.getSystemResource(fileName);
+            URL resource;
+            try {
+                resource = new URL ("file:///usr/share/mars-sim/" + fileName);
+            } catch (java.net.MalformedURLException e) {
+                // This can not possibly happen
+                e.printStackTrace();
+                System.exit(1);
+                return found;
+            }
 
             found = new ImageIcon(resource);
 
@@ -72,11 +81,20 @@ public class ImageLoader {
             if (usedToolkit == null) {
                 usedToolkit = Toolkit.getDefaultToolkit();
             }
-            URL imageURL = ClassLoader.getSystemResource(IMAGE_DIR + imagename);
+            //URL imageURL = ClassLoader.getSystemResource(IMAGE_DIR + imagename);
+            URL imageURL;
+            try {
+                imageURL = new URL ("file:///usr/share/mars-sim/" + IMAGE_DIR + imagename);
+            } catch (java.net.MalformedURLException e) {
+                // This can not possibly happen
+                e.printStackTrace();
+                System.exit(1);
+                return newImage;
+            }
 
             newImage = usedToolkit.createImage(imageURL);
             imageCache.put(imagename, newImage);
         }
         return newImage;
     }
-}
\ No newline at end of file
+}
diff -urp mars-sim.orig/org/mars_sim/msp/ui/standard/sound/SoundConstants.java mars-sim/org/mars_sim/msp/ui/standard/sound/SoundConstants.java
--- mars-sim.orig/org/mars_sim/msp/ui/standard/sound/SoundConstants.java	2008-06-25 06:26:52.000000000 +0200
+++ mars-sim/org/mars_sim/msp/ui/standard/sound/SoundConstants.java	2008-07-26 10:03:47.000000000 +0200
@@ -12,7 +12,7 @@ package org.mars_sim.msp.ui.standard.sou
 public interface SoundConstants {
 	
 	// The root path for sounds.
-	public final static String SOUNDS_ROOT_PATH = "sounds/";
+	public final static String SOUNDS_ROOT_PATH = "/usr/share/mars-sim/sounds/";
 	
 	// Unit window sounds for rovers.
     public final static String SND_ROVER_MOVING = "rover_moving.wav";
diff -urp mars-sim.orig/org/mars_sim/msp/ui/standard/tool/about/AboutWindow.java mars-sim/org/mars_sim/msp/ui/standard/tool/about/AboutWindow.java
--- mars-sim.orig/org/mars_sim/msp/ui/standard/tool/about/AboutWindow.java	2008-06-24 20:33:28.000000000 +0200
+++ mars-sim/org/mars_sim/msp/ui/standard/tool/about/AboutWindow.java	2008-07-26 10:03:47.000000000 +0200
@@ -37,7 +37,8 @@ public class AboutWindow extends ToolWin
     // Data members
     private JViewport viewPort; // The view port for the text pane
     private HTMLContentPane editorPane; // our HTML content pane
-    private URL guideURL = AboutWindow.class.getResource("../../../../../../../docs/help/about.html");
+    //private URL guideURL = AboutWindow.class.getResource("../../../../../../../docs/help/about.html");
+    private URL guideURL;
 
     /** Constructs a TableWindow object
      *  @param desktop the desktop pane
@@ -48,6 +49,14 @@ public class AboutWindow extends ToolWin
         super(NAME, desktop);
         
 
+        try {
+            guideURL = new URL ("file:///usr/share/mars-sim/help/about.html");
+        } catch (java.net.MalformedURLException e) {
+            // This can not possibly happen
+            e.printStackTrace();
+            return;
+        }
+        
     // Create the main panel
     JPanel mainPane = new JPanel(new BorderLayout());
     mainPane.setBorder(new EmptyBorder(5, 5, 5, 5));
@@ -103,4 +112,4 @@ public class AboutWindow extends ToolWin
      */
     public void destroy() {
     }
-}
\ No newline at end of file
+}
diff -urp mars-sim.orig/org/mars_sim/msp/ui/standard/tool/guide/GuideWindow.java mars-sim/org/mars_sim/msp/ui/standard/tool/guide/GuideWindow.java
--- mars-sim.orig/org/mars_sim/msp/ui/standard/tool/guide/GuideWindow.java	2008-06-24 20:34:48.000000000 +0200
+++ mars-sim/org/mars_sim/msp/ui/standard/tool/guide/GuideWindow.java	2008-07-26 10:03:47.000000000 +0200
@@ -43,7 +43,8 @@ public class GuideWindow extends ToolWin
     // Data members
     private JViewport viewPort; // The view port for the text pane
     private HTMLContentPane htmlPane; // our HTML content pane
-    private URL guideURL = GuideWindow.class.getResource("../../../../../../../docs/help/userguide.html");
+    //private URL guideURL = GuideWindow.class.getResource("../../../../../../../docs/help/userguide.html");
+    private URL guideURL;
     private JButton homeButton = new JButton ("Home");
     private JButton backButton = new JButton ("Back");
     private JButton forwardButton = new JButton ("Forward");
@@ -57,6 +58,14 @@ public class GuideWindow extends ToolWin
         // Use TableWindow constructor
         super(NAME, desktop);
         
+        try {
+            guideURL = new URL ("file:///usr/share/mars-sim/help/userguide.html");
+        } catch (java.net.MalformedURLException e) {
+            // This can not possibly happen
+            e.printStackTrace();
+            System.exit(1);
+            return;
+        }
 
     // Create the main panel
     JPanel mainPane = new JPanel(new BorderLayout());
diff -urp mars-sim.orig/org/mars_sim/msp/ui/standard/UIConfig.java mars-sim/org/mars_sim/msp/ui/standard/UIConfig.java
--- mars-sim.orig/org/mars_sim/msp/ui/standard/UIConfig.java	2008-02-17 12:39:36.000000000 +0100
+++ mars-sim/org/mars_sim/msp/ui/standard/UIConfig.java	2008-07-26 10:03:47.000000000 +0200
@@ -33,7 +33,7 @@ import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.NodeList;
 
-import com.sun.org.apache.xml.internal.serialize.XMLSerializer;
+import org.apache.xml.serialize.XMLSerializer;
 
 public class UIConfig {
     
diff -urp mars-sim.orig/scripts/build.xml mars-sim/scripts/build.xml
--- mars-sim.orig/scripts/build.xml	2008-04-09 09:20:38.000000000 +0200
+++ mars-sim/scripts/build.xml	2008-07-26 10:03:47.000000000 +0200
@@ -51,12 +51,21 @@
         <javac srcdir="${mars.src}" destdir="${mars.class}">
             <include name="org/mars_sim/msp/simulation/**/*.java" />
             <classpath>
+<!--
                 <fileset dir="${mars.jars}">
                     <include name="junit.jar" />
                     <include name="plexus-core.jar" />
                     <include name="commons-collections-3.1.jar" />
                     <include name="log4j-1.2.8.jar" />
                 </fileset>
+-->
+                <fileset dir="/usr/share/java">
+                    <include name="plexus-graph.jar" />
+                    <include name="commons-collections.jar" />
+                    <include name="log4j.jar" />
+                    <include name="junit.jar" />
+                    <include name="xerces-j2.jar" />
+                </fileset>
             </classpath>
         </javac>
     </target>
@@ -66,6 +75,7 @@
         <javac srcdir="${mars.src}" destdir="${mars.class}">
             <include name="org/mars_sim/msp/ui/standard/**/*.java" />
             <classpath>
+<!--
                 <fileset dir="${mars.jars}">
                     <include name="jcommon.jar" />
                     <include name="jfreechart.jar" />
@@ -76,6 +86,13 @@
                 	<include name="jorbis-0.0.15.jar" />
                 	<include name="vorbisspi1.0.2.jar" />
                 </fileset>
+-->
+                <fileset dir="/usr/share/java">
+                    <include name="jfreechart/jfreechart.jar" />
+                    <include name="jcommon.jar" />
+                    <include name="xerces-j2.jar" />
+                    <include name="plexus-graph.jar" />
+                </fileset>
             </classpath>
         </javac>
     </target>
@@ -166,6 +183,7 @@
             windowtitle="Mars Simulation Project v 2.84 API Specification"
             doctitle="Mars Simulation Project v 2.84 &lt;br>API Specification"> 
             <classpath>
+<!--
                 <fileset dir="${mars.jars}">
                     <include name="jcommon.jar" />
                     <include name="jfreechart.jar" />
@@ -180,6 +198,16 @@
                 	<include name="jorbis-0.0.15.jar" />
                 	<include name="vorbisspi1.0.2.jar" />
                 </fileset>
+-->
+                <fileset dir="/usr/share/java">
+                    <include name="jfreechart/jfreechart.jar" />
+                    <include name="jcommon.jar" />
+                    <include name="plexus-graph.jar" />
+                    <include name="commons-collections.jar" />
+                    <include name="log4j.jar" />
+                    <include name="junit.jar" />
+                    <include name="xerces-j2.jar" />
+                </fileset>
             </classpath>
         </javadoc>