diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 2fb93a48c..fa9bb447a 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -6,13 +6,14 @@ jobs:
build:
name: Build Smack
- runs-on: ubuntu-22.04
+ runs-on: ubuntu-24.04
strategy:
matrix:
java:
- - 11
+ - 17
+ - 21
env:
- PRIMARY_JAVA_VERSION: 11
+ PRIMARY_JAVA_VERSION: 21
steps:
- name: Checkout
@@ -52,10 +53,10 @@ jobs:
- name: Install GraphViz
run: sudo apt update && sudo apt install graphviz
- name: Install Android SDK Manager
- uses: android-actions/setup-android@v2
+ uses: android-actions/setup-android@v3
- name: Install Android SDK
run: |
- sdkmanager "platforms;android-19"
+ sdkmanager "platforms;android-23"
# Testing
- name: Gradle Check
@@ -71,15 +72,22 @@ jobs:
run: ./gradlew javadocAll --stacktrace
# Test Coverage Report
- - name: Jacoco Test Coverage
+ - name: Aggregated Jacoco Test Coverage Report
if: ${{ matrix.java == env.PRIMARY_JAVA_VERSION }}
- run: ./gradlew jacocoRootReport coveralls
- env:
- COVERALLS_REPO_TOKEN: S2ecSJja2cKJa9yv45C8ZFPohXuRrTXKd
+ run: |
+ ./gradlew smack-java11-full:testCodeCoverageReport
+
+ # Coveralls
+ - name: Report coverage stats to Coveralls
+ if: ${{ matrix.java == env.PRIMARY_JAVA_VERSION }}
+ uses: coverallsapp/github-action@v2
+ with:
+ format: jacoco
+ file: smack-java11-full/build/reports/jacoco/testCodeCoverageReport/testCodeCoverageReport.xml
# Upload build artifacts
- name: Upload build artifacts
- uses: actions/upload-artifact@v2
+ uses: actions/upload-artifact@v4
with:
name: smack-java-${{ matrix.java }}
path: |
diff --git a/.gitignore b/.gitignore
index 7bd5f61be..ec8037f60 100644
--- a/.gitignore
+++ b/.gitignore
@@ -12,7 +12,6 @@
.project
.settings
.gradle
-gradle.properties
build/
core/build/
diff --git a/CHANGELOG.md b/CHANGELOG.md
index d896bc4e4..b413e7f75 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,17 @@
# Smack Changelog
+# 4.4.8 -- 2024-04-02
+
+### Improvement
+
+[SMACK-941](https://igniterealtime.atlassian.net/browse/SMACK-941) Suppress "roster not loaded while processing presence" warning if its caused by the reflected self-presence
+
+### Bug
+
+[SMACK-938](https://igniterealtime.atlassian.net/browse/SMACK-938) Busy loop in SmackReactor
+
+[SMACK-940](https://igniterealtime.atlassian.net/browse/SMACK-940) Ignore IPv6 Zone IDs in incoming streamhost candidates
+
# 4.4.7 -- 2023-11-25
### Improvement
diff --git a/Makefile b/Makefile
new file mode 100644
index 000000000..4689ef8af
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,30 @@
+GRADLE ?= ./gradlew
+
+.PHONY: all
+all: check jacocoRootReport javadocAll sinttest
+
+.PHONY: codecov
+codecov:
+ $(GRADLE) smack-java11-full:testCodeCoverageReport
+ echo "Report available at smack-java11-full/build/reports/jacoco/testCodeCoverageReport/html/index.html"
+
+.PHONY: check
+check:
+ $(GRADLE) $@
+
+.PHONY: eclipse
+eclipse:
+ $(GRADLE) $@
+
+.PHONY: sinttest
+sinttest:
+ $(GRADLE) $@
+
+.PHONY: jacocoRootReport
+jacocoRootReport:
+ $(GRADLE) $@
+
+.PHONY: javadocAll
+javadocAll:
+ $(GRADLE) $@
+ echo "Smack javadoc available at build/javadoc/index.html"
diff --git a/build-logic/build.gradle b/build-logic/build.gradle
new file mode 100644
index 000000000..7b02d03a7
--- /dev/null
+++ b/build-logic/build.gradle
@@ -0,0 +1,14 @@
+plugins {
+ id 'groovy-gradle-plugin'
+}
+
+repositories {
+ gradlePluginPortal()
+}
+
+dependencies {
+ implementation "biz.aQute.bnd:biz.aQute.bnd.gradle:7.0.0"
+ implementation "me.champeau.jmh:jmh-gradle-plugin:0.7.2"
+ implementation "net.ltgt.gradle:gradle-errorprone-plugin:4.0.1"
+ implementation "ru.vyarus:gradle-animalsniffer-plugin:1.7.1"
+}
diff --git a/build-logic/settings.gradle b/build-logic/settings.gradle
new file mode 100644
index 000000000..d082ce7e0
--- /dev/null
+++ b/build-logic/settings.gradle
@@ -0,0 +1 @@
+rootProject.name = 'smack-build-logic'
diff --git a/build-logic/src/main/groovy/org.igniterealtime.smack.android-boot-classpath-conventions.gradle b/build-logic/src/main/groovy/org.igniterealtime.smack.android-boot-classpath-conventions.gradle
new file mode 100644
index 000000000..c14cb3199
--- /dev/null
+++ b/build-logic/src/main/groovy/org.igniterealtime.smack.android-boot-classpath-conventions.gradle
@@ -0,0 +1,6 @@
+compileJava {
+ options.bootstrapClasspath = files(androidBootClasspath)
+}
+javadoc {
+ classpath += files(androidBootClasspath)
+}
diff --git a/build-logic/src/main/groovy/org.igniterealtime.smack.android-conventions.gradle b/build-logic/src/main/groovy/org.igniterealtime.smack.android-conventions.gradle
new file mode 100644
index 000000000..94beb432c
--- /dev/null
+++ b/build-logic/src/main/groovy/org.igniterealtime.smack.android-conventions.gradle
@@ -0,0 +1,10 @@
+plugins {
+ id 'ru.vyarus.animalsniffer'
+ id 'org.igniterealtime.smack.global-conventions'
+}
+dependencies {
+ signature "net.sf.androidscents.signature:android-api-level-${smackMinAndroidSdk}:6.0_r3@signature"
+}
+animalsniffer {
+ sourceSets = [sourceSets.main]
+}
diff --git a/build-logic/src/main/groovy/org.igniterealtime.smack.application-conventions.gradle b/build-logic/src/main/groovy/org.igniterealtime.smack.application-conventions.gradle
new file mode 100644
index 000000000..fa4c7011e
--- /dev/null
+++ b/build-logic/src/main/groovy/org.igniterealtime.smack.application-conventions.gradle
@@ -0,0 +1,12 @@
+plugins {
+ id 'application'
+}
+
+application {
+ applicationDefaultJvmArgs = ["-enableassertions"]
+}
+
+run {
+ // Pass all system properties down to the "application" run
+ systemProperties System.getProperties()
+}
diff --git a/build-logic/src/main/groovy/org.igniterealtime.smack.global-conventions.gradle b/build-logic/src/main/groovy/org.igniterealtime.smack.global-conventions.gradle
new file mode 100644
index 000000000..5bd92c7ee
--- /dev/null
+++ b/build-logic/src/main/groovy/org.igniterealtime.smack.global-conventions.gradle
@@ -0,0 +1,37 @@
+ext {
+ javaVersion = JavaVersion.VERSION_11
+ javaMajor = javaVersion.getMajorVersion()
+ smackMinAndroidSdk = 23
+
+ androidBootClasspath = { getAndroidRuntimeJar() }
+}
+
+repositories {
+ mavenLocal()
+ mavenCentral()
+}
+
+def getAndroidRuntimeJar() {
+ def androidApiLevel = ext.smackMinAndroidSdk
+ def androidHome = getAndroidHome()
+ def androidJar = new File("$androidHome/platforms/android-${androidApiLevel}/android.jar")
+ if (androidJar.isFile()) {
+ return androidJar
+ } else {
+ throw new Exception("Can't find android.jar for API level ${androidApiLevel}. Please install corresponding SDK platform package")
+ }
+}
+def getAndroidJavadocOffline() {
+ def androidHome = getAndroidHome()
+ return androidHome.toString() + "/docs/reference"
+}
+
+def getAndroidHome() {
+ def androidHomeEnv = System.getenv("ANDROID_HOME")
+ if (androidHomeEnv == null) {
+ throw new Exception("ANDROID_HOME environment variable is not set")
+ }
+ def androidHome = new File(androidHomeEnv)
+ if (!androidHome.isDirectory()) throw new Exception("Environment variable ANDROID_HOME is not pointing to a directory")
+ return androidHome
+}
diff --git a/build-logic/src/main/groovy/org.igniterealtime.smack.java-common-conventions.gradle b/build-logic/src/main/groovy/org.igniterealtime.smack.java-common-conventions.gradle
new file mode 100644
index 000000000..598fdfa67
--- /dev/null
+++ b/build-logic/src/main/groovy/org.igniterealtime.smack.java-common-conventions.gradle
@@ -0,0 +1,367 @@
+plugins {
+ id 'biz.aQute.bnd.builder'
+ id 'checkstyle'
+ id 'eclipse'
+ id 'idea'
+ id 'jacoco'
+ id 'java'
+ id 'java-library'
+ id 'java-test-fixtures'
+ id 'maven-publish'
+ id 'net.ltgt.errorprone'
+ id 'signing'
+
+ id 'jacoco-report-aggregation'
+ id 'test-report-aggregation'
+
+ id 'org.igniterealtime.smack.global-conventions'
+ id 'org.igniterealtime.smack.javadoc-conventions'
+}
+
+version readVersionFile()
+
+ext {
+ isSnapshot = version.endsWith('-SNAPSHOT')
+ gitCommit = getGitCommit()
+ rootConfigDir = new File(rootDir, 'config')
+ sonatypeCredentialsAvailable = project.hasProperty('sonatypeUsername') && project.hasProperty('sonatypePassword')
+ isReleaseVersion = !isSnapshot
+ isContinuousIntegrationEnvironment = Boolean.parseBoolean(System.getenv('CI'))
+ signingRequired = !(isSnapshot || isContinuousIntegrationEnvironment)
+ sonatypeSnapshotUrl = 'https://oss.sonatype.org/content/repositories/snapshots'
+ sonatypeStagingUrl = 'https://oss.sonatype.org/service/local/staging/deploy/maven2'
+ builtDate = (new java.text.SimpleDateFormat("yyyy-MM-dd")).format(new Date())
+ oneLineDesc = 'An Open Source XMPP (Jabber) client library'
+
+ jxmppVersion = '[1.1.0-beta1, 1.1.999]'
+ miniDnsVersion = '[1.1.0-alpha3, 1.1.999]'
+ junitVersion = '5.9.2'
+ commonsIoVersion = '2.6'
+ bouncyCastleVersion = '1.73'
+ guavaVersion = '30.1-jre'
+ mockitoVersion = '5.13.0'
+ orgReflectionsVersion = '0.9.11'
+
+ if (project.hasProperty("useSonatype")) {
+ useSonatype = project.getProperty("useSonatype").toBoolean()
+ } else {
+ // Default to true
+ useSonatype = true
+ }
+
+ gplLicensedProjects = [
+ ':smack-examples',
+ ':smack-omemo-signal',
+ ':smack-omemo-signal-integration-test',
+ ':smack-repl'
+ ].collect{ project(it) }
+}
+
+group = 'org.igniterealtime.smack'
+
+java {
+ sourceCompatibility = javaVersion
+ targetCompatibility = sourceCompatibility
+}
+
+eclipse {
+ classpath {
+ downloadJavadoc = true
+ }
+}
+
+// Make all project's 'test' target depend on javadoc, so that
+// javadoc is also linted.
+test.dependsOn javadoc
+
+tasks.withType(JavaCompile) {
+ // Some systems may not have set their platform default
+ // converter to 'utf8', but we use unicode in our source
+ // files. Therefore ensure that javac uses unicode
+ options.encoding = "utf8"
+ options.compilerArgs = [
+ '-Xlint:all',
+ // Set '-options' because a non-java7 javac will emit a
+ // warning if source/target is set to 1.7 and
+ // bootclasspath is *not* set.
+ '-Xlint:-options',
+ // TODO: Enable xlint serial
+ '-Xlint:-serial',
+ '-Werror',
+ ]
+}
+if (JavaVersion.current().isJava8Compatible()) {
+ tasks.withType(Javadoc) {
+ // The '-quiet' as second argument is actually a hack,
+ // since the one parameter addStringOption doesn't seem to
+ // work, we extra add '-quiet', which is added anyway by
+ // gradle.
+ // We disable 'missing' as we do most of javadoc checking via checkstyle.
+ options.addStringOption('Xdoclint:all,-missing', '-quiet')
+ // Abort on javadoc warnings.
+ // See JDK-8200363 (https://bugs.openjdk.java.net/browse/JDK-8200363)
+ // for information about the -Xwerror option.
+ options.addStringOption('Xwerror', '-quiet')
+ }
+}
+
+if (JavaVersion.current().isJava9Compatible()) {
+ tasks.withType(JavaCompile) {
+ options.compilerArgs.addAll([
+ '--release', javaMajor,
+ ])
+ }
+}
+
+jacoco {
+ toolVersion = "0.8.12"
+}
+
+jacocoTestReport {
+ dependsOn test
+ reports {
+ xml.required = true
+ }
+}
+
+dependencies {
+ testImplementation "org.junit.jupiter:junit-jupiter-api:$junitVersion"
+ testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junitVersion"
+
+ testFixturesApi "org.junit.jupiter:junit-jupiter-api:$junitVersion"
+ testImplementation "org.junit.jupiter:junit-jupiter-params:$junitVersion"
+ testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junitVersion"
+ // https://stackoverflow.com/a/77274251/194894
+ testRuntimeOnly "org.junit.platform:junit-platform-launcher:1.11.0"
+
+ // The smack-extensions subproject uses mockito in its fest
+ // fixtures, and we want to have mockito also available in
+ // test, so we use API here.
+ testFixturesApi "org.mockito:mockito-core:${mockitoVersion}"
+
+ testImplementation 'com.jamesmurty.utils:java-xmlbuilder:1.2'
+
+ errorprone 'com.google.errorprone:error_prone_core:2.32.0'
+}
+
+test {
+ useJUnitPlatform()
+
+ maxParallelForks = Runtime.runtime.availableProcessors().intdiv(2) ?: 1
+
+ // Enable full stacktraces of failed tests. Especially handy
+ // for CI environments.
+ testLogging {
+ events "failed"
+ exceptionFormat "full"
+ }
+}
+
+jar {
+ manifest {
+ attributes(
+ 'Implementation-Version': version,
+ 'Implementation-GitRevision': gitCommit,
+ 'Built-JDK': System.getProperty('java.version'),
+ 'Built-Gradle': gradle.gradleVersion,
+ 'Built-By': System.getProperty('user.name')
+ )
+ }
+
+ bundle {
+ bnd(
+ '-removeheaders': 'Tool, Bnd-*',
+ '-exportcontents': '*',
+ )
+ }
+}
+
+checkstyle {
+ toolVersion = '8.27'
+
+ if (project in gplLicensedProjects) {
+ configProperties.checkstyleLicenseHeader = "${project.name}-gplv3-license-header"
+ } else {
+ configProperties.checkstyleLicenseHeader = "header"
+ }
+}
+task sourcesJar(type: Jar, dependsOn: classes) {
+ archiveClassifier = 'sources'
+ from sourceSets.main.allSource
+}
+task javadocJar(type: Jar, dependsOn: javadoc) {
+ archiveClassifier = 'javadoc'
+ from javadoc.destinationDir
+}
+task testsJar(type: Jar) {
+ archiveClassifier = 'tests'
+ from sourceSets.test.output
+}
+configurations {
+ testRuntime
+}
+artifacts {
+ // Add a 'testRuntime' configuration including the tests so that
+ // it can be consumed by other projects (smack-omemo-signal for
+ // example). See http://stackoverflow.com/a/21946676/194894
+ testRuntime testsJar
+}
+
+publishing {
+ publications {
+ mavenJava(MavenPublication) {
+ from components.java
+ artifact sourcesJar
+ artifact javadocJar
+ artifact testsJar
+ pom {
+ name = 'Smack'
+ packaging = 'jar'
+ inceptionYear = '2003'
+ url = 'http://www.igniterealtime.org/projects/jxmpp/'
+ afterEvaluate {
+ description = project.description
+ }
+
+ issueManagement {
+ system = 'JIRA'
+ url = 'http://issues.igniterealtime.org/browse/SMACK'
+ }
+
+ scm {
+ url = 'https://github.com/igniterealtime/Smack'
+ connection = 'scm:git:https://github.com/igniterealtime/Smack.git'
+ developerConnection = 'scm:git:https://github.com/igniterealtime/Smack.git'
+ }
+
+ licenses {
+ if (project in gplLicensedProjects) {
+ license {
+ name = 'GNU General Public License, version 3 or any later version'
+ url = 'https://www.gnu.org/licenses/gpl.txt'
+ distribution = 'repo'
+ }
+ } else {
+ license {
+ name = 'The Apache Software License, Version 2.0'
+ url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
+ distribution = 'repo'
+ }
+ }
+ }
+
+ developers {
+ developer {
+ id = 'flow'
+ name = 'Florian Schmaus'
+ email = 'flow@igniterealtime.org'
+ }
+ }
+ }
+ }
+ }
+ repositories {
+ if (sonatypeCredentialsAvailable && useSonatype) {
+ maven {
+ url isSnapshot ? sonatypeSnapshotUrl : sonatypeStagingUrl
+ credentials {
+ username = sonatypeUsername
+ password = sonatypePassword
+ }
+ }
+ }
+ // Use
+ // gradle publish -P customRepoUrl=https://www.igniterealtime.org/archiva/repository/maven -P customRepoUsername=bamboo -P customRepoPassword=hidden -P useSonatype=false
+ // to deploy to this repo.
+ if (project.hasProperty("customRepoUrl")) {
+ maven {
+ name 'customRepo'
+ url customRepoUrl
+ if (project.hasProperty("customRepoUsername")) {
+ credentials {
+ username customRepoUsername
+ password customRepoPassword
+ }
+ }
+ }
+ }
+ }
+}
+
+// Workaround for gpg signatory not supporting the 'required' option
+// See https://github.com/gradle/gradle/issues/5064#issuecomment-381924984
+// Note what we use 'signing.gnupg.keyName' instead of 'signing.keyId'.
+tasks.withType(Sign) {
+ onlyIf {
+ project.hasProperty('signing.gnupg.keyName')
+ }
+}
+signing {
+ required { signingRequired }
+ useGpgCmd()
+ sign publishing.publications.mavenJava
+}
+
+tasks.withType(JavaCompile) {
+ options.errorprone {
+ disableWarningsInGeneratedCode = true
+ excludedPaths = ".*/jmh_generated/.*"
+ error(
+ "UnusedVariable",
+ "UnusedMethod",
+ "MethodCanBeStatic",
+ )
+ errorproneArgs = [
+ // Disable MissingCasesInEnumSwitch error prone check
+ // because this check is already done by javac as incomplete-switch.
+ '-Xep:MissingCasesInEnumSwitch:OFF',
+ '-Xep:StringSplitter:OFF',
+ '-Xep:JavaTimeDefaultTimeZone:OFF',
+ '-Xep:InlineMeSuggester:OFF',
+ ]
+ }
+}
+
+// Work around https://github.com/gradle/gradle/issues/4046
+task copyJavadocDocFiles(type: Copy) {
+ from('src/javadoc')
+ into 'build/docs/javadoc'
+ include '**/doc-files/*.*'
+}
+javadoc.dependsOn copyJavadocDocFiles
+
+def getGitCommit() {
+ def projectDirFile = new File("$projectDir")
+
+ def cmd = 'git describe --always --tags --dirty=+'
+ def proc = cmd.execute(null, projectDirFile)
+
+ def exitStatus = proc.waitFor()
+ if (exitStatus != 0) return "non-git build"
+
+ def gitCommit = proc.text.trim()
+ assert !gitCommit.isEmpty()
+ gitCommit
+}
+
+def getAndroidRuntimeJar() {
+ def androidHome = new File("$System.env.ANDROID_HOME")
+ if (!androidHome.isDirectory()) throw new Exception("ANDROID_HOME not found or set")
+ def androidJar = new File("$androidHome/platforms/android-$smackMinAndroidSdk/android.jar")
+ if (androidJar.isFile()) {
+ return androidJar
+ } else {
+ throw new Exception("Can't find android.jar for $smackMinAndroidSdk API. Please install corresponding SDK platform package")
+ }
+}
+
+def readVersionFile() {
+ def versionFile = new File(rootDir, 'version')
+ if (!versionFile.isFile()) {
+ throw new Exception("Could not find version file")
+ }
+ if (versionFile.text.isEmpty()) {
+ throw new Exception("Version file does not contain a version")
+ }
+ versionFile.text.trim()
+}
diff --git a/build-logic/src/main/groovy/org.igniterealtime.smack.javadoc-conventions.gradle b/build-logic/src/main/groovy/org.igniterealtime.smack.javadoc-conventions.gradle
new file mode 100644
index 000000000..61cb8f3c6
--- /dev/null
+++ b/build-logic/src/main/groovy/org.igniterealtime.smack.javadoc-conventions.gradle
@@ -0,0 +1,30 @@
+plugins {
+ // Javadoc linking requires repositories to bet configured. And
+ // those are declared in global-conventions, hence we add it here.
+ id 'org.igniterealtime.smack.global-conventions'
+}
+
+if (JavaVersion.current().isJava8Compatible()) {
+ tasks.withType(Javadoc) {
+ // The '-quiet' as second argument is actually a hack,
+ // since the one parameter addStringOption doesn't seem to
+ // work, we extra add '-quiet', which is added anyway by
+ // gradle.
+ // We disable 'missing' as we do most of javadoc checking via checkstyle.
+ options.addStringOption('Xdoclint:all,-missing', '-quiet')
+ // Abort on javadoc warnings.
+ // See JDK-8200363 (https://bugs.openjdk.java.net/browse/JDK-8200363)
+ // for information about the -Xwerror option.
+ options.addStringOption('Xwerror', '-quiet')
+ }
+}
+
+if (JavaVersion.current().isJava9Compatible()) {
+ tasks.withType(Javadoc) {
+ options.addStringOption('-release', javaMajor)
+ }
+}
+
+tasks.withType(Javadoc) {
+ options.charSet = "UTF-8"
+}
diff --git a/build.gradle b/build.gradle
index be40f20fe..13f9b12d7 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,349 +1,20 @@
-buildscript {
- repositories {
- jcenter()
- maven { url 'https://plugins.gradle.org/m2/' }
- maven { url 'https://dl.bintray.com/content/aalmiray/kordamp' }
- }
- dependencies {
- classpath 'org.kordamp.gradle:clirr-gradle-plugin:0.2.2'
- classpath "biz.aQute.bnd:biz.aQute.bnd.gradle:6.0.0"
- }
-}
-
plugins {
- id 'ru.vyarus.animalsniffer' version '1.5.0'
- id 'net.ltgt.errorprone' version '1.3.0'
- // Use e.g. "gradle
-
-Thank you for downloading Smack! This version of Smack is compatible
-with JVMs @targetCompatibility@ or higher. Using a build system which
-is able to consume Maven artifacts, like gradle or Maven, is highly
-recommended when using Smack.
-
- This is not the real README. Please visit
-
- Smack tries to depend on as few as possible libraries. The only
- requirement is jXMPP. For DNS
- resolution we recommend to
- use MiniDNS.
-
-Start off by viewing the documentation
-that can be found in the "documentation" directory included with this distribution.
- Changelog and Upgrading
-
-View the changelog for a list of changes since the
-last release.
-
- License Agreements
-Smack Readme
-
-
-
-
-
-version:
- @version@
-
-
-released:
- @releasedate@
-
-
-
- Copyright 2002-2008 Jive Software.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
printInterpreted
static variable to true
.
*
*/
diff --git a/smack-android/src/main/java/org/jivesoftware/smackx/package-info.java b/smack-android/src/main/java/org/jivesoftware/smackx/package-info.java
index 7ebe86244..bce3b6064 120000
--- a/smack-android/src/main/java/org/jivesoftware/smackx/package-info.java
+++ b/smack-android/src/main/java/org/jivesoftware/smackx/package-info.java
@@ -1 +1 @@
-../../../../../../../smack-java8-full/src/main/java/org/jivesoftware/smackx/package-info.java
\ No newline at end of file
+../../../../../../../smack-java11-full/src/main/java/org/jivesoftware/smackx/package-info.java
\ No newline at end of file
diff --git a/smack-bosh/build.gradle b/smack-bosh/build.gradle
index fcd3d5896..d939a9e46 100644
--- a/smack-bosh/build.gradle
+++ b/smack-bosh/build.gradle
@@ -1,3 +1,8 @@
+plugins {
+ id 'org.igniterealtime.smack.java-common-conventions'
+ id 'org.igniterealtime.smack.android-conventions'
+}
+
description = """\
Smack BOSH API.
This API is considered beta quality."""
diff --git a/smack-core/build.gradle b/smack-core/build.gradle
index f449ec5b7..1ffb92eb7 100644
--- a/smack-core/build.gradle
+++ b/smack-core/build.gradle
@@ -1,7 +1,7 @@
-// Note that this is also declared in the main build.gradle for
-// subprojects, but since evaluationDependsOnChildren is enabled we
-// need to declare it here too to have bundle{bnd{...}} available
-apply plugin: 'biz.aQute.bnd.builder'
+plugins {
+ id 'org.igniterealtime.smack.java-common-conventions'
+ id 'org.igniterealtime.smack.android-conventions'
+}
description = """\
Smack core components."""
@@ -16,6 +16,9 @@ dependencies {
api "org.jxmpp:jxmpp-jid:$jxmppVersion"
api "org.minidns:minidns-core:$miniDnsVersion"
+ // TODO: Migrate Junit4 tests to Junit5.
+ testImplementation "org.junit.vintage:junit-vintage-engine:$junitVersion"
+
testFixturesImplementation project(':smack-xmlparser-stax')
testFixturesImplementation project(':smack-xmlparser-xpp3')
@@ -28,7 +31,7 @@ dependencies {
testFixturesApi "org.jxmpp:jxmpp-jid:$jxmppVersion:tests"
testFixturesApi "org.xmlunit:xmlunit-core:$xmlUnitVersion"
- // Explictily add assertj-core which is a dependency of
+ // Explicitly add assertj-core which is a dependency of
// xmlunit-assertj, but gradle fails to resolves it with:
// Execution failed for task ':smack-core:compileTestJava'.
// > Could not resolve all files for configuration ':smack-core:testCompileClasspath'.
@@ -59,7 +62,7 @@ task createVersionResource(type: CreateFileTask) {
outputFile = new File(projectDir, 'src/main/resources/org.jivesoftware.smack/version')
}
-compileJava.dependsOn(createVersionResource)
+processResources.dependsOn(createVersionResource)
jar {
bundle {
diff --git a/smack-core/src/integration-test/java/org/jivesoftware/smack/MessageTest.java b/smack-core/src/integration-test/java/org/jivesoftware/smack/MessageTest.java
index 75b4f6915..bcded200c 100644
--- a/smack-core/src/integration-test/java/org/jivesoftware/smack/MessageTest.java
+++ b/smack-core/src/integration-test/java/org/jivesoftware/smack/MessageTest.java
@@ -60,7 +60,7 @@ public class MessageTest extends SmackTestCase {
}
Message message = (Message) collector.nextResult(2500);
- assertNotNull("Message not recieved from remote user", message);
+ assertNotNull("Message not received from remote user", message);
}
/**
diff --git a/smack-core/src/integration-test/java/org/jivesoftware/smack/test/SmackTestCase.java b/smack-core/src/integration-test/java/org/jivesoftware/smack/test/SmackTestCase.java
index 601540abe..ae25506ba 100644
--- a/smack-core/src/integration-test/java/org/jivesoftware/smack/test/SmackTestCase.java
+++ b/smack-core/src/integration-test/java/org/jivesoftware/smack/test/SmackTestCase.java
@@ -487,7 +487,7 @@ public abstract class SmackTestCase extends TestCase {
}
/**
- * Returns the name of the configuration file related to this test case. By default all
+ * Returns the name of the configuration file related to this test case. By default,all
* the test cases will use the same configuration file. However, it's possible to override the
* default configuration by providing a file of the form
@@ -387,6 +388,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
*
* @param configuration The configuration which is used to establish the connection.
*/
+ @SuppressWarnings("this-escape")
protected AbstractXMPPConnection(ConnectionConfiguration configuration) {
saslAuthentication = new SASLAuthentication(this, configuration);
config = configuration;
@@ -1067,6 +1069,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
}
@Override
+ @SuppressWarnings("TypeParameterUnusedInFormals")
public I sendIqRequestAndWaitForResponse(IQ request)
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
StanzaCollector collector = createStanzaCollectorAndSend(request);
@@ -1214,7 +1217,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
}
Stanza packet = (Stanza) sendTopLevelStreamElement;
- final List
* Technically there are typically at least two parameters required: Some kind of credentials for authentication. And
@@ -248,7 +248,7 @@ public abstract class ConnectionConfiguration {
stanzaIdSourceFactory = builder.stanzaIdSourceFactory;
- // If the enabledSaslmechanisms are set, then they must not be empty
+ // If the enabledSaslMechanisms are set, then they must not be empty
assert enabledSaslMechanisms == null || !enabledSaslMechanisms.isEmpty();
}
@@ -267,7 +267,7 @@ public abstract class ConnectionConfiguration {
context = SSLContext.getInstance("TLS");
}
- // TODO: Remove the block below once we removed setKeystorePath(), setKeystoreType(), setCallbackHanlder() and
+ // TODO: Remove the block below once we removed setKeystorePath(), setKeystoreType(), setCallbackHandler() and
// setPKCS11Library() in the builder, and all related fields and the parameters of this function.
if (keyManagers == null) {
keyManagers = Builder.getKeyManagersFrom(keystoreType, keystorePath, callbackHandler, pkcs11Library);
@@ -534,7 +534,7 @@ public abstract class ConnectionConfiguration {
/**
* Returns the stream language to use when connecting to the server.
*
- * @return the stream language to use when connecting to the server.
+ * @return the stream language to use when connecting to the server or If the developer sets the language to null, this will also return null, leading to
- * the removal of the xml:lang tag from the stream. If a Locale("") is configured, this will
- * return "", which can be used as an override.null
.
*/
public Locale getLanguage() {
return language;
@@ -544,19 +544,21 @@ public abstract class ConnectionConfiguration {
* Returns the xml:lang string of the stream language to use when connecting to the server.
*
*
null
.
*/
public String getXmlLang() {
- // TODO: Change to Locale.toLanguageTag() once Smack's minimum Android API level is 21 or higher.
- // This will need a workaround for new Locale("").getLanguageTag() returning "und". Expected
- // behavior of this function:
- // - returns null if language is null
- // - returns "" if language.getLanguage() returns the empty string
- // - returns language.toLanguageTag() otherwise
- return language != null ? language.toString().replace("_", "-") : null;
+ if (language == null) {
+ return null;
+ }
+
+ String languageTag = language.toLanguageTag();
+ if (languageTag.equals("und")) {
+ return null;
+ }
+
+ return languageTag;
}
/**
@@ -583,7 +585,7 @@ public abstract class ConnectionConfiguration {
* Returns true if the connection is going to use stream compression. Stream compression
* will be requested after TLS was established (if TLS was enabled) and only if the server
* offered stream compression. With stream compression network traffic can be reduced
- * up to 90%. By default compression is disabled.
+ * up to 90%. By default,compression is disabled.
*
* @return true if the connection is going to use stream compression.
*/
@@ -592,7 +594,7 @@ public abstract class ConnectionConfiguration {
}
/**
- * Check if the given SASL mechansism is enabled in this connection configuration.
+ * Check if the given SASL mechanism is enabled in this connection configuration.
*
* @param saslMechanism TODO javadoc me please
* @return true if the given SASL mechanism is enabled, false otherwise.
@@ -607,7 +609,7 @@ public abstract class ConnectionConfiguration {
/**
* Return the explicitly enabled SASL mechanisms. May return null
if no SASL mechanisms where
- * explicitly enabled, i.e. all SALS mechanisms supported and announced by the service will be considered.
+ * explicitly enabled, i.e. all SASL mechanisms supported and announced by the service will be considered.
*
* @return the enabled SASL mechanisms or null
.
*/
@@ -670,6 +672,7 @@ public abstract class ConnectionConfiguration {
private boolean compressionEnabled = false;
private StanzaIdSourceFactory stanzaIdSourceFactory = new StandardStanzaIdSource.Factory();
+ @SuppressWarnings("this-escape")
protected Builder() {
if (SmackConfiguration.DEBUG) {
enableDefaultDebugger();
@@ -857,22 +860,6 @@ public abstract class ConnectionConfiguration {
return getThis();
}
- /**
- * Set the host to connect to by either its fully qualified domain name (FQDN) or its IP.
- *
- * @param fqdnOrIp a CharSequence either representing the FQDN or the IP of the host.
- * @return a reference to this builder.
- * @see #setHost(DnsName)
- * @see #setHostAddress(InetAddress)
- * @since 4.3.2
- * @deprecated use {@link #setHost(CharSequence)} instead.
- */
- @Deprecated
- // TODO: Remove in Smack 4.5.
- public B setHostAddressByNameOrIp(CharSequence fqdnOrIp) {
- return setHost(fqdnOrIp);
- }
-
public B setPort(int port) {
if (port < 0 || port > 65535) {
throw new IllegalArgumentException(
@@ -1021,25 +1008,6 @@ public abstract class ConnectionConfiguration {
return getThis();
}
- /**
- * Sets a custom SSLContext for creating SSL sockets.
- * - * For more information on how to create a SSLContext see Java Secure Socket Extension (JSEE) Reference Guide: Creating Your Own X509TrustManager - * - * @param context the custom SSLContext for new sockets. - * @return a reference to this builder. - * @deprecated use {@link #setSslContextFactory(SslContextFactory)} instead}. - */ - // TODO: Remove in Smack 4.5. - @Deprecated - public B setCustomSSLContext(SSLContext context) { - return setSslContextFactory(() -> { - return context; - }); - } - /** * Sets a custom SSLContext for creating SSL sockets. *
@@ -1090,8 +1058,7 @@ public abstract class ConnectionConfiguration {
}
/**
- * Sets if an initial available presence will be sent to the server. By default
- * an available presence will be sent to the server indicating that this presence
+ * Sets if an initial available presence will be sent to the server. By default, * an available presence will be sent to the server indicating that this presence
* is not online and available to receive messages. If you want to log in without
* being 'noticed' then pass a false
value.
*
@@ -1187,7 +1154,9 @@ public abstract class ConnectionConfiguration {
if (!SASLAuthentication.isSaslMechanismRegistered(SASLMechanism.EXTERNAL)) {
throw new IllegalArgumentException("SASL " + SASLMechanism.EXTERNAL + " is not registered");
}
- setCustomSSLContext(sslContext);
+ setSslContextFactory(() -> {
+ return sslContext;
+ });
throwIfEnabledSaslMechanismsSet();
allowEmptyOrNullUsernames();
@@ -1266,7 +1235,7 @@ public abstract class ConnectionConfiguration {
* Sets if the connection is going to use compression (default false).
*
* Compression is only activated if the server offers compression. With compression network
- * traffic can be reduced up to 90%. By default compression is disabled.
+ * traffic can be reduced up to 90%. By default,compression is disabled.
*
* @param compressionEnabled if the connection is going to use compression on the HTTP level.
* @return a reference to this object.
@@ -1324,7 +1293,7 @@ public abstract class ConnectionConfiguration {
} else {
InputStream stream = TLSUtils.getDefaultTruststoreStreamIfPossible();
try {
- // Note that PKCS12 keystores need a password one some Java platforms. Hence we try the famous
+ // Note that PKCS12 keystores need a password one some Java platforms. Hence, we try the famous
// 'changeit' here. See https://bugs.openjdk.java.net/browse/JDK-8194702
char[] password = "changeit".toCharArray();
try {
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/SASLAuthentication.java b/smack-core/src/main/java/org/jivesoftware/smack/SASLAuthentication.java
index 4685bf4af..7d545bb45 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/SASLAuthentication.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/SASLAuthentication.java
@@ -53,7 +53,7 @@ import org.jxmpp.jid.EntityBareJid;
*
*
Once TLS has been negotiated (i.e. the connection has been secured) it is possible to * register with the server or authenticate using SASL. If the - * server supports SASL then Smack will try to authenticate using SASL..
+ * server supports SASL then Smack will try to authenticate using SASL. * *The server may support many SASL mechanisms to use for authenticating. Out of the box * Smack provides several SASL mechanisms, but it is possible to register new SASL Mechanisms. Use diff --git a/smack-core/src/main/java/org/jivesoftware/smack/ScheduledAction.java b/smack-core/src/main/java/org/jivesoftware/smack/ScheduledAction.java index da0377fab..def612a19 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/ScheduledAction.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/ScheduledAction.java @@ -1,6 +1,6 @@ /** * - * Copyright 2018 Florian Schmaus + * Copyright 2018-2024 Florian Schmaus * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -50,11 +50,13 @@ public class ScheduledAction implements Delayed { return smackReactor.cancel(this); } + @SuppressWarnings("JavaUtilDate") public boolean isDue() { Date now = new Date(); return now.after(releaseTime); } + @SuppressWarnings("JavaUtilDate") public long getTimeToDueMillis() { long now = System.currentTimeMillis(); return releaseTime.getTime() - now; diff --git a/smack-core/src/main/java/org/jivesoftware/smack/Smack.java b/smack-core/src/main/java/org/jivesoftware/smack/Smack.java index 6608bba4b..daa7a18b4 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/Smack.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/Smack.java @@ -30,7 +30,7 @@ public class Smack { public static final String SMACK_PACKAGE = SMACK_ORG + ".smack"; /** - * Returns the Smack version information, eg "1.3.0". + * Returns the Smack version information, e.g."1.3.0". * * @return the Smack version information. */ diff --git a/smack-core/src/main/java/org/jivesoftware/smack/SmackConfiguration.java b/smack-core/src/main/java/org/jivesoftware/smack/SmackConfiguration.java index f3316c8ed..ef1101cff 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/SmackConfiguration.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/SmackConfiguration.java @@ -102,7 +102,7 @@ public final class SmackConfiguration { private static HostnameVerifier defaultHostnameVerififer; /** - * Returns the Smack version information, eg "1.3.0". + * Returns the Smack version information, e.g."1.3.0". * * @return the Smack version information. * @deprecated use {@link Smack#getVersion()} instead. diff --git a/smack-core/src/main/java/org/jivesoftware/smack/SmackInitialization.java b/smack-core/src/main/java/org/jivesoftware/smack/SmackInitialization.java index 2a5b79c6a..82098094f 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/SmackInitialization.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/SmackInitialization.java @@ -1,6 +1,6 @@ /** * - * Copyright 2003-2007 Jive Software, 2014-2020 Florian Schmaus + * Copyright 2003-2007 Jive Software, 2014-2024 Florian Schmaus * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -63,7 +63,7 @@ public final class SmackInitialization { private static final Logger LOGGER = Logger.getLogger(SmackInitialization.class.getName()); - /** + /* * Loads the configuration from the smack-config.xml and system properties file. *
* So far this means that:
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/SmackReactor.java b/smack-core/src/main/java/org/jivesoftware/smack/SmackReactor.java
index efc6ca602..8fc59ab3a 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/SmackReactor.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/SmackReactor.java
@@ -1,6 +1,6 @@
/**
*
- * Copyright 2018-2023 Florian Schmaus
+ * Copyright 2018-2024 Florian Schmaus
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -144,6 +144,7 @@ public class SmackReactor {
}
}
+ @SuppressWarnings("JavaUtilDate")
ScheduledAction schedule(Runnable runnable, long delay, TimeUnit unit, ScheduledAction.Kind scheduledActionKind) {
long releaseTimeEpoch = System.currentTimeMillis() + unit.toMillis(delay);
Date releaseTimeDate = new Date(releaseTimeEpoch);
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/StanzaCollector.java b/smack-core/src/main/java/org/jivesoftware/smack/StanzaCollector.java
index 2ceaaf19d..dfa0ec7d2 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/StanzaCollector.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/StanzaCollector.java
@@ -1,6 +1,6 @@
/**
*
- * Copyright 2003-2007 Jive Software, 2016-2019 Florian Schmaus.
+ * Copyright 2003-2007 Jive Software, 2016-2024 Florian Schmaus.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -117,7 +117,7 @@ public final class StanzaCollector implements AutoCloseable {
* @return the next stanza result, or null
if there are no more
* results.
*/
- @SuppressWarnings("unchecked")
+ @SuppressWarnings({"unchecked", "TypeParameterUnusedInFormals"})
public synchronized
P pollResult() { return (P) resultQueue.poll(); } @@ -134,6 +134,7 @@ public final class StanzaCollector implements AutoCloseable { * @return the next available packet. * @throws XMPPErrorException in case an error response. */ + @SuppressWarnings("TypeParameterUnusedInFormals") public
P pollResultOrThrow() throws XMPPErrorException { P result = pollResult(); if (result != null) { @@ -150,7 +151,7 @@ public final class StanzaCollector implements AutoCloseable { * @return the next available packet. * @throws InterruptedException if the calling thread was interrupted. */ - @SuppressWarnings("unchecked") + @SuppressWarnings({"unchecked", "TypeParameterUnusedInFormals"}) // TODO: Consider removing this method as it is hardly ever useful. public synchronized
P nextResultBlockForever() throws InterruptedException { throwIfCancelled(); @@ -175,6 +176,7 @@ public final class StanzaCollector implements AutoCloseable { * @return the next available packet. * @throws InterruptedException if the calling thread was interrupted. */ + @SuppressWarnings("TypeParameterUnusedInFormals") public
P nextResult() throws InterruptedException {
return nextResult(connection.getReplyTimeout());
}
@@ -191,7 +193,7 @@ public final class StanzaCollector implements AutoCloseable {
* @return the next available stanza or null
on timeout or connection error.
* @throws InterruptedException if the calling thread was interrupted.
*/
- @SuppressWarnings("unchecked")
+ @SuppressWarnings({"unchecked", "TypeParameterUnusedInFormals"})
public
P nextResult(long timeout) throws InterruptedException { throwIfCancelled(); P res = null; @@ -223,6 +225,7 @@ public final class StanzaCollector implements AutoCloseable { * @throws NotConnectedException if the XMPP connection is not connected. * @see #nextResultOrThrow(long) */ + @SuppressWarnings("TypeParameterUnusedInFormals") public
P nextResultOrThrow() throws NoResponseException, XMPPErrorException, InterruptedException, NotConnectedException { return nextResultOrThrow(connection.getReplyTimeout()); @@ -263,6 +266,7 @@ public final class StanzaCollector implements AutoCloseable { * @throws InterruptedException if the calling thread was interrupted. * @throws NotConnectedException if there was no response and the connection got disconnected. */ + @SuppressWarnings("TypeParameterUnusedInFormals") public
P nextResultOrThrow(long timeout) throws NoResponseException, XMPPErrorException, InterruptedException, NotConnectedException { P result; diff --git a/smack-core/src/main/java/org/jivesoftware/smack/StanzaListener.java b/smack-core/src/main/java/org/jivesoftware/smack/StanzaListener.java index 52b3168c8..786c5a8b0 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/StanzaListener.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/StanzaListener.java @@ -27,12 +27,6 @@ import org.jivesoftware.smack.packet.Stanza; * the {@link #processStanza(Stanza)} method will be called. This is the * opposite approach to the functionality provided by a {@link StanzaCollector} * which lets you block while waiting for results. - *
- * Additionally you are able to intercept Packets that are going to be send and - * make modifications to them. You can register a PacketListener as interceptor - * by using {@link XMPPConnection#addStanzaInterceptor(StanzaListener, - * org.jivesoftware.smack.filter.StanzaFilter)} - *
* * @see XMPPConnection#addAsyncStanzaListener(StanzaListener, org.jivesoftware.smack.filter.StanzaFilter) * @author Matt Tucker diff --git a/smack-core/src/main/java/org/jivesoftware/smack/XMPPConnection.java b/smack-core/src/main/java/org/jivesoftware/smack/XMPPConnection.java index f7543e724..45cd8328f 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/XMPPConnection.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/XMPPConnection.java @@ -96,7 +96,7 @@ import org.jxmpp.jid.EntityFullJid; *- * Asynchronous callbacks are run decoupled from the connections main event loop. Hence a callback triggered by + * Asynchronous callbacks are run decoupled from the connections main event loop. Hence, a callback triggered by * stanza B may (appear to) invoked before a callback triggered by stanza A, even though stanza A arrived before B. *
*@@ -242,7 +242,7 @@ public interface XMPPConnection { *
* * @param stanza the stanza to send. - * @return {@code true} if the stanza was successfully scheduled to be send, {@code false} otherwise. + * @return {@code true} if the stanza was successfully scheduled to be sent, {@code false} otherwise. * @throws NotConnectedException if the connection is not connected. * @since 4.4.0 * @deprecated use {@link #sendStanzaNonBlocking(Stanza)} instead. @@ -265,7 +265,7 @@ public interface XMPPConnection { * @param stanza the stanza to send. * @param timeout how long to wait before giving up, in units of {@code unit}. * @param unit a {@code TimeUnit} determining how to interpret the {@code timeout} parameter. - * @return {@code true} if the stanza was successfully scheduled to be send, {@code false} otherwise. + * @return {@code true} if the stanza was successfully scheduled to be sent, {@code false} otherwise. * @throws NotConnectedException if the connection is not connected. * @throws InterruptedException if the calling thread was interrupted. * @since 4.4.0 @@ -318,6 +318,7 @@ public interface XMPPConnection { * @throws InterruptedException if the calling thread was interrupted. * @since 4.3 */ + @SuppressWarnings("TypeParameterUnusedInFormals") I sendIqRequestAndWaitForResponse(IQ request) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException; @@ -423,7 +424,6 @@ public interface XMPPConnection { * * @param stanzaListener the stanza listener to notify of new received stanzas. * @param stanzaFilter the stanza filter to use. - * @see #addStanzaInterceptor(StanzaListener, StanzaFilter) * @since 4.1 */ void addSyncStanzaListener(StanzaListener stanzaListener, StanzaFilter stanzaFilter); @@ -449,7 +449,6 @@ public interface XMPPConnection { * * @param stanzaListener the stanza listener to notify of new received stanzas. * @param stanzaFilter the stanza filter to use. - * @see #addStanzaInterceptor(StanzaListener, StanzaFilter) * @since 4.1 */ void addAsyncStanzaListener(StanzaListener stanzaListener, StanzaFilter stanzaFilter); @@ -483,34 +482,6 @@ public interface XMPPConnection { */ void removeStanzaSendingListener(StanzaListener stanzaListener); - /** - * Registers a stanza interceptor with this connection. The interceptor will be - * invoked every time a stanza is about to be sent by this connection. Interceptors - * may modify the stanza to be sent. A stanza filter determines which stanzas - * will be delivered to the interceptor. - * - *- * NOTE: For a similar functionality on incoming stanzas, see {@link #addAsyncStanzaListener(StanzaListener, StanzaFilter)}. - *
- * - * @param stanzaInterceptor the stanza interceptor to notify of stanzas about to be sent. - * @param stanzaFilter the stanza filter to use. - * @deprecated use {@link #addMessageInterceptor(Consumer, Predicate)} or {@link #addPresenceInterceptor(Consumer, Predicate)} instead. - */ - @Deprecated - // TODO: Remove in Smack 4.5. - void addStanzaInterceptor(StanzaListener stanzaInterceptor, StanzaFilter stanzaFilter); - - /** - * Removes a stanza interceptor. - * - * @param stanzaInterceptor the stanza interceptor to remove. - * @deprecated use {@link #removeMessageInterceptor(Consumer)} or {@link #removePresenceInterceptor(Consumer)} instead. - */ - @Deprecated - // TODO: Remove in Smack 4.5. - void removeStanzaInterceptor(StanzaListener stanzaInterceptor); - /** * Registers a stanza interceptor with this connection. The interceptor will be * invoked every time a stanza is about to be sent by this connection. Interceptors @@ -611,23 +582,6 @@ public interface XMPPConnection { */ FromMode getFromMode(); - /** - * Get the feature stanza extensions for a given stream feature of the - * server, ornull
if the server doesn't support that feature.
- *
- * @param null
- * @deprecated use {@link #getFeature(Class)} instead.
- */
- // TODO: Remove in Smack 4.5.
- @Deprecated
- default null
if the server doesn't support that feature.
@@ -637,6 +591,7 @@ public interface XMPPConnection {
* @return a stanza extensions of the feature or null
* @since 4.4
*/
+ @SuppressWarnings("TypeParameterUnusedInFormals")
* It is possible to not only print the raw sent and received stanzas but also the interpreted
- * packets by Smack. By default interpreted packets won't be printed. To enable this feature
+ * packets by Smack. By default,interpreted packets won't be printed. To enable this feature
* just change the printInterpreted
static variable to true
.
*
* It is possible to not only print the raw sent and received stanzas but also the interpreted
- * packets by Smack. By default interpreted packets won't be printed. To enable this feature
+ * packets by Smack. By default,interpreted packets won't be printed. To enable this feature
* just change the printInterpreted
static variable to true
.
*
null
if it doesn't exist.
*/
+ @SuppressWarnings("TypeParameterUnusedInFormals")
public * Use this class when implementing new extension elements when possible. This means that every instance of your * implemented class must represent an XML element of the same qualified name. diff --git a/smack-core/src/main/java/org/jivesoftware/smack/packet/IQ.java b/smack-core/src/main/java/org/jivesoftware/smack/packet/IQ.java index 1881f4c23..98f9880f3 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/packet/IQ.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/packet/IQ.java @@ -88,14 +88,14 @@ public abstract class IQ extends Stanza implements IqView { } @Override - public Type getType() { + public final Type getType() { return type; } /** * Sets the type of the IQ packet. *
- * Since the type of an IQ must present, an IllegalArgmentException will be thrown when type is
+ * Since the type of an IQ must present, an IllegalArgumentException will be thrown when type is
* null
.
*
- * This does not perform a deep clone, as extension elements are shared between the new and old - * instance. - *
- * @return a clone of this message. - * @deprecated use {@link #asBuilder()} instead. - */ - // TODO: Remove in Smack 4.5. - @Deprecated - @Override - public Message clone() { - return new Message(this); - } - /** * Represents a message subject, its language and the content of the subject. */ diff --git a/smack-core/src/main/java/org/jivesoftware/smack/packet/MessageOrPresence.java b/smack-core/src/main/java/org/jivesoftware/smack/packet/MessageOrPresence.java index f48b794a0..c3aa3d180 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/packet/MessageOrPresence.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/packet/MessageOrPresence.java @@ -20,11 +20,6 @@ import org.jivesoftware.smack.XMPPConnection; public abstract class MessageOrPresence
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/packet/Presence.java b/smack-core/src/main/java/org/jivesoftware/smack/packet/Presence.java
index 3490e1a23..caa3942dc 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/packet/Presence.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/packet/Presence.java
@@ -1,6 +1,6 @@
/**
*
- * Copyright 2003-2007 Jive Software, 2020-2021 Florian Schmaus.
+ * Copyright 2003-2007 Jive Software, 2020-2024 Florian Schmaus.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,12 +21,9 @@ import java.util.List;
import java.util.Locale;
import org.jivesoftware.smack.XMPPConnection;
-import org.jivesoftware.smack.util.Objects;
import org.jivesoftware.smack.util.StringUtils;
import org.jivesoftware.smack.util.XmlStringBuilder;
-import org.jxmpp.jid.Jid;
-
/**
* Represents XMPP presence stanzas. Every presence stanza has a type, which is one of
* the following values:
@@ -78,55 +75,6 @@ public final class Presence extends MessageOrPresence
- * This does not perform a deep clone, as extension elements are shared between the new and old
- * instance.
- *
* This is meant to construct extension elements used as simple flags in Stanzas.
- *
*
* @param name the name of the extension element.
* @param namespace the namespace of the extension element.
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/packet/Stanza.java b/smack-core/src/main/java/org/jivesoftware/smack/packet/Stanza.java
index 7123e82f8..88c30bbfa 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/packet/Stanza.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/packet/Stanza.java
@@ -98,7 +98,7 @@ public abstract class Stanza implements StanzaView, TopLevelStreamElement {
protected Stanza(StanzaBuilder> stanzaBuilder) {
if (stanzaBuilder.stanzaIdSource != null) {
id = stanzaBuilder.stanzaIdSource.getNewStanzaId();
- // Note that some stanza ID sources, e.g. StanzaBuilder.PresenceBuilder.EMPTY return null here. Hence we
+ // Note that some stanza ID sources, e.g. StanzaBuilder.PresenceBuilder.EMPTY return null here. Hence, we
// only check that the returned string is not empty.
assert StringUtils.isNullOrNotEmpty(id);
usedStanzaIdSource = stanzaBuilder.stanzaIdSource;
@@ -159,22 +159,6 @@ public abstract class Stanza implements StanzaView, TopLevelStreamElement {
return id != null;
}
- /**
- * Set the stanza id if none is set.
- *
- * @return the stanza id.
- * @since 4.2
- * @deprecated use {@link StanzaBuilder} instead.
- */
- @Deprecated
- // TODO: Remove in Smack 4.5.
- public String setStanzaId() {
- if (!hasStanzaIdSet()) {
- setNewStanzaId();
- }
- return getStanzaId();
- }
-
/**
* Throws an {@link IllegalArgumentException} if this stanza has no stanza ID set.
*
@@ -219,7 +203,7 @@ public abstract class Stanza implements StanzaView, TopLevelStreamElement {
* @param to who the packet is being sent to.
*/
// TODO: Mark this as deprecated once StanzaBuilder is ready and all call sites are gone.
- public void setTo(Jid to) {
+ public final void setTo(Jid to) {
this.to = to;
}
@@ -255,34 +239,11 @@ public abstract class Stanza implements StanzaView, TopLevelStreamElement {
error = stanzaError;
}
- /**
- * Deprecated.
- * @param stanzaError the stanza error.
- * @deprecated use {@link StanzaBuilder} instead.
- */
- @Deprecated
- // TODO: Remove in Smack 4.5.
- public void setError(StanzaError.Builder stanzaError) {
- setError(stanzaError.build());
- }
-
@Override
public final String getLanguage() {
return language;
}
- /**
- * Sets the xml:lang of this Stanza.
- *
- * @param language the xml:lang of this Stanza.
- * @deprecated use {@link StanzaBuilder#setLanguage(String)} instead.
- */
- @Deprecated
- // TODO: Remove in Smack 4.5.
- public void setLanguage(String language) {
- this.language = language;
- }
-
@Override
public final List
+ * attribute optional, so it does not always need to be set.
*
* @return who the stanza is being sent to, or
+ * attribute optional, so it does not always need to be set.
*
* @return who the stanza is being sent from, or
* If multiple provider entries attempt to register to handle the same element name and namespace,
* the first entry loaded from the classpath will take precedence. Whenever a stanza extension
* is found in a packet, parsing will be passed to the correct provider. Each provider
@@ -106,7 +107,8 @@ import org.jivesoftware.smack.util.XmppElementUtil;
* set the properties of th class using the values in the stanza extension sub-element. When an
* extension provider is not registered for an element name and namespace combination, Smack will
* store all top-level elements of the sub-packet in DefaultPacketExtension object and then
- * attach it to the packet.
+ * attach it to the packet.
+ *
- * According to the Encrypted
- * XMPP Manifesto, TLSv1.2 shall be deployed, providing fallback support for SSLv3 and
- * TLSv1.1. This method goes one step beyond and upgrades the handshake to use TLSv1 or better.
- * This method requires the underlying OS to support all of TLSv1.2 , 1.1 and 1.0.
- *
- * According to the Encrypted
- * XMPP Manifesto, TLSv1.2 shall be deployed, providing fallback support for SSLv3 and
- * TLSv1.1.
- *
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/util/XmlStringBuilder.java b/smack-core/src/main/java/org/jivesoftware/smack/util/XmlStringBuilder.java
index 3ecb67877..5c327157b 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/util/XmlStringBuilder.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/util/XmlStringBuilder.java
@@ -1,6 +1,6 @@
/**
*
- * Copyright 2014-2023 Florian Schmaus
+ * Copyright 2014-2024 Florian Schmaus
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -47,6 +47,7 @@ public class XmlStringBuilder implements Appendable, CharSequence, Element {
this(pe, null);
}
+ @SuppressWarnings("this-escape")
public XmlStringBuilder(NamedElement e) {
this();
halfOpenElement(e.getElementName());
@@ -56,6 +57,7 @@ public class XmlStringBuilder implements Appendable, CharSequence, Element {
this(element.getElementName(), element.getNamespace(), element.getLanguage(), enclosingXmlEnvironment);
}
+ @SuppressWarnings("this-escape")
public XmlStringBuilder(String elementName, String xmlNs, String xmlLang, XmlEnvironment enclosingXmlEnvironment) {
sb = new LazyStringBuilder();
halfOpenElement(elementName);
@@ -138,20 +140,6 @@ public class XmlStringBuilder implements Appendable, CharSequence, Element {
return this;
}
- /**
- * Deprecated.
- *
- * @param element deprecated.
- * @return deprecated.
- * @deprecated use {@link #append(Element)} instead.
- */
- @Deprecated
- // TODO: Remove in Smack 4.5.
- public XmlStringBuilder element(Element element) {
- assert element != null;
- return append(element.toXML());
- }
-
public XmlStringBuilder optElement(String name, String content) {
if (content != null) {
element(name, content);
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/util/XmppElementUtil.java b/smack-core/src/main/java/org/jivesoftware/smack/util/XmppElementUtil.java
index 5639a7e5f..7ffe2f2eb 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/util/XmppElementUtil.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/util/XmppElementUtil.java
@@ -71,6 +71,7 @@ public class XmppElementUtil {
return qname;
}
+ @SuppressWarnings("MixedMutabilityReturnType")
public static
- * We recommend that applications using Smack's DNSSEC API do not ask the user if DNSSEC is avaialble. Instead they
- * should check for DNSSEC suport on every connection attempt. Once DNSSEC support has been discovered, the application
+ * We recommend that applications using Smack's DNSSEC API do not ask the user if DNSSEC is available. Instead they
+ * should check for DNSSEC support on every connection attempt. Once DNSSEC support has been discovered, the application
* should use the `needsDnssec` mode for all future connection attempts. The same scheme can be applied when using DANE.
* This approach is similar to the scheme established by to HTTP Strict
* Transport Security" (HSTS, RFC 6797.
diff --git a/smack-core/src/test/java/org/jivesoftware/smack/packet/IqTest.java b/smack-core/src/test/java/org/jivesoftware/smack/packet/IqTest.java
index b8f192bd7..2101daca4 100644
--- a/smack-core/src/test/java/org/jivesoftware/smack/packet/IqTest.java
+++ b/smack-core/src/test/java/org/jivesoftware/smack/packet/IqTest.java
@@ -1,6 +1,6 @@
/**
*
- * Copyright © 2023 Florian Schmaus
+ * Copyright © 2023-2024 Florian Schmaus
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,7 +18,13 @@ package org.jivesoftware.smack.packet;
import static org.jivesoftware.smack.test.util.XmlAssertUtil.assertXmlSimilar;
+import org.jivesoftware.smack.test.util.SmackTestUtil;
+import org.jivesoftware.smack.util.PacketParserUtils;
+import org.jivesoftware.smack.xml.XmlPullParser;
+
import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.EnumSource;
public class IqTest {
@@ -35,4 +41,36 @@ public class IqTest {
assertXmlSimilar(expected, errorIq.toXML());
}
+ @ParameterizedTest
+ @EnumSource(SmackTestUtil.XmlPullParserKind.class)
+ public void testIqWithXmlns(SmackTestUtil.XmlPullParserKind parserKind) throws Exception {
+ final String iqXml = " the top level stream element class.
* @return a sent packet.
*/
+ @SuppressWarnings("TypeParameterUnusedInFormals")
public P getSentPacket() {
return getSentPacket(5 * 60);
}
@@ -176,7 +179,7 @@ public class DummyConnection extends AbstractXMPPConnection {
* @param the top level stream element class.
* @return a sent packet.
*/
- @SuppressWarnings("unchecked")
+ @SuppressWarnings({"unchecked", "TypeParameterUnusedInFormals"})
public P getSentPacket(int wait) {
try {
return (P) queue.poll(wait, TimeUnit.SECONDS);
diff --git a/smack-core/src/testFixtures/java/org/jivesoftware/smack/test/util/MemoryLeakTestUtil.java b/smack-core/src/testFixtures/java/org/jivesoftware/smack/test/util/MemoryLeakTestUtil.java
index 6746e8f13..1eccfd75a 100644
--- a/smack-core/src/testFixtures/java/org/jivesoftware/smack/test/util/MemoryLeakTestUtil.java
+++ b/smack-core/src/testFixtures/java/org/jivesoftware/smack/test/util/MemoryLeakTestUtil.java
@@ -41,7 +41,7 @@ import org.jxmpp.stringprep.XmppStringprepException;
* Note that this test is based on the assumption that it is possible to trigger a full garbage collection run, which is
* not the case. See also this
* stackoverflow
- * question. Hence the {@link #triggerGarbageCollection()} method defined in this class is not portable and depends
+ * question. Hence, the {@link #triggerGarbageCollection()} method defined in this class is not portable and depends
* on implementation depended Java Virtual Machine behavior.
*
@@ -162,7 +162,7 @@
* Things can usually only be used by other things if they are friends. Since a
* thing normally can't decide on its own if an incoming friendship request
* should be granted or not, we can delegate this decision to a provisioning
- * service. Smack provides the `IoTProvisinoManager` to deal with friendship and
+ * service. Smack provides the `IoTProvisionManager` to deal with friendship and
* provisioning.
*
diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/provisioning/element/ClearCache.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/provisioning/element/ClearCache.java
index fe98b32b3..d17e46c94 100644
--- a/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/provisioning/element/ClearCache.java
+++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/provisioning/element/ClearCache.java
@@ -1,6 +1,6 @@
/**
*
- * Copyright © 2016 Florian Schmaus
+ * Copyright © 2016-2024 Florian Schmaus
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,6 +23,7 @@ public class ClearCache extends SimpleIQ {
public static final String ELEMENT = "clearCache";
public static final String NAMESPACE = Constants.IOT_PROVISIONING_NAMESPACE;
+ @SuppressWarnings("this-escape")
public ClearCache() {
super(ELEMENT, NAMESPACE);
//
* The most important class is the {@link org.jivesoftware.smackx.message_markup.element.MarkupElement} class, which
- * contains a Builder to construct message markup..
+ * contains a Builder to construct message markup.
*
* To start creating a Message Markup Extension, call
diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/MUCLightRoomConfiguration.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/MUCLightRoomConfiguration.java
index aab822087..7f0595871 100644
--- a/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/MUCLightRoomConfiguration.java
+++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/MUCLightRoomConfiguration.java
@@ -16,7 +16,7 @@
*/
package org.jivesoftware.smackx.muclight;
-import java.util.HashMap;
+import java.util.Map;
/**
* MUC Light room configuration class.
@@ -28,7 +28,7 @@ public class MUCLightRoomConfiguration {
private final String roomName;
private final String subject;
- private final HashMapnull
if it doesn't exist.
- * @deprecated use {@link #getExtension(Class)} or {@link #getExtensionElement(String, String)} instead.
- */
- // TODO: Remove in Smack 4.5.
- @SuppressWarnings("unchecked")
- @Deprecated
- public final null
if
* the value is not set. The XMPP protocol often makes the "to"
- * attribute optional, so it does not always need to be set.null
if the
* value has not been set.
@@ -46,7 +46,7 @@ public interface StanzaView extends XmlLangElement {
/**
* Returns who the stanza is being sent "from" or null
if
* the value is not set. The XMPP protocol often makes the "from"
- * attribute optional, so it does not always need to be set.null
if the
* value has not been set.
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/packet/StreamError.java b/smack-core/src/main/java/org/jivesoftware/smack/packet/StreamError.java
index f034be9d3..a58599de8 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/packet/StreamError.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/packet/StreamError.java
@@ -58,9 +58,9 @@ import org.jivesoftware.smack.util.XmlStringBuilder;
* stream has been authenticated
*
- * policy-violation the entity has violated some local service
* policy. remote-connection-failed Rthe server is unable to properly connect
+ *
- * remote-connection-failed the server is unable to properly connect
* to a remote entity. resource-constraint Rthe server lacks the system resources necessary
+ *
* resource-constraint the server lacks the system resources necessary
* to service the stream.
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/packet/UnparsedIQ.java b/smack-core/src/main/java/org/jivesoftware/smack/packet/UnparsedIQ.java
index e363d2e30..8cd2146f8 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/packet/UnparsedIQ.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/packet/UnparsedIQ.java
@@ -16,6 +16,8 @@
*/
package org.jivesoftware.smack.packet;
+import org.jivesoftware.smack.util.StringUtils;
+
/**
* An IQ stanzas that could not be parsed because no provider was found.
*/
@@ -34,7 +36,12 @@ public class UnparsedIQ extends IQ {
@Override
protected IQChildElementXmlStringBuilder getIQChildElementBuilder(IQChildElementXmlStringBuilder xml) {
- xml.escape(content);
+ if (StringUtils.isEmpty(content)) {
+ xml.setEmptyElement();
+ } else {
+ xml.rightAngleBracket();
+ xml.escape(content);
+ }
return xml;
}
}
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/provider/ProviderFileLoader.java b/smack-core/src/main/java/org/jivesoftware/smack/provider/ProviderFileLoader.java
index 11da95318..2781fe0d9 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/provider/ProviderFileLoader.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/provider/ProviderFileLoader.java
@@ -17,9 +17,9 @@
package org.jivesoftware.smack.provider;
import java.io.InputStream;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
-import java.util.LinkedList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -39,11 +39,11 @@ import org.jivesoftware.smack.xml.XmlPullParser;
public class ProviderFileLoader implements ProviderLoader {
private static final Logger LOGGER = Logger.getLogger(ProviderFileLoader.class.getName());
- private final Collection restricted-xml the entity has attempted to send restricted XML
* features.
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/proxy/HTTPProxySocketConnection.java b/smack-core/src/main/java/org/jivesoftware/smack/proxy/HTTPProxySocketConnection.java
index 549406423..bdf0cf390 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/proxy/HTTPProxySocketConnection.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/proxy/HTTPProxySocketConnection.java
@@ -23,6 +23,7 @@ import java.io.StringReader;
import java.net.HttpURLConnection;
import java.net.InetSocketAddress;
import java.net.Socket;
+import java.nio.charset.StandardCharsets;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -58,7 +59,7 @@ class HTTPProxySocketConnection implements ProxySocketConnection {
proxyLine = "\r\nProxy-Authorization: Basic " + Base64.encode(username + ":" + password);
}
socket.getOutputStream().write((hostport + " HTTP/1.1\r\nHost: "
- + host + ":" + port + proxyLine + "\r\n\r\n").getBytes("UTF-8"));
+ + host + ":" + port + proxyLine + "\r\n\r\n").getBytes(StandardCharsets.UTF_8));
InputStream in = socket.getInputStream();
StringBuilder got = new StringBuilder(100);
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/proxy/ProxyInfo.java b/smack-core/src/main/java/org/jivesoftware/smack/proxy/ProxyInfo.java
index 402a106a4..90433c5c8 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/proxy/ProxyInfo.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/proxy/ProxyInfo.java
@@ -41,6 +41,7 @@ public class ProxyInfo {
private ProxyType proxyType;
private final ProxySocketConnection proxySocketConnection;
+ @SuppressWarnings("this-escape")
public ProxyInfo(ProxyType pType, String pHost, int pPort, String pUser,
String pPass) {
this.proxyType = pType;
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/sasl/SASLMechanism.java b/smack-core/src/main/java/org/jivesoftware/smack/sasl/SASLMechanism.java
index f1c00ef19..24330a6ac 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/sasl/SASLMechanism.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/sasl/SASLMechanism.java
@@ -358,7 +358,7 @@ public abstract class SASLMechanism implements Comparable
S parseStanza(String stanza) throws XmlPullParserException, SmackParsingException, IOException {
return (S) parseStanza(getParserFor(stanza), XmlEnvironment.EMPTY);
}
@@ -230,7 +229,7 @@ public class PacketParserUtils {
// Assume this is the end tag of the start tag at the
// beginning of this method. Typical examples where this
// happens are body elements containing the empty string,
- // ie. , which appears to be valid XMPP, or a
+ // i.e. , which appears to be valid XMPP, or a
// least it's not explicitly forbidden by RFC 6121 5.2.3
return "";
} else {
@@ -644,7 +643,7 @@ public class PacketParserUtils {
assert parser.getEventType() == XmlPullParser.Event.START_ELEMENT;
String name;
final int initialDepth = parser.getDepth();
- ListBest Practices
*
*
*
* IoTDiscoveryManager iotDiscoveryManager = IoTDiscoveryManager.getInstanceFor(connection);
- * iotDiscovyerManager.registerThing(thing);
+ * iotDiscoveryManager.registerThing(thing);
*
* Usage
*
*
- * Message message = new Message("Alice is a realy nice person.");
+ * Message message = new Message("Alice is a really nice person.");
* BareJid alice = JidCreate.bareFrom("alice@capulet.lit");
* ReferenceManager.addMention(message, 0, 5, alice);
*
diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/sid/element/OriginIdElement.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/sid/element/OriginIdElement.java
index a50fd99e2..f0766de8b 100644
--- a/smack-experimental/src/main/java/org/jivesoftware/smackx/sid/element/OriginIdElement.java
+++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/sid/element/OriginIdElement.java
@@ -38,28 +38,6 @@ public class OriginIdElement extends StableAndUniqueIdElement {
super(id);
}
- /**
- * Add an origin-id element to a message and set the stanzas id to the same id as in the origin-id element.
- *
- * @param message message.
- * @return the added origin-id element.
- * @deprecated use {@link #addTo(MessageBuilder)} instead.
- */
- @Deprecated
- // TODO: Remove in Smack 4.5.
- public static OriginIdElement addOriginId(Message message) {
- OriginIdElement originId = message.getExtension(OriginIdElement.class);
- if (originId != null) {
- return originId;
- }
-
- originId = new OriginIdElement();
- message.addExtension(originId);
- // TODO: Find solution to have both the originIds stanzaId and a nice to look at incremental stanzaID.
- // message.setStanzaId(originId.getId());
- return originId;
- }
-
/**
* Add an origin-id element to a message and set the stanzas id to the same id as in the origin-id element.
*
diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/spoiler/element/SpoilerElement.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/spoiler/element/SpoilerElement.java
index 6d5c02fd6..b18a5af5c 100644
--- a/smack-experimental/src/main/java/org/jivesoftware/smackx/spoiler/element/SpoilerElement.java
+++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/spoiler/element/SpoilerElement.java
@@ -114,6 +114,7 @@ public class SpoilerElement implements ExtensionElement {
* @param message message
* @return map of spoilers
*/
+ @SuppressWarnings("MixedMutabilityReturnType")
public static Map
*
*
diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/blocking/element/BlockContactsIQ.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/blocking/element/BlockContactsIQ.java
index 39cb9525b..79bd2068a 100644
--- a/smack-extensions/src/main/java/org/jivesoftware/smackx/blocking/element/BlockContactsIQ.java
+++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/blocking/element/BlockContactsIQ.java
@@ -51,6 +51,7 @@ public class BlockContactsIQ extends IQ {
*
* @param jids TODO javadoc me please
*/
+ @SuppressWarnings("this-escape")
public BlockContactsIQ(List