[FOray-commit] SF.net SVN: foray:[10916] trunk/foray
Modular XSL-FO Implementation for Java.
Status: Alpha
Brought to you by:
victormote
|
From: <vic...@us...> - 2010-02-01 22:42:50
|
Revision: 10916
http://foray.svn.sourceforge.net/foray/?rev=10916&view=rev
Author: victormote
Date: 2010-02-01 22:42:44 +0000 (Mon, 01 Feb 2010)
Log Message:
-----------
Clean up some more weird leftover dependencies.
Modified Paths:
--------------
trunk/foray/foray-app/src/java/org/foray/app/AWTStarter.java
trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoAWTViewer.java
trunk/foray/foray-render/src/java/org/foray/render/awt/viewer/LoadableProperties.java
trunk/foray/foray-render/src/java/org/foray/render/awt/viewer/SecureResourceBundle.java
trunk/foray/foray-render/src/java/org/foray/render/awt/viewer/UserMessage.java
Modified: trunk/foray/foray-app/src/java/org/foray/app/AWTStarter.java
===================================================================
--- trunk/foray/foray-app/src/java/org/foray/app/AWTStarter.java 2010-02-01 22:23:33 UTC (rev 10915)
+++ trunk/foray/foray-app/src/java/org/foray/app/AWTStarter.java 2010-02-01 22:42:44 UTC (rev 10916)
@@ -199,7 +199,7 @@
* @return The secure resource bundle.
*/
private SecureResourceBundle getResourceBundle(final String path) {
- InputStream in = null;
+ SecureResourceBundle bundle = null;
try {
URL url = getClass().getResource(path);
@@ -213,18 +213,15 @@
* uses as default */
modifiedPath = path.substring(0, path.lastIndexOf(".")) + ".en";
url = getClass().getResource(modifiedPath);
- }
-
- in = url.openStream();
+ }
+ final InputStream in = url.openStream();
+ bundle = new SecureResourceBundle(in);
} catch (final IOException ex) {
getLogger().error("Can't find URL to: <" + path + "> "
+ ex.getMessage());
getLogger().error(ex.getMessage());
}
- return new SecureResourceBundle(in, getLogger());
+ return bundle;
}
}
-
-
-
Modified: trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoAWTViewer.java
===================================================================
--- trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoAWTViewer.java 2010-02-01 22:23:33 UTC (rev 10915)
+++ trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoAWTViewer.java 2010-02-01 22:42:44 UTC (rev 10916)
@@ -118,7 +118,7 @@
modifiedPath = path.substring(0, path.lastIndexOf(".")) + ".en";
url = getClass().getResource(modifiedPath);
}
- return new SecureResourceBundle(url.openStream(), getLogger());
+ return new SecureResourceBundle(url.openStream());
}
/**
Modified: trunk/foray/foray-render/src/java/org/foray/render/awt/viewer/LoadableProperties.java
===================================================================
--- trunk/foray/foray-render/src/java/org/foray/render/awt/viewer/LoadableProperties.java 2010-02-01 22:23:33 UTC (rev 10915)
+++ trunk/foray/foray-render/src/java/org/foray/render/awt/viewer/LoadableProperties.java 2010-02-01 22:42:44 UTC (rev 10916)
@@ -47,20 +47,17 @@
*
*/
public class LoadableProperties extends Hashtable<String, String> {
+ /* TODO: This class looks a lot like a parser for a standard java.util.Properties file. Can it be replaced with
+ * that class? */
/** Constant needed for serialization. */
static final long serialVersionUID = 733955308698967466L;
- /** The parent resource bundle. */
- private SecureResourceBundle parent;
-
/**
* Constructor.
- * @param bundle The parent resource bundle.
*/
- public LoadableProperties(final SecureResourceBundle bundle) {
+ public LoadableProperties() {
super();
- this.parent = bundle;
}
/**
@@ -109,9 +106,6 @@
if (index > 0 && str.length() > index) {
return true;
}
- this.parent.getLogger().info(getClass().getName()
- + ": load(): invalid line " + str + "."
- + " Character '=' missed.");
return false;
}
Modified: trunk/foray/foray-render/src/java/org/foray/render/awt/viewer/SecureResourceBundle.java
===================================================================
--- trunk/foray/foray-render/src/java/org/foray/render/awt/viewer/SecureResourceBundle.java 2010-02-01 22:23:33 UTC (rev 10915)
+++ trunk/foray/foray-render/src/java/org/foray/render/awt/viewer/SecureResourceBundle.java 2010-02-01 22:42:44 UTC (rev 10916)
@@ -28,8 +28,6 @@
package org.foray.render.awt.viewer;
-import org.apache.commons.logging.Log;
-
import java.io.IOException;
import java.io.InputStream;
import java.util.Enumeration;
@@ -48,23 +46,15 @@
public class SecureResourceBundle extends ResourceBundle implements Translator {
/** The properties in this bundle. */
- private LoadableProperties lookup = new LoadableProperties(this);
+ private LoadableProperties lookup = new LoadableProperties();
- /** The logger. */
- private Log logger;
-
/**
* Constructor.
* @param in The input stream containing the unparsed resources.
- * @param logger The logger.
+ * @throws IOException For errors reading <code>in</code>.
*/
- public SecureResourceBundle(final InputStream in, final Log logger) {
- this.logger = logger;
- try {
- this.lookup.load(in);
- } catch (final IOException ex) {
- logger.info("Exception caught: " + ex.getMessage());
- }
+ public SecureResourceBundle(final InputStream in) throws IOException {
+ this.lookup.load(in);
}
/**
@@ -98,12 +88,4 @@
return this.lookup.get(key) != null;
}
- /**
- * Returns the logger.
- * @return The logger.
- */
- public Log getLogger() {
- return this.logger;
- }
-
}
Modified: trunk/foray/foray-render/src/java/org/foray/render/awt/viewer/UserMessage.java
===================================================================
--- trunk/foray/foray-render/src/java/org/foray/render/awt/viewer/UserMessage.java 2010-02-01 22:23:33 UTC (rev 10915)
+++ trunk/foray/foray-render/src/java/org/foray/render/awt/viewer/UserMessage.java 2010-02-01 22:42:44 UTC (rev 10916)
@@ -30,6 +30,8 @@
import org.apache.commons.logging.Log;
+import java.io.IOException;
+
import javax.swing.JOptionPane;
/**
@@ -74,7 +76,11 @@
this.res = aRes;
if (this.res == null) {
this.logger.info("UserMessage: setTranslator(null) !");
- this.res = new SecureResourceBundle(null, this.logger);
+ try {
+ this.res = new SecureResourceBundle(null);
+ } catch (final IOException e) {
+ this.res = null;
+ }
}
MessagesDialog.setTranslator(this.res);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|