/** * Enable or disable javax.mail debugging. By default debugging is disabled. * * @param bDebug * <code>true</code> to enabled debugging, <code>false</code> to * disable it. */ @SuppressFBWarnings ("LG_LOST_LOGGER_DUE_TO_WEAK_REFERENCE") public static void enableJavaxMailDebugging (final boolean bDebug) { java.util.logging.Logger.getLogger ("com.sun.mail.smtp").setLevel (bDebug ? Level.FINEST : Level.INFO); java.util.logging.Logger.getLogger ("com.sun.mail.smtp.protocol").setLevel (bDebug ? Level.FINEST : Level.INFO); SystemProperties.setPropertyValue ("mail.socket.debug", bDebug); SystemProperties.setPropertyValue ("java.security.debug", bDebug ? "certpath" : null); SystemProperties.setPropertyValue ("javax.net.debug", bDebug ? "trustmanager" : null); }
public static void enableCustomLogger (final boolean bEnable) { if (bEnable) SystemProperties.setPropertyValue (SYS_PROP_POI_LOGGER, POISLF4JLogger.class.getName ()); else SystemProperties.removePropertyValue (SYS_PROP_POI_LOGGER); }
/** * Enable advanced JAX-WS debugging on more or less all relevant layers. This * method internally calls {@link #enableSoapLogging(boolean)} so it does not * need to be called explicitly. By default all this logging is disabled. * * @param bDebug * <code>true</code> to enabled debugging, <code>false</code> to * disable it. */ public static void setMetroDebugSystemProperties (final boolean bDebug) { // Depending on the used JAX-WS version, the property names are // different.... enableSoapLogging (bDebug); SystemProperties.setPropertyValue ("com.sun.xml.ws.transport.http.HttpAdapter.dump", Boolean.toString (bDebug)); SystemProperties.setPropertyValue ("com.sun.xml.internal.ws.transport.http.HttpAdapter.dump", Boolean.toString (bDebug)); SystemProperties.setPropertyValue ("com.sun.xml.ws.fault.SOAPFaultBuilder.disableCaptureStackTrace", bDebug ? null : "false"); SystemProperties.setPropertyValue ("com.sun.metro.soap.dump", Boolean.toString (bDebug)); SystemProperties.setPropertyValue ("com.sun.xml.wss.provider.wsit.SecurityTubeFactory.dump", Boolean.toString (bDebug)); SystemProperties.setPropertyValue ("com.sun.xml.wss.jaxws.impl.SecurityServerTube.dump", Boolean.toString (bDebug)); SystemProperties.setPropertyValue ("com.sun.xml.wss.jaxws.impl.SecurityClientTube.dump", Boolean.toString (bDebug)); SystemProperties.setPropertyValue ("com.sun.xml.ws.rx.rm.runtime.ClientTube.dump", Boolean.toString (bDebug)); }
/** * Limit the number of entity expansions.<br> * This setting only takes effect if a parser with <b>explicitly</b> disabled * "Secure processing" feature is used. Otherwise this setting has no effect! * * @param sEntityExpansionLimit * A positive integer as a String. Values ≤ 0 are treated as no * limit. <code>null</code> means the property is deleted */ public static void setXMLEntityExpansionLimit (@Nullable final String sEntityExpansionLimit) { SystemProperties.setPropertyValue (SYSTEM_PROPERTY_ENTITY_EXPANSION_LIMIT, sEntityExpansionLimit); SystemProperties.setPropertyValue (SYSTEM_PROPERTY_JDX_XML_ENTITY_EXPANSION_LIMIT, sEntityExpansionLimit); _onSystemPropertyChange (); }
/** * Limit the number of attributes an element can have.<br> * This setting only takes effect if a parser with <b>explicitly</b> disabled * "Secure processing" feature is used. Otherwise this setting has no effect! * * @param sElementAttributeLimit * A positive integer. Values ≤ 0 are treated as no limit. * <code>null</code> means the property is deleted * @since 8.6.2 */ public static void setXMLElementAttributeLimit (@Nullable final String sElementAttributeLimit) { SystemProperties.setPropertyValue (SYSTEM_PROPERTY_ELEMENT_ATTRIBUTE_LIMIT, sElementAttributeLimit); SystemProperties.setPropertyValue (SYSTEM_PROPERTY_JDX_XML_ELEMENT_ATTRIBUTE_LIMIT, sElementAttributeLimit); _onSystemPropertyChange (); }
public void activateGlobally () { // Deactivate other proxy configurations HttpProxyConfig.deactivateGlobally (); UseSystemProxyConfig.deactivateGlobally (); SystemProperties.setPropertyValue (SYSPROP_SOCKS_PROXY_HOST, m_sHost); SystemProperties.setPropertyValue (SYSPROP_SOCKS_PROXY_PORT, Integer.toString (m_nPort)); }
/** * Limit the number of content model nodes that may be created when building a * grammar for a W3C XML Schema that contains maxOccurs attributes with values * other than "unbounded".<br> * This setting only takes effect if a parser with <b>explicitly</b> disabled * "Secure processing" feature is used. Otherwise this setting has no effect! * * @param sMaxOccur * A positive integer. Values ≤ 0 are treated as no limit. * <code>null</code> means the property is deleted. * @since 8.6.2 */ public static void setXMLMaxOccur (@Nullable final String sMaxOccur) { SystemProperties.setPropertyValue (SYSTEM_PROPERTY_MAX_OCCUR, sMaxOccur); SystemProperties.setPropertyValue (SYSTEM_PROPERTY_JDX_XML_MAX_OCCUR, sMaxOccur); _onSystemPropertyChange (); }
/** * Limit the total size of all entities that include general and parameter * entities. The size is calculated as an aggregation of all entities.<br> * This is available since JDK 1.7.0_45/1.8.<br> * This setting only takes effect if a parser with <b>explicitly</b> disabled * "Secure processing" feature is used. Otherwise this setting has no effect! * * @param sTotalEntitySizeLimit * A positive integer. Values ≤ 0 are treated as no limit. * <code>null</code> means the property is deleted. * @since 8.6.2 */ public static void setXMLTotalEntitySizeLimit (@Nullable final String sTotalEntitySizeLimit) { SystemProperties.setPropertyValue (SYSTEM_PROPERTY_JDX_XML_TOTAL_ENTITY_SIZE_LIMIT, sTotalEntitySizeLimit); _onSystemPropertyChange (); }
SystemProperties.setPropertyValue ("com.sun.xml.ws.transport.http.client.HttpTransportPipe.dump", sDebug); SystemProperties.setPropertyValue ("com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.dump", sDebug); SystemProperties.setPropertyValue ("com.sun.xml.ws.transport.http.HttpTransportPipe.dump", sDebug); SystemProperties.setPropertyValue ("com.sun.xml.internal.ws.transport.http.HttpTransportPipe.dump", sDebug); SystemProperties.setPropertyValue ("com.sun.xml.ws.transport.http.HttpAdapter.dumpTreshold", sValue); SystemProperties.setPropertyValue ("com.sun.xml.internal.ws.transport.http.HttpAdapter.dumpTreshold", sValue);
/** * Limit the maximum size of any general entities. It is recommended that * users set the limit to the smallest possible number so that malformed xml * files can be caught quickly.<br> * This is available since JDK 1.7.0_45/1.8.<br> * This setting only takes effect if a parser with <b>explicitly</b> disabled * "Secure processing" feature is used. Otherwise this setting has no effect! * * @param sMaxGeneralEntitySizeLimit * A positive integer. Values ≤ 0 are treated as no limit. * <code>null</code> means the property is deleted. * @since 8.6.2 */ public static void setXMLMaxGeneralEntitySizeLimit (@Nullable final String sMaxGeneralEntitySizeLimit) { SystemProperties.setPropertyValue (SYSTEM_PROPERTY_JDX_XML_MAX_GENERAL_ENTITY_SIZE_LIMIT, sMaxGeneralEntitySizeLimit); _onSystemPropertyChange (); }
public void activateGlobally () { // Deactivate other proxy configurations SocksProxyConfig.deactivateGlobally (); UseSystemProxyConfig.deactivateGlobally (); SystemProperties.setPropertyValue (m_eProxyType.getPropertyNameProxyHost (), m_sHost); SystemProperties.setPropertyValue (m_eProxyType.getPropertyNameProxyPort (), Integer.toString (m_nPort)); SystemProperties.setPropertyValue (m_eProxyType.getPropertyNameProxyUserName (), m_sUserName); SystemProperties.setPropertyValue (m_eProxyType.getPropertyNameProxyPassword (), m_sPassword); SystemProperties.setPropertyValue (m_eProxyType.getPropertyNameNoProxyHosts (), StringHelper.getImploded ('|', m_aNonProxyHosts)); }
/** * Limit the maximum size of any parameter entities, including the result of * nesting multiple parameter entities. It is recommended that users set the * limit to the smallest possible number so that malformed xml files can be * caught quickly.<br> * This is available since JDK 1.7.0_45/1.8.<br> * This setting only takes effect if a parser with <b>explicitly</b> disabled * "Secure processing" feature is used. Otherwise this setting has no effect! * * @param sMaxParameterEntitySizeLimit * A positive integer. Values ≤ 0 are treated as no limit. * <code>null</code> means the property is deleted. * @since 8.6.2 */ public static void setXMLMaxParameterEntitySizeLimit (@Nullable final String sMaxParameterEntitySizeLimit) { SystemProperties.setPropertyValue (SYSTEM_PROPERTY_JDX_XML_MAX_PARAMETER_ENTITY_SIZE_LIMIT, sMaxParameterEntitySizeLimit); _onSystemPropertyChange (); }
public SMPServerTestRule (@Nullable final String sSMPServerPropertiesPath) { if (StringHelper.hasText (sSMPServerPropertiesPath)) { SystemProperties.setPropertyValue (SMPServerConfiguration.SYSTEM_PROPERTY_SMP_SERVER_PROPERTIES_PATH, sSMPServerPropertiesPath); SMPServerConfiguration.reloadConfiguration (); } }
public static void activateGloballyStatic () { // Deactivate other proxy configurations HttpProxyConfig.deactivateGlobally (); SocksProxyConfig.deactivateGlobally (); SystemProperties.setPropertyValue (SYSPROP_JAVA_NET_USE_SYSTEM_PROXIES, Boolean.TRUE.toString ()); }
public SMPServerTestRule (@Nullable final String sSMPServerPropertiesPath) { if (StringHelper.hasText (sSMPServerPropertiesPath)) { SystemProperties.setPropertyValue (SMPServerConfiguration.SYSTEM_PROPERTY_SMP_SERVER_PROPERTIES_PATH, sSMPServerPropertiesPath); SMPServerConfiguration.reloadConfiguration (); } }
@Nonnull public static org.xml.sax.XMLReader createXMLReader () { try { org.xml.sax.XMLReader ret; if (true) { ret = XMLReaderFactory.createXMLReader (); // Because of a performance flaw in this implementation, explicitly set // the system property to avoid scanning JAR files over and over again SystemProperties.setPropertyValue ("org.xml.sax.driver", ret.getClass ().getName ()); } else { // This fails with Xerces on the classpath ret = SAXParserFactory.newInstance ().newSAXParser ().getXMLReader (); } return ret; } catch (final ParserConfigurationException | SAXException ex) { throw new InitializationException ("Failed to instantiate XML reader!", ex); } } }
/** * Set special DNS client properties that have influence on the DNS client * behavior. This method should be called as soon as possible on startup. In * most cases it may be beneficiary if the respective system properties are * provided as system properties on the commandline! * * @param nSeconds * DNS client caching time in seconds. */ public static void setDNSCacheTime (final int nSeconds) { final String sValue = Integer.toString (nSeconds); Security.setProperty ("networkaddress.cache.ttl", sValue); Security.setProperty ("networkaddress.cache.negative.ttl", sValue); SystemProperties.setPropertyValue ("disableWSAddressCaching", nSeconds == 0); } }
SystemProperties.setPropertyValue ("sun.io.serialization.extendedDebugInfo", "true");