Tabnine Logo
MalformedURLException
Code IndexAdd Tabnine to your IDE (free)

How to use
MalformedURLException
in
java.net

Best Java code snippets using java.net.MalformedURLException (Showing top 20 results out of 17,442)

Refine searchRefine arrow

  • URL
  • URI
  • Matcher
  • Pattern
  • URISyntaxException
origin: apache/incubator-dubbo

public java.net.URL toJavaURL() {
  try {
    return new java.net.URL(toString());
  } catch (MalformedURLException e) {
    throw new IllegalStateException(e.getMessage(), e);
  }
}
origin: Bilibili/DanmakuFlameMaster

public void fillStreamFromHttpFile(Uri uri) {
  try {
    URL url = new URL(uri.getPath());
    url.openConnection();
    inStream = new BufferedInputStream(url.openStream());
  } catch (MalformedURLException e) {
    e.printStackTrace();
  } catch (IOException e) {
    e.printStackTrace();
  }
}
origin: RipMeApp/ripme

@Override
public String getGID(URL url) throws MalformedURLException {
  Matcher m = p.matcher(url.toExternalForm());
  if (m.matches()) {
    return m.group(1);
  }
  throw new MalformedURLException("Expected luscious.net URL format: "
      + "luscious.net/albums/albumname \n members.luscious.net/albums/albumname  - got " + url + " instead.");
}
origin: spring-projects/spring-framework

/**
 * Create a new {@code UrlResource} based on a URI specification.
 * <p>The given parts will automatically get encoded if necessary.
 * @param protocol the URL protocol to use (e.g. "jar" or "file" - without colon);
 * also known as "scheme"
 * @param location the location (e.g. the file path within that protocol);
 * also known as "scheme-specific part"
 * @param fragment the fragment within that location (e.g. anchor on an HTML page,
 * as following after a "#" separator)
 * @throws MalformedURLException if the given URL specification is not valid
 * @see java.net.URI#URI(String, String, String)
 */
public UrlResource(String protocol, String location, @Nullable String fragment) throws MalformedURLException  {
  try {
    this.uri = new URI(protocol, location, fragment);
    this.url = this.uri.toURL();
    this.cleanedUrl = getCleanedUrl(this.url, this.uri.toString());
  }
  catch (URISyntaxException ex) {
    MalformedURLException exToThrow = new MalformedURLException(ex.getMessage());
    exToThrow.initCause(ex);
    throw exToThrow;
  }
}
origin: apache/pulsar

@Override
public void connect() throws IOException {
  if (this.parsed) {
    return;
  }
  if (this.uri == null) {
    throw new IOException();
  }
  Matcher matcher = pattern.matcher(this.uri.getSchemeSpecificPart());
  if (matcher.matches()) {
    this.contentType = matcher.group("mimeType");
    if (contentType == null) {
      this.contentType = "application/data";
    }
    if (matcher.group("base64") == null) {
      // Support Urlencode but not decode here because already decoded by URI class.
      this.data = matcher.group("data").getBytes();
    } else {
      this.data = Base64.getDecoder().decode(matcher.group("data"));
    }
  } else {
    throw new MalformedURLException();
  }
  parsed = true;
}
origin: aws/aws-sdk-java

StringBuilder url = new StringBuilder(request.getEndpoint().toString());
url.append(urlPath);
  return new URL(url.toString());
} catch (MalformedURLException e) {
  throw new SdkClientException(
      "Unable to convert request to well formed URL: " + e.getMessage(), e);
origin: edu.ucar/netcdf

static public URL makeURL( URL parent, String urlString) throws MalformedURLException {
 if (installed)
  return new URL( parent, urlString);
 // install failed, use alternate form of URL constructor
 try {
  URI uri = new URI( urlString);
  URLStreamHandler h = (URLStreamHandler) hash.get( uri.getScheme().toLowerCase());;
  return new URL( parent, urlString, h);
 } catch (URISyntaxException e) {
  throw new MalformedURLException(e.getMessage());
 }
 // return new URL( url.getScheme(), url.getHost(), url.getPort(), url.getFile(), h);
}
origin: knightliao/disconf

public RemoteUrl(String url, List<String> serverList) {
  this.url = url;
  this.serverList = serverList;
  for (String server : serverList) {
    try {
      if (!server.startsWith("http://")) {
        if (server.startsWith("https://")) {
        } else {
          server = "http://" + server;
        }
      }
      urls.add(new URL(server + url));
    } catch (MalformedURLException e) {
      LOGGER.error(e.toString());
    }
  }
}
origin: hibernate/hibernate-orm

String file = url.getFile();
if ( ! entry.startsWith( "/" ) ) {
  entry = "/" + entry;
  final String protocol = url.getProtocol();
    jarUrl = new URL( file );
    if ( "file".equals( jarUrl.getProtocol() ) ) {
      if ( file.indexOf( ' ' ) != -1 ) {
        jarUrl = new File( jarUrl.getFile() ).toURI().toURL();
      jarUrl = new File(file).toURI().toURL();
      "Unable to determine JAR Url from " + url + ". Cause: " + e.getMessage()
  );
origin: embulk/embulk

private URL getEmbeddedJarUrl(final String embeddedJarPath) throws MalformedURLException {
  final URL embeddedJarUrl;
  try {
    embeddedJarUrl = new URL(this.oneNestedJarUrlBase, embeddedJarPath);
  } catch (MalformedURLException ex) {
    // TODO: Notify this to reporters as far as possible.
    System.err.println("Failed to load entry in embedded JAR: " + embeddedJarPath);
    ex.printStackTrace();
    throw ex;
  }
  return embeddedJarUrl;
}
origin: chewiebug/GCViewer

private String getResourceUrlString(String resource) {
  URL url = null;
  try {
    if (resource.startsWith("http") || resource.startsWith("file")) {
      url = new URL(resource);
    }
    else {
      url = new File(resource).toURI().toURL();
    }
  }
  catch (MalformedURLException ex) {
    logger.log(Level.WARNING, "Failed to determine URL of " + resource + ". Reason: " + ex.getMessage());
    logger.log(Level.FINER, "Details: ", ex);
  }
  return url != null ? url.toString() : null;
}
origin: geotools/geotools

private URL calculateImageUrl() {
  if (typ == ImportTyp.DIR) {
    try {
      return imageFiles[currentPos - 1].toURI().toURL();
    } catch (MalformedURLException e1) {
    }
  }
  URL startUrl = null;
  if (typ == ImportTyp.SHAPE) startUrl = shapeFileUrl;
  if (typ == ImportTyp.CSV) startUrl = csvFileURL;
  String path = startUrl.getPath();
  int index = path.lastIndexOf('/');
  String imagePath = null;
  if (index == -1) {
    imagePath = currentLocation;
  } else {
    imagePath = path.substring(0, index + 1) + currentLocation;
  }
  try {
    return new URL(
        startUrl.getProtocol(), startUrl.getHost(), startUrl.getPort(), imagePath);
  } catch (MalformedURLException e) {
    logError(e, e.getMessage());
    return null;
  }
}
origin: igniterealtime/Openfire

  addURL(classesDir.toURI().toURL());
  addURL(databaseDir.toURI().toURL());
  addURL(i18nDir.toURI().toURL());
          addURLFile(new URL("jar", "", -1, jarFileUri));
        addURLFile(new URL("jar", "", -1, jarFileUri));
Log.error(mue.getMessage(), mue);
origin: cloudfoundry/uaa

private static URI validateIssuer(String issuer) throws URISyntaxException {
  try {
    new URL(issuer);
  } catch (MalformedURLException x) {
    throw new URISyntaxException(issuer, x.getMessage());
  }
  return new URI(issuer);
}
origin: stackoverflow.com

try
  url = new URI(taintedURL).normalize().toURL();
  throw new MalformedURLException(e.getMessage());
final String path = url.getPath().replace("/$", "");
final SortedMap<String, String> params = createParameterMap(url.getQuery());
final int port = url.getPort();
final String queryString;
origin: aa112901/remusic

public PreLoad(Context context, String url) {
  try {
    this.url = new URL(url);
  } catch (MalformedURLException e) {
    e.printStackTrace();
  }
  uri = URI.create(url);
  fileUtils = ProxyFileUtils.getInstance(context, uri, false);
}
origin: geotools/geotools

  gazetteerURL = new URL(gazetteer.toString() + "&placename=" + place);
} catch (MalformedURLException e) {
  results.error(feature, e.toString());
      (HttpURLConnection) gazetteerURL.openConnection();
origin: apache/nifi

  additionalClasspath.add(new URL(modulePathString));
} catch (MalformedURLException mue) {
  isUrl = false;
      additionalClasspath.add(modulePath.toURI().toURL());
              LOGGER.warn("Recursive directories are not supported, skipping " + classpathResource.getAbsolutePath());
            } else {
              additionalClasspath.add(classpathResource.toURI().toURL());
      throw new MalformedURLException("Path specified does not exist");
origin: com.sun.xml.ws/jaxws-rt

public static URL getEncodedURL(String urlStr) throws MalformedURLException {
  URL url = new URL(urlStr);
  String scheme = String.valueOf(url.getProtocol()).toLowerCase();
  if (scheme.equals("http") || scheme.equals("https")) {
    try {
      return new URL(url.toURI().toASCIIString());
    } catch (URISyntaxException e) {
      MalformedURLException malformedURLException = new MalformedURLException(e.getMessage());
      malformedURLException.initCause(e);
      throw malformedURLException;
    }
   }
   return url;
}
origin: httpunit/httpunit

public String getHref() {
  String relativeLocation = getAttributeWithNoDefault( "href" );
  if (relativeLocation.indexOf( ':' ) > 0 || relativeLocation.equals( "#" )) {
    return relativeLocation;
  } else {
    try {
      return new URL( ((HTMLDocumentImpl) getOwnerDocument()).getBaseUrl(), relativeLocation ).toExternalForm();
    } catch (MalformedURLException e) {
      return e.toString();
    }
  }
}
java.netMalformedURLException

Javadoc

This exception is thrown when a program attempts to create an URL from an incorrect specification.

Most used methods

  • getMessage
  • printStackTrace
  • <init>
    Constructs a new instance with given detail message and cause.
  • toString
  • getLocalizedMessage
  • initCause
  • getStackTrace
  • getCause
  • setStackTrace
  • addSuppressed
  • fillInStackTrace
  • fillInStackTrace

Popular in Java

  • Reactive rest calls using spring rest template
  • scheduleAtFixedRate (ScheduledExecutorService)
  • requestLocationUpdates (LocationManager)
  • onRequestPermissionsResult (Fragment)
  • FileReader (java.io)
    A specialized Reader that reads from a file in the file system. All read requests made by calling me
  • ByteBuffer (java.nio)
    A buffer for bytes. A byte buffer can be created in either one of the following ways: * #allocate
  • StringTokenizer (java.util)
    Breaks a string into tokens; new code should probably use String#split.> // Legacy code: StringTo
  • ConcurrentHashMap (java.util.concurrent)
    A plug-in replacement for JDK1.5 java.util.concurrent.ConcurrentHashMap. This version is based on or
  • 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
  • Logger (org.apache.log4j)
    This is the central class in the log4j package. Most logging operations, except configuration, are d
  • Top PhpStorm plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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