Codota Logo
ConnectionUriInvalidException.newBuilder
Code IndexAdd Codota to your IDE (free)

How to use
newBuilder
method
in
org.eclipse.ditto.model.connectivity.ConnectionUriInvalidException

Best Java code snippets using org.eclipse.ditto.model.connectivity.ConnectionUriInvalidException.newBuilder (Showing top 4 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
ScheduledThreadPoolExecutor s =
  • Codota Iconnew ScheduledThreadPoolExecutor(corePoolSize)
  • Codota IconThreadFactory threadFactory;new ScheduledThreadPoolExecutor(corePoolSize, threadFactory)
  • Codota IconString str;new ScheduledThreadPoolExecutor(1, new ThreadFactoryBuilder().setNameFormat(str).build())
  • Smart code suggestions by Codota
}
origin: org.eclipse.ditto/ditto-model-connectivity

private ConnectionUri(final String theUriString) {
  final URI uri;
  try {
    uri = new URI(theUriString).parseServerAuthority();
  } catch (final URISyntaxException e) {
    throw ConnectionUriInvalidException.newBuilder(theUriString).build();
  }
  // validate self
  if (!isValid(uri)) {
    throw ConnectionUriInvalidException.newBuilder(theUriString).build();
  }
  uriString = uri.toASCIIString();
  protocol = uri.getScheme();
  hostname = uri.getHost();
  port = uri.getPort();
  path = uri.getPath();
  // initialize nullable fields
  final String userInfo = uri.getUserInfo();
  if (userInfo != null && userInfo.contains(USERNAME_PASSWORD_SEPARATOR)) {
    final int separatorIndex = userInfo.indexOf(USERNAME_PASSWORD_SEPARATOR);
    userName = userInfo.substring(0, separatorIndex);
    password = userInfo.substring(separatorIndex + 1);
  } else {
    userName = null;
    password = null;
  }
  // must be initialized after all else
  uriStringWithMaskedPassword = createUriStringWithMaskedPassword();
}
origin: eclipse/ditto

private ConnectionUri(final String theUriString) {
  final URI uri;
  try {
    uri = new URI(theUriString).parseServerAuthority();
  } catch (final URISyntaxException e) {
    throw ConnectionUriInvalidException.newBuilder(theUriString).build();
  }
  // validate self
  if (!isValid(uri)) {
    throw ConnectionUriInvalidException.newBuilder(theUriString).build();
  }
  uriString = uri.toASCIIString();
  protocol = uri.getScheme();
  hostname = uri.getHost();
  port = uri.getPort();
  path = uri.getPath();
  // initialize nullable fields
  final String userInfo = uri.getUserInfo();
  if (userInfo != null && userInfo.contains(USERNAME_PASSWORD_SEPARATOR)) {
    final int separatorIndex = userInfo.indexOf(USERNAME_PASSWORD_SEPARATOR);
    userName = userInfo.substring(0, separatorIndex);
    password = userInfo.substring(separatorIndex + 1);
  } else {
    userName = null;
    password = null;
  }
  // must be initialized after all else
  uriStringWithMaskedPassword = createUriStringWithMaskedPassword();
}
origin: eclipse/ditto

/**
 * Check whether the URI scheme of the connection belongs to an accepted scheme.
 *
 * @param connection the connection to check.
 * @param dittoHeaders headers of the command that triggered the connection validation.
 * @param acceptedSchemes valid URI schemes for the connection type.
 * @param protocolName protocol name of the connection type.
 * @throws DittoRuntimeException if the URI scheme is not accepted.
 */
protected static void validateUriScheme(final Connection connection,
    final DittoHeaders dittoHeaders,
    final Collection<String> acceptedSchemes,
    final String protocolName) {
  if (!acceptedSchemes.contains(connection.getProtocol())) {
    final String message =
        MessageFormat.format("The URI scheme ''{0}'' is not valid for {1}.", connection.getProtocol(),
            protocolName);
    final String description =
        MessageFormat.format("Accepted URI schemes are: {0}", String.join(", ", acceptedSchemes));
    throw ConnectionUriInvalidException.newBuilder(connection.getUri())
        .message(message)
        .description(description)
        .dittoHeaders(dittoHeaders)
        .build();
  }
}
origin: org.eclipse.ditto/ditto-services-connectivity-messaging

/**
 * Check whether the URI scheme of the connection belongs to an accepted scheme.
 *
 * @param connection the connection to check.
 * @param dittoHeaders headers of the command that triggered the connection validation.
 * @param acceptedSchemes valid URI schemes for the connection type.
 * @param protocolName protocol name of the connection type.
 * @throws DittoRuntimeException if the URI scheme is not accepted.
 */
protected static void validateUriScheme(final Connection connection,
    final DittoHeaders dittoHeaders,
    final Collection<String> acceptedSchemes,
    final String protocolName) {
  if (!acceptedSchemes.contains(connection.getProtocol())) {
    final String message =
        MessageFormat.format("The URI scheme ''{0}'' is not valid for {1}.", connection.getProtocol(),
            protocolName);
    final String description =
        MessageFormat.format("Accepted URI schemes are: {0}", String.join(", ", acceptedSchemes));
    throw ConnectionUriInvalidException.newBuilder(connection.getUri())
        .message(message)
        .description(description)
        .dittoHeaders(dittoHeaders)
        .build();
  }
}
org.eclipse.ditto.model.connectivityConnectionUriInvalidExceptionnewBuilder

Javadoc

A mutable builder for a ConnectionUriInvalidException.

Popular methods of ConnectionUriInvalidException

  • <init>
  • readDescription
  • readHRef
  • readMessage

Popular in Java

  • Running tasks concurrently on multiple threads
  • setContentView (Activity)
  • addToBackStack (FragmentTransaction)
  • getExternalFilesDir (Context)
  • PrintStream (java.io)
    A PrintStream adds functionality to another output stream, namely the ability to print representatio
  • MalformedURLException (java.net)
    Thrown to indicate that a malformed URL has occurred. Either no legal protocol could be found in a s
  • TimeUnit (java.util.concurrent)
    A TimeUnit represents time durations at a given unit of granularity and provides utility methods to
  • AtomicInteger (java.util.concurrent.atomic)
    An int value that may be updated atomically. See the java.util.concurrent.atomic package specificati
  • HttpServletRequest (javax.servlet.http)
    Extends the javax.servlet.ServletRequest interface to provide request information for HTTP servlets.
  • SAXParseException (org.xml.sax)
    Encapsulate an XML parse error or warning.This exception may include information for locating the er
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now