Author: luc
Date: Sun Apr 5 15:33:06 2009
New Revision: 762107
URL: http://svn.apache.org/viewvc?rev=762107&view=rev
Log:
Fixed threading issues with MathException and MathRuntimeException
Jira: MATH-253
Modified:
commons/proper/math/trunk/src/java/org/apache/commons/math/MathException.java
commons/proper/math/trunk/src/java/org/apache/commons/math/MathRuntimeException.java
commons/proper/math/trunk/src/site/xdoc/changes.xml
Modified:
commons/proper/math/trunk/src/java/org/apache/commons/math/MathException.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/MathException.java?rev=762107&r1=762106&r2=762107&view=diff
==============================================================================
---
commons/proper/math/trunk/src/java/org/apache/commons/math/MathException.java
(original)
+++
commons/proper/math/trunk/src/java/org/apache/commons/math/MathException.java
Sun Apr 5 15:33:06 2009
@@ -36,11 +36,8 @@
public class MathException extends Exception {
/** Serializable version identifier. */
- private static final long serialVersionUID = -2803873247432645339L;
+ private static final long serialVersionUID = -9004610152740737812L;
- /** Cache for resources bundle. */
- private static ResourceBundle cachedResources = null;
-
/**
* Pattern used to build the message.
*/
@@ -60,15 +57,11 @@
*/
private static String translate(String s, Locale locale) {
try {
- if ((cachedResources == null) || (!
cachedResources.getLocale().equals(locale))) {
- // caching the resource bundle
- cachedResources =
+ ResourceBundle bundle =
ResourceBundle.getBundle("org.apache.commons.math.MessagesResources", locale);
- }
-
- if
(cachedResources.getLocale().getLanguage().equals(locale.getLanguage())) {
+ if (bundle.getLocale().getLanguage().equals(locale.getLanguage()))
{
// the value of the resource is the translated string
- return cachedResources.getString(s);
+ return bundle.getString(s);
}
} catch (MissingResourceException mre) {
Modified:
commons/proper/math/trunk/src/java/org/apache/commons/math/MathRuntimeException.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/MathRuntimeException.java?rev=762107&r1=762106&r2=762107&view=diff
==============================================================================
---
commons/proper/math/trunk/src/java/org/apache/commons/math/MathRuntimeException.java
(original)
+++
commons/proper/math/trunk/src/java/org/apache/commons/math/MathRuntimeException.java
Sun Apr 5 15:33:06 2009
@@ -37,11 +37,8 @@
public class MathRuntimeException extends RuntimeException {
/** Serializable version identifier. */
- private static final long serialVersionUID = 4184290229453587356L;
+ private static final long serialVersionUID = -5128983364075381060L;
- /** Cache for resources bundle. */
- private static ResourceBundle cachedResources = null;
-
/**
* Pattern used to build the message.
*/
@@ -61,15 +58,11 @@
*/
private static String translate(final String s, final Locale locale) {
try {
- if ((cachedResources == null) || (!
cachedResources.getLocale().equals(locale))) {
- // caching the resource bundle
- cachedResources =
+ ResourceBundle bundle =
ResourceBundle.getBundle("org.apache.commons.math.MessagesResources", locale);
- }
-
- if
(cachedResources.getLocale().getLanguage().equals(locale.getLanguage())) {
+ if (bundle.getLocale().getLanguage().equals(locale.getLanguage()))
{
// the value of the resource is the translated string
- return cachedResources.getString(s);
+ return bundle.getString(s);
}
} catch (MissingResourceException mre) {
Modified: commons/proper/math/trunk/src/site/xdoc/changes.xml
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/site/xdoc/changes.xml?rev=762107&r1=762106&r2=762107&view=diff
==============================================================================
--- commons/proper/math/trunk/src/site/xdoc/changes.xml (original)
+++ commons/proper/math/trunk/src/site/xdoc/changes.xml Sun Apr 5 15:33:06 2009
@@ -39,6 +39,9 @@
</properties>
<body>
<release version="2.0" date="TBD" description="TBD">
+ <action dev="luc" type="fix" issue="MATH-253" due-to="Sebb">
+ Fixed threading issues with MathException and MathRuntimeException
+ </action>
<action dev="luc" type="fix" issue="MATH-254" due-to="Sebb">
Fixed threading issues with UnivariateRealSolverUtils factory
</action>