Commit a40ee70b authored by Daniel Gultsch's avatar Daniel Gultsch
Browse files

update some dependencies

parent fc119ffb
......@@ -21,7 +21,7 @@
<dependency>
<groupId>com.sparkjava</groupId>
<artifactId>spark-core</artifactId>
<version>2.8.0</version>
<version>2.9.3</version>
</dependency>
<dependency>
......@@ -33,7 +33,7 @@
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>27.0-jre</version>
<version>30.1-jre</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
......@@ -43,7 +43,7 @@
<dependency>
<groupId>com.googlecode.libphonenumber</groupId>
<artifactId>libphonenumber</artifactId>
<version>8.10.14</version>
<version>8.12.16</version>
</dependency>
<dependency>
<groupId>com.github.zafarkhaja</groupId>
......@@ -54,18 +54,12 @@
<dependency>
<groupId>rocks.xmpp</groupId>
<artifactId>xmpp-core-client</artifactId>
<version>0.8.1</version>
<version>0.8.2</version>
</dependency>
<dependency>
<groupId>rocks.xmpp</groupId>
<artifactId>xmpp-extensions-client</artifactId>
<version>0.8.1</version>
</dependency>
<dependency>
<groupId>com.github.inputmice</groupId>
<artifactId>xmpp-addr-adapter</artifactId>
<version>0.2.1</version>
<version>0.8.2</version>
</dependency>
<dependency>
......@@ -77,7 +71,7 @@
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.5</version>
<version>2.8.6</version>
</dependency>
<dependency>
......@@ -89,7 +83,7 @@
<dependency>
<groupId>org.mariadb.jdbc</groupId>
<artifactId>mariadb-java-client</artifactId>
<version>2.4.2</version>
<version>2.7.1</version>
</dependency>
<dependency>
......@@ -123,7 +117,7 @@
<groupId>QuicksyServer</groupId>
<artifactId>im.quicksy.server</artifactId>
<version>0.1</version>
<version>0.2</version>
<build>
<plugins>
......
package de.gultsch.xmpp.addr.adapter;
import com.google.gson.GsonBuilder;
import de.gultsch.xmpp.addr.adapter.gson.JidDeserializer;
import de.gultsch.xmpp.addr.adapter.gson.JidSerializer;
import de.gultsch.xmpp.addr.adapter.sql2o.IllegalJidStrategy;
import de.gultsch.xmpp.addr.adapter.sql2o.JidConverter;
import org.sql2o.converters.Converter;
import rocks.xmpp.addr.Jid;
import java.util.Map;
public class Adapter {
public static void register(GsonBuilder gsonBuilder) {
gsonBuilder.registerTypeAdapter(Jid.class, new JidDeserializer());
gsonBuilder.registerTypeAdapter(Jid.class, new JidSerializer());
}
public static void register(Map<Class, Converter> converters) {
register(converters, IllegalJidStrategy.THROW);
}
public static void register(Map<Class, Converter> converters, IllegalJidStrategy illegalJidStrategy) {
final JidConverter jidConverter = new JidConverter(illegalJidStrategy);
converters.put(Jid.class, jidConverter);
try {
converters.put(Class.forName("rocks.xmpp.addr.FullJid"), jidConverter);
} catch (ClassNotFoundException e) {
throw new AssertionError(e);
}
}
}
package de.gultsch.xmpp.addr.adapter.gson;
import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
import com.google.gson.JsonParseException;
import rocks.xmpp.addr.Jid;
import java.lang.reflect.Type;
public class JidDeserializer implements JsonDeserializer<Jid> {
public Jid deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext jsonDeserializationContext) throws JsonParseException {
String jid = jsonElement.getAsString();
return Jid.ofEscaped(jid);
}
}
\ No newline at end of file
package de.gultsch.xmpp.addr.adapter.gson;
import com.google.gson.*;
import rocks.xmpp.addr.Jid;
import java.lang.reflect.Type;
public class JidSerializer implements JsonSerializer<Jid> {
public JsonElement serialize(Jid jid, Type type, JsonSerializationContext jsonSerializationContext) {
return new JsonPrimitive(jid.toEscapedString());
}
}
package de.gultsch.xmpp.addr.adapter.sql2o;
import org.sql2o.converters.Converter;
import org.sql2o.converters.ConverterException;
import rocks.xmpp.addr.Jid;
public class JidConverter implements Converter<Jid> {
@Override
public Jid convert(Object o) throws ConverterException {
if (o == null) {
return null;
} else if (o instanceof String) {
try {
return Jid.of((String) o);
} catch (IllegalArgumentException e) {
throw new ConverterException("Unable to convert " + o.toString(), e);
}
} else {
throw new ConverterException("can not convert object of type " + o.getClass().getName() + " to Jid");
}
}
@Override
public Object toDatabaseParam(Jid jid) {
return jid.asBareJid().toString();
}
}
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment