Tabnine Logo
StanzaError$Builder.build
Code IndexAdd Tabnine to your IDE (free)

How to use
build
method
in
org.jivesoftware.smack.packet.StanzaError$Builder

Best Java code snippets using org.jivesoftware.smack.packet.StanzaError$Builder.build (Showing top 11 results out of 315)

origin: igniterealtime/Smack

/**
 * Creates a new XMPPErrorException with the given builder.
 *
 * @param xmppErrorBuilder
 * @deprecated Use {@link #XMPPErrorException(Stanza, StanzaError)} instead.
 */
@Deprecated
public XMPPErrorException(StanzaError.Builder xmppErrorBuilder) {
  this(null, xmppErrorBuilder.build());
}
origin: igniterealtime/Smack

@Test(expected = IllegalArgumentException.class)
public void descriptiveTextNullLangPassedMap() throws Exception {
  final String text = "Dummy descriptive text";
  Map<String, String> texts = new HashMap<>();
  texts.put(null, text);
  StanzaError
    .getBuilder(StanzaError.Condition.internal_server_error)
    .setDescriptiveTexts(texts)
    .build();
}
origin: igniterealtime/Smack

} else {
  StanzaError.Builder builder = PacketParserUtils.parseError(parser);
  throw new XMPPException.XMPPErrorException(null, builder.build());
origin: org.igniterealtime.smack/smack-core

/**
 * Creates a new XMPPErrorException with the given builder.
 *
 * @param xmppErrorBuilder
 * @deprecated Use {@link #XMPPErrorException(Stanza, StanzaError)} instead.
 */
@Deprecated
public XMPPErrorException(StanzaError.Builder xmppErrorBuilder) {
  this(null, xmppErrorBuilder.build());
}
origin: org.igniterealtime.smack/smack-core

/**
 * Sets the error for this stanza.
 *
 * @param xmppErrorBuilder the error to associate with this stanza.
 */
public void setError(StanzaError.Builder xmppErrorBuilder) {
  if (xmppErrorBuilder == null) {
    return;
  }
  xmppErrorBuilder.setStanza(this);
  error = xmppErrorBuilder.build();
}
origin: igniterealtime/Smack

/**
 * Test creating a error response based on an IQ request.
 * @throws XmppStringprepException
 */
@Test
public void testGeneratingValidErrorResponse() throws XmppStringprepException {
  final StanzaError.Builder error = StanzaError.getBuilder(StanzaError.Condition.bad_request);
  final IQ request = new TestIQ(ELEMENT, NAMESPACE);
  request.setType(IQ.Type.set);
  request.setFrom(JidCreate.from("sender@test/Smack"));
  request.setTo(JidCreate.from("receiver@test/Smack"));
  final IQ result = IQ.createErrorResponse(request, error);
  assertEquals(IQ.Type.error, result.getType());
  assertNotNull(result.getStanzaId());
  assertEquals(request.getStanzaId(), result.getStanzaId());
  assertEquals(request.getFrom(), result.getTo());
  assertEquals(error.build().toXML(), result.getError().toXML());
  // TODO this test was never valid
  // assertEquals(CHILD_ELEMENT, result.getChildElementXML());
}
origin: igniterealtime/Smack

@Test
public void ensureNoEmptyLangInDescriptiveText() throws Exception {
  final String text = "Dummy descriptive text";
  Map<String, String> texts = new HashMap<>();
  texts.put("", text);
  StanzaError error = StanzaError
      .getBuilder(StanzaError.Condition.internal_server_error)
      .setDescriptiveTexts(texts)
      .build();
  final String errorXml = XMLBuilder
      .create(StanzaError.ERROR).a("type", "cancel").up()
      .element("internal-server-error", StanzaError.ERROR_CONDITION_AND_TEXT_NAMESPACE).up()
      .element("text", StanzaError.ERROR_CONDITION_AND_TEXT_NAMESPACE).t(text).up()
      .asString();
  XmlUnitUtils.assertSimilar(errorXml, error.toXML(StreamOpen.CLIENT_NAMESPACE));
}
origin: igniterealtime/Smack

/**
 * Cancels the SOCKS5 Bytestream request by sending an error to the initiator and building a
 * XMPP exception.
 * @throws XMPPErrorException
 * @throws NotConnectedException
 * @throws InterruptedException
 */
private void cancelRequest() throws XMPPErrorException, NotConnectedException, InterruptedException {
  String errorMessage = "Could not establish socket with any provided host";
  StanzaError.Builder error = StanzaError.from(StanzaError.Condition.item_not_found, errorMessage);
  IQ errorIQ = IQ.createErrorResponse(this.bytestreamRequest, error);
  this.manager.getConnection().sendStanza(errorIQ);
  throw new XMPPErrorException(errorIQ, error.build());
}
origin: igniterealtime/Smack

  @Test
  public void ensureNoNullLangInParsedDescriptiveTexts() throws Exception {
    final String text = "Dummy descriptive text";
    final String errorXml = XMLBuilder
      .create(StanzaError.ERROR).a("type", "cancel").up()
      .element("internal-server-error", StanzaError.ERROR_CONDITION_AND_TEXT_NAMESPACE).up()
      .element("text", StanzaError.ERROR_CONDITION_AND_TEXT_NAMESPACE).t(text).up()
      .asString();
    XmlPullParser parser = TestUtils.getParser(errorXml);
    StanzaError error = PacketParserUtils.parseError(parser).build();
    assertEquals(text, error.getDescriptiveText());
  }
}
origin: igniterealtime/Smack

  @SmackIntegrationTest
  public void throwRuntimeExceptionTest() throws XMPPErrorException {
    Message message = new Message();
    throw new XMPPException.XMPPErrorException(message,
            StanzaError.from(StanzaError.Condition.bad_request, DESCRIPTIVE_TEXT).build());
  }
}
origin: igniterealtime/Smack

/**
 * Sets the error for this stanza.
 *
 * @param xmppErrorBuilder the error to associate with this stanza.
 */
public void setError(StanzaError.Builder xmppErrorBuilder) {
  if (xmppErrorBuilder == null) {
    return;
  }
  xmppErrorBuilder.setStanza(this);
  error = xmppErrorBuilder.build();
}
org.jivesoftware.smack.packetStanzaError$Builderbuild

Popular methods of StanzaError$Builder

  • setCondition
  • setDescriptiveTexts
  • <init>
  • addExtension
  • copyFrom
  • setConditionText
  • setErrorGenerator
  • setExtensions
  • setStanza
  • setTextNamespace
  • setType
  • setDescriptiveEnText
  • setType,
  • setDescriptiveEnText

Popular in Java

  • Creating JSON documents from java classes using gson
  • scheduleAtFixedRate (Timer)
  • getContentResolver (Context)
  • runOnUiThread (Activity)
  • URL (java.net)
    A Uniform Resource Locator that identifies the location of an Internet resource as specified by RFC
  • KeyStore (java.security)
    KeyStore is responsible for maintaining cryptographic keys and their owners. The type of the syste
  • SimpleDateFormat (java.text)
    Formats and parses dates in a locale-sensitive manner. Formatting turns a Date into a String, and pa
  • ReentrantLock (java.util.concurrent.locks)
    A reentrant mutual exclusion Lock with the same basic behavior and semantics as the implicit monitor
  • Base64 (org.apache.commons.codec.binary)
    Provides Base64 encoding and decoding as defined by RFC 2045.This class implements section 6.8. Base
  • Get (org.apache.hadoop.hbase.client)
    Used to perform Get operations on a single row. To get everything for a row, instantiate a Get objec
  • 14 Best Plugins for Eclipse
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now