當前位置: 首頁>>代碼示例>>Java>>正文


Java MalformedURLException.printStackTrace方法代碼示例

本文整理匯總了Java中java.net.MalformedURLException.printStackTrace方法的典型用法代碼示例。如果您正苦於以下問題:Java MalformedURLException.printStackTrace方法的具體用法?Java MalformedURLException.printStackTrace怎麽用?Java MalformedURLException.printStackTrace使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.net.MalformedURLException的用法示例。


在下文中一共展示了MalformedURLException.printStackTrace方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: a

import java.net.MalformedURLException; //導入方法依賴的package包/類
private static HttpURLConnection a(Context context, String str) {
    try {
        URL url = new URL(str);
        if (context.getPackageManager().checkPermission(z[43], context.getPackageName()) == 0) {
            NetworkInfo activeNetworkInfo = ((ConnectivityManager) context.getSystemService(z[44])).getActiveNetworkInfo();
            if (!(activeNetworkInfo == null || activeNetworkInfo.getType() == 1)) {
                String extraInfo = activeNetworkInfo.getExtraInfo();
                if (extraInfo != null && (extraInfo.equals(z[40]) || extraInfo.equals(z[41]) || extraInfo.equals(z[42]))) {
                    return (HttpURLConnection) url.openConnection(new Proxy(Type.HTTP, new InetSocketAddress(z[45], 80)));
                }
            }
        }
        return (HttpURLConnection) url.openConnection();
    } catch (MalformedURLException e) {
        e.printStackTrace();
        return null;
    } catch (IOException e2) {
        e2.printStackTrace();
        return null;
    }
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:22,代碼來源:p.java

示例2: buildUrlWithLocationQuery

import java.net.MalformedURLException; //導入方法依賴的package包/類
/**
 * Builds the URL used to talk to the weather server using a location. This location is based
 * on the query capabilities of the weather provider that we are using.
 *
 * @param locationQuery The location that will be queried for.
 * @return The URL to use to query the weather server.
 */
private static URL buildUrlWithLocationQuery(String locationQuery) {
    Uri weatherQueryUri = Uri.parse(FORECAST_BASE_URL).buildUpon()
            .appendQueryParameter(QUERY_PARAM, locationQuery)
            .appendQueryParameter(FORMAT_PARAM, format)
            .appendQueryParameter(UNITS_PARAM, units)
            .appendQueryParameter(DAYS_PARAM, Integer.toString(numDays))
            .build();

    try {
        URL weatherQueryUrl = new URL(weatherQueryUri.toString());
        Log.v(TAG, "URL: " + weatherQueryUrl);
        return weatherQueryUrl;
    } catch (MalformedURLException e) {
        e.printStackTrace();
        return null;
    }
}
 
開發者ID:fjoglar,項目名稱:android-dev-challenge,代碼行數:25,代碼來源:NetworkUtils.java

示例3: findResource

import java.net.MalformedURLException; //導入方法依賴的package包/類
@Override
protected URL findResource(String name) {
    if (getSystemResource(name) == null) {
        if (JarArchive.resources.containsKey(name)) {
            try {
                return JarArchive.resources.get(name).toURI().toURL();
            } catch (MalformedURLException e) {
                e.printStackTrace();
                return null;
            }
        } else {
            return null;
        }
    }
    return getSystemResource(name);
}
 
開發者ID:Parabot,項目名稱:Parabot-317-API-Minified-OS-Scape,代碼行數:17,代碼來源:ArchiveClassLoader.java

示例4: buildTMDBMovieURL

import java.net.MalformedURLException; //導入方法依賴的package包/類
public static URL buildTMDBMovieURL(String movieId) {
    Uri uri = new Uri.Builder()
            .scheme(SCHEME)
            .appendEncodedPath(TMDB_BASE_PATH)
            .appendEncodedPath(MOVIE_PATH)
            .appendEncodedPath(movieId)
            .build();

    try {
        return new URL(uri.toString());
    } catch (MalformedURLException e) {
        e.printStackTrace();
    }

    return null;
}
 
開發者ID:scaffeinate,項目名稱:Inflix,代碼行數:17,代碼來源:URIBuilderUtils.java

示例5: buildUrlWithLatitudeLongitude

import java.net.MalformedURLException; //導入方法依賴的package包/類
/**
 * Builds the URL used to talk to the weather server using latitude and longitude of a
 * location.
 *
 * @param latitude  The latitude of the location
 * @param longitude The longitude of the location
 * @return The Url to use to query the weather server.
 */
private static URL buildUrlWithLatitudeLongitude(Double latitude, Double longitude) {
    Uri weatherQueryUri = Uri.parse(FORECAST_BASE_URL).buildUpon()
            .appendQueryParameter(LAT_PARAM, String.valueOf(latitude))
            .appendQueryParameter(LON_PARAM, String.valueOf(longitude))
            .appendQueryParameter(FORMAT_PARAM, format)
            .appendQueryParameter(UNITS_PARAM, units)
            .appendQueryParameter(DAYS_PARAM, Integer.toString(numDays))
            .build();

    try {
        URL weatherQueryUrl = new URL(weatherQueryUri.toString());
        Log.v(TAG, "URL: " + weatherQueryUrl);
        return weatherQueryUrl;
    } catch (MalformedURLException e) {
        e.printStackTrace();
        return null;
    }
}
 
開發者ID:fjoglar,項目名稱:android-dev-challenge,代碼行數:27,代碼來源:NetworkUtils.java

示例6: readFromParcel

import java.net.MalformedURLException; //導入方法依賴的package包/類
public void readFromParcel(Parcel in){

        String tit = in.readString();
        if (tit == null || tit.isEmpty()) {
            throw new IllegalArgumentException("El titulo no puede ser nulo ni vacio"); //$NON-NLS-1$
        }
        this.title = tit;

        this.promoter = in.readString();
        this.banner = new byte[in.readInt()];
        in.readByteArray(this.banner);

        this.initDate = (Date) in.readSerializable();
        this.endDate = (Date) in.readSerializable();

        this.numRequiredSignatures = in.readInt();
        this.id = in.readInt();
        try {
            this.promoterUrl = new URL(in.readString());
        } catch (MalformedURLException e) {
            e.printStackTrace();
        }
        this.numActualSignatures = in.readInt();
        this.howtoSolveAsHtml = in.readString();

    }
 
開發者ID:MiFirma,項目名稱:mi-firma-android,代碼行數:27,代碼來源:Initiative.java

示例7: loadSampleResourceUrls

import java.net.MalformedURLException; //導入方法依賴的package包/類
private static void loadSampleResourceUrls(File destDir, String urlToSampleJavaFile, String[] resourceUrlArray) {
    //get dir from urlToSampleJavaFile
    String sampleJavaFileDir = urlToSampleJavaFile.substring(0,
            urlToSampleJavaFile.lastIndexOf('/') + 1); //include the last forward slash
    List<String> resourceUrlList = Arrays.asList(resourceUrlArray);
    //create resource files for each of the resources we use
    if (!resourceUrlList.isEmpty()) {
        for (String oneResourceUrl : resourceUrlList) {
            String sampleResourceName = oneResourceUrl.substring(
                    oneResourceUrl.lastIndexOf('/') + 1,
                    oneResourceUrl.length());
            try {
                URL resourceUrl = new URL(sampleJavaFileDir + sampleResourceName);
                Utils.copyFile(resourceUrl, destDir.getPath() + "/" + sampleResourceName);
            } catch (MalformedURLException e) {
                e.printStackTrace();
            }
        }
    }
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:21,代碼來源:SampleProjectBuilder.java

示例8: speedrun

import java.net.MalformedURLException; //導入方法依賴的package包/類
/**
 * 
 * Parses url from speedrun.com
 * 
 * @param param mapId for mode 0, or userId for mode 1
 * @param mode 0 for map parsing, 1 for user parsing
 * @return the parsed URL
 */
public static URL speedrun(String param, int mode){
	String url = "";
	switch(mode){
	case 0:
		url =  "http://www.speedrun.com/api/v1/leaderboards/369ep8dl/level/@[email protected]/824xzvmd?top=1";
		break;
	case 1:
		url = "http://www.speedrun.com/api/v1/users/@[email protected]";
	}
	try {
		return new URL(url.replaceAll("@[email protected]", param));
	} catch (MalformedURLException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
		return null;
	}
}
 
開發者ID:RoccoDev,項目名稱:5zig-TIMV-Plugin,代碼行數:26,代碼來源:APIUtils.java

示例9: urlCleanup

import java.net.MalformedURLException; //導入方法依賴的package包/類
private boolean urlCleanup() {
    // remove whitespaces and create url
    try {
        mStationURL = new URL(mStationUri.toString().trim());
        return true;
    } catch (MalformedURLException e) {
        e.printStackTrace();
        return false;
    }
}
 
開發者ID:sanjaysingh1990,項目名稱:Exoplayer2Radio,代碼行數:11,代碼來源:StationFetcher.java

示例10: getJar

import java.net.MalformedURLException; //導入方法依賴的package包/類
@Override
public URL getJar() {
    String name   = "os-scape.jar";
    File   target = new File(Directories.getCachePath(), name);
    if (!target.exists()) {
        try {
            WebUtil.downloadFile(new URL("https://cdn.os-scape.com/clients/game.jar"), target, VerboseLoader.get());
        } catch (MalformedURLException e) {
            e.printStackTrace();
        }
    }

    return WebUtil.toURL(target);
}
 
開發者ID:Parabot,項目名稱:Parabot-317-API-Minified-OS-Scape,代碼行數:15,代碼來源:Loader.java

示例11: recycleSlotView

import java.net.MalformedURLException; //導入方法依賴的package包/類
/**
 * Recycles a slot view, if it already exists. This means, changing the title,
 * stopping a previous image loading task and instantiating a new image
 * loading task.
 * 
 * @param slot
 *          the slot to recycle
 * @param item
 *          the item that holds the data for the slot
 */
private void recycleSlotView(ThumbnailSlotView slot,
    final ThumbnailItem<T> item) {
  slot.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
      listener.thumbnailClicked(item.getDataObject());
    }
  });

  TextView picTitle = (TextView) slot.findViewById(R.id.picture_title);
  picTitle.setText(item.getTitle());

  // We need to cancel the UI update of the image loading task for this
  // slot, if one is present and instead set the loading icon.
  ImageLoadingTask previousLoadingTask = slot.getImageLoadingTask();
  if (previousLoadingTask != null) {
    previousLoadingTask.setCancelUiUpdate(true);
  }

  ImageView albumThumbnail = (ImageView) slot
      .findViewById(R.id.album_thumbnail);

  // The ImageLoadingTask will load the thumbnail asynchronously and set
  // the result as soon as the response is in. The image will be set
  // immediately, if the result is already in cache.
  try {
    ImageLoadingTask task = new ImageLoadingTask(albumThumbnail, new URL(
        item.getThumbnailUrl()), cachedImageFetcher);
    slot.setImageLoadingTask(task);
    task.execute();
  } catch (MalformedURLException e) {
    e.printStackTrace();
  }
}
 
開發者ID:sdrausty,項目名稱:buildAPKsSamples,代碼行數:45,代碼來源:MultiColumnImageAdapter.java

示例12: loadFile

import java.net.MalformedURLException; //導入方法依賴的package包/類
/**
 * Load a text file into a String
 *
 * @param url The url to load file from
 * @return file contents as a string
 */
public static String loadFile(String url) {
    try {
        return loadFile(new URL(url));
    } catch (MalformedURLException e) {
        e.printStackTrace();
        return null;
    }
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:15,代碼來源:Utils.java

示例13: createOSXSizeGrip

import java.net.MalformedURLException; //導入方法依賴的package包/類
/**
 * Creates and returns the OS X size grip image.
 *
 * @return The OS X size grip.
 */
private Image createOSXSizeGrip() {
	ClassLoader cl = getClass().getClassLoader();
	URL url = cl.getResource("org/fife/ui/rsyntaxtextarea/focusabletip/osx_sizegrip.png");
	if (url==null) {
		// We're not running in a jar - we may be debugging in Eclipse,
		// for example
		File f = new File("../RSyntaxTextArea/src/org/fife/ui/rsyntaxtextarea/focusabletip/osx_sizegrip.png");
		if (f.isFile()) {
			try {
				url = f.toURI().toURL();
			} catch (MalformedURLException mue) { // Never happens
				mue.printStackTrace();
				return null;
			}
		}
		else {
			return null; // Can't find resource or image file
		}
	}
	Image image = null;
	try {
		image = ImageIO.read(url);
	} catch (IOException ioe) { // Never happens
		ioe.printStackTrace();
	}
	return image;
}
 
開發者ID:Thecarisma,項目名稱:powertext,代碼行數:33,代碼來源:SizeGrip.java

示例14: readProperties

import java.net.MalformedURLException; //導入方法依賴的package包/類
protected void readProperties() {
  this.tablePathParts = this.properties.getProperty(CommonConfig.TABLE_PATH_PARTS);
  this.tableName = this.properties.getProperty(CommonConfig.TABLE_NAME);
  final String partitionIdStr = this.properties.getProperty(CommonConfig.PARTITION_ID);
  if (partitionIdStr != null) {
    this.partitionId = Integer.parseInt(partitionIdStr);
  }
  final URI baseURI = URI.create(this.properties.getProperty(CommonConfig.BASE_URI));
  this.directory = baseURI.getPath();
  this.partPath = tablePathParts != null
      ? Paths.get(this.directory, tablePathParts.split(CommonConfig.TABLE_PATH_PARTS_SEPARATOR))
      : Paths.get(this.directory, tableName, String.valueOf(partitionId));
  this.conf = new Configuration();

  String hdfsSiteXMLPath = this.properties.getProperty(CommonConfig.HDFS_SITE_XML_PATH);
  String hadoopSiteXMLPath = this.properties.getProperty(CommonConfig.HADOOP_SITE_XML_PATH);
  try {
    if (hdfsSiteXMLPath != null) {
      conf.addResource(Paths.get(hdfsSiteXMLPath).toUri().toURL());
    }
    if (hadoopSiteXMLPath != null) {
      conf.addResource(Paths.get(hadoopSiteXMLPath).toUri().toURL());
    }
    properties.entrySet().forEach((PROP) -> {
      conf.set(String.valueOf(PROP.getKey()), String.valueOf(PROP.getValue()));
    });
  } catch (MalformedURLException e) {
    e.printStackTrace();
  }

  this.fileList = null;

  if (this.scan == null) {
    this.scan = new StoreScan();
  }
}
 
開發者ID:ampool,項目名稱:monarch,代碼行數:37,代碼來源:AbstractTierStoreReader.java

示例15: formatmessage

import java.net.MalformedURLException; //導入方法依賴的package包/類
public Text formatmessage(String message, String service, String player) {
	if (message == null) {
		return Text.of("");
	}
	String serviceName = service;
	String playerName = player;
	int votes = 0;

	if (message.contains("<votes>")) {
		votes = SwitchSQL.TotalsVote(playerName);
		message = message.replace("<votes>", String.valueOf(votes));
	}

	if (message.indexOf("/") == 0) {
		message = message.substring(1);
	}
	message = message.replace("<servicename>", serviceName).replace("<service>", serviceName)
			.replace("<SERVICE>", serviceName).replace("<name>", playerName).replace("(name)", playerName)
			.replace("<player>", playerName).replace("(player)", playerName).replace("<username>", playerName)
			.replace("(username)", playerName).replace("<name>", playerName).replace("<player>", playerName)
			.replace("<username>", playerName).replace("[name]", playerName).replace("[player]", playerName)
			.replace("[username]", playerName).replace("<AQUA>", "�b").replace("<BLACK>", "�0")
			.replace("<BLUE>", "�9").replace("<DARK_AQUA>", "�3").replace("<DARK_BLUE>", "�1")
			.replace("<DARK_GRAY>", "�8").replace("<DARK_GREEN>", "�2").replace("<DARK_PURPLE>", "�5")
			.replace("<DARK_RED>", "�4").replace("<GOLD>", "�6").replace("<GRAY>", "�7").replace("<GREEN>", "�a")
			.replace("<LIGHT_PURPLE>", "�d").replace("<RED>", "�c").replace("<WHITE>", "�f")
			.replace("<YELLOW>", "�e").replace("<BOLD>", "�l").replace("<ITALIC>", "�o").replace("<MAGIC>", "�k")
			.replace("<RESET>", "�r").replace("<STRIKE>", "�m").replace("<STRIKETHROUGH>", "�m")
			.replace("<UNDERLINE>", "�n").replace("<votes>", String.valueOf(votes));

	if (message.toLowerCase().contains("http")) {
		String url = "";
		Pattern pattern = Pattern.compile("http(\\S+)");
		Matcher matcher = pattern.matcher(message);
		if (matcher.find()) {
			url = matcher.group(0);
		}
		Text text = null;
		try {
			text = TextSerializers.formattingCode('�').deserialize(message).toBuilder()
					.onClick(TextActions.openUrl(new URL(url))).build();
		} catch (MalformedURLException e) {
			e.printStackTrace();
			return Text.of("Url False, contact admin");
		}

		return text;
	}

	else {
		return TextSerializers.formattingCode('�').deserialize(message);
	}

}
 
開發者ID:Mineaurion,項目名稱:AurionVoteListener,代碼行數:55,代碼來源:AurionsVoteListener.java


注:本文中的java.net.MalformedURLException.printStackTrace方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。