1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-11-22 12:02:05 +01:00

[gitlab-ci] Also check with Java 15

This commit is contained in:
Florian Schmaus 2021-02-14 20:34:48 +01:00
parent 8b0248c346
commit 4e90db3191
9 changed files with 63 additions and 28 deletions

View file

@ -14,6 +14,7 @@ jobs:
matrix:
java:
- 11
- 15
steps:
- name: Checkout

View file

@ -256,7 +256,7 @@ allprojects {
}
jacoco {
toolVersion = "0.8.3"
toolVersion = "0.8.6"
}
jacocoTestReport {
@ -274,7 +274,10 @@ allprojects {
// since the one paramater addStringOption doesn't seem to
// work, we extra add '-quiet', which is added anyway by
// gradle.
options.addStringOption('Xdoclint:all', '-quiet')
// TODO: This enables all doclint check but
// 'missing'. Re-enable 'missing' once every public API in
// Smack has a javadoc comment.
options.addStringOption('Xdoclint:accessibility,html,reference,syntax', '-quiet')
// Treat warnings as errors.
// See also https://bugs.openjdk.java.net/browse/JDK-8200363
@ -286,6 +289,9 @@ allprojects {
tasks.withType(Javadoc) {
options.addStringOption('-release', javaMajor)
// The -no-modules-directories javadoc option was removed in Java 13
// See https://bugs.openjdk.java.net/browse/JDK-8215582
if (JavaVersion.current() < JavaVersion.VERSION_13) {
// Fix for javadoc search. If not set, the search result would direct to
// javadoc/undefined/org/jivesoftware/smack/altconnections/HttpLookupMethod.html
// instead of
@ -293,6 +299,7 @@ allprojects {
// https://stackoverflow.com/a/53732633/194894
options.addBooleanOption("-no-module-directories", true)
}
}
tasks.withType(JavaCompile) {
options.compilerArgs.addAll([
'--release', javaMajor,

View file

@ -79,6 +79,12 @@ public final class ServerPingWithAlarmManager extends Manager {
});
}
/**
* Get the instance of this manager for the given connection.
*
* @param connection the connection.
* @return the instance of this manager for the given connection.
*/
public static synchronized ServerPingWithAlarmManager getInstanceFor(XMPPConnection connection) {
ServerPingWithAlarmManager serverPingWithAlarmManager = INSTANCES.get(connection);
if (serverPingWithAlarmManager == null) {
@ -104,6 +110,11 @@ public final class ServerPingWithAlarmManager extends Manager {
mEnabled = enabled;
}
/**
* Check if this manager is enabled.
*
* @return <code>true</code> if this manager is enabled, <code>false</code> otherwise.
*/
public boolean isEnabled() {
return mEnabled;
}

View file

@ -1,6 +1,6 @@
/**
*
* Copyright © 2014-2018 Florian Schmaus
* Copyright © 2014-2021 Florian Schmaus
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -39,8 +39,8 @@ public class AndroidSmackInitializer implements SmackInitializer {
@Override
public List<Exception> initialize() {
SmackConfiguration.setDefaultHostnameVerifier(new StrictHostnameVerifier());
Base64.setEncoder(AndroidBase64Encoder.getInstance());
Base64UrlSafeEncoder.setEncoder(AndroidBase64UrlSafeEncoder.getInstance());
Base64.setEncoder(AndroidBase64Encoder.INSTANCE);
Base64UrlSafeEncoder.setEncoder(AndroidBase64UrlSafeEncoder.INSTANCE);
return null;
}

View file

@ -1,6 +1,6 @@
/**
*
* Copyright © 2014-2019 Florian Schmaus
* Copyright © 2014-2021 Florian Schmaus
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -24,7 +24,10 @@ import android.util.Base64;
*/
public final class AndroidBase64Encoder implements org.jivesoftware.smack.util.stringencoder.Base64.Encoder {
private static AndroidBase64Encoder instance = new AndroidBase64Encoder();
/**
* An instance of this encoder.
*/
public static AndroidBase64Encoder INSTANCE = new AndroidBase64Encoder();
private static final int BASE64_ENCODER_FLAGS = Base64.NO_WRAP;
@ -32,10 +35,6 @@ public final class AndroidBase64Encoder implements org.jivesoftware.smack.util.s
// Use getInstance()
}
public static AndroidBase64Encoder getInstance() {
return instance;
}
@Override
public byte[] decode(String string) {
return Base64.decode(string, Base64.DEFAULT);

View file

@ -1,6 +1,6 @@
/**
*
* Copyright © 2014-2019 Florian Schmaus
* Copyright © 2014-2021 Florian Schmaus
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -22,9 +22,16 @@ import org.jivesoftware.smack.util.stringencoder.StringEncoder;
import android.util.Base64;
/**
* An URL-safe Base64 encoder.
* @author Florian Schmaus
*/
public final class AndroidBase64UrlSafeEncoder implements StringEncoder<String> {
private static AndroidBase64UrlSafeEncoder instance = new AndroidBase64UrlSafeEncoder();
/**
* An instance of this encoder.
*/
public static AndroidBase64UrlSafeEncoder INSTANCE = new AndroidBase64UrlSafeEncoder();
private static final int BASE64_ENCODER_FLAGS = Base64.URL_SAFE | Base64.NO_WRAP;
@ -32,10 +39,6 @@ public final class AndroidBase64UrlSafeEncoder implements StringEncoder<String>
// Use getInstance()
}
public static AndroidBase64UrlSafeEncoder getInstance() {
return instance;
}
@Override
public String encode(String string) {
return Base64.encodeToString(string.getBytes(StandardCharsets.UTF_8), BASE64_ENCODER_FLAGS);

View file

@ -1,6 +1,6 @@
/**
*
* Copyright © 2014-2017 Florian Schmaus
* Copyright © 2014-2021 Florian Schmaus
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -34,6 +34,11 @@ import android.util.Log;
*/
public class AndroidDebugger extends AbstractDebugger {
/**
* Constructs a new Smack debugger for Android.
*
* @param connection the connection to debug.
*/
public AndroidDebugger(XMPPConnection connection) {
super(connection);
}

View file

@ -27,7 +27,9 @@ import org.jivesoftware.smackx.pubsub.provider.ItemProvider;
* PubSub node. An <code>Item</code> has several properties that are dependent
* on the configuration of the node to which it has been or will be published.
*
* <h3>An Item received from a node (via {@link LeafNode#getItems()} or {@link LeafNode#addItemEventListener(org.jivesoftware.smackx.pubsub.listener.ItemEventListener)}</h3>
* <p>
* <b>An Item received from a node (via {@link LeafNode#getItems()} or {@link LeafNode#addItemEventListener(org.jivesoftware.smackx.pubsub.listener.ItemEventListener)}</b>
* </p>
* <ul>
* <li>Will always have an id (either user or server generated) unless node configuration has both
* {@link ConfigureForm#isPersistItems()} and {@link ConfigureForm#isDeliverPayloads()}set to false.
@ -35,7 +37,9 @@ import org.jivesoftware.smackx.pubsub.provider.ItemProvider;
* to true, otherwise it will be null.
* </ul>
*
* <h3>An Item created to send to a node (via {@link LeafNode#publish()} or {@link LeafNode#publish()}</h3>
* <p>
* <b>An Item created to send to a node (via {@link LeafNode#publish()} or {@link LeafNode#publish()}</b>
* </p>
* <ul>
* <li>The id is optional, since the server will generate one if necessary, but should be used if it is
* meaningful in the context of the node. This value must be unique within the node that it is sent to, since

View file

@ -28,7 +28,9 @@ import org.jivesoftware.smackx.pubsub.provider.ItemProvider;
* pubsub node. An <code>Item</code> has several properties that are dependent
* on the configuration of the node to which it has been or will be published.
*
* <h3>An Item received from a node (via {@link LeafNode#getItems()} or {@link LeafNode#addItemEventListener(org.jivesoftware.smackx.pubsub.listener.ItemEventListener)}</h3>
* <p>
* <b>An Item received from a node (via {@link LeafNode#getItems()} or {@link LeafNode#addItemEventListener(org.jivesoftware.smackx.pubsub.listener.ItemEventListener)}</b>
* </p>
* <ul>
* <li>Will always have an id (either user or server generated) unless node configuration has both
* {@link ConfigureForm#isPersistItems()} and {@link ConfigureForm#isDeliverPayloads()}set to false.</li>
@ -36,7 +38,9 @@ import org.jivesoftware.smackx.pubsub.provider.ItemProvider;
* to true, otherwise it will be null.</li>
* </ul>
*
* <h3>An Item created to send to a node (via {@link LeafNode#publish()}</h3>
* <p>
* <b>An Item created to send to a node (via {@link LeafNode#publish()}</b>
* </p>
* <ul>
* <li>The id is optional, since the server will generate one if necessary, but should be used if it is
* meaningful in the context of the node. This value must be unique within the node that it is sent to, since
@ -45,6 +49,7 @@ import org.jivesoftware.smackx.pubsub.provider.ItemProvider;
* to true.</li>
* </ul>
*
*
* <p>To customise the payload object being returned from the {@link #getPayload()} method, you can
* add a custom parser as explained in {@link ItemProvider}.</p>
*