[libpostgresql-jdbc-java] 01/15: Fix a minor concurrency issue during the setup for processing escape functions.
Emmanuel Bourg
ebourg-guest at moszumanska.debian.org
Mon Jan 9 10:20:55 UTC 2017
This is an automated email from the git hooks/post-receive script.
ebourg-guest pushed a commit to tag REL8_4_703
in repository libpostgresql-jdbc-java.
commit 957da710f9e666621633422fa0b49f8be9157831
Author: Kris Jurka <books at ejurka.com>
Date: Tue Aug 10 18:18:42 2010 +0000
Fix a minor concurrency issue during the setup for processing
escape functions.
Pierre Queinnec
---
org/postgresql/jdbc2/EscapedFunctions.java | 26 ++++++++++++++------------
1 file changed, 14 insertions(+), 12 deletions(-)
diff --git a/org/postgresql/jdbc2/EscapedFunctions.java b/org/postgresql/jdbc2/EscapedFunctions.java
index d4f098a..32c0320 100644
--- a/org/postgresql/jdbc2/EscapedFunctions.java
+++ b/org/postgresql/jdbc2/EscapedFunctions.java
@@ -3,7 +3,7 @@
* Copyright (c) 2004-2008, PostgreSQL Global Development Group
*
* IDENTIFICATION
-* $PostgreSQL: pgjdbc/org/postgresql/jdbc2/EscapedFunctions.java,v 1.11 2008/02/19 06:12:24 jurka Exp $
+* $PostgreSQL: pgjdbc/org/postgresql/jdbc2/EscapedFunctions.java,v 1.12 2008/11/16 12:14:06 jurka Exp $
*
*-------------------------------------------------------------------------
*/
@@ -116,23 +116,25 @@ public class EscapedFunctions {
/** storage for functions implementations */
- private static Map functionMap = null;
-
+ private static Map functionMap = createFunctionMap();
+
+ private static Map createFunctionMap() {
+ Method[] arrayMeths = EscapedFunctions.class.getDeclaredMethods();
+ Map functionMap = new HashMap(arrayMeths.length*2);
+ for (int i=0;i<arrayMeths.length;i++){
+ Method meth = arrayMeths[i];
+ if (meth.getName().startsWith("sql"))
+ functionMap.put(meth.getName().toLowerCase(Locale.US),meth);
+ }
+ return functionMap;
+ }
+
/**
* get Method object implementing the given function
* @param functionName name of the searched function
* @return a Method object or null if not found
*/
public static Method getFunction(String functionName){
- if (functionMap==null){
- Method[] arrayMeths = EscapedFunctions.class.getDeclaredMethods();
- functionMap = new HashMap(arrayMeths.length*2);
- for (int i=0;i<arrayMeths.length;i++){
- Method meth = arrayMeths[i];
- if (meth.getName().startsWith("sql"))
- functionMap.put(meth.getName().toLowerCase(Locale.US),meth);
- }
- }
return (Method) functionMap.get("sql"+functionName.toLowerCase(Locale.US));
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/libpostgresql-jdbc-java.git
More information about the pkg-java-commits
mailing list