Author: jleroux
Date: Sat Nov 7 18:14:22 2009
New Revision: 833725
URL: http://svn.apache.org/viewvc?rev=833725&view=rev
Log:
A modified patch from Bob Morley "Resolve java warnings exposed in
Eclipse : framework - entityext"
(https://issues.apache.org/jira/browse/OFBIZ-3108
) - OFBIZ-3108
I replaced 4 while loops by for loops. Doing that I removed the
empty checks. So I also used a FastList in StrungUtile.split() which
I also refactored a bit.
Modified:
ofbiz/trunk/framework/base/src/org/ofbiz/base/util/StringUtil.java
ofbiz/trunk/framework/service/src/org/ofbiz/service/
DispatchContext.java
ofbiz/trunk/framework/service/src/org/ofbiz/service/
ModelPermGroup.java
ofbiz/trunk/framework/service/src/org/ofbiz/service/
ModelPermission.java
ofbiz/trunk/framework/service/src/org/ofbiz/service/
ServiceUtil.java
ofbiz/trunk/framework/service/src/org/ofbiz/service/
ServiceXaWrapper.java
ofbiz/trunk/framework/service/src/org/ofbiz/service/calendar/
ExpressionUiHelper.java
ofbiz/trunk/framework/service/src/org/ofbiz/service/calendar/
RecurrenceRule.java
ofbiz/trunk/framework/service/src/org/ofbiz/service/calendar/
RecurrenceUtil.java
ofbiz/trunk/framework/service/src/org/ofbiz/service/config/
ServiceConfigUtil.java
ofbiz/trunk/framework/service/src/org/ofbiz/service/eca/
ServiceEcaAction.java
ofbiz/trunk/framework/service/src/org/ofbiz/service/engine/
GenericAsyncEngine.java
ofbiz/trunk/framework/service/src/org/ofbiz/service/engine/
GenericEngineFactory.java
ofbiz/trunk/framework/service/src/org/ofbiz/service/engine/
HttpEngine.java
ofbiz/trunk/framework/service/src/org/ofbiz/service/engine/
SOAPClientEngine.java
ofbiz/trunk/framework/service/src/org/ofbiz/service/engine/
StandardJavaEngine.java
ofbiz/trunk/framework/service/src/org/ofbiz/service/group/
GroupModel.java
ofbiz/trunk/framework/service/src/org/ofbiz/service/group/
ServiceGroupReader.java
ofbiz/trunk/framework/service/src/org/ofbiz/service/jms/
JmsListenerFactory.java
ofbiz/trunk/framework/service/src/org/ofbiz/service/jms/
JmsServiceEngine.java
ofbiz/trunk/framework/service/src/org/ofbiz/service/job/
AbstractJob.java
ofbiz/trunk/framework/service/src/org/ofbiz/service/mail/
ServiceMcaRule.java
ofbiz/trunk/framework/service/src/org/ofbiz/service/mail/
ServiceMcaUtil.java
ofbiz/trunk/framework/service/src/org/ofbiz/service/rmi/socket/
ssl/SSLServerSocketFactory.java
ofbiz/trunk/framework/service/src/org/ofbiz/service/semaphore/
ServiceSemaphore.java
Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/
StringUtil.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/StringUtil.java?rev=833725&r1=833724&r2=833725&view=diff
=
=
=
=
=
=
=
=
======================================================================
--- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/
StringUtil.java (original)
+++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/
StringUtil.java Sat Nov 7 18:14:22 2009
@@ -181,16 +181,19 @@
* @return a list of Strings
*/
public static List<String> split(String str, String delim) {
- List<String> splitList = null;
+ List<String> splitList = FastList.newInstance();
StringTokenizer st = null;
- if (str == null)
+ if (str == null) {
return splitList;
+ }
- if (delim != null)
+ if (delim != null) {
st = new StringTokenizer(str, delim);
- else
+ }
+ else {
st = new StringTokenizer(str);
+ }
if (st != null && st.hasMoreTokens()) {
splitList = FastList.newInstance();
Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/
DispatchContext.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/DispatchContext.java?rev=833725&r1=833724&r2=833725&view=diff
=
=
=
=
=
=
=
=
======================================================================
--- ofbiz/trunk/framework/service/src/org/ofbiz/service/
DispatchContext.java (original)
+++ ofbiz/trunk/framework/service/src/org/ofbiz/service/
DispatchContext.java Sat Nov 7 18:14:22 2009
@@ -21,11 +21,10 @@
import java.io.Serializable;
import java.net.URL;
import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeSet;
+
import javax.wsdl.WSDLException;
import javolution.util.FastMap;
@@ -42,7 +41,6 @@
import org.ofbiz.security.authz.Authorization;
import org.ofbiz.service.config.ServiceConfigUtil;
import org.ofbiz.service.eca.ServiceEcaUtil;
-
import org.w3c.dom.Document;
import org.w3c.dom.Element;
Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/
ModelPermGroup.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelPermGroup.java?rev=833725&r1=833724&r2=833725&view=diff
=
=
=
=
=
=
=
=
======================================================================
--- ofbiz/trunk/framework/service/src/org/ofbiz/service/
ModelPermGroup.java (original)
+++ ofbiz/trunk/framework/service/src/org/ofbiz/service/
ModelPermGroup.java Sat Nov 7 18:14:22 2009
@@ -18,11 +18,10 @@
*******************************************************************************/
package org.ofbiz.service;
-import java.util.List;
-import java.util.Iterator;
+import java.io.Serializable;
import java.util.LinkedList;
+import java.util.List;
import java.util.Map;
-import java.io.Serializable;
/**
* Service Permission Group Model Class
Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/
ModelPermission.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelPermission.java?rev=833725&r1=833724&r2=833725&view=diff
=
=
=
=
=
=
=
=
======================================================================
--- ofbiz/trunk/framework/service/src/org/ofbiz/service/
ModelPermission.java (original)
+++ ofbiz/trunk/framework/service/src/org/ofbiz/service/
ModelPermission.java Sat Nov 7 18:14:22 2009
@@ -25,7 +25,6 @@
import org.ofbiz.base.util.Debug;
import org.ofbiz.base.util.UtilValidate;
import org.ofbiz.entity.Delegator;
-import org.ofbiz.entity.GenericEntityException;
import org.ofbiz.entity.GenericValue;
import org.ofbiz.entity.util.EntityUtil;
import org.ofbiz.security.Security;
Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/
ServiceUtil.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceUtil.java?rev=833725&r1=833724&r2=833725&view=diff
=
=
=
=
=
=
=
=
======================================================================
--- ofbiz/trunk/framework/service/src/org/ofbiz/service/
ServiceUtil.java (original)
+++ ofbiz/trunk/framework/service/src/org/ofbiz/service/
ServiceUtil.java Sat Nov 7 18:14:22 2009
@@ -163,7 +163,7 @@
/** A small routine used all over to improve code efficiency,
make a result map with the message and the success response code */
public static Map<String, Object> returnSuccess(List<String>
successMessageList) {
- Map result = returnMessage(ModelService.RESPOND_SUCCESS,
null);
+ Map<String, Object> result =
returnMessage(ModelService.RESPOND_SUCCESS, null);
result.put(ModelService.SUCCESS_MESSAGE_LIST,
successMessageList);
return result;
}
Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/
ServiceXaWrapper.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceXaWrapper.java?rev=833725&r1=833724&r2=833725&view=diff
=
=
=
=
=
=
=
=
======================================================================
--- ofbiz/trunk/framework/service/src/org/ofbiz/service/
ServiceXaWrapper.java (original)
+++ ofbiz/trunk/framework/service/src/org/ofbiz/service/
ServiceXaWrapper.java Sat Nov 7 18:14:22 2009
@@ -140,7 +140,7 @@
/**
* @return The context used when running the rollback() service
*/
- public Map getRollbackContext() {
+ public Map<String, ? extends Object> getRollbackContext() {
return this.rollbackContext;
}
Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/
calendar/ExpressionUiHelper.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/calendar/ExpressionUiHelper.java?rev=833725&r1=833724&r2=833725&view=diff
=
=
=
=
=
=
=
=
======================================================================
--- ofbiz/trunk/framework/service/src/org/ofbiz/service/calendar/
ExpressionUiHelper.java (original)
+++ ofbiz/trunk/framework/service/src/org/ofbiz/service/calendar/
ExpressionUiHelper.java Sat Nov 7 18:14:22 2009
@@ -44,7 +44,7 @@
/** Returns a List of valid DayInMonth occurrence int values.
* @return
*/
- public static List getOccurrenceList() {
+ public static List<?> getOccurrenceList() {
return Arrays.asList(Occurrence);
}
@@ -53,13 +53,13 @@
* @return List of Maps. Each Map has a
* <code>description</code> entry and a <code>value</code> entry.
*/
- public static List<Map> getDayValueList(Locale locale) {
+ public static List<Map<String, Object>> getDayValueList(Locale
locale) {
Calendar tempCal = Calendar.getInstance(locale);
tempCal.set(Calendar.DAY_OF_WEEK,
tempCal.getFirstDayOfWeek());
SimpleDateFormat dateFormat = new SimpleDateFormat("EEEE",
locale);
- List<Map> result = new ArrayList<Map>(7);
+ List<Map<String, Object>> result = new
ArrayList<Map<String, Object>>(7);
for (int i = 0; i < 7; i++) {
- result.add(UtilMisc.toMap("description",
dateFormat.format(tempCal.getTime()), "value", new
Integer(tempCal.get(Calendar.DAY_OF_WEEK))));
+ result.add(UtilMisc.toMap("description",
(Object)dateFormat.format(tempCal.getTime()), "value", new
Integer(tempCal.get(Calendar.DAY_OF_WEEK))));
tempCal.roll(Calendar.DAY_OF_WEEK, 1);
}
return result;
@@ -90,13 +90,13 @@
* @return List of Maps. Each Map has a
* <code>description</code> entry and a <code>value</code> entry.
*/
- public static List<Map> getMonthValueList(Locale locale) {
+ public static List<Map<String, Object>>
getMonthValueList(Locale locale) {
Calendar tempCal = Calendar.getInstance(locale);
tempCal.set(Calendar.MONTH, Calendar.JANUARY);
SimpleDateFormat dateFormat = new SimpleDateFormat("MMMM",
locale);
- List<Map> result = new ArrayList<Map>(13);
+ List<Map<String, Object>> result = new
ArrayList<Map<String, Object>>(13);
for (int i = Calendar.JANUARY; i <=
tempCal.getActualMaximum(Calendar.MONTH); i++) {
- result.add(UtilMisc.toMap("description",
dateFormat.format(tempCal.getTime()), "value", new Integer(i)));
+ result.add(UtilMisc.toMap("description",
(Object)dateFormat.format(tempCal.getTime()), "value", new
Integer(i)));
tempCal.roll(Calendar.MONTH, 1);
}
return result;
@@ -107,8 +107,8 @@
* @return List of Maps. Each Map has a
* <code>description</code> entry and a <code>value</code> entry.
*/
- public static List<Map> getFrequencyValueList(Map<String,
Object> uiLabelMap) {
- List<Map> result = new ArrayList<Map>(6);
+ public static List<Map<String, Object>>
getFrequencyValueList(Map<String, Object> uiLabelMap) {
+ List<Map<String, Object>> result = new
ArrayList<Map<String, Object>>(6);
result.add(UtilMisc.toMap("description",
uiLabelMap.get("CommonSecond"), "value", new
Integer(Calendar.SECOND)));
result.add(UtilMisc.toMap("description",
uiLabelMap.get("CommonMinute"), "value", new
Integer(Calendar.MINUTE)));
result.add(UtilMisc.toMap("description",
uiLabelMap.get("CommonHour"), "value", new
Integer(Calendar.HOUR_OF_DAY)));
@@ -123,9 +123,9 @@
* @return List of Maps. Each Map has a
* <code>description</code> entry and a <code>value</code> entry.
*/
- public static List<Map> getExpressionTypeList(Map<String,
Object> uiLabelMap) {
+ public static List<Map<String, Object>>
getExpressionTypeList(Map<String, Object> uiLabelMap) {
int listSize =
TemporalExpressionWorker.ExpressionTypeList.length;
- List<Map> result = new ArrayList<Map>(listSize);
+ List<Map<String, Object>> result = new
ArrayList<Map<String, Object>>(listSize);
for (int i = 0; i < listSize; i++) {
String exprType =
TemporalExpressionWorker.ExpressionTypeList[i];
result.add(UtilMisc.toMap("description",
uiLabelMap.get("TemporalExpression_" + exprType), "value", exprType));
Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/
calendar/RecurrenceRule.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/calendar/RecurrenceRule.java?rev=833725&r1=833724&r2=833725&view=diff
=
=
=
=
=
=
=
=
======================================================================
--- ofbiz/trunk/framework/service/src/org/ofbiz/service/calendar/
RecurrenceRule.java (original)
+++ ofbiz/trunk/framework/service/src/org/ofbiz/service/calendar/
RecurrenceRule.java Sat Nov 7 18:14:22 2009
@@ -19,9 +19,7 @@
package org.ofbiz.service.calendar;
import java.util.Arrays;
-import com.ibm.icu.util.Calendar;
import java.util.Date;
-import java.util.Iterator;
import java.util.List;
import org.ofbiz.base.util.Debug;
@@ -31,6 +29,8 @@
import org.ofbiz.entity.GenericEntityException;
import org.ofbiz.entity.GenericValue;
+import com.ibm.icu.util.Calendar;
+
/**
* Recurrence Rule Object
*/
@@ -88,15 +88,15 @@
// **********************
// * Parsed byXXX lists
// **********************
- protected List bySecondList;
- protected List byMinuteList;
- protected List byHourList;
- protected List byDayList;
- protected List byMonthDayList;
- protected List byYearDayList;
- protected List byWeekNoList;
- protected List byMonthList;
- protected List bySetPosList;
+ protected List<String> bySecondList;
+ protected List<String> byMinuteList;
+ protected List<String> byHourList;
+ protected List<String> byDayList;
+ protected List<String> byMonthDayList;
+ protected List<String> byYearDayList;
+ protected List<String> byWeekNoList;
+ protected List<String> byMonthList;
+ protected List<String> bySetPosList;
/**
* Creates a new RecurrenceRule object from a RecurrenceInfo
entity.
@@ -501,169 +501,148 @@
if (!
byHourList.contains(String.valueOf(cal.get(Calendar.HOUR_OF_DAY))))
return false;
}
- if (UtilValidate.isNotEmpty(byDayList)) {
- Iterator iter = byDayList.iterator();
- boolean foundDay = false;
-
- while (iter.hasNext() && !foundDay) {
- String dayRule = (String) iter.next();
- String dayString = getDailyString(dayRule);
-
- if (cal.get(Calendar.DAY_OF_WEEK) ==
getCalendarDay(dayString)) {
- if ((hasNumber(dayRule)) && (getFrequency() ==
MONTHLY || getFrequency() == YEARLY)) {
- int modifier = getDailyNumber(dayRule);
-
- if (modifier == 0)
- foundDay = true;
-
- if (getFrequency() == MONTHLY) {
- // figure if we are the nth xDAY if
this month
- int currentPos =
cal.get(Calendar.WEEK_OF_MONTH);
- int dayPosCalc =
cal.get(Calendar.DAY_OF_MONTH) - ((currentPos - 1) * 7);
-
- if (dayPosCalc < 1)
- currentPos--;
- if (modifier > 0) {
- if (currentPos == modifier) {
- foundDay = true;
- }
- } else if (modifier < 0) {
- int maxDay =
cal.getActualMaximum(Calendar.DAY_OF_MONTH);
- int firstDay = dayPosCalc > 0 ?
dayPosCalc : dayPosCalc + 7;
- int totalDay = ((maxDay -
firstDay) / 7) + 1;
- int thisDiff = (currentPos -
totalDay) - 1;
-
- if (thisDiff == modifier) {
- foundDay = true;
- }
+ boolean foundDay = false;
+ for (String dayRule : byDayList) {
+ String dayString = getDailyString(dayRule);
+
+ if (cal.get(Calendar.DAY_OF_WEEK) ==
getCalendarDay(dayString)) {
+ if ((hasNumber(dayRule)) && (getFrequency() ==
MONTHLY || getFrequency() == YEARLY)) {
+ int modifier = getDailyNumber(dayRule);
+
+ if (modifier == 0)
+ foundDay = true;
+
+ if (getFrequency() == MONTHLY) {
+ // figure if we are the nth xDAY if this
month
+ int currentPos =
cal.get(Calendar.WEEK_OF_MONTH);
+ int dayPosCalc =
cal.get(Calendar.DAY_OF_MONTH) - ((currentPos - 1) * 7);
+
+ if (dayPosCalc < 1)
+ currentPos--;
+ if (modifier > 0) {
+ if (currentPos == modifier) {
+ foundDay = true;
}
- } else if (getFrequency() == YEARLY) {
- // figure if we are the nth xDAY if
this year
- int currentPos =
cal.get(Calendar.WEEK_OF_YEAR);
- int dayPosCalc =
cal.get(Calendar.DAY_OF_YEAR) - ((currentPos - 1) * 7);
+ } else if (modifier < 0) {
+ int maxDay =
cal.getActualMaximum(Calendar.DAY_OF_MONTH);
+ int firstDay = dayPosCalc > 0 ?
dayPosCalc : dayPosCalc + 7;
+ int totalDay = ((maxDay - firstDay) /
7) + 1;
+ int thisDiff = (currentPos - totalDay)
- 1;
- if (dayPosCalc < 1) {
- currentPos--;
+ if (thisDiff == modifier) {
+ foundDay = true;
}
- if (modifier > 0) {
- if (currentPos == modifier) {
- foundDay = true;
- }
- } else if (modifier < 0) {
- int maxDay =
cal.getActualMaximum(Calendar.DAY_OF_YEAR);
- int firstDay = dayPosCalc > 0 ?
dayPosCalc : dayPosCalc + 7;
- int totalDay = ((maxDay -
firstDay) / 7) + 1;
- int thisDiff = (currentPos -
totalDay) - 1;
-
- if (thisDiff == modifier) {
- foundDay = true;
- }
+ }
+ } else if (getFrequency() == YEARLY) {
+ // figure if we are the nth xDAY if this year
+ int currentPos =
cal.get(Calendar.WEEK_OF_YEAR);
+ int dayPosCalc =
cal.get(Calendar.DAY_OF_YEAR) - ((currentPos - 1) * 7);
+
+ if (dayPosCalc < 1) {
+ currentPos--;
+ }
+ if (modifier > 0) {
+ if (currentPos == modifier) {
+ foundDay = true;
+ }
+ } else if (modifier < 0) {
+ int maxDay =
cal.getActualMaximum(Calendar.DAY_OF_YEAR);
+ int firstDay = dayPosCalc > 0 ?
dayPosCalc : dayPosCalc + 7;
+ int totalDay = ((maxDay - firstDay) /
7) + 1;
+ int thisDiff = (currentPos - totalDay)
- 1;
+
+ if (thisDiff == modifier) {
+ foundDay = true;
}
}
- } else {
- // we are a DOW only rule
- foundDay = true;
}
+ } else {
+ // we are a DOW only rule
+ foundDay = true;
}
}
- if (!foundDay) {
- return false;
- }
}
- if (UtilValidate.isNotEmpty(byMonthDayList)) {
- Iterator iter = byMonthDayList.iterator();
- boolean foundDay = false;
-
- while (iter.hasNext() && !foundDay) {
- int day = 0;
- String dayStr = (String) iter.next();
-
- try {
- day = Integer.parseInt(dayStr);
- } catch (NumberFormatException nfe) {
- Debug.logError(nfe, "Error parsing day string "
+ dayStr + ": " + nfe.toString(), module);
- }
- int maxDay =
cal.getActualMaximum(Calendar.DAY_OF_MONTH);
- int currentDay = cal.get(Calendar.DAY_OF_MONTH);
+ if (!foundDay) {
+ return false;
+ }
+
+ foundDay = false;
+ for (String dayStr : byMonthDayList) {
+ int day = 0;
+ try {
+ day = Integer.parseInt(dayStr);
+ } catch (NumberFormatException nfe) {
+ Debug.logError(nfe, "Error parsing day string " +
dayStr + ": " + nfe.toString(), module);
+ }
+ int maxDay = cal.getActualMaximum(Calendar.DAY_OF_MONTH);
+ int currentDay = cal.get(Calendar.DAY_OF_MONTH);
- if (day > 0 && day == currentDay) {
- foundDay = true;
- }
- if (day < 0 && day == ((currentDay - maxDay) - 1)) {
- foundDay = true;
- }
+ if (day > 0 && day == currentDay) {
+ foundDay = true;
}
- if (!foundDay) {
- return false;
+ if (day < 0 && day == ((currentDay - maxDay) - 1)) {
+ foundDay = true;
}
}
- if (UtilValidate.isNotEmpty(byYearDayList)) {
- Iterator iter = byYearDayList.iterator();
- boolean foundDay = false;
-
- while (iter.hasNext() && !foundDay) {
- int day = 0;
- String dayStr = (String) iter.next();
-
- try {
- day = Integer.parseInt(dayStr);
- } catch (NumberFormatException nfe) {
- Debug.logError(nfe, "Error parsing day string "
+ dayStr + ": " + nfe.toString(), module);
- }
- int maxDay =
cal.getActualMaximum(Calendar.DAY_OF_YEAR);
- int currentDay = cal.get(Calendar.DAY_OF_YEAR);
+ if (!foundDay) {
+ return false;
+ }
- if (day > 0 && day == currentDay)
- foundDay = true;
- if (day < 0 && day == ((currentDay - maxDay) - 1))
- foundDay = true;
+ foundDay = false;
+ for(String dayStr : byYearDayList) {
+ int day = 0;
+ try {
+ day = Integer.parseInt(dayStr);
+ } catch (NumberFormatException nfe) {
+ Debug.logError(nfe, "Error parsing day string " +
dayStr + ": " + nfe.toString(), module);
}
- if (!foundDay)
- return false;
+ int maxDay = cal.getActualMaximum(Calendar.DAY_OF_YEAR);
+ int currentDay = cal.get(Calendar.DAY_OF_YEAR);
+
+ if (day > 0 && day == currentDay)
+ foundDay = true;
+ if (day < 0 && day == ((currentDay - maxDay) - 1))
+ foundDay = true;
}
- if (UtilValidate.isNotEmpty(byWeekNoList)) {
- Iterator iter = byWeekNoList.iterator();
- boolean foundWeek = false;
-
- while (iter.hasNext() && !foundWeek) {
- int week = 0;
- String weekStr = (String) iter.next();
-
- try {
- week = Integer.parseInt(weekStr);
- } catch (NumberFormatException nfe) {
- Debug.logError(nfe, "Error parsing week string
" + weekStr + ": " + nfe.toString(), module);
- }
- int maxWeek =
cal.getActualMaximum(Calendar.WEEK_OF_YEAR);
- int currentWeek = cal.get(Calendar.WEEK_OF_YEAR);
+ if (!foundDay) {
+ return false;
+ }
+
+ boolean foundWeek = false;
- if (week > 0 && week == currentWeek)
- foundWeek = true;
- if (week < 0 && week == ((currentWeek - maxWeek) -
1))
- foundWeek = true;
+ for (String weekStr : byWeekNoList) {
+ int week = 0;
+ try {
+ week = Integer.parseInt(weekStr);
+ } catch (NumberFormatException nfe) {
+ Debug.logError(nfe, "Error parsing week string " +
weekStr + ": " + nfe.toString(), module);
}
- if (!foundWeek)
- return false;
+ int maxWeek =
cal.getActualMaximum(Calendar.WEEK_OF_YEAR);
+ int currentWeek = cal.get(Calendar.WEEK_OF_YEAR);
+
+ if (week > 0 && week == currentWeek)
+ foundWeek = true;
+ if (week < 0 && week == ((currentWeek - maxWeek) - 1))
+ foundWeek = true;
}
- if (UtilValidate.isNotEmpty(byMonthList)) {
- Iterator iter = byMonthList.iterator();
- boolean foundMonth = false;
-
- while (iter.hasNext() && !foundMonth) {
- int month = 0;
- String monthStr = (String) iter.next();
-
- try {
- month = Integer.parseInt(monthStr);
- } catch (NumberFormatException nfe) {
- Debug.logError(nfe, "Error parsing month string
" + monthStr + ": " + nfe.toString(), module);
- }
- if (month == cal.get(Calendar.MONTH)) {
- foundMonth = true;
- }
+ if (!foundWeek) {
+ return false;
+ }
+
+ boolean foundMonth = false;
+ for (String monthStr : byMonthList) {
+ int month = 0;
+ try {
+ month = Integer.parseInt(monthStr);
+ } catch (NumberFormatException nfe) {
+ Debug.logError(nfe, "Error parsing month string " +
monthStr + ": " + nfe.toString(), module);
}
- if (!foundMonth)
- return false;
+ if (month == cal.get(Calendar.MONTH)) {
+ foundMonth = true;
+ }
+ }
+ if (!foundMonth) {
+ return false;
}
return true;
@@ -672,7 +651,7 @@
// Tests a string for the contents of a number at the beginning
private boolean hasNumber(String str) {
String list[] = {"+", "-", "1", "2", "3", "4", "5", "6",
"7", "8", "9", "0"};
- List numberList = Arrays.asList(list);
+ List<String> numberList = Arrays.asList(list);
String firstChar = str.substring(0, 1);
if (numberList.contains(firstChar))
Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/
calendar/RecurrenceUtil.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/calendar/RecurrenceUtil.java?rev=833725&r1=833724&r2=833725&view=diff
=
=
=
=
=
=
=
=
======================================================================
--- ofbiz/trunk/framework/service/src/org/ofbiz/service/calendar/
RecurrenceUtil.java (original)
+++ ofbiz/trunk/framework/service/src/org/ofbiz/service/calendar/
RecurrenceUtil.java Sat Nov 7 18:14:22 2009
@@ -21,11 +21,11 @@
import java.text.ParsePosition;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
-import com.ibm.icu.util.Calendar;
import java.util.Date;
-import java.util.Iterator;
import java.util.List;
+import com.ibm.icu.util.Calendar;
+
/**
* Recurrence Utilities
*/
Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/config/
ServiceConfigUtil.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/config/ServiceConfigUtil.java?rev=833725&r1=833724&r2=833725&view=diff
=
=
=
=
=
=
=
=
======================================================================
--- ofbiz/trunk/framework/service/src/org/ofbiz/service/config/
ServiceConfigUtil.java (original)
+++ ofbiz/trunk/framework/service/src/org/ofbiz/service/config/
ServiceConfigUtil.java Sat Nov 7 18:14:22 2009
@@ -18,10 +18,9 @@
*******************************************************************************/
package org.ofbiz.service.config;
-import java.util.Iterator;
+import java.io.Serializable;
import java.util.List;
import java.util.Map;
-import java.io.Serializable;
import javolution.util.FastList;
import javolution.util.FastMap;
Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/eca/
ServiceEcaAction.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/eca/ServiceEcaAction.java?rev=833725&r1=833724&r2=833725&view=diff
=
=
=
=
=
=
=
=
======================================================================
--- ofbiz/trunk/framework/service/src/org/ofbiz/service/eca/
ServiceEcaAction.java (original)
+++ ofbiz/trunk/framework/service/src/org/ofbiz/service/eca/
ServiceEcaAction.java Sat Nov 7 18:14:22 2009
@@ -18,21 +18,23 @@
*******************************************************************************/
package org.ofbiz.service.eca;
-import java.util.*;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
import javax.transaction.xa.XAException;
import javolution.util.FastMap;
+import org.ofbiz.base.util.Debug;
import org.ofbiz.base.util.UtilGenerics;
-import org.ofbiz.base.util.UtilMisc;
import org.ofbiz.base.util.UtilValidate;
-import org.ofbiz.base.util.Debug;
import org.ofbiz.service.DispatchContext;
import org.ofbiz.service.GenericServiceException;
import org.ofbiz.service.LocalDispatcher;
import org.ofbiz.service.ModelService;
-import org.ofbiz.service.ServiceXaWrapper;
import org.ofbiz.service.ServiceUtil;
+import org.ofbiz.service.ServiceXaWrapper;
import org.w3c.dom.Element;
/**
Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/engine/
GenericAsyncEngine.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/engine/GenericAsyncEngine.java?rev=833725&r1=833724&r2=833725&view=diff
=
=
=
=
=
=
=
=
======================================================================
--- ofbiz/trunk/framework/service/src/org/ofbiz/service/engine/
GenericAsyncEngine.java (original)
+++ ofbiz/trunk/framework/service/src/org/ofbiz/service/engine/
GenericAsyncEngine.java Sat Nov 7 18:14:22 2009
@@ -21,8 +21,6 @@
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Date;
-import java.util.LinkedList;
-import java.util.List;
import java.util.Map;
import org.ofbiz.base.util.Debug;
@@ -41,8 +39,8 @@
import org.ofbiz.service.config.ServiceConfigUtil;
import org.ofbiz.service.job.GenericServiceJob;
import org.ofbiz.service.job.Job;
-import org.ofbiz.service.job.JobManagerException;
import org.ofbiz.service.job.JobManager;
+import org.ofbiz.service.job.JobManagerException;
/**
* Generic Asynchronous Engine
Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/engine/
GenericEngineFactory.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/engine/GenericEngineFactory.java?rev=833725&r1=833724&r2=833725&view=diff
=
=
=
=
=
=
=
=
======================================================================
--- ofbiz/trunk/framework/service/src/org/ofbiz/service/engine/
GenericEngineFactory.java (original)
+++ ofbiz/trunk/framework/service/src/org/ofbiz/service/engine/
GenericEngineFactory.java Sat Nov 7 18:14:22 2009
@@ -27,6 +27,7 @@
import org.ofbiz.service.GenericServiceException;
import org.ofbiz.service.ServiceDispatcher;
import org.ofbiz.service.config.ServiceConfigUtil;
+import org.ofbiz.base.util.UtilGenerics;
import org.ofbiz.base.util.UtilXml;
import org.w3c.dom.Element;
@@ -73,8 +74,8 @@
try {
ClassLoader loader =
Thread.currentThread().getContextClassLoader();
Class<?> c = loader.loadClass(className);
- Constructor cn =
c.getConstructor(ServiceDispatcher.class);
- engine = (GenericEngine)
cn.newInstance(dispatcher);
+ Constructor<GenericEngine> cn =
UtilGenerics.cast(c.getConstructor(ServiceDispatcher.class));
+ engine = cn.newInstance(dispatcher);
} catch (Exception e) {
throw new
GenericServiceException(e.getMessage(), e);
}
Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/engine/
HttpEngine.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/engine/HttpEngine.java?rev=833725&r1=833724&r2=833725&view=diff
=
=
=
=
=
=
=
=
======================================================================
--- ofbiz/trunk/framework/service/src/org/ofbiz/service/engine/
HttpEngine.java (original)
+++ ofbiz/trunk/framework/service/src/org/ofbiz/service/engine/
HttpEngine.java Sat Nov 7 18:14:22 2009
@@ -98,7 +98,7 @@
*/
@Override
public void runSyncIgnore(String localName, ModelService
modelService, Map<String, Object> context) throws
GenericServiceException {
- Map<String, Object> result = runSync(localName,
modelService, context);
+ runSync(localName, modelService, context);
}
/**
Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/engine/
SOAPClientEngine.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/engine/SOAPClientEngine.java?rev=833725&r1=833724&r2=833725&view=diff
=
=
=
=
=
=
=
=
======================================================================
--- ofbiz/trunk/framework/service/src/org/ofbiz/service/engine/
SOAPClientEngine.java (original)
+++ ofbiz/trunk/framework/service/src/org/ofbiz/service/engine/
SOAPClientEngine.java Sat Nov 7 18:14:22 2009
@@ -151,17 +151,14 @@
Map<String, Object> mRet = FastMap.newInstance();
try {
SOAPEnvelope resEnv = respMessage.getSOAPEnvelope();
- List bodies = resEnv.getBodyElements();
- Iterator i = bodies.iterator();
+ Iterator<?> i = resEnv.getBodyElements().iterator();
while (i.hasNext()) {
Object o = i.next();
if (o instanceof RPCElement) {
RPCElement body = (RPCElement) o;
- List params = null;
- params = body.getParams();
-
- Iterator p = params.iterator();
+
+ Iterator<?> p = body.getParams().iterator();
while (p.hasNext()) {
RPCParam param = (RPCParam) p.next();
mRet.put(param.getName(), param.getValue());
Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/engine/
StandardJavaEngine.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/engine/StandardJavaEngine.java?rev=833725&r1=833724&r2=833725&view=diff
=
=
=
=
=
=
=
=
======================================================================
--- ofbiz/trunk/framework/service/src/org/ofbiz/service/engine/
StandardJavaEngine.java (original)
+++ ofbiz/trunk/framework/service/src/org/ofbiz/service/engine/
StandardJavaEngine.java Sat Nov 7 18:14:22 2009
@@ -46,7 +46,7 @@
*/
@Override
public void runSyncIgnore(String localName, ModelService
modelService, Map<String, Object> context) throws
GenericServiceException {
- Map result = runSync(localName, modelService, context);
+ runSync(localName, modelService, context);
}
/**
Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/group/
GroupModel.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/group/GroupModel.java?rev=833725&r1=833724&r2=833725&view=diff
=
=
=
=
=
=
=
=
======================================================================
--- ofbiz/trunk/framework/service/src/org/ofbiz/service/group/
GroupModel.java (original)
+++ ofbiz/trunk/framework/service/src/org/ofbiz/service/group/
GroupModel.java Sat Nov 7 18:14:22 2009
@@ -18,7 +18,6 @@
*******************************************************************************/
package org.ofbiz.service.group;
-import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
@@ -31,7 +30,6 @@
import org.ofbiz.service.GenericServiceException;
import org.ofbiz.service.ServiceDispatcher;
import org.ofbiz.service.ServiceUtil;
-
import org.w3c.dom.Element;
/**
@@ -111,6 +109,9 @@
public List<GroupServiceModel> getServices() {
return this.services;
}
+ public boolean isOptional() {
+ return optional;
+ }
/**
* Invokes the group of services in order defined
Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/group/
ServiceGroupReader.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/group/ServiceGroupReader.java?rev=833725&r1=833724&r2=833725&view=diff
=
=
=
=
=
=
=
=
======================================================================
--- ofbiz/trunk/framework/service/src/org/ofbiz/service/group/
ServiceGroupReader.java (original)
+++ ofbiz/trunk/framework/service/src/org/ofbiz/service/group/
ServiceGroupReader.java Sat Nov 7 18:14:22 2009
@@ -18,8 +18,6 @@
*******************************************************************************/
package org.ofbiz.service.group;
-import java.util.Iterator;
-import java.util.List;
import java.util.Map;
import javolution.util.FastMap;
Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/jms/
JmsListenerFactory.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/jms/JmsListenerFactory.java?rev=833725&r1=833724&r2=833725&view=diff
=
=
=
=
=
=
=
=
======================================================================
--- ofbiz/trunk/framework/service/src/org/ofbiz/service/jms/
JmsListenerFactory.java (original)
+++ ofbiz/trunk/framework/service/src/org/ofbiz/service/jms/
JmsListenerFactory.java Sat Nov 7 18:14:22 2009
@@ -19,19 +19,17 @@
package org.ofbiz.service.jms;
import java.lang.reflect.Constructor;
-import java.util.Iterator;
-import java.util.List;
import java.util.Map;
-import java.util.Set;
import javolution.util.FastMap;
-import org.ofbiz.service.GenericServiceException;
-import org.ofbiz.service.ServiceDispatcher;
-import org.ofbiz.service.config.ServiceConfigUtil;
import org.ofbiz.base.util.Debug;
+import org.ofbiz.base.util.UtilGenerics;
import org.ofbiz.base.util.UtilMisc;
import org.ofbiz.base.util.UtilXml;
+import org.ofbiz.service.GenericServiceException;
+import org.ofbiz.service.ServiceDispatcher;
+import org.ofbiz.service.config.ServiceConfigUtil;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
@@ -144,9 +142,9 @@
try {
Class<?> c = cl.loadClass(className);
- Constructor cn =
c.getConstructor(ServiceDispatcher.class, String.class,
String.class, String.class, String.class, String.class);
+ Constructor<GenericMessageListener> cn =
UtilGenerics.cast(c.getConstructor(ServiceDispatcher.class,
String.class, String.class, String.class, String.class,
String.class));
- listener = (GenericMessageListener)
cn.newInstance(dispatcher, serverName, jndiName, queueName,
userName, password);
+ listener = cn.newInstance(dispatcher,
serverName, jndiName, queueName, userName, password);
} catch (Exception e) {
throw new
GenericServiceException(e.getMessage(), e);
}
Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/jms/
JmsServiceEngine.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/jms/JmsServiceEngine.java?rev=833725&r1=833724&r2=833725&view=diff
=
=
=
=
=
=
=
=
======================================================================
--- ofbiz/trunk/framework/service/src/org/ofbiz/service/jms/
JmsServiceEngine.java (original)
+++ ofbiz/trunk/framework/service/src/org/ofbiz/service/jms/
JmsServiceEngine.java Sat Nov 7 18:14:22 2009
@@ -19,7 +19,6 @@
package org.ofbiz.service.jms;
import java.util.ArrayList;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/job/
AbstractJob.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/job/AbstractJob.java?rev=833725&r1=833724&r2=833725&view=diff
=
=
=
=
=
=
=
=
======================================================================
--- ofbiz/trunk/framework/service/src/org/ofbiz/service/job/
AbstractJob.java (original)
+++ ofbiz/trunk/framework/service/src/org/ofbiz/service/job/
AbstractJob.java Sat Nov 7 18:14:22 2009
@@ -77,4 +77,8 @@
* Executes the Job.
*/
public abstract void exec() throws InvalidJobException;
+
+ public boolean isQueued() {
+ return queued;
+ }
}
Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/mail/
ServiceMcaRule.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/mail/ServiceMcaRule.java?rev=833725&r1=833724&r2=833725&view=diff
=
=
=
=
=
=
=
=
======================================================================
--- ofbiz/trunk/framework/service/src/org/ofbiz/service/mail/
ServiceMcaRule.java (original)
+++ ofbiz/trunk/framework/service/src/org/ofbiz/service/mail/
ServiceMcaRule.java Sat Nov 7 18:14:22 2009
@@ -18,17 +18,15 @@
*******************************************************************************/
package org.ofbiz.service.mail;
-import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
-import org.ofbiz.service.GenericServiceException;
-import org.ofbiz.service.LocalDispatcher;
-import org.ofbiz.base.util.UtilXml;
import org.ofbiz.base.util.Debug;
+import org.ofbiz.base.util.UtilXml;
import org.ofbiz.entity.GenericValue;
-
+import org.ofbiz.service.GenericServiceException;
+import org.ofbiz.service.LocalDispatcher;
import org.w3c.dom.Element;
public class ServiceMcaRule implements java.io.Serializable {
Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/mail/
ServiceMcaUtil.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/mail/ServiceMcaUtil.java?rev=833725&r1=833724&r2=833725&view=diff
=
=
=
=
=
=
=
=
======================================================================
--- ofbiz/trunk/framework/service/src/org/ofbiz/service/mail/
ServiceMcaUtil.java (original)
+++ ofbiz/trunk/framework/service/src/org/ofbiz/service/mail/
ServiceMcaUtil.java Sat Nov 7 18:14:22 2009
@@ -18,10 +18,10 @@
*******************************************************************************/
package org.ofbiz.service.mail;
-import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;
+
import org.ofbiz.base.component.ComponentConfig;
import org.ofbiz.base.config.GenericConfigException;
import org.ofbiz.base.config.MainResourceHandler;
@@ -29,11 +29,10 @@
import org.ofbiz.base.util.Debug;
import org.ofbiz.base.util.UtilXml;
import org.ofbiz.base.util.cache.UtilCache;
-import org.ofbiz.service.config.ServiceConfigUtil;
-import org.ofbiz.service.LocalDispatcher;
-import org.ofbiz.service.GenericServiceException;
import org.ofbiz.entity.GenericValue;
-
+import org.ofbiz.service.GenericServiceException;
+import org.ofbiz.service.LocalDispatcher;
+import org.ofbiz.service.config.ServiceConfigUtil;
import org.w3c.dom.Element;
public class ServiceMcaUtil {
Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/rmi/
socket/ssl/SSLServerSocketFactory.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/rmi/socket/ssl/SSLServerSocketFactory.java?rev=833725&r1=833724&r2=833725&view=diff
=
=
=
=
=
=
=
=
======================================================================
--- ofbiz/trunk/framework/service/src/org/ofbiz/service/rmi/socket/
ssl/SSLServerSocketFactory.java (original)
+++ ofbiz/trunk/framework/service/src/org/ofbiz/service/rmi/socket/
ssl/SSLServerSocketFactory.java Sat Nov 7 18:14:22 2009
@@ -29,12 +29,12 @@
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import java.security.cert.CertificateException;
+
import javax.net.ssl.SSLServerSocket;
+import org.ofbiz.base.config.GenericConfigException;
import org.ofbiz.base.util.Debug;
import org.ofbiz.base.util.SSLUtil;
-import org.ofbiz.base.util.UtilProperties;
-import org.ofbiz.base.config.GenericConfigException;
/**
* RMI SSL Server Socket Factory
Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/
semaphore/ServiceSemaphore.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/semaphore/ServiceSemaphore.java?rev=833725&r1=833724&r2=833725&view=diff
=
=
=
=
=
=
=
=
======================================================================
--- ofbiz/trunk/framework/service/src/org/ofbiz/service/semaphore/
ServiceSemaphore.java (original)
+++ ofbiz/trunk/framework/service/src/org/ofbiz/service/semaphore/
ServiceSemaphore.java Sat Nov 7 18:14:22 2009
@@ -18,23 +18,19 @@
*******************************************************************************/
package org.ofbiz.service.semaphore;
+import java.sql.Timestamp;
+
+import javax.transaction.Transaction;
+
import org.ofbiz.base.util.Debug;
import org.ofbiz.base.util.UtilDateTime;
-import org.ofbiz.base.util.UtilMisc;
import org.ofbiz.entity.Delegator;
import org.ofbiz.entity.GenericEntityException;
import org.ofbiz.entity.GenericValue;
import org.ofbiz.entity.transaction.GenericTransactionException;
-import org.ofbiz.entity.transaction.GenericXaResource;
import org.ofbiz.entity.transaction.TransactionUtil;
import org.ofbiz.service.ModelService;
-import javax.transaction.Transaction;
-import javax.transaction.xa.Xid;
-import javax.transaction.xa.XAException;
-import java.sql.Timestamp;
-import java.util.Map;
-
/**
* ServiceSemaphore
*/