当前位置: 首页>>代码示例>>Java>>正文


Java URISyntaxException.printStackTrace方法代码示例

本文整理汇总了Java中java.net.URISyntaxException.printStackTrace方法的典型用法代码示例。如果您正苦于以下问题:Java URISyntaxException.printStackTrace方法的具体用法?Java URISyntaxException.printStackTrace怎么用?Java URISyntaxException.printStackTrace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.net.URISyntaxException的用法示例。


在下文中一共展示了URISyntaxException.printStackTrace方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: contextInitialized

import java.net.URISyntaxException; //导入方法依赖的package包/类
@Override
public void contextInitialized(ServletContextEvent e) {
	LOG.info("Creating Smaph context.");
	ServletContext context = e.getServletContext();
	context.setAttribute("nif-parser", new TurtleNIFDocumentParser());
	context.setAttribute("nif-creator", new TurtleNIFDocumentCreator());
	String watGcubeToken = context.getInitParameter(WAT_GCUBE_TOKEN);
	SmaphBuilder.initialize(watGcubeToken);
	try {
		context.setAttribute("wikipedia-api", new WikipediaInterfaceWAT.WikipediaInterfaceWATBuilder().gcubeToken(watGcubeToken).build());
	} catch (URISyntaxException e1) {
		e1.printStackTrace();
	}
	
	context.setAttribute("wiki-to-freebase", WikipediaToFreebase.open(context.getInitParameter(FREEBASE_DIR)));
	context.setAttribute("entity-to-anchors", EntityToAnchors.fromDB(context.getInitParameter(ENTITY_TO_ANCHORS_DB)));
}
 
开发者ID:marcocor,项目名称:smaph,代码行数:18,代码来源:SmaphContextListener.java

示例2: initCookies

import java.net.URISyntaxException; //导入方法依赖的package包/类
private void initCookies() {
    CookieManager cookieManager = new CookieManager();
    CookieHandler.setDefault(cookieManager);
    if (cookieManager.getCookieStore().getCookies().size() == 0) {
        try {
            String url = SharedPreferencesEditor.getInstance().getString(
                    Constants.PREFS_URL_SHORTCUT);
            URI uri = new URI(url);
            HttpCookie cookie = new HttpCookie(Constants.COOKIE_AUTH_NAME,
                    SharedPreferencesEditor.getInstance().getString(
                            Constants.PREFS_AUTH));
            cookie.setDomain(uri.getHost());
            cookie.setPath(Constants.COOKIE_BASE_PATH);
            cookie.setVersion(0);
            cookie.setMaxAge((new Date()).getTime()
                    + Constants.COOKIE_LIFETIME_YEAR);
            cookieManager.getCookieStore().add(uri, cookie);
        } catch (URISyntaxException e) {
            e.printStackTrace();
        }

    }
}
 
开发者ID:CactusSoft,项目名称:zabbkit-android,代码行数:24,代码来源:GraphFragment.java

示例3: build

import java.net.URISyntaxException; //导入方法依赖的package包/类
/**
 * Creates a URI for the requested api and method
 * [bittrex-api-url]/[version]/[api]/[method]
 * 
 * @param api
 *            API to use
 * @param method
 *            String literal representing the methodname
 * @param params
 *            URI Parameter
 * @return Bittrex API URI
 */
public static URI build(String api, String method, Map<String, String> params) {
	final URIBuilder builder = new URIBuilder();
	builder.setScheme(SCHEME);
	builder.setHost(HOST);
	builder.setPath(String.format("%s/%s/%s/%s", API_PATH, VERSION, api, method));
	if(params == null) {
		params = new HashMap<>();
	}
	
	for(Entry<String, String> paramEntry : params.entrySet()) {
		builder.addParameter(paramEntry.getKey(), paramEntry.getValue());
	}

	try {
		return builder.build();
	} catch (URISyntaxException e) {
		// Do
		e.printStackTrace();
	}

	return null;
}
 
开发者ID:Lyhnx,项目名称:bittrex-api-wrapper,代码行数:35,代码来源:BittrexUri.java

示例4: UpdateImgStatus

import java.net.URISyntaxException; //导入方法依赖的package包/类
public static void UpdateImgStatus(String group_id, int status){
    Connection connection = null;
    PreparedStatement ps = null;
    String groupMemberTableName = "img_detect_status";
    try{
        try {
            connection = DbConnection.getConnection();
        } catch (URISyntaxException e) {
            e.printStackTrace();
        }
        ps = connection.prepareStatement(
                "UPDATE " + groupMemberTableName + " SET status=?" + " WHERE group_id=?"
        );
        ps.setInt(1, status);
        ps.setString(2, group_id);
        if(ps.executeUpdate()==1){
            System.out.println("Berhasil update imd status : " + status);
        }
    } catch (SQLException ex){
        System.out.println("Gagal update status img detect : " + ex.toString());
    } finally {
        DbConnection.ClosePreparedStatement(ps);
        DbConnection.CloseConnection(connection);
    }
}
 
开发者ID:axellageraldinc,项目名称:lj-line-bot,代码行数:26,代码来源:MainDao.java

示例5: queryActivies

import java.net.URISyntaxException; //导入方法依赖的package包/类
private int queryActivies(String url) {

        try {
            if (mWeakReference.get() == null) {
                return 0;
            }
            Intent intent = new Intent().parseUri(url, Intent.URI_INTENT_SCHEME);
            PackageManager mPackageManager = mWeakReference.get().getPackageManager();
            List<ResolveInfo> mResolveInfos = mPackageManager.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY);
            return mResolveInfos == null ? 0 : mResolveInfos.size();
        } catch (URISyntaxException ignore) {
            if (LogUtils.isDebug()) {
                ignore.printStackTrace();
            }
            return 0;
        }
    }
 
开发者ID:Justson,项目名称:AgentWeb,代码行数:18,代码来源:DefaultWebClient.java

示例6: invalidPackageOrClass

import java.net.URISyntaxException; //导入方法依赖的package包/类
@Override
protected long invalidPackageOrClass(XmlResourceParser parser) {
    final String uri = getAttributeValue(parser, ATTR_URI);
    if (TextUtils.isEmpty(uri)) {
        return -1;
    }

    final Intent metaIntent;
    try {
        metaIntent = Intent.parseUri(uri, 0);
    } catch (URISyntaxException e) {
        e.printStackTrace();
        return -1;
    }

    ResolveInfo resolved = mPackageManager.resolveActivity(metaIntent,
            PackageManager.MATCH_DEFAULT_ONLY);
    final List<ResolveInfo> appList = mPackageManager.queryIntentActivities(
            metaIntent, PackageManager.MATCH_DEFAULT_ONLY);

    // Verify that the result is an app and not just the resolver dialog asking which
    // app to use.
    if (wouldLaunchResolverActivity(resolved, appList)) {
        // If only one of the results is a system app then choose that as the default.
        final ResolveInfo systemApp = getSingleSystemActivity(appList);
        if (systemApp == null) {
            // There is no logical choice for this meta-favorite, so rather than making
            // a bad choice just add nothing.
            return -1;
        }
        resolved = systemApp;
    }
    final ActivityInfo info = resolved.activityInfo;
    final Intent intent = mPackageManager.getLaunchIntentForPackage(info.packageName);
    if (intent == null) {
        return -1;
    }
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK |
            Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);

    return addShortcut(info.loadLabel(mPackageManager).toString(), intent,
            Favorites.ITEM_TYPE_APPLICATION);
}
 
开发者ID:enricocid,项目名称:LaunchEnr,代码行数:44,代码来源:DefaultLayoutParser.java

示例7: openWebsite

import java.net.URISyntaxException; //导入方法依赖的package包/类
/**
 * Opens a Website in the Browser
 *
 * @param url - Target URL
 */
public static void openWebsite(URL url) {
	try {
		Functions.openWebsite(url.toURI());
	} catch (URISyntaxException e) {
		e.printStackTrace();
	}
}
 
开发者ID:Petschko,项目名称:Java-RPG-Maker-MV-Decrypter,代码行数:13,代码来源:Functions.java

示例8: openWebpage

import java.net.URISyntaxException; //导入方法依赖的package包/类
public static void openWebpage(URL url) {
    try {
        openWebpage(url.toURI());
    } catch (URISyntaxException e) {
        e.printStackTrace();
    }
}
 
开发者ID:danicuestasuarez,项目名称:NMapGUI,代码行数:8,代码来源:NMapLoaderWindow.java

示例9: convertShortcutsToLauncherActivities

import java.net.URISyntaxException; //导入方法依赖的package包/类
/**
 * Replaces all shortcuts of type {@link Favorites#ITEM_TYPE_SHORTCUT} which have a valid
 * launcher activity target with {@link Favorites#ITEM_TYPE_APPLICATION}.
 */
@Thunk void convertShortcutsToLauncherActivities(SQLiteDatabase db) {
    db.beginTransaction();
    Cursor c = null;
    SQLiteStatement updateStmt = null;

    try {
        // Only consider the primary user as other users can't have a shortcut.
        long userSerial = getDefaultUserSerial();
        c = db.query(Favorites.TABLE_NAME, new String[] {
                Favorites._ID,
                Favorites.INTENT,
            }, "itemType=" + Favorites.ITEM_TYPE_SHORTCUT + " AND profileId=" + userSerial,
            null, null, null, null);

        updateStmt = db.compileStatement("UPDATE favorites SET itemType="
                + Favorites.ITEM_TYPE_APPLICATION + " WHERE _id=?");

        final int idIndex = c.getColumnIndexOrThrow(Favorites._ID);
        final int intentIndex = c.getColumnIndexOrThrow(Favorites.INTENT);

        while (c.moveToNext()) {
            String intentDescription = c.getString(intentIndex);
            Intent intent;
            try {
                intent = Intent.parseUri(intentDescription, 0);
            } catch (URISyntaxException e) {
                e.printStackTrace();
                continue;
            }

            if (!Utilities.isLauncherAppTarget(intent)) {
                continue;
            }

            long id = c.getLong(idIndex);
            updateStmt.bindLong(1, id);
            updateStmt.executeUpdateDelete();
        }
        db.setTransactionSuccessful();
    } catch (SQLException ex) {
        ex.printStackTrace();
    } finally {
        db.endTransaction();
        if (c != null) {
            c.close();
        }
        if (updateStmt != null) {
            updateStmt.close();
        }
    }
}
 
开发者ID:enricocid,项目名称:LaunchEnr,代码行数:56,代码来源:LauncherProvider.java

示例10: getStringFromURL

import java.net.URISyntaxException; //导入方法依赖的package包/类
public static String getStringFromURL(String url){
	if (url!=null && !"".equals(url)) {
		try {
			URI uri = new URI(url);
			url=uri.getPath();
		} catch (URISyntaxException e){
			e.printStackTrace();
		}
	}
	return url;
}
 
开发者ID:starn,项目名称:encdroidMC,代码行数:12,代码来源:XMLHelper.java

示例11: init

import java.net.URISyntaxException; //导入方法依赖的package包/类
/**
 * This is to be called before any other method of DistributedCacheEmulator.
 * <br> Checks if emulation of distributed cache load is needed and is feasible.
 *  Sets the flags generateDistCacheData and emulateDistributedCache to the
 *  appropriate values.
 * <br> Gridmix does not emulate distributed cache load if
 * <ol><li> the specific gridmix job type doesn't need emulation of
 * distributed cache load OR
 * <li> the trace is coming from a stream instead of file OR
 * <li> the distributed cache dir where distributed cache data is to be
 * generated by gridmix is on local file system OR
 * <li> execute permission is not there for any of the ascendant directories
 * of &lt;ioPath&gt; till root. This is because for emulation of distributed
 * cache load, distributed cache files created under
 * &lt;ioPath/distributedCache/&gt; should be considered by hadoop
 * as public distributed cache files.
 * <li> creation of pseudo local file system fails.</ol>
 * <br> For (2), (3), (4) and (5), generation of distributed cache data
 * is also disabled.
 * 
 * @param traceIn trace file path. If this is '-', then trace comes from the
 *                stream stdin.
 * @param jobCreator job creator of gridmix jobs of a specific type
 * @param generate  true if -generate option was specified
 * @throws IOException
 */
void init(String traceIn, JobCreator jobCreator, boolean generate)
    throws IOException {
  emulateDistributedCache = jobCreator.canEmulateDistCacheLoad()
      && conf.getBoolean(GRIDMIX_EMULATE_DISTRIBUTEDCACHE, true);
  generateDistCacheData = generate;

  if (generateDistCacheData || emulateDistributedCache) {
    if ("-".equals(traceIn)) {// trace is from stdin
      LOG.warn("Gridmix will not emulate Distributed Cache load because "
          + "the input trace source is a stream instead of file.");
      emulateDistributedCache = generateDistCacheData = false;
    } else if (FileSystem.getLocal(conf).getUri().getScheme().equals(
        distCachePath.toUri().getScheme())) {// local FS
      LOG.warn("Gridmix will not emulate Distributed Cache load because "
          + "<iopath> provided is on local file system.");
      emulateDistributedCache = generateDistCacheData = false;
    } else {
      // Check if execute permission is there for all the ascendant
      // directories of distCachePath till root.
      FileSystem fs = FileSystem.get(conf);
      Path cur = distCachePath.getParent();
      while (cur != null) {
        if (cur.toString().length() > 0) {
          FsPermission perm = fs.getFileStatus(cur).getPermission();
          if (!perm.getOtherAction().and(FsAction.EXECUTE).equals(
              FsAction.EXECUTE)) {
            LOG.warn("Gridmix will not emulate Distributed Cache load "
                + "because the ascendant directory (of distributed cache "
                + "directory) " + cur + " doesn't have execute permission "
                + "for others.");
            emulateDistributedCache = generateDistCacheData = false;
            break;
          }
        }
        cur = cur.getParent();
      }
    }
  }

  // Check if pseudo local file system can be created
  try {
    pseudoLocalFs = FileSystem.get(new URI("pseudo:///"), conf);
  } catch (URISyntaxException e) {
    LOG.warn("Gridmix will not emulate Distributed Cache load because "
        + "creation of pseudo local file system failed.");
    e.printStackTrace();
    emulateDistributedCache = generateDistCacheData = false;
    return;
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:77,代码来源:DistributedCacheEmulator.java

示例12: uri

import java.net.URISyntaxException; //导入方法依赖的package包/类
private static URI uri(String address) {
    try {
        return new URI(address);
    } catch (URISyntaxException e) {
        e.printStackTrace();
        return null;
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:9,代码来源:ServiceAddress.java

示例13: startRestServer

import java.net.URISyntaxException; //导入方法依赖的package包/类
public static HttpServer startRestServer() {
    BeanConfig beanConfig = new BeanConfig();
    beanConfig.setVersion("1.0.0");
    beanConfig.setTitle("SlideBar REST Interface");
    beanConfig.setResourcePackage(RootResource.class.getPackage().getName());
    beanConfig.setSchemes(new String[] { "http" });
    beanConfig.setHost("localhost:5055");
    beanConfig.setScan(true);

    final ResourceConfig rc = new ResourceConfig();
    rc.packages(RootResource.class.getPackage().getName());
    rc.register(LoggingFeature.class);
    rc.register(JacksonFeature.class);
    rc.register(ApiListingResource.class);
    rc.register(SwaggerSerializers.class);
    rc.property(ServerProperties.WADL_FEATURE_DISABLE, true);

    Logger l = Logger.getLogger("org.glassfish.grizzly.http.server.HttpHandler");
    l.setLevel(Level.FINE);
    l.setUseParentHandlers(false);
    ConsoleHandler ch = new ConsoleHandler();
    ch.setLevel(Level.ALL);
    l.addHandler(ch);

    try {
        return GrizzlyHttpServerFactory.createHttpServer(new URI("http://localhost:5055"), rc);
    } catch (URISyntaxException e) {
        e.printStackTrace();
        return null;
    }
}
 
开发者ID:SlideKB,项目名称:SlideBar,代码行数:32,代码来源:MainBack.java

示例14: normalizePercentEncoding

import java.net.URISyntaxException; //导入方法依赖的package包/类
public void normalizePercentEncoding() {
    try {
        uri = new URI(uri.getScheme(), 
                      uri.getSchemeSpecificPart(), 
                      uri.getFragment());
    } catch (URISyntaxException e) {
        // This should never be reached
        e.printStackTrace();
    }
}
 
开发者ID:NCAR,项目名称:joai-project,代码行数:11,代码来源:NormalizedURL.java

示例15: findProxy

import java.net.URISyntaxException; //导入方法依赖的package包/类
/**
 * Return a proxy if exist
 * @return
 * 	null if no proxy, the InetSocketAddress else of proxy
 */
public static InetSocketAddress findProxy() {
	logger.info("detecting proxies");
	ProxySearch ps = ProxySearch.getDefaultProxySearch();
	ProxySelector myProxySelector = ps.getProxySelector(); 
	ProxySelector.setDefault(myProxySelector);


	List<Proxy> l = null;
	if(myProxySelector == null) {
       	logger.info("No Proxy");
		return null;
	}
	try {
		l = myProxySelector.select(new URI("https://graph.microsoft.com"));
	}  
	catch (URISyntaxException e) {
	    e.printStackTrace();
	}
	if (l != null) {
	    for (Iterator<Proxy> iter = l.iterator(); iter.hasNext();) {
	        java.net.Proxy proxy = (java.net.Proxy) iter.next();
	        logger.info("proxy type: " + proxy.type());

	        InetSocketAddress addr = (InetSocketAddress) proxy.address();
	        if (addr == null) {
	        	logger.info("No Proxy");
	            return null;
	        } 
	        logger.info("Hostname: " + addr.getHostName());
	        logger.info("Port : " + addr.getPort());
	        return addr;
	    }
	}
   	logger.info("No Proxy");
	return null;
}
 
开发者ID:OwaNotifier,项目名称:owa-notifier,代码行数:42,代码来源:RestfullAcessProxy.java


注:本文中的java.net.URISyntaxException.printStackTrace方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。