You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ad...@apache.org on 2013/06/02 14:19:59 UTC

svn commit: r1488695 - /ofbiz/trunk/framework/service/src/org/ofbiz/service/config/model/ThreadPool.java

Author: adrianc
Date: Sun Jun  2 12:19:58 2013
New Revision: 1488695

URL: http://svn.apache.org/r1488695
Log:
Improved attribute value validation in ThreadPool.java.

Modified:
    ofbiz/trunk/framework/service/src/org/ofbiz/service/config/model/ThreadPool.java

Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/config/model/ThreadPool.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/config/model/ThreadPool.java?rev=1488695&r1=1488694&r2=1488695&view=diff
==============================================================================
--- ofbiz/trunk/framework/service/src/org/ofbiz/service/config/model/ThreadPool.java (original)
+++ ofbiz/trunk/framework/service/src/org/ofbiz/service/config/model/ThreadPool.java Sun Jun  2 12:19:58 2013
@@ -56,6 +56,9 @@ public final class ThreadPool {
         } else {
             try {
                 this.purgeJobDays = Integer.parseInt(purgeJobDays);
+                if (this.purgeJobDays < 0) {
+                    throw new ServiceConfigException("<thread-pool> element purge-job-days attribute value is invalid");
+                }
             } catch (Exception e) {
                 throw new ServiceConfigException("<thread-pool> element purge-job-days attribute value is invalid");
             }
@@ -66,6 +69,9 @@ public final class ThreadPool {
         } else {
             try {
                 this.failedRetryMin = Integer.parseInt(failedRetryMin);
+                if (this.failedRetryMin < 0) {
+                    throw new ServiceConfigException("<thread-pool> element failed-retry-min attribute value is invalid");
+                }
             } catch (Exception e) {
                 throw new ServiceConfigException("<thread-pool> element failed-retry-min attribute value is invalid");
             }
@@ -76,6 +82,9 @@ public final class ThreadPool {
         } else {
             try {
                 this.ttl = Integer.parseInt(ttl);
+                if (this.ttl < 0) {
+                    throw new ServiceConfigException("<thread-pool> element ttl attribute value is invalid");
+                }
             } catch (Exception e) {
                 throw new ServiceConfigException("<thread-pool> element ttl attribute value is invalid");
             }
@@ -86,6 +95,9 @@ public final class ThreadPool {
         } else {
             try {
                 this.jobs = Integer.parseInt(jobs);
+                if (this.jobs < 1) {
+                    throw new ServiceConfigException("<thread-pool> element jobs attribute value is invalid");
+                }
             } catch (Exception e) {
                 throw new ServiceConfigException("<thread-pool> element jobs attribute value is invalid");
             }
@@ -96,6 +108,9 @@ public final class ThreadPool {
         } else {
             try {
                 this.minThreads = Integer.parseInt(minThreads);
+                if (this.minThreads < 1) {
+                    throw new ServiceConfigException("<thread-pool> element min-threads attribute value is invalid");
+                }
             } catch (Exception e) {
                 throw new ServiceConfigException("<thread-pool> element min-threads attribute value is invalid");
             }
@@ -106,6 +121,9 @@ public final class ThreadPool {
         } else {
             try {
                 this.maxThreads = Integer.parseInt(maxThreads);
+                if (this.maxThreads < this.minThreads) {
+                    throw new ServiceConfigException("<thread-pool> element max-threads attribute value is invalid");
+                }
             } catch (Exception e) {
                 throw new ServiceConfigException("<thread-pool> element max-threads attribute value is invalid");
             }
@@ -117,6 +135,9 @@ public final class ThreadPool {
         } else {
             try {
                 this.pollDbMillis = Integer.parseInt(pollDbMillis);
+                if (this.pollDbMillis < 0) {
+                    throw new ServiceConfigException("<thread-pool> element poll-db-millis attribute value is invalid");
+                }
             } catch (Exception e) {
                 throw new ServiceConfigException("<thread-pool> element poll-db-millis attribute value is invalid");
             }