1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2025-09-10 17:49:38 +02:00

Merge branch '4.4'

This commit is contained in:
Florian Schmaus 2021-10-19 14:33:21 +02:00
commit e842195b71
28 changed files with 282 additions and 86 deletions

View file

@ -1,3 +1,8 @@
// 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."""
@ -55,3 +60,11 @@ task createVersionResource(type: CreateFileTask) {
}
compileJava.dependsOn(createVersionResource)
jar {
bundle {
bnd(
'DynamicImport-Package': '*',
)
}
}

View file

@ -405,7 +405,7 @@ public abstract class ConnectionConfiguration {
/**
* Returns the TLS security mode used when making the connection. By default,
* the mode is {@link SecurityMode#ifpossible}.
* the mode is {@link SecurityMode#required}.
*
* @return the security mode.
*/
@ -960,7 +960,7 @@ public abstract class ConnectionConfiguration {
/**
* Sets the TLS security mode used when making the connection. By default,
* the mode is {@link SecurityMode#ifpossible}.
* the mode is {@link SecurityMode#required}.
*
* @param securityMode the security mode.
* @return a reference to this builder.

View file

@ -120,6 +120,16 @@ public abstract class XMPPException extends Exception {
return error;
}
/**
* Gets the stanza associated with this exception.
*
* @return the stanza from which this exception was created or {@code null} if the exception is not from a
* stanza.
*/
public Stanza getStanza() {
return stanza;
}
/**
* Get the request which triggered the error response causing this exception.
*

View file

@ -202,7 +202,7 @@ public abstract class IQ extends Stanza implements IqView {
// Add the query section if there is one.
IQChildElementXmlStringBuilder iqChildElement = getIQChildElementBuilder(
new IQChildElementXmlStringBuilder(this));
new IQChildElementXmlStringBuilder(getChildElementName(), getChildElementNamespace(), null, xml.getXmlEnvironment()));
// TOOD: Document the cases where iqChildElement is null but childElementName not. And if there are none, change
// the logic.
if (iqChildElement == null) {
@ -399,17 +399,16 @@ public abstract class IQ extends Stanza implements IqView {
private boolean isEmptyElement;
private IQChildElementXmlStringBuilder(IQ iq) {
this(iq.getChildElementName(), iq.getChildElementNamespace());
public IQChildElementXmlStringBuilder(ExtensionElement extensionElement,
XmlEnvironment enclosingXmlEnvironment) {
this(extensionElement.getElementName(), extensionElement.getNamespace(), extensionElement.getLanguage(),
enclosingXmlEnvironment);
}
public IQChildElementXmlStringBuilder(ExtensionElement pe) {
this(pe.getElementName(), pe.getNamespace());
}
private IQChildElementXmlStringBuilder(String element, String namespace) {
prelude(element, namespace);
this.element = element;
private IQChildElementXmlStringBuilder(String elementName, String xmlNs, String xmlLang,
XmlEnvironment enclosingXmlEnvironment) {
super(elementName, xmlNs, xmlLang, enclosingXmlEnvironment);
this.element = elementName;
}
public void setEmptyElement() {

View file

@ -60,4 +60,8 @@ public class SASLAnonymous extends SASLMechanism {
// SASL Anonymous is always successful :)
}
@Override
public boolean requiresPassword() {
return false;
}
}

View file

@ -78,6 +78,7 @@ public class ParserUtils {
throws XmlPullParserException, IOException {
XmlPullParser.Event event = parser.getEventType();
while (!(event == XmlPullParser.Event.END_ELEMENT && parser.getDepth() == depth)) {
assert event != XmlPullParser.Event.END_DOCUMENT;
event = parser.next();
}
}

View file

@ -1,6 +1,6 @@
/**
*
* Copyright 2014-2020 Florian Schmaus
* Copyright 2014-2021 Florian Schmaus
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -52,11 +52,13 @@ public class XmlStringBuilder implements Appendable, CharSequence, Element {
}
public XmlStringBuilder(XmlElement element, XmlEnvironment enclosingXmlEnvironment) {
sb = new LazyStringBuilder();
halfOpenElement(element);
this(element.getElementName(), element.getNamespace(), element.getLanguage(), enclosingXmlEnvironment);
}
public XmlStringBuilder(String elementName, String xmlNs, String xmlLang, XmlEnvironment enclosingXmlEnvironment) {
sb = new LazyStringBuilder();
halfOpenElement(elementName);
String xmlNs = element.getNamespace();
String xmlLang = element.getLanguage();
if (enclosingXmlEnvironment == null) {
xmlnsAttribute(xmlNs);
xmllangAttribute(xmlLang);