当前位置: 首页>>代码示例>>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;未经允许,请勿转载。