use Java 17

This commit is contained in:
Daniel Gultsch 2023-03-05 15:23:46 +01:00
parent e4fb793769
commit cfaf6162e6
No known key found for this signature in database
GPG key ID: F43D18AD2A0982C2
14 changed files with 208 additions and 188 deletions

View file

@ -30,8 +30,8 @@ android {
}
compileOptions {
coreLibraryDesugaringEnabled true
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
buildFeatures {
dataBinding true
@ -65,7 +65,7 @@ android {
spotless {
java {
target '**/*.java'
googleJavaFormat('1.8').aosp().reflowLongStrings()
googleJavaFormat().aosp().reflowLongStrings()
}
}

View file

@ -2,7 +2,7 @@
"formatVersion": 1,
"database": {
"version": 1,
"identityHash": "9620a1b63d595091a2b463e89b504eb7",
"identityHash": "414be5ac9e68ecf9063dddbcc1cf993a",
"entities": [
{
"tableName": "account",
@ -1009,7 +1009,7 @@
},
{
"tableName": "chat",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT, `accountId` INTEGER NOT NULL, `address` TEXT NOT NULL, `type` TEXT, `archived` INTEGER NOT NULL, `mucState` TEXT, `errorCondition` TEXT, FOREIGN KEY(`accountId`) REFERENCES `account`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT, `accountId` INTEGER NOT NULL, `address` TEXT NOT NULL, `type` TEXT NOT NULL, `archived` INTEGER NOT NULL, `mucState` TEXT, `errorCondition` TEXT, FOREIGN KEY(`accountId`) REFERENCES `account`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",
"fields": [
{
"fieldPath": "id",
@ -1033,7 +1033,7 @@
"fieldPath": "type",
"columnName": "type",
"affinity": "TEXT",
"notNull": false
"notNull": true
},
{
"fieldPath": "archived",
@ -2594,7 +2594,7 @@
"views": [],
"setupQueries": [
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '9620a1b63d595091a2b463e89b504eb7')"
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '414be5ac9e68ecf9063dddbcc1cf993a')"
]
}
}

View file

@ -31,7 +31,7 @@ public class ChatEntity {
@NonNull public String address;
public ChatType type;
@NonNull public ChatType type;
public boolean archived;

View file

@ -19,15 +19,13 @@ public final class Intents {
private Intents() {}
public static Intent of(final ChatFilter chatFilter) {
if (chatFilter instanceof AccountIdentifier) {
final var account = (AccountIdentifier) chatFilter;
if (chatFilter instanceof final AccountIdentifier account) {
final var intent = new Intent(ACTION_FILTER_CHATS_BY_ACCOUNT);
intent.putExtra(EXTRA_ACCOUNT_ID, account.id);
intent.putExtra(EXTRA_ACCOUNT_ADDRESS, account.address.toString());
return intent;
}
if (chatFilter instanceof GroupIdentifier) {
final var group = (GroupIdentifier) chatFilter;
if (chatFilter instanceof final GroupIdentifier group) {
final var intent = new Intent(ACTION_FILTER_CHATS_BY_GROUP);
intent.putExtra(EXTRA_GROUP_ID, group.id);
intent.putExtra(EXTRA_GROUP_NAME, group.name);

View file

@ -21,8 +21,7 @@ public class InterfaceSettingsFragment extends PreferenceFragmentCompat {
}
themePreference.setOnPreferenceChangeListener(
(preference, newValue) -> {
if (newValue instanceof String) {
final String theme = (String) newValue;
if (newValue instanceof final String theme) {
final int desiredNightMode = Conversations.getDesiredNightMode(theme);
requireSettingsActivity().setDesiredNightMode(desiredNightMode);
}

View file

@ -109,8 +109,7 @@ public class AxolotlManager extends AbstractManager implements AxolotlService.Po
if (throwable instanceof TimeoutException) {
return;
}
if (throwable instanceof IqErrorException) {
final var iqErrorException = (IqErrorException) throwable;
if (throwable instanceof final IqErrorException iqErrorException) {
final var error = iqErrorException.getError();
final var condition = error == null ? null : error.getCondition();
if (condition != null) {

View file

@ -179,8 +179,7 @@ public class MultiUserChatManager extends AbstractManager {
@Override
public void onFailure(@NonNull final Throwable throwable) {
final String errorCondition;
if (throwable instanceof IqErrorException) {
final var iqErrorException = (IqErrorException) throwable;
if (throwable instanceof final IqErrorException iqErrorException) {
final Error error = iqErrorException.getError();
final Condition condition = error == null ? null : error.getCondition();
errorCondition = condition == null ? null : condition.getName();

View file

@ -1,6 +1,9 @@
package im.conversations.android.xmpp.processor;
import android.content.Context;
import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.MoreExecutors;
import im.conversations.android.xml.Namespace;
import im.conversations.android.xmpp.Entity;
import im.conversations.android.xmpp.XmppConnection;
@ -8,9 +11,11 @@ import im.conversations.android.xmpp.manager.AxolotlManager;
import im.conversations.android.xmpp.manager.BlockingManager;
import im.conversations.android.xmpp.manager.BookmarkManager;
import im.conversations.android.xmpp.manager.DiscoManager;
import im.conversations.android.xmpp.manager.HttpUploadManager;
import im.conversations.android.xmpp.manager.PresenceManager;
import im.conversations.android.xmpp.manager.RosterManager;
import java.util.function.Consumer;
import okhttp3.MediaType;
import org.jxmpp.jid.Jid;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -28,7 +33,6 @@ public class BindProcessor extends XmppConnection.Delegate implements Consumer<J
final var account = getAccount();
final var database = getDatabase();
// TODO reset errorCondition; mucState in chats
database.runInTransaction(
() -> {
database.chatDao().resetMucStates();
@ -53,5 +57,23 @@ public class BindProcessor extends XmppConnection.Delegate implements Consumer<J
getManager(AxolotlManager.class).publishIfNecessary();
getManager(PresenceManager.class).sendPresence();
final var future =
getManager(HttpUploadManager.class)
.request("foo.jpg", 123, MediaType.get("image/jpeg"));
Futures.addCallback(
future,
new FutureCallback<HttpUploadManager.Slot>() {
@Override
public void onSuccess(HttpUploadManager.Slot result) {
LOGGER.info("requested slot {}", result);
}
@Override
public void onFailure(Throwable t) {
LOGGER.info("could not request slot", t);
}
},
MoreExecutors.directExecutor());
}
}

View file

@ -23,15 +23,15 @@ public class EntityCapabilitiesTest {
@Test
public void entityCaps() throws IOException {
final String xml =
"<query xmlns='http://jabber.org/protocol/disco#info'\n"
+ " "
+ " node='http://code.google.com/p/exodus#QgayPKawpkPSDYmwT/WM94uAlu0='>\n"
+ " <identity category='client' name='Exodus 0.9.1' type='pc'/>\n"
+ " <feature var='http://jabber.org/protocol/caps'/>\n"
+ " <feature var='http://jabber.org/protocol/disco#items'/>\n"
+ " <feature var='http://jabber.org/protocol/disco#info'/>\n"
+ " <feature var='http://jabber.org/protocol/muc'/>\n"
+ " </query>";
"""
<query xmlns='http://jabber.org/protocol/disco#info'
node='http://code.google.com/p/exodus#QgayPKawpkPSDYmwT/WM94uAlu0='>
<identity category='client' name='Exodus 0.9.1' type='pc'/>
<feature var='http://jabber.org/protocol/caps'/>
<feature var='http://jabber.org/protocol/disco#items'/>
<feature var='http://jabber.org/protocol/disco#info'/>
<feature var='http://jabber.org/protocol/muc'/>
</query>""";
final Element element = XmlElementReader.read(xml.getBytes(StandardCharsets.UTF_8));
assertThat(element, instanceOf(InfoQuery.class));
final InfoQuery info = (InfoQuery) element;
@ -42,36 +42,37 @@ public class EntityCapabilitiesTest {
@Test
public void entityCapsComplexExample() throws IOException {
final String xml =
"<query xmlns='http://jabber.org/protocol/disco#info'\n"
+ " node='http://psi-im.org#q07IKJEyjvHSyhy//CH0CxmKi8w='>\n"
+ " <identity xml:lang='en' category='client' name='Psi 0.11' type='pc'/>\n"
+ " <identity xml:lang='el' category='client' name='Ψ 0.11' type='pc'/>\n"
+ " <feature var='http://jabber.org/protocol/caps'/>\n"
+ " <feature var='http://jabber.org/protocol/disco#info'/>\n"
+ " <feature var='http://jabber.org/protocol/disco#items'/>\n"
+ " <feature var='http://jabber.org/protocol/muc'/>\n"
+ " <x xmlns='jabber:x:data' type='result'>\n"
+ " <field var='FORM_TYPE' type='hidden'>\n"
+ " <value>urn:xmpp:dataforms:softwareinfo</value>\n"
+ " </field>\n"
+ " <field var='ip_version' type='text-multi' >\n"
+ " <value>ipv4</value>\n"
+ " <value>ipv6</value>\n"
+ " </field>\n"
+ " <field var='os'>\n"
+ " <value>Mac</value>\n"
+ " </field>\n"
+ " <field var='os_version'>\n"
+ " <value>10.5.1</value>\n"
+ " </field>\n"
+ " <field var='software'>\n"
+ " <value>Psi</value>\n"
+ " </field>\n"
+ " <field var='software_version'>\n"
+ " <value>0.11</value>\n"
+ " </field>\n"
+ " </x>\n"
+ " </query>";
"""
<query xmlns='http://jabber.org/protocol/disco#info'
node='http://psi-im.org#q07IKJEyjvHSyhy//CH0CxmKi8w='>
<identity xml:lang='en' category='client' name='Psi 0.11' type='pc'/>
<identity xml:lang='el' category='client' name='Ψ 0.11' type='pc'/>
<feature var='http://jabber.org/protocol/caps'/>
<feature var='http://jabber.org/protocol/disco#info'/>
<feature var='http://jabber.org/protocol/disco#items'/>
<feature var='http://jabber.org/protocol/muc'/>
<x xmlns='jabber:x:data' type='result'>
<field var='FORM_TYPE' type='hidden'>
<value>urn:xmpp:dataforms:softwareinfo</value>
</field>
<field var='ip_version' type='text-multi' >
<value>ipv4</value>
<value>ipv6</value>
</field>
<field var='os'>
<value>Mac</value>
</field>
<field var='os_version'>
<value>10.5.1</value>
</field>
<field var='software'>
<value>Psi</value>
</field>
<field var='software_version'>
<value>0.11</value>
</field>
</x>
</query>""";
final Element element = XmlElementReader.read(xml.getBytes(StandardCharsets.UTF_8));
assertThat(element, instanceOf(InfoQuery.class));
final InfoQuery info = (InfoQuery) element;
@ -82,26 +83,27 @@ public class EntityCapabilitiesTest {
@Test
public void caps2() throws IOException {
final String xml =
"<query xmlns=\"http://jabber.org/protocol/disco#info\">\n"
+ " <identity category=\"client\" name=\"BombusMod\" type=\"mobile\"/>\n"
+ " <feature var=\"http://jabber.org/protocol/si\"/>\n"
+ " <feature var=\"http://jabber.org/protocol/bytestreams\"/>\n"
+ " <feature var=\"http://jabber.org/protocol/chatstates\"/>\n"
+ " <feature var=\"http://jabber.org/protocol/disco#info\"/>\n"
+ " <feature var=\"http://jabber.org/protocol/disco#items\"/>\n"
+ " <feature var=\"urn:xmpp:ping\"/>\n"
+ " <feature var=\"jabber:iq:time\"/>\n"
+ " <feature var=\"jabber:iq:privacy\"/>\n"
+ " <feature var=\"jabber:iq:version\"/>\n"
+ " <feature var=\"http://jabber.org/protocol/rosterx\"/>\n"
+ " <feature var=\"urn:xmpp:time\"/>\n"
+ " <feature var=\"jabber:x:oob\"/>\n"
+ " <feature var=\"http://jabber.org/protocol/ibb\"/>\n"
+ " <feature var=\"http://jabber.org/protocol/si/profile/file-transfer\"/>\n"
+ " <feature var=\"urn:xmpp:receipts\"/>\n"
+ " <feature var=\"jabber:iq:roster\"/>\n"
+ " <feature var=\"jabber:iq:last\"/>\n"
+ "</query>";
"""
<query xmlns="http://jabber.org/protocol/disco#info">
<identity category="client" name="BombusMod" type="mobile"/>
<feature var="http://jabber.org/protocol/si"/>
<feature var="http://jabber.org/protocol/bytestreams"/>
<feature var="http://jabber.org/protocol/chatstates"/>
<feature var="http://jabber.org/protocol/disco#info"/>
<feature var="http://jabber.org/protocol/disco#items"/>
<feature var="urn:xmpp:ping"/>
<feature var="jabber:iq:time"/>
<feature var="jabber:iq:privacy"/>
<feature var="jabber:iq:version"/>
<feature var="http://jabber.org/protocol/rosterx"/>
<feature var="urn:xmpp:time"/>
<feature var="jabber:x:oob"/>
<feature var="http://jabber.org/protocol/ibb"/>
<feature var="http://jabber.org/protocol/si/profile/file-transfer"/>
<feature var="urn:xmpp:receipts"/>
<feature var="jabber:iq:roster"/>
<feature var="jabber:iq:last"/>
</query>""";
final Element element = XmlElementReader.read(xml.getBytes(StandardCharsets.UTF_8));
assertThat(element, instanceOf(InfoQuery.class));
final InfoQuery info = (InfoQuery) element;
@ -112,72 +114,70 @@ public class EntityCapabilitiesTest {
@Test
public void caps2complex() throws IOException {
final String xml =
"<query xmlns=\"http://jabber.org/protocol/disco#info\">\n"
+ " <identity category=\"client\" name=\"Tkabber\" type=\"pc\""
+ " xml:lang=\"en\"/>\n"
+ " <identity category=\"client\" name=\"Ткаббер\" type=\"pc\""
+ " xml:lang=\"ru\"/>\n"
+ " <feature var=\"games:board\"/>\n"
+ " <feature var=\"http://jabber.org/protocol/activity\"/>\n"
+ " <feature var=\"http://jabber.org/protocol/activity+notify\"/>\n"
+ " <feature var=\"http://jabber.org/protocol/bytestreams\"/>\n"
+ " <feature var=\"http://jabber.org/protocol/chatstates\"/>\n"
+ " <feature var=\"http://jabber.org/protocol/commands\"/>\n"
+ " <feature var=\"http://jabber.org/protocol/disco#info\"/>\n"
+ " <feature var=\"http://jabber.org/protocol/disco#items\"/>\n"
+ " <feature var=\"http://jabber.org/protocol/evil\"/>\n"
+ " <feature var=\"http://jabber.org/protocol/feature-neg\"/>\n"
+ " <feature var=\"http://jabber.org/protocol/geoloc\"/>\n"
+ " <feature var=\"http://jabber.org/protocol/geoloc+notify\"/>\n"
+ " <feature var=\"http://jabber.org/protocol/ibb\"/>\n"
+ " <feature var=\"http://jabber.org/protocol/iqibb\"/>\n"
+ " <feature var=\"http://jabber.org/protocol/mood\"/>\n"
+ " <feature var=\"http://jabber.org/protocol/mood+notify\"/>\n"
+ " <feature var=\"http://jabber.org/protocol/rosterx\"/>\n"
+ " <feature var=\"http://jabber.org/protocol/si\"/>\n"
+ " <feature var=\"http://jabber.org/protocol/si/profile/file-transfer\"/>\n"
+ " <feature var=\"http://jabber.org/protocol/tune\"/>\n"
+ " <feature var=\"http://www.facebook.com/xmpp/messages\"/>\n"
+ " <feature"
+ " var=\"http://www.xmpp.org/extensions/xep-0084.html#ns-metadata+notify\"/>\n"
+ " <feature var=\"jabber:iq:avatar\"/>\n"
+ " <feature var=\"jabber:iq:browse\"/>\n"
+ " <feature var=\"jabber:iq:dtcp\"/>\n"
+ " <feature var=\"jabber:iq:filexfer\"/>\n"
+ " <feature var=\"jabber:iq:ibb\"/>\n"
+ " <feature var=\"jabber:iq:inband\"/>\n"
+ " <feature var=\"jabber:iq:jidlink\"/>\n"
+ " <feature var=\"jabber:iq:last\"/>\n"
+ " <feature var=\"jabber:iq:oob\"/>\n"
+ " <feature var=\"jabber:iq:privacy\"/>\n"
+ " <feature var=\"jabber:iq:roster\"/>\n"
+ " <feature var=\"jabber:iq:time\"/>\n"
+ " <feature var=\"jabber:iq:version\"/>\n"
+ " <feature var=\"jabber:x:data\"/>\n"
+ " <feature var=\"jabber:x:event\"/>\n"
+ " <feature var=\"jabber:x:oob\"/>\n"
+ " <feature var=\"urn:xmpp:avatar:metadata+notify\"/>\n"
+ " <feature var=\"urn:xmpp:ping\"/>\n"
+ " <feature var=\"urn:xmpp:receipts\"/>\n"
+ " <feature var=\"urn:xmpp:time\"/>\n"
+ " <x xmlns=\"jabber:x:data\" type=\"result\">\n"
+ " <field type=\"hidden\" var=\"FORM_TYPE\">\n"
+ " <value>urn:xmpp:dataforms:softwareinfo</value>\n"
+ " </field>\n"
+ " <field var=\"software\">\n"
+ " <value>Tkabber</value>\n"
+ " </field>\n"
+ " <field var=\"software_version\">\n"
+ " <value>0.11.1-svn-20111216-mod (Tcl/Tk 8.6b2)</value>\n"
+ " </field>\n"
+ " <field var=\"os\">\n"
+ " <value>Windows</value>\n"
+ " </field>\n"
+ " <field var=\"os_version\">\n"
+ " <value>XP</value>\n"
+ " </field>\n"
+ " </x>\n"
+ "</query>";
"""
<query xmlns="http://jabber.org/protocol/disco#info">
<identity category="client" name="Tkabber" type="pc" xml:lang="en"/>
<identity category="client" name="Ткаббер" type="pc" xml:lang="ru"/>
<feature var="games:board"/>
<feature var="http://jabber.org/protocol/activity"/>
<feature var="http://jabber.org/protocol/activity+notify"/>
<feature var="http://jabber.org/protocol/bytestreams"/>
<feature var="http://jabber.org/protocol/chatstates"/>
<feature var="http://jabber.org/protocol/commands"/>
<feature var="http://jabber.org/protocol/disco#info"/>
<feature var="http://jabber.org/protocol/disco#items"/>
<feature var="http://jabber.org/protocol/evil"/>
<feature var="http://jabber.org/protocol/feature-neg"/>
<feature var="http://jabber.org/protocol/geoloc"/>
<feature var="http://jabber.org/protocol/geoloc+notify"/>
<feature var="http://jabber.org/protocol/ibb"/>
<feature var="http://jabber.org/protocol/iqibb"/>
<feature var="http://jabber.org/protocol/mood"/>
<feature var="http://jabber.org/protocol/mood+notify"/>
<feature var="http://jabber.org/protocol/rosterx"/>
<feature var="http://jabber.org/protocol/si"/>
<feature var="http://jabber.org/protocol/si/profile/file-transfer"/>
<feature var="http://jabber.org/protocol/tune"/>
<feature var="http://www.facebook.com/xmpp/messages"/>
<feature var="http://www.xmpp.org/extensions/xep-0084.html#ns-metadata+notify"/>
<feature var="jabber:iq:avatar"/>
<feature var="jabber:iq:browse"/>
<feature var="jabber:iq:dtcp"/>
<feature var="jabber:iq:filexfer"/>
<feature var="jabber:iq:ibb"/>
<feature var="jabber:iq:inband"/>
<feature var="jabber:iq:jidlink"/>
<feature var="jabber:iq:last"/>
<feature var="jabber:iq:oob"/>
<feature var="jabber:iq:privacy"/>
<feature var="jabber:iq:roster"/>
<feature var="jabber:iq:time"/>
<feature var="jabber:iq:version"/>
<feature var="jabber:x:data"/>
<feature var="jabber:x:event"/>
<feature var="jabber:x:oob"/>
<feature var="urn:xmpp:avatar:metadata+notify"/>
<feature var="urn:xmpp:ping"/>
<feature var="urn:xmpp:receipts"/>
<feature var="urn:xmpp:time"/>
<x xmlns="jabber:x:data" type="result">
<field type="hidden" var="FORM_TYPE">
<value>urn:xmpp:dataforms:softwareinfo</value>
</field>
<field var="software">
<value>Tkabber</value>
</field>
<field var="software_version">
<value>0.11.1-svn-20111216-mod (Tcl/Tk 8.6b2)</value>
</field>
<field var="os">
<value>Windows</value>
</field>
<field var="os_version">
<value>XP</value>
</field>
</x>
</query>""";
final Element element = XmlElementReader.read(xml.getBytes(StandardCharsets.UTF_8));
assertThat(element, instanceOf(InfoQuery.class));
final InfoQuery info = (InfoQuery) element;

View file

@ -23,32 +23,32 @@ public class PubSubTest {
@Test
public void parseBookmarkResult() throws IOException {
final String xml =
"<iq type='result'\n"
+ " to='juliet@capulet.lit/balcony'\n"
+ " id='retrieve1' xmlns='jabber:client'>\n"
+ " <pubsub xmlns='http://jabber.org/protocol/pubsub'>\n"
+ " <items node='urn:xmpp:bookmarks:1'>\n"
+ " <item id='theplay@conference.shakespeare.lit'>\n"
+ " <conference xmlns='urn:xmpp:bookmarks:1'\n"
+ " name='The Play&apos;s the Thing'\n"
+ " autojoin='true'>\n"
+ " <nick>JC</nick>\n"
+ " </conference>\n"
+ " </item>\n"
+ " <item id='orchard@conference.shakespeare.lit'>\n"
+ " <conference xmlns='urn:xmpp:bookmarks:1'\n"
+ " name='The Orcard'\n"
+ " autojoin='1'>\n"
+ " <nick>JC</nick>\n"
+ " <extensions>\n"
+ " <state xmlns='http://myclient.example/bookmark/state'"
+ " minimized='true'/>\n"
+ " </extensions>\n"
+ " </conference>\n"
+ " </item>\n"
+ " </items>\n"
+ " </pubsub>\n"
+ "</iq>";
"""
<iq type='result'
to='juliet@capulet.lit/balcony'
id='retrieve1' xmlns='jabber:client'>
<pubsub xmlns='http://jabber.org/protocol/pubsub'>
<items node='urn:xmpp:bookmarks:1'>
<item id='theplay@conference.shakespeare.lit'>
<conference xmlns='urn:xmpp:bookmarks:1'
name='The Play&apos;s the Thing'
autojoin='true'>
<nick>JC</nick>
</conference>
</item>
<item id='orchard@conference.shakespeare.lit'>
<conference xmlns='urn:xmpp:bookmarks:1'
name='The Orcard'
autojoin='1'>
<nick>JC</nick>
<extensions>
<state xmlns='http://myclient.example/bookmark/state' minimized='true'/>
</extensions>
</conference>
</item>
</items>
</pubsub>
</iq>""";
final Element element = XmlElementReader.read(xml.getBytes(StandardCharsets.UTF_8));
assertThat(element, instanceOf(Iq.class));
final Iq iq = (Iq) element;

View file

@ -21,9 +21,10 @@ public class TimestampTest {
@Test
public void testZuluNoMillis() throws IOException {
final String xml =
"<delay xmlns='urn:xmpp:delay'\n"
+ " from='capulet.com'\n"
+ " stamp='2002-09-10T23:08:25Z'/>";
"""
<delay xmlns='urn:xmpp:delay'
from='capulet.com'
stamp='2002-09-10T23:08:25Z'/>""";
final Element element = XmlElementReader.read(xml.getBytes(StandardCharsets.UTF_8));
assertThat(element, instanceOf(Delay.class));
final Delay delay = (Delay) element;
@ -33,9 +34,10 @@ public class TimestampTest {
@Test
public void testZuluWithMillis() throws IOException {
final String xml =
"<delay xmlns='urn:xmpp:delay'\n"
+ " from='capulet.com'\n"
+ " stamp='2002-09-10T23:08:25.023Z'/>";
"""
<delay xmlns='urn:xmpp:delay'
from='capulet.com'
stamp='2002-09-10T23:08:25.023Z'/>""";
final Element element = XmlElementReader.read(xml.getBytes(StandardCharsets.UTF_8));
assertThat(element, instanceOf(Delay.class));
final Delay delay = (Delay) element;

View file

@ -37,16 +37,17 @@ public class XmlElementReaderTest {
public void readMessageError() throws IOException {
final String xml =
"<message\n"
+ " to='juliet@capulet.com/balcony'\n"
+ " from='romeo@montague.net/garden'\n"
+ " xmlns='jabber:client'\n"
+ " type='error'>\n"
+ " <body>Wherefore art thou, Romeo?</body>\n"
+ " <error code='404' type='cancel'>\n"
+ " <item-not-found xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>\n"
+ " </error>\n"
+ "</message>";
"""
<message
to='juliet@capulet.com/balcony'
from='romeo@montague.net/garden'
xmlns='jabber:client'
type='error'>
<body>Wherefore art thou, Romeo?</body>
<error code='404' type='cancel'>
<item-not-found xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
</error>
</message>""";
final Element element = XmlElementReader.read(xml.getBytes(StandardCharsets.UTF_8));
assertThat(element, instanceOf(Message.class));
final Message message = (Message) element;

View file

@ -18,7 +18,7 @@ buildscript {
dependencies {
classpath 'com.android.tools.build:gradle:7.4.2'
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$navVersion"
classpath "com.diffplug.spotless:spotless-plugin-gradle:6.13.0"
classpath "com.diffplug.spotless:spotless-plugin-gradle:6.16.0"
}
}
allprojects {

View file

@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-rc-2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-all.zip