diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index fa9bb447a..2fb93a48c 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -6,14 +6,13 @@ jobs:
build:
name: Build Smack
- runs-on: ubuntu-24.04
+ runs-on: ubuntu-22.04
strategy:
matrix:
java:
- - 17
- - 21
+ - 11
env:
- PRIMARY_JAVA_VERSION: 21
+ PRIMARY_JAVA_VERSION: 11
steps:
- name: Checkout
@@ -53,10 +52,10 @@ jobs:
- name: Install GraphViz
run: sudo apt update && sudo apt install graphviz
- name: Install Android SDK Manager
- uses: android-actions/setup-android@v3
+ uses: android-actions/setup-android@v2
- name: Install Android SDK
run: |
- sdkmanager "platforms;android-23"
+ sdkmanager "platforms;android-19"
# Testing
- name: Gradle Check
@@ -72,22 +71,15 @@ jobs:
run: ./gradlew javadocAll --stacktrace
# Test Coverage Report
- - name: Aggregated Jacoco Test Coverage Report
+ - name: Jacoco Test Coverage
if: ${{ matrix.java == env.PRIMARY_JAVA_VERSION }}
- 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
+ run: ./gradlew jacocoRootReport coveralls
+ env:
+ COVERALLS_REPO_TOKEN: S2ecSJja2cKJa9yv45C8ZFPohXuRrTXKd
# Upload build artifacts
- name: Upload build artifacts
- uses: actions/upload-artifact@v4
+ uses: actions/upload-artifact@v2
with:
name: smack-java-${{ matrix.java }}
path: |
diff --git a/.gitignore b/.gitignore
index ec8037f60..7bd5f61be 100644
--- a/.gitignore
+++ b/.gitignore
@@ -12,6 +12,7 @@
.project
.settings
.gradle
+gradle.properties
build/
core/build/
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b413e7f75..d896bc4e4 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,17 +1,5 @@
# 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
deleted file mode 100644
index 4689ef8af..000000000
--- a/Makefile
+++ /dev/null
@@ -1,30 +0,0 @@
-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
deleted file mode 100644
index 7b02d03a7..000000000
--- a/build-logic/build.gradle
+++ /dev/null
@@ -1,14 +0,0 @@
-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
deleted file mode 100644
index d082ce7e0..000000000
--- a/build-logic/settings.gradle
+++ /dev/null
@@ -1 +0,0 @@
-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
deleted file mode 100644
index c14cb3199..000000000
--- a/build-logic/src/main/groovy/org.igniterealtime.smack.android-boot-classpath-conventions.gradle
+++ /dev/null
@@ -1,6 +0,0 @@
-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
deleted file mode 100644
index 94beb432c..000000000
--- a/build-logic/src/main/groovy/org.igniterealtime.smack.android-conventions.gradle
+++ /dev/null
@@ -1,10 +0,0 @@
-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
deleted file mode 100644
index fa4c7011e..000000000
--- a/build-logic/src/main/groovy/org.igniterealtime.smack.application-conventions.gradle
+++ /dev/null
@@ -1,12 +0,0 @@
-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
deleted file mode 100644
index 5bd92c7ee..000000000
--- a/build-logic/src/main/groovy/org.igniterealtime.smack.global-conventions.gradle
+++ /dev/null
@@ -1,37 +0,0 @@
-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
deleted file mode 100644
index 598fdfa67..000000000
--- a/build-logic/src/main/groovy/org.igniterealtime.smack.java-common-conventions.gradle
+++ /dev/null
@@ -1,367 +0,0 @@
-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
deleted file mode 100644
index 61cb8f3c6..000000000
--- a/build-logic/src/main/groovy/org.igniterealtime.smack.javadoc-conventions.gradle
+++ /dev/null
@@ -1,30 +0,0 @@
-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 13f9b12d7..be40f20fe 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,20 +1,349 @@
-plugins {
- // The scalastyle plugin of smack-repl wants the root project to
- // have a ideaProject task, so let's add one.
- id 'idea'
+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"
+ }
+}
- id 'org.igniterealtime.smack.javadoc-conventions'
+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 bce3b6064..7ebe86244 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-java11-full/src/main/java/org/jivesoftware/smackx/package-info.java
\ No newline at end of file
+../../../../../../../smack-java8-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 d939a9e46..fcd3d5896 100644
--- a/smack-bosh/build.gradle
+++ b/smack-bosh/build.gradle
@@ -1,8 +1,3 @@
-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 1ffb92eb7..f449ec5b7 100644
--- a/smack-core/build.gradle
+++ b/smack-core/build.gradle
@@ -1,7 +1,7 @@
-plugins {
- id 'org.igniterealtime.smack.java-common-conventions'
- id 'org.igniterealtime.smack.android-conventions'
-}
+// 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'
description = """\
Smack core components."""
@@ -16,9 +16,6 @@ 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')
@@ -31,7 +28,7 @@ dependencies {
testFixturesApi "org.jxmpp:jxmpp-jid:$jxmppVersion:tests"
testFixturesApi "org.xmlunit:xmlunit-core:$xmlUnitVersion"
- // Explicitly add assertj-core which is a dependency of
+ // Explictily 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'.
@@ -62,7 +59,7 @@ task createVersionResource(type: CreateFileTask) {
outputFile = new File(projectDir, 'src/main/resources/org.jivesoftware.smack/version')
}
-processResources.dependsOn(createVersionResource)
+compileJava.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 bcded200c..75b4f6915 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 received from remote user", message);
+ assertNotNull("Message not recieved 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 ae25506ba..601540abe 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
@@ -388,7 +387,6 @@ 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;
@@ -1069,7 +1067,6 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
}
@Override
- @SuppressWarnings("TypeParameterUnusedInFormals")
public I sendIqRequestAndWaitForResponse(IQ request)
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
StanzaCollector collector = createStanzaCollectorAndSend(request);
@@ -1217,7 +1214,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(), setCallbackHandler() and
+ // TODO: Remove the block below once we removed setKeystorePath(), setKeystoreType(), setCallbackHanlder() 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 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.null
.
+ * @return the stream language to use when connecting to the server.
*/
public Locale getLanguage() {
return language;
@@ -544,21 +544,19 @@ public abstract class ConnectionConfiguration {
* Returns the xml:lang string of the stream language to use when connecting to the server.
*
*
null
.
+ * @return the stream language to use when connecting to the server.
*/
public String getXmlLang() {
- if (language == null) {
- return null;
- }
-
- String languageTag = language.toLanguageTag();
- if (languageTag.equals("und")) {
- return null;
- }
-
- return languageTag;
+ // 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;
}
/**
@@ -585,7 +583,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.
*/
@@ -594,7 +592,7 @@ public abstract class ConnectionConfiguration {
}
/**
- * Check if the given SASL mechanism is enabled in this connection configuration.
+ * Check if the given SASL mechansism is enabled in this connection configuration.
*
* @param saslMechanism TODO javadoc me please
* @return true if the given SASL mechanism is enabled, false otherwise.
@@ -609,7 +607,7 @@ public abstract class ConnectionConfiguration {
/**
* Return the explicitly enabled SASL mechanisms. May return null
if no SASL mechanisms where
- * explicitly enabled, i.e. all SASL mechanisms supported and announced by the service will be considered.
+ * explicitly enabled, i.e. all SALS mechanisms supported and announced by the service will be considered.
*
* @return the enabled SASL mechanisms or null
.
*/
@@ -672,7 +670,6 @@ public abstract class ConnectionConfiguration {
private boolean compressionEnabled = false;
private StanzaIdSourceFactory stanzaIdSourceFactory = new StandardStanzaIdSource.Factory();
- @SuppressWarnings("this-escape")
protected Builder() {
if (SmackConfiguration.DEBUG) {
enableDefaultDebugger();
@@ -860,6 +857,22 @@ 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(
@@ -1008,6 +1021,25 @@ 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. *
@@ -1058,7 +1090,8 @@ 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.
*
@@ -1154,9 +1187,7 @@ public abstract class ConnectionConfiguration {
if (!SASLAuthentication.isSaslMechanismRegistered(SASLMechanism.EXTERNAL)) {
throw new IllegalArgumentException("SASL " + SASLMechanism.EXTERNAL + " is not registered");
}
- setSslContextFactory(() -> {
- return sslContext;
- });
+ setCustomSSLContext(sslContext);
throwIfEnabledSaslMechanismsSet();
allowEmptyOrNullUsernames();
@@ -1235,7 +1266,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.
@@ -1293,7 +1324,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 7d545bb45..4685bf4af 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 def612a19..da0377fab 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-2024 Florian Schmaus + * Copyright 2018 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,13 +50,11 @@ 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 daa7a18b4..6608bba4b 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, e.g."1.3.0". + * Returns the Smack version information, eg "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 ef1101cff..f3316c8ed 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, e.g."1.3.0". + * Returns the Smack version information, eg "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 82098094f..2a5b79c6a 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-2024 Florian Schmaus + * Copyright 2003-2007 Jive Software, 2014-2020 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 8fc59ab3a..efc6ca602 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-2024 Florian Schmaus
+ * Copyright 2018-2023 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,7 +144,6 @@ 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 dfa0ec7d2..2ceaaf19d 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-2024 Florian Schmaus.
+ * Copyright 2003-2007 Jive Software, 2016-2019 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", "TypeParameterUnusedInFormals"})
+ @SuppressWarnings("unchecked")
public synchronized
P pollResult() { return (P) resultQueue.poll(); } @@ -134,7 +134,6 @@ 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) { @@ -151,7 +150,7 @@ public final class StanzaCollector implements AutoCloseable { * @return the next available packet. * @throws InterruptedException if the calling thread was interrupted. */ - @SuppressWarnings({"unchecked", "TypeParameterUnusedInFormals"}) + @SuppressWarnings("unchecked") // TODO: Consider removing this method as it is hardly ever useful. public synchronized
P nextResultBlockForever() throws InterruptedException { throwIfCancelled(); @@ -176,7 +175,6 @@ 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());
}
@@ -193,7 +191,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", "TypeParameterUnusedInFormals"})
+ @SuppressWarnings("unchecked")
public
P nextResult(long timeout) throws InterruptedException { throwIfCancelled(); P res = null; @@ -225,7 +223,6 @@ 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()); @@ -266,7 +263,6 @@ 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 786c5a8b0..52b3168c8 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/StanzaListener.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/StanzaListener.java @@ -27,6 +27,12 @@ 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 45cd8328f..f7543e724 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 sent, {@code false} otherwise. + * @return {@code true} if the stanza was successfully scheduled to be send, {@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 sent, {@code false} otherwise. + * @return {@code true} if the stanza was successfully scheduled to be send, {@code false} otherwise. * @throws NotConnectedException if the connection is not connected. * @throws InterruptedException if the calling thread was interrupted. * @since 4.4.0 @@ -318,7 +318,6 @@ 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; @@ -424,6 +423,7 @@ 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,6 +449,7 @@ 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); @@ -482,6 +483,34 @@ 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 @@ -582,6 +611,23 @@ 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.
@@ -591,7 +637,6 @@ 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 98f9880f3..1881f4c23 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 final Type getType() { + public Type getType() { return type; } /** * Sets the type of the IQ packet. *
- * Since the type of an IQ must present, an IllegalArgumentException will be thrown when type is
+ * Since the type of an IQ must present, an IllegalArgmentException 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 c3aa3d180..f48b794a0 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,6 +20,11 @@ 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 caa3942dc..3490e1a23 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-2024 Florian Schmaus.
+ * Copyright 2003-2007 Jive Software, 2020-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.
@@ -21,9 +21,12 @@ 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:
@@ -75,6 +78,55 @@ 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 88c30bbfa..7123e82f8 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,6 +159,22 @@ 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.
*
@@ -203,7 +219,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 final void setTo(Jid to) {
+ public void setTo(Jid to) {
this.to = to;
}
@@ -239,11 +255,34 @@ 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
*
* @return who the stanza is being sent to, or
*
* @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
@@ -107,8 +106,7 @@ 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.
- *
*
* @author Matt Tucker
*/
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/provider/package-info.java b/smack-core/src/main/java/org/jivesoftware/smack/provider/package-info.java
index 21fafdfcb..5e40c5639 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/provider/package-info.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/provider/package-info.java
@@ -16,7 +16,7 @@
*/
/**
- * The Smack provider architecture is a system for plugging in custom XML parsing of stanza extensions
+ * The Smack provider architecture is a system for plugging in custom XML parsing of staza extensions
* ({@link org.jivesoftware.smack.packet.ExtensionElement}, {@link org.jivesoftware.smack.packet.IQ} stanzas and
* {@link org.jivesoftware.smack.packet.Nonza}. Hence, there are the the following providers:
*
+ * 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 5c327157b..3ecb67877 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-2024 Florian Schmaus
+ * Copyright 2014-2023 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,7 +47,6 @@ public class XmlStringBuilder implements Appendable, CharSequence, Element {
this(pe, null);
}
- @SuppressWarnings("this-escape")
public XmlStringBuilder(NamedElement e) {
this();
halfOpenElement(e.getElementName());
@@ -57,7 +56,6 @@ 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);
@@ -140,6 +138,20 @@ 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 7ffe2f2eb..5639a7e5f 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,7 +71,6 @@ 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 available. Instead they
- * should check for DNSSEC support 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 avaialble. Instead they
+ * should check for DNSSEC suport 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 2101daca4..b8f192bd7 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-2024 Florian Schmaus
+ * Copyright © 2023 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,13 +18,7 @@ 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 {
@@ -41,36 +35,4 @@ 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);
}
@@ -179,7 +176,7 @@ public class DummyConnection extends AbstractXMPPConnection {
* @param the top level stream element class.
* @return a sent packet.
*/
- @SuppressWarnings({"unchecked", "TypeParameterUnusedInFormals"})
+ @SuppressWarnings("unchecked")
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 1eccfd75a..6746e8f13 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 `IoTProvisionManager` to deal with friendship and
+ * service. Smack provides the `IoTProvisinoManager` 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 d17e46c94..fe98b32b3 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-2024 Florian Schmaus
+ * Copyright © 2016 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,7 +23,6 @@ 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 7f0595871..aab822087 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.Map;
+import java.util.HashMap;
/**
* MUC Light room configuration class.
@@ -28,7 +28,7 @@ public class MUCLightRoomConfiguration {
private final String roomName;
private final String subject;
- private final Mapnull
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.
+ * 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.
+ * 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 a58599de8..f034be9d3 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 the server is unable to properly connect
+ *
- * remote-connection-failed Rthe server is unable to properly connect
* to a remote entity. resource-constraint the server lacks the system resources necessary
+ *
* resource-constraint Rthe 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 8cd2146f8..e363d2e30 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,8 +16,6 @@
*/
package org.jivesoftware.smack.packet;
-import org.jivesoftware.smack.util.StringUtils;
-
/**
* An IQ stanzas that could not be parsed because no provider was found.
*/
@@ -36,12 +34,7 @@ public class UnparsedIQ extends IQ {
@Override
protected IQChildElementXmlStringBuilder getIQChildElementBuilder(IQChildElementXmlStringBuilder xml) {
- if (StringUtils.isEmpty(content)) {
- xml.setEmptyElement();
- } else {
- xml.rightAngleBracket();
- xml.escape(content);
- }
+ 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 2781fe0d9..11da95318 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 bdf0cf390..549406423 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,7 +23,6 @@ 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;
@@ -59,7 +58,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(StandardCharsets.UTF_8));
+ + host + ":" + port + proxyLine + "\r\n\r\n").getBytes("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 90433c5c8..402a106a4 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,7 +41,6 @@ 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 24330a6ac..f1c00ef19 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);
}
@@ -229,7 +230,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,
- // i.e. , which appears to be valid XMPP, or a
+ // ie. , which appears to be valid XMPP, or a
// least it's not explicitly forbidden by RFC 6121 5.2.3
return "";
} else {
@@ -643,7 +644,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);
- * iotDiscoveryManager.registerThing(thing);
+ * iotDiscovyerManager.registerThing(thing);
*
* Usage
*
*
- * Message message = new Message("Alice is a really nice person.");
+ * Message message = new Message("Alice is a realy 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 f0766de8b..a50fd99e2 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,6 +38,28 @@ 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 b18a5af5c..6d5c02fd6 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,7 +114,6 @@ 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 79bd2068a..39cb9525b 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,7 +51,6 @@ public class BlockContactsIQ extends IQ {
*
* @param jids TODO javadoc me please
*/
- @SuppressWarnings("this-escape")
public BlockContactsIQ(List