List of usage examples for java.lang System clearProperty
public static String clearProperty(String key)
From source file:Main.java
public static void main(String[] args) { String s = System.clearProperty("java.class.path"); System.setProperty("user.dir", "C:/java2s.com"); System.out.println(System.getProperty("user.dir")); }
From source file:MainClass.java
public static void main(String[] a) { String oldValue = System.clearProperty("java.class.path"); System.setProperty("user.dir", "C:/MyProg"); System.out.println(System.getProperty("user.dir")); }
From source file:Main.java
public static void main(String[] args) { String key = "user.dir"; System.clearProperty(key); }
From source file:Main.java
@SuppressLint("NewApi") @SuppressWarnings("all") private static boolean setProxyKK(WebView webView, String host, int port, String applicationClassName) { Context appContext = webView.getContext().getApplicationContext(); if (null == host) { System.clearProperty("http.proxyHost"); System.clearProperty("http.proxyPort"); System.clearProperty("https.proxyHost"); System.clearProperty("https.proxyPort"); } else {// w ww . j a v a2s . com System.setProperty("http.proxyHost", host); System.setProperty("http.proxyPort", port + ""); System.setProperty("https.proxyHost", host); System.setProperty("https.proxyPort", port + ""); } try { Class applictionCls = Class.forName(applicationClassName); Field loadedApkField = applictionCls.getField("mLoadedApk"); loadedApkField.setAccessible(true); Object loadedApk = loadedApkField.get(appContext); Class loadedApkCls = Class.forName("android.app.LoadedApk"); Field receiversField = loadedApkCls.getDeclaredField("mReceivers"); receiversField.setAccessible(true); Map receivers = (Map) receiversField.get(loadedApk); for (Object receiverMap : receivers.values()) { for (Object rec : ((Map) receiverMap).keySet()) { Class clazz = rec.getClass(); if (clazz.getName().contains("ProxyChangeListener")) { Method onReceiveMethod = clazz.getDeclaredMethod("onReceive", Context.class, Intent.class); Intent intent = new Intent(Proxy.PROXY_CHANGE_ACTION); /*********** optional, may be need in future *************/ final String CLASS_NAME = "android.net.ProxyProperties"; Class cls = Class.forName(CLASS_NAME); Constructor constructor = cls.getConstructor(String.class, Integer.TYPE, String.class); constructor.setAccessible(true); Object proxyProperties = constructor.newInstance(host, port, null); intent.putExtra("proxy", (Parcelable) proxyProperties); /*********** optional, may be need in future *************/ onReceiveMethod.invoke(rec, appContext, intent); } } } Log.d(LOG_TAG, "Setting proxy with >= 4.4 API successful!"); return true; } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (NoSuchFieldException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (NoSuchMethodException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } catch (InstantiationException e) { e.printStackTrace(); } return false; }
From source file:org.wgrus.ServletConfigurationTests.java
@AfterClass public static void close() { System.clearProperty("spring.profiles.default"); }
From source file:Main.java
private static XPathFactory getXPathFactory() throws XPathFactoryConfigurationException { if (_xPathFactory == null) { String magicValue = System .getProperty("javax.xml.xpath.XPathFactory:http://java.sun.com/jaxp/xpath/dom"); System.setProperty("javax.xml.xpath.XPathFactory:http://java.sun.com/jaxp/xpath/dom", "net.sf.saxon.xpath.XPathFactoryImpl"); // System.setProperty("javax.xml.xpath.XPathFactory:http://java.sun.com/jaxp/xpath/dom","org.apache.xpath.jaxp.XPathFactoryImpl"); // System.setProperty("jaxp.debug","yes"); _xPathFactory = XPathFactory.newInstance(XPathConstants.DOM_OBJECT_MODEL); if (magicValue == null) System.clearProperty("javax.xml.xpath.XPathFactory:http://java.sun.com/jaxp/xpath/dom"); else/*from ww w .j a v a2s . c o m*/ System.setProperty("javax.xml.xpath.XPathFactory:http://java.sun.com/jaxp/xpath/dom", magicValue); } return _xPathFactory; }
From source file:org.artificer.test.client.AbstractClientTest.java
@AfterClass public static void resetAuditing() { System.clearProperty(ArtificerConstants.ARTIFICER_CONFIG_AUDITING); }
From source file:org.apache.logging.log4j.core.util.ClockFactoryTest.java
public static void resetClock(final Class<?> clazz) throws IllegalAccessException { System.clearProperty(ClockFactory.PROPERTY_NAME); final Field field = FieldUtils.getField(clazz, "CLOCK", true); FieldUtils.removeFinalModifier(field, true); FieldUtils.writeStaticField(field, ClockFactory.getClock(), false); }
From source file:org.constretto.spring.configuration.ConstrettoNameSpaceTest.java
@BeforeClass public static void setupTags() { System.setProperty(DefaultConfigurationContextResolver.TAGS, "test"); System.clearProperty("key7"); }
From source file:com.redhat.victims.mock.MockEnvironment.java
public static void tearDown() { MockService.stop();/* w ww . j a va 2s. c o m*/ System.clearProperty(VictimsConfig.Key.DB_PURGE); System.clearProperty(VictimsConfig.Key.URI); System.clearProperty(VictimsConfig.Key.HOME); deleteCache(); }