Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

try/catch usage of sql classes in serializer static initializer to al… #1073

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,18 @@ public abstract class BasicSerializerFactory
_concrete.put(Calendar.class.getName(), CalendarSerializer.instance);
DateSerializer dateSer = DateSerializer.instance;
_concrete.put(java.util.Date.class.getName(), dateSer);
// note: timestamps are very similar to java.util.Date, thus serialized as such
_concrete.put(java.sql.Timestamp.class.getName(), dateSer);

// leave some of less commonly used ones as lazy, no point in proactive construction
_concreteLazy.put(java.sql.Date.class.getName(), SqlDateSerializer.class);
_concreteLazy.put(java.sql.Time.class.getName(), SqlTimeSerializer.class);

try {
// note: timestamps are very similar to java.util.Date, thus serialized as such
_concrete.put(java.sql.Timestamp.class.getName(), dateSer);

// leave some of less commonly used ones as lazy, no point in proactive construction
_concreteLazy.put(java.sql.Date.class.getName(), SqlDateSerializer.class);
_concreteLazy.put(java.sql.Time.class.getName(), SqlTimeSerializer.class);
} catch(NoClassDefFoundError e) {
//java.sql is not standard in embedded compact configurations.
}

// And then other standard non-structured JDK types
for (Map.Entry<Class<?>,Object> en : StdJdkSerializers.all()) {
Object value = en.getValue();
Expand Down