-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Java] remove deprecated jackson classes (#7304)
* [java/resttemplate] Generate valid code if no Authentication implementations present Take the logic used to decide which instances to add to the authentications map and re-use to not import classes or offer non-functional util methods * parameterize formParams fixes #5782 * replace use of ISO8601DateFormat and ISO8601Utils with StdDateFormat fixes #5779 * add constructor to intialise calendar * Revert "[java/resttemplate] Generate valid code if no Authentication implementations present" This reverts commit 6e45090. * Revert "parameterize formParams" This reverts commit 7a26ce5. * also override single arg parse method to avoid throwing exception * also override single arg parse method to avoid throwing exception * update samples * update samples * fix jersey1 tests * fix jersey2 test * update resteasy dependencies * fix java jersey2 oas3 tests * use java8 in springboot-beanvalidation Co-authored-by: Jon Freedman <jon.freedman@zoho.com>
- Loading branch information
1 parent
892836f
commit 26c17c5
Showing
81 changed files
with
1,564 additions
and
1,446 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 30 additions & 7 deletions
37
modules/openapi-generator/src/main/resources/Java/RFC3339DateFormat.mustache
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,44 @@ | ||
{{>licenseInfo}} | ||
package {{invokerPackage}}; | ||
|
||
import com.fasterxml.jackson.databind.util.ISO8601DateFormat; | ||
import com.fasterxml.jackson.databind.util.ISO8601Utils; | ||
import com.fasterxml.jackson.databind.util.StdDateFormat; | ||
|
||
import java.text.DateFormat; | ||
import java.text.FieldPosition; | ||
import java.text.ParsePosition; | ||
import java.util.Date; | ||
import java.util.GregorianCalendar; | ||
import java.util.TimeZone; | ||
|
||
public class RFC3339DateFormat extends DateFormat { | ||
private static final long serialVersionUID = 1L; | ||
private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); | ||
public class RFC3339DateFormat extends ISO8601DateFormat { | ||
private final StdDateFormat fmt = new StdDateFormat() | ||
.withTimeZone(TIMEZONE_Z) | ||
.withColonInTimeZone(true); | ||
public RFC3339DateFormat() { | ||
this.calendar = new GregorianCalendar(); | ||
} | ||
|
||
@Override | ||
public Date parse(String source) { | ||
return parse(source, new ParsePosition(0)); | ||
} | ||
|
||
@Override | ||
public Date parse(String source, ParsePosition pos) { | ||
return fmt.parse(source, pos); | ||
} | ||
|
||
// Same as ISO8601DateFormat but serializing milliseconds. | ||
@Override | ||
public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { | ||
String value = ISO8601Utils.format(date, true); | ||
toAppendTo.append(value); | ||
return toAppendTo; | ||
return fmt.format(date, toAppendTo, fieldPosition); | ||
} | ||
|
||
@Override | ||
public Object clone() { | ||
return this; | ||
} | ||
} |
39 changes: 29 additions & 10 deletions
39
modules/openapi-generator/src/main/resources/JavaJaxRS/RFC3339DateFormat.mustache
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,38 @@ | ||
package {{apiPackage}}; | ||
|
||
import com.fasterxml.jackson.databind.util.ISO8601DateFormat; | ||
import com.fasterxml.jackson.databind.util.ISO8601Utils; | ||
import com.fasterxml.jackson.databind.util.StdDateFormat; | ||
|
||
import java.text.DateFormat; | ||
import java.text.FieldPosition; | ||
import java.text.ParsePosition; | ||
import java.util.Date; | ||
import java.util.GregorianCalendar; | ||
import java.util.TimeZone; | ||
|
||
public class RFC3339DateFormat extends ISO8601DateFormat { | ||
public class RFC3339DateFormat extends DateFormat { | ||
private static final long serialVersionUID = 1L; | ||
private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); | ||
// Same as ISO8601DateFormat but serializing milliseconds. | ||
@Override | ||
public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { | ||
String value = ISO8601Utils.format(date, true); | ||
toAppendTo.append(value); | ||
return toAppendTo; | ||
} | ||
private final StdDateFormat fmt = new StdDateFormat() | ||
.withTimeZone(TIMEZONE_Z) | ||
.withColonInTimeZone(true); | ||
public RFC3339DateFormat() { | ||
this.calendar = new GregorianCalendar(); | ||
} | ||
|
||
@Override | ||
public Date parse(String source, ParsePosition pos) { | ||
return fmt.parse(source, pos); | ||
} | ||
|
||
@Override | ||
public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { | ||
return fmt.format(date, toAppendTo, fieldPosition); | ||
} | ||
|
||
@Override | ||
public Object clone() { | ||
return this; | ||
} | ||
} |
39 changes: 29 additions & 10 deletions
39
modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/RFC3339DateFormat.mustache
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,38 @@ | ||
package {{invokerPackage}}; | ||
|
||
import com.fasterxml.jackson.databind.util.ISO8601DateFormat; | ||
import com.fasterxml.jackson.databind.util.ISO8601Utils; | ||
import com.fasterxml.jackson.databind.util.StdDateFormat; | ||
|
||
import java.text.DateFormat; | ||
import java.text.FieldPosition; | ||
import java.text.ParsePosition; | ||
import java.util.Date; | ||
import java.util.GregorianCalendar; | ||
import java.util.TimeZone; | ||
|
||
public class RFC3339DateFormat extends ISO8601DateFormat { | ||
public class RFC3339DateFormat extends DateFormat { | ||
private static final long serialVersionUID = 1L; | ||
private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); | ||
// Same as ISO8601DateFormat but serializing milliseconds. | ||
@Override | ||
public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { | ||
String value = ISO8601Utils.format(date, true); | ||
toAppendTo.append(value); | ||
return toAppendTo; | ||
} | ||
private final StdDateFormat fmt = new StdDateFormat() | ||
.withTimeZone(TIMEZONE_Z) | ||
.withColonInTimeZone(true); | ||
public RFC3339DateFormat() { | ||
this.calendar = new GregorianCalendar(); | ||
} | ||
|
||
@Override | ||
public Date parse(String source, ParsePosition pos) { | ||
return fmt.parse(source, pos); | ||
} | ||
|
||
@Override | ||
public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { | ||
return fmt.format(date, toAppendTo, fieldPosition); | ||
} | ||
|
||
@Override | ||
public Object clone() { | ||
return this; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 24 additions & 8 deletions
32
...-generator/src/main/resources/JavaSpring/libraries/spring-boot/RFC3339DateFormat.mustache
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,38 @@ | ||
package {{basePackage}}; | ||
|
||
import com.fasterxml.jackson.databind.util.ISO8601DateFormat; | ||
import com.fasterxml.jackson.databind.util.ISO8601Utils; | ||
import com.fasterxml.jackson.databind.util.StdDateFormat; | ||
|
||
import java.text.DateFormat; | ||
import java.text.FieldPosition; | ||
import java.text.ParsePosition; | ||
import java.util.Date; | ||
import java.util.GregorianCalendar; | ||
import java.util.TimeZone; | ||
|
||
public class RFC3339DateFormat extends DateFormat { | ||
private static final long serialVersionUID = 1L; | ||
private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); | ||
public class RFC3339DateFormat extends ISO8601DateFormat { | ||
private final StdDateFormat fmt = new StdDateFormat() | ||
.withTimeZone(TIMEZONE_Z) | ||
.withColonInTimeZone(true); | ||
private static final long serialVersionUID = 1L; | ||
public RFC3339DateFormat() { | ||
this.calendar = new GregorianCalendar(); | ||
} | ||
|
||
@Override | ||
public Date parse(String source, ParsePosition pos) { | ||
return fmt.parse(source, pos); | ||
} | ||
|
||
// Same as ISO8601DateFormat but serializing milliseconds. | ||
@Override | ||
public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { | ||
String value = ISO8601Utils.format(date, true); | ||
toAppendTo.append(value); | ||
return toAppendTo; | ||
return fmt.format(date, toAppendTo, fieldPosition); | ||
} | ||
|
||
@Override | ||
public Object clone() { | ||
return this; | ||
} | ||
} |
32 changes: 24 additions & 8 deletions
32
...i-generator/src/main/resources/JavaSpring/libraries/spring-mvc/RFC3339DateFormat.mustache
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,38 @@ | ||
package {{configPackage}}; | ||
|
||
import com.fasterxml.jackson.databind.util.ISO8601DateFormat; | ||
import com.fasterxml.jackson.databind.util.ISO8601Utils; | ||
import com.fasterxml.jackson.databind.util.StdDateFormat; | ||
|
||
import java.text.DateFormat; | ||
import java.text.FieldPosition; | ||
import java.text.ParsePosition; | ||
import java.util.Date; | ||
import java.util.GregorianCalendar; | ||
import java.util.TimeZone; | ||
|
||
public class RFC3339DateFormat extends DateFormat { | ||
private static final long serialVersionUID = 1L; | ||
private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); | ||
public class RFC3339DateFormat extends ISO8601DateFormat { | ||
private final StdDateFormat fmt = new StdDateFormat() | ||
.withTimeZone(TIMEZONE_Z) | ||
.withColonInTimeZone(true); | ||
private static final long serialVersionUID = 1L; | ||
public RFC3339DateFormat() { | ||
this.calendar = new GregorianCalendar(); | ||
} | ||
|
||
@Override | ||
public Date parse(String source, ParsePosition pos) { | ||
return fmt.parse(source, pos); | ||
} | ||
|
||
// Same as ISO8601DateFormat but serializing milliseconds. | ||
@Override | ||
public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { | ||
String value = ISO8601Utils.format(date, true); | ||
toAppendTo.append(value); | ||
return toAppendTo; | ||
return fmt.format(date, toAppendTo, fieldPosition); | ||
} | ||
|
||
@Override | ||
public Object clone() { | ||
return this; | ||
} | ||
} |
39 changes: 29 additions & 10 deletions
39
modules/openapi-generator/src/main/resources/java-msf4j-server/RFC3339DateFormat.mustache
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,38 @@ | ||
package {{apiPackage}}; | ||
|
||
import com.fasterxml.jackson.databind.util.ISO8601DateFormat; | ||
import com.fasterxml.jackson.databind.util.ISO8601Utils; | ||
import com.fasterxml.jackson.databind.util.StdDateFormat; | ||
|
||
import java.text.DateFormat; | ||
import java.text.FieldPosition; | ||
import java.text.ParsePosition; | ||
import java.util.Date; | ||
import java.util.GregorianCalendar; | ||
import java.util.TimeZone; | ||
|
||
public class RFC3339DateFormat extends ISO8601DateFormat { | ||
public class RFC3339DateFormat extends DateFormat { | ||
private static final long serialVersionUID = 1L; | ||
private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); | ||
// Same as ISO8601DateFormat but serializing milliseconds. | ||
@Override | ||
public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { | ||
String value = ISO8601Utils.format(date, true); | ||
toAppendTo.append(value); | ||
return toAppendTo; | ||
} | ||
private final StdDateFormat fmt = new StdDateFormat() | ||
.withTimeZone(TIMEZONE_Z) | ||
.withColonInTimeZone(true); | ||
public RFC3339DateFormat() { | ||
this.calendar = new GregorianCalendar(); | ||
} | ||
|
||
@Override | ||
public Date parse(String source, ParsePosition pos) { | ||
return fmt.parse(source, pos); | ||
} | ||
|
||
@Override | ||
public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { | ||
return fmt.format(date, toAppendTo, fieldPosition); | ||
} | ||
|
||
@Override | ||
public Object clone() { | ||
return this; | ||
} | ||
} |
32 changes: 25 additions & 7 deletions
32
modules/openapi-generator/src/main/resources/java-pkmst/RFC3339DateFormat.mustache
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,38 @@ | ||
package {{basePackage}}; | ||
|
||
import com.fasterxml.jackson.databind.util.ISO8601DateFormat; | ||
import com.fasterxml.jackson.databind.util.ISO8601Utils; | ||
import com.fasterxml.jackson.databind.util.StdDateFormat; | ||
|
||
import java.text.DateFormat; | ||
import java.text.FieldPosition; | ||
import java.text.ParsePosition; | ||
import java.util.Date; | ||
import java.util.GregorianCalendar; | ||
import java.util.TimeZone; | ||
|
||
public class RFC3339DateFormat extends DateFormat { | ||
private static final long serialVersionUID = 1L; | ||
private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); | ||
public class RFC3339DateFormat extends ISO8601DateFormat { | ||
private final StdDateFormat fmt = new StdDateFormat() | ||
.withTimeZone(TIMEZONE_Z) | ||
.withColonInTimeZone(true); | ||
public RFC3339DateFormat() { | ||
this.calendar = new GregorianCalendar(); | ||
} | ||
|
||
@Override | ||
public Date parse(String source, ParsePosition pos) { | ||
return fmt.parse(source, pos); | ||
} | ||
|
||
// Same as ISO8601DateFormat but serializing milliseconds. | ||
@Override | ||
public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { | ||
String value = ISO8601Utils.format(date, true); | ||
toAppendTo.append(value); | ||
return toAppendTo; | ||
return fmt.format(date, toAppendTo, fieldPosition); | ||
} | ||
|
||
@Override | ||
public Object clone() { | ||
return this; | ||
} | ||
} |
Oops, something went wrong.