svn commit: r13623 - trunk/src_new/org/argouml/util/ConfigLoader.java

[email protected]
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: tfmorris
Date: 2007-09-27 07:59:36-0700
New Revision: 13623

Modified:
   trunk/src_new/org/argouml/util/ConfigLoader.java

Log:
Fix logging conditional per dev list email.  Extract magic strings.

Modified: trunk/src_new/org/argouml/util/ConfigLoader.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/util/ConfigLoader.java?view=diff&rev=13623&p1=trunk/src_new/org/argouml/util/ConfigLoader.java&p2=trunk/src_new/org/argouml/util/ConfigLoader.java&r1=13622&r2=13623
==============================================================================
--- trunk/src_new/org/argouml/util/ConfigLoader.java	(original)
+++ trunk/src_new/org/argouml/util/ConfigLoader.java	2007-09-27 07:59:36-0700
@@ -41,7 +41,7 @@
 import org.tigris.swidgets.Orientation;
 
 /**
- * This class loads panel classes according a certain configuration file.
+ * This class loads panel classes specified by a configuration file.
  *
  */
 public class ConfigLoader {
@@ -49,9 +49,8 @@
     private static final Logger LOG =
         Logger.getLogger(ConfigLoader.class);
 
-    ////////////////////////////////////////////////////////////////
-    // static utility functions
-
+    private static final String CONFIG_FILE_PROPERTY = "argo.config";
+    private static final String DEFAULT_CONFIG_FILE = "/org/argouml/argo.ini";
     private static String tabPath = "org.argouml";
     private static Orientation tabPropsOrientation;
 
@@ -87,7 +86,7 @@
 
         InputStream is = null;
 	LineNumberReader lnr = null;
-	String configFile = System.getProperty("argo.config");
+	String configFile = System.getProperty(CONFIG_FILE_PROPERTY);
         //
         //    if property specified
         //
@@ -98,16 +97,16 @@
             }
             catch (FileNotFoundException e) {
                 is = ConfigLoader.class.getResourceAsStream(configFile);
-                if (is != null) {
-                    LOG.info("Value of argo.config (" + configFile
-                        +
-                        ") could not be loaded.\nLoading default configuration."
-                    );
+                if (is == null) {
+                    LOG.info("File specified by argo.config ("
+                            + configFile
+                            + ") could not be loaded.\n" 
+                            + "Loading default configuration.");
                 }
             }
         }
         if (is == null) {
-            configFile = "/org/argouml/argo.ini";
+            configFile = DEFAULT_CONFIG_FILE;
             is = ConfigLoader.class.getResourceAsStream(configFile);
         }
         if (is != null) {
@@ -180,7 +179,9 @@
 					int lineNum, String configFile) {
 	if (line.startsWith("tabpath:")) {
 	    String newPath = stripBeforeColon(line).trim();
-	    if (newPath.length() > 0) tabPath = newPath;
+	    if (newPath.length() > 0) {
+	        tabPath = newPath;
+	    }
 	    return null;
 	}
 	else if (line.startsWith(panelName + ":")) {
@@ -230,4 +231,4 @@
 	return s.substring(colonPos  + 1);
     }
 
-} /* end class ConfigLoader */
+}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.