diff --git a/.gitignore b/.gitignore
index 286679a..24c491d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,22 +1,7 @@
-
-/json-smart/target
-/json-smart/.settings
-/json-smart/.classpath
-/json-smart/.project
-/parent/.project
-/parent/.settings
-/json-smart/src/test/java/asm
-/asm/.classpath
-/asm/.project
-/asm/.settings
-/asm/targetjson-smart-backport/.classpath
-json-smart-backport/.project
-json-smart-backport/.settings
-asm/target/
-json-smart-backport/target/
-json-smart/target/
-**/.project
+**/.classpath
+**/.idea/
+**/.project
+**/.settings/
+**/*.iml
**/bin
-*.classpath
-*.project
-*.prefs
+**/target
diff --git a/accessors-smart/pom.xml b/accessors-smart/pom.xml
index baf9570..4571fb6 100644
--- a/accessors-smart/pom.xml
+++ b/accessors-smart/pom.xml
@@ -3,7 +3,7 @@
4.0.0
net.minidev
accessors-smart
- 1.1
+ 1.2
ASM based accessors helper used by json-smart
Java reflect give poor performance on getter setter an constructor calls, accessors-smart use ASM to speed up those calls.
diff --git a/accessors-smart/src/main/java/net/minidev/asm/ConvertDate.java b/accessors-smart/src/main/java/net/minidev/asm/ConvertDate.java
index f94e9bd..7de2822 100644
--- a/accessors-smart/src/main/java/net/minidev/asm/ConvertDate.java
+++ b/accessors-smart/src/main/java/net/minidev/asm/ConvertDate.java
@@ -8,6 +8,7 @@
import java.util.HashSet;
import java.util.Locale;
import java.util.StringTokenizer;
+import java.util.TimeZone;
import java.util.TreeMap;
public class ConvertDate {
@@ -40,6 +41,7 @@ private static Integer parseMonth(String s1) {
static {
voidData.add("CET");
voidData.add("MEZ");
+ voidData.add("PST");
voidData.add("Uhr");
voidData.add("h");
voidData.add("pm");
@@ -118,6 +120,8 @@ public static Date convertToDate(Object obj) {
return null;
if (obj instanceof Date)
return (Date) obj;
+ if (obj instanceof Number)
+ return new Date(((Number)obj).longValue());
if (obj instanceof String) {
StringTokenizer st = new StringTokenizer((String) obj, " -/:,.+");
String s1 = "";
@@ -204,8 +208,12 @@ private static Date getMMDDYYYY(StringTokenizer st, String s1) {
return null;
s1 = st.nextToken();
}
- cal.set(Calendar.YEAR, getYear(s1));
-
+ if (s1.length() == 4)
+ cal.set(Calendar.YEAR, getYear(s1));
+ else if (s1.length() == 2) {
+ return addHour2(st, cal, s1);
+
+ }
// /if (st.hasMoreTokens())
// return null;
// s1 = st.nextToken();
@@ -236,6 +244,10 @@ private static Date addHour(StringTokenizer st, Calendar cal, String s1) {
return cal.getTime();
s1 = st.nextToken();
}
+ return addHour2(st, cal, s1);
+ }
+
+ private static Date addHour2(StringTokenizer st, Calendar cal, String s1) {
cal.set(Calendar.HOUR_OF_DAY, Integer.parseInt(s1));
if (!st.hasMoreTokens())
@@ -273,6 +285,10 @@ private static Date addHour(StringTokenizer st, Calendar cal, String s1) {
s1 = trySkip(st, s1, cal);
// if (s1.equalsIgnoreCase("pm"))
// cal.add(Calendar.HOUR_OF_DAY, 12);
+
+ if (s1.length() == 4 && Character.isDigit(s1.charAt(0)))
+ cal.set(Calendar.YEAR, getYear(s1));
+
return cal.getTime();
}
@@ -280,6 +296,8 @@ private static String trySkip(StringTokenizer st, String s1, Calendar cal) {
while (voidData.contains(s1)) {
if (s1.equalsIgnoreCase("pm"))
cal.add(Calendar.HOUR_OF_DAY, 12);
+ if (s1.equalsIgnoreCase("PST"))
+ cal.setTimeZone(TimeZone.getTimeZone("PST"));
if (!st.hasMoreTokens())
return null;
s1 = st.nextToken();
diff --git a/accessors-smart/src/test/java/net/minidev/asm/TestDateConvert.java b/accessors-smart/src/test/java/net/minidev/asm/TestDateConvert.java
index af34745..df54664 100644
--- a/accessors-smart/src/test/java/net/minidev/asm/TestDateConvert.java
+++ b/accessors-smart/src/test/java/net/minidev/asm/TestDateConvert.java
@@ -17,6 +17,7 @@ public void testDateFR() throws Exception {
tests.add("23 janvier 2012 13:42:12");
tests.add("lundi 23 janvier 2012 13:42:12");
tests.add("2012-01-23 13:42:12");
+ tests.add("Thu Jan 23 13:42:12 PST 2012");
//
for (String testDate : tests) {
Date parsed = null;
diff --git a/json-smart/pom.xml b/json-smart/pom.xml
index 6f8ef20..a7d9430 100644
--- a/json-smart/pom.xml
+++ b/json-smart/pom.xml
@@ -3,7 +3,7 @@
4.0.0
net.minidev
json-smart
- 2.2.1
+ 2.2.2
JSON Small and Fast Parser
JSON (JavaScript Object Notation) is a lightweight data-interchange format. It is easy for humans to read and write. It is easy for machines to parse and generate. It is based on a subset of the JavaScript Programming Language, Standard ECMA-262 3rd Edition - December 1999. JSON is a text format that is completely language independent but uses conventions that are familiar to programmers of the C-family of languages, including C, C++, C#, Java, JavaScript, Perl, Python, and many others. These properties make JSON an ideal data-interchange language.
@@ -47,7 +47,7 @@
net.minidev
accessors-smart
- 1.1
+ 1.2
@@ -95,7 +95,7 @@
2C8DF6EC
-
+
@@ -264,4 +264,4 @@
-
\ No newline at end of file
+
diff --git a/json-smart/src/main/java/net/minidev/json/JSONArray.java b/json-smart/src/main/java/net/minidev/json/JSONArray.java
index 350d491..1803768 100644
--- a/json-smart/src/main/java/net/minidev/json/JSONArray.java
+++ b/json-smart/src/main/java/net/minidev/json/JSONArray.java
@@ -24,8 +24,8 @@
/**
* A JSON array. JSONObject supports java.util.List interface.
*
- * @author FangYidong
- * @author Uriel Chemouni
+ * @author FangYidong <fangyidong@yahoo.com.cn>
+ * @author Uriel Chemouni <uchemouni@gmail.com>
*/
public class JSONArray extends ArrayList