Author: tfischer
Date: Wed Feb 20 21:00:14 2013
New Revision: 1448409

URL: http://svn.apache.org/r1448409
Log:
Better description of why customProjectPaths is not in a valid state.

Modified:
    
db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/paths/CustomProjectPaths.java

Modified: 
db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/paths/CustomProjectPaths.java
URL: 
http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/paths/CustomProjectPaths.java?rev=1448409&r1=1448408&r2=1448409&view=diff
==============================================================================
--- 
db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/paths/CustomProjectPaths.java
 (original)
+++ 
db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/paths/CustomProjectPaths.java
 Wed Feb 20 21:00:14 2013
@@ -185,11 +185,7 @@ public class CustomProjectPaths implemen
      */
     public File getConfigurationPath()
     {
-        if (!isInit())
-        {
-            throw new IllegalStateException(
-                    "CustomProjectPaths is not initialized");
-        }
+        checkInit();
         return configurationDir;
     }
 
@@ -202,11 +198,7 @@ public class CustomProjectPaths implemen
      */
     public String getConfigurationPackage()
     {
-        if (!isInit())
-        {
-            throw new IllegalStateException(
-                    "CustomProjectPaths is not initialized");
-        }
+        checkInit();
         return configurationPackage;
     }
 
@@ -222,11 +214,7 @@ public class CustomProjectPaths implemen
      */
     public File getDefaultSourcePath()
     {
-        if (!isInit())
-        {
-            throw new IllegalStateException(
-                    "CustomProjectPaths is not initialized");
-        }
+        checkInit();
         return sourceDir;
     }
 
@@ -245,11 +233,7 @@ public class CustomProjectPaths implemen
      */
     public File getOutputDirectory(String outputDirKey)
     {
-        if (!isInit())
-        {
-            throw new IllegalStateException(
-                    "CustomProjectPaths is not initialized");
-        }
+        checkInit();
         File result = outputDirectoryMap.get(outputDirKey);
         if (result == null)
         {
@@ -271,11 +255,7 @@ public class CustomProjectPaths implemen
      */
     public Map<String, File> getOutputDirectoryMap()
     {
-        if (!isInit())
-        {
-            throw new IllegalStateException(
-                    "CustomProjectPaths is not initialized");
-        }
+        checkInit();
         return outputDirectoryMap;
     }
 
@@ -290,27 +270,39 @@ public class CustomProjectPaths implemen
      */
     public File getWorkDirectory()
     {
-        if (!isInit())
-        {
-            throw new IllegalStateException(
-                    "CustomProjectPaths is not initialized");
-        }
+        checkInit();
         return workDir;
     }
 
     /**
-     * returns whether the current settings are valid.
-     *
+     * Checks whether the current settings are valid.
      * It is checked whether all necessary informations are set.
+     * If not, an IllegalStateException is thrown.
      *
-     * @return true if the current settings are valid, false otherwise.
+     * @throws true if the current settings are valid, false otherwise.
      */
-    public boolean isInit()
+    public void checkInit()
     {
-        return (configurationDir != null || configurationPackage != null)
-            && sourceDir != null
-            && outputDirectoryMap.get(null) != null
-            && workDir != null;
+        if (configurationDir == null && configurationPackage == null)
+        {
+            throw new IllegalStateException(
+                "configurationDir or configurationPackage must not be null.");
+        }
+        if (sourceDir == null)
+        {
+            throw new IllegalStateException(
+                "sourceDir must not be null.");
+        }
+        if (outputDirectoryMap.get(null) == null)
+        {
+            throw new IllegalStateException(
+                "default output directory must not be null.");
+        }
+        if (workDir == null)
+        {
+            throw new IllegalStateException(
+                "workDir must not be null.");
+        }
     }
 
     @Override



---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscr...@db.apache.org
For additional commands, e-mail: torque-dev-h...@db.apache.org

Reply via email to