You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@turbine.apache.org by tv...@apache.org on 2018/08/01 09:57:00 UTC
svn commit: r1837220 - in /turbine/fulcrum/trunk/parser/src:
changes/changes.xml java/org/apache/fulcrum/parser/BaseValueParser.java
java/org/apache/fulcrum/parser/ValueParser.java
Author: tv
Date: Wed Aug 1 09:57:00 2018
New Revision: 1837220
URL: http://svn.apache.org/viewvc?rev=1837220&view=rev
Log:
Revert last change. Parser is not thread-safe anyway
Modified:
turbine/fulcrum/trunk/parser/src/changes/changes.xml
turbine/fulcrum/trunk/parser/src/java/org/apache/fulcrum/parser/BaseValueParser.java
turbine/fulcrum/trunk/parser/src/java/org/apache/fulcrum/parser/ValueParser.java
Modified: turbine/fulcrum/trunk/parser/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/parser/src/changes/changes.xml?rev=1837220&r1=1837219&r2=1837220&view=diff
==============================================================================
--- turbine/fulcrum/trunk/parser/src/changes/changes.xml (original)
+++ turbine/fulcrum/trunk/parser/src/changes/changes.xml Wed Aug 1 09:57:00 2018
@@ -23,9 +23,6 @@
<body>
<release version="2.0.0" date="in SVN">
- <action dev="tv" type="fix">
- Fix thread safety issues in BaseValueParser
- </action>
<action dev="tv" type="remove">
INCOMAPTIBLE: Remove dependency on fulcrum-upload.
All FileItems are now Parts.
Modified: turbine/fulcrum/trunk/parser/src/java/org/apache/fulcrum/parser/BaseValueParser.java
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/parser/src/java/org/apache/fulcrum/parser/BaseValueParser.java?rev=1837220&r1=1837219&r2=1837220&view=diff
==============================================================================
--- turbine/fulcrum/trunk/parser/src/java/org/apache/fulcrum/parser/BaseValueParser.java (original)
+++ turbine/fulcrum/trunk/parser/src/java/org/apache/fulcrum/parser/BaseValueParser.java Wed Aug 1 09:57:00 2018
@@ -39,7 +39,6 @@ import org.apache.avalon.framework.logge
import org.apache.avalon.framework.logger.Logger;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.lang3.time.FastDateFormat;
import org.apache.fulcrum.pool.Recyclable;
/**
@@ -102,7 +101,7 @@ public class BaseValueParser
private Locale locale = Locale.getDefault();
/** The DateFormat to use for converting dates */
- private FastDateFormat dateFormat = FastDateFormat.getDateInstance(FastDateFormat.SHORT, locale);
+ private DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.SHORT, locale);
/** The NumberFormat to use when converting floats and decimals */
private NumberFormat numberFormat = NumberFormat.getNumberInstance(locale);
@@ -221,7 +220,7 @@ public class BaseValueParser
public void setLocale(Locale l)
{
locale = l;
- setDateFormat(FastDateFormat.getDateInstance(FastDateFormat.SHORT, locale));
+ setDateFormat(DateFormat.getDateInstance(DateFormat.SHORT, locale));
setNumberFormat(NumberFormat.getNumberInstance(locale));
}
@@ -238,7 +237,7 @@ public class BaseValueParser
* Set the date format that will be used by this ValueParser.
*/
@Override
- public void setDateFormat(FastDateFormat df)
+ public void setDateFormat(DateFormat df)
{
dateFormat = df;
}
@@ -247,7 +246,7 @@ public class BaseValueParser
* Get the date format that will be used by this ValueParser.
*/
@Override
- public FastDateFormat getDateFormat()
+ public DateFormat getDateFormat()
{
return dateFormat;
}
@@ -279,8 +278,7 @@ public class BaseValueParser
@Override
public void add(String name, double value)
{
- NumberFormat nf = (NumberFormat) numberFormat.clone();
- add(name, nf.format(value));
+ add(name, numberFormat.format(value));
}
/**
@@ -616,9 +614,8 @@ public class BaseValueParser
if (StringUtils.isNotEmpty(value))
{
- NumberFormat nf = (NumberFormat) numberFormat.clone();
ParsePosition pos = new ParsePosition(0);
- Number number = nf.parse(value, pos);
+ Number number = numberFormat.parse(value, pos);
if (pos.getIndex() == value.length())
{
@@ -1383,23 +1380,7 @@ public class BaseValueParser
@Override
public Date getDate(String name)
{
- Date result = null;
- String value = StringUtils.trim(getString(name));
-
- if (StringUtils.isNotEmpty(value))
- {
- try
- {
- // Reject invalid dates.
- result = dateFormat.parse(value);
- }
- catch (ParseException e)
- {
- logConversionFailure(name, value, "Date");
- }
- }
-
- return result;
+ return getDate(name, dateFormat, null);
}
/**
Modified: turbine/fulcrum/trunk/parser/src/java/org/apache/fulcrum/parser/ValueParser.java
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/parser/src/java/org/apache/fulcrum/parser/ValueParser.java?rev=1837220&r1=1837219&r2=1837220&view=diff
==============================================================================
--- turbine/fulcrum/trunk/parser/src/java/org/apache/fulcrum/parser/ValueParser.java (original)
+++ turbine/fulcrum/trunk/parser/src/java/org/apache/fulcrum/parser/ValueParser.java Wed Aug 1 09:57:00 2018
@@ -27,9 +27,6 @@ import java.util.Date;
import java.util.Locale;
import java.util.Set;
-import org.apache.commons.lang3.time.FastDateFormat;
-
-
/**
* ValueParser is a base interface for classes that need to parse
* name/value Parameters, for example GET/POST data or Cookies
@@ -99,12 +96,12 @@ public interface ValueParser extends Ite
/**
* Set the date format that will be used by this ValueParser.
*/
- void setDateFormat(FastDateFormat df);
+ void setDateFormat(DateFormat df);
/**
* Get the date format that will be used by this ValueParser.
*/
- FastDateFormat getDateFormat();
+ DateFormat getDateFormat();
/**
* Set the number format that will be used by this ValueParser.