我有一个java.lang.String可能包含任何可能的字符,是否有一种简单的方法来清理字符串(例如,有一个额外的类可以做到这一点?)并删除所有"危险"字符以便以后java.util.regex.Matcher或正则表达式处理(例如$,^ ,...)?
我正在ant taskMySQL-5.7 服务器上运行一些 SQL,但我不想使用 SSL。我目前正在使用mysql-connector-java-5.1.42.jar连接到 MySQL-5.7 ( v5.7.18-0ubuntu0.16.04.1)
我的 SQL 属性如下所示
<sql
url="jdbc:mysql://mysql.box.lan:3306/mydb?autoReconnect=true&useSSL=false&verifyServerCertificate=false"
userid="my-user"
password="xxx"
driver="com.mysql.jdbc.Driver"
onerror="continue"
showWarnings="false"
delimiter=";"
encoding="UTF-8">
Run Code Online (Sandbox Code Playgroud)
不幸的是,驱动程序似乎并不关心 和/或 的任何组合autoReconnect,useSSL如此verifyServerCertificate处、此处和此处所述。
确切的错误是
2017 年 6 月 22 日星期四 12:20:32 GMT 警告:不建议在没有服务器身份验证的情况下建立 SSL 连接。根据 MySQL 5.5.45+、5.6.26+ 和 5.7.6+ 的要求,如果未设置显式选项,则必须默认建立 SSL 连接。为了符合不使用 SSL 的现有应用程序,verifyServerCertificate 属性设置为“false”。您需要通过设置 useSSL=false 显式禁用 SSL,或者设置 useSSL=true 并提供用于服务器证书验证的信任库。
我喜欢在MySQL中加入一个临时表失败,这个想法很简单:
CREATE TEMPORARY TABLE temp_table LIKE any_other_table; -- srsly it does not matter which table
(
SELECT p1,p2,p3 FROM temp_table WHERE p4 = 1
) UNION (
SELECT p1,p2,p3 FROM temp_table WHERE p4 = 2
)
Run Code Online (Sandbox Code Playgroud)
任何帮助是极大的赞赏.
编辑:mysql抛出的错误是 ERROR 1137 (HY000): Can't reopen table: 'temp_table'
部署我的应用程序并尝试通过简单的网页(基于Apache Shiro 1.2.3我的EAR文件中提供的)进行身份验证后,会发生以下异常:
2015-09-07 13:17:45,265 ERROR [org.jboss.as.ejb3.invocation] (default task-31) WFLYEJB0034: EJB Invocation failed on component CenterwareRealmBean for method public abstract org.apache.shiro.authc.AuthenticationInfo org.apache.shiro.realm.Realm.getAuthenticationInfo(org.apache.shiro.authc.AuthenticationToken) throws org.apache.shiro.authc.AuthenticationException: javax.ejb.EJBException: java.lang.IllegalStateException: WFLYEE0067: Method does not exist public final org.apache.shiro.authc.AuthenticationInfo org.apache.shiro.realm.AuthenticatingRealm.getAuthenticationInfo(org.apache.shiro.authc.AuthenticationToken) throws org.apache.shiro.authc.AuthenticationException
at org.jboss.as.ejb3.tx.CMTTxInterceptor.handleExceptionInOurTx(CMTTxInterceptor.java:187)
at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:277)
at org.jboss.as.ejb3.tx.CMTTxInterceptor.required(CMTTxInterceptor.java:327)
at org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:239)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at org.jboss.as.ejb3.component.invocationmetrics.WaitTimeInterceptor.processInvocation(WaitTimeInterceptor.java:43)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at org.jboss.as.ejb3.security.SecurityContextInterceptor.processInvocation(SecurityContextInterceptor.java:100)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at org.jboss.as.ejb3.component.interceptors.ShutDownInterceptorFactory$1.processInvocation(ShutDownInterceptorFactory.java:64)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at org.jboss.as.ejb3.component.interceptors.LoggingInterceptor.processInvocation(LoggingInterceptor.java:66)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at org.jboss.as.ejb3.component.interceptors.AdditionalSetupInterceptor.processInvocation(AdditionalSetupInterceptor.java:54)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at org.jboss.invocation.ContextClassLoaderInterceptor.processInvocation(ContextClassLoaderInterceptor.java:64)
at …Run Code Online (Sandbox Code Playgroud) 我的代码目前受到“对构造函数中非最终静态字段的可能不安全赋值”(PMD 中的 AssignmentToNonFinalStatic)的影响。
类写成单例类,受此警告影响的属性如下所示
私有静态字符串 myProperty;
并由这个结构填充:
public SystemPropertyUtils() throws ConfigException {
someMethodThrowingConfigException();
myProperty = "someValue" + this.someOtherValueFromAThreadSafeString;
}
Run Code Online (Sandbox Code Playgroud)
有没有详细的方法来否定这个警告?
我目前使用以下方法jboss-ejb3.xml来切换行为,使方法可用于所有用户/角色。
<?xml version="1.1" encoding="UTF-8"?>
<jboss:ejb-jar xmlns:jboss="http://www.jboss.com/xml/ns/javaee"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:s="urn:security:1.1"
xsi:schemaLocation="http://www.jboss.com/xml/ns/javaee http://www.jboss.org/j2ee/schema/jboss-ejb3-2_0.xsd http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_1.xsd"
impl-version="2.0" version="3.1">
<assembly-descriptor>
<s:security>
<s:missing-method-permissions-deny-access>false</s:missing-method-permissions-deny-access>
</s:security>
</assembly-descriptor>
</jboss:ejb-jar>
Run Code Online (Sandbox Code Playgroud)
我喜欢为我的所有 ejb 全局设置此行为,而不jboss-ejb3.xml在每个模块中提供本地。不幸的是,我无法在此文件之外的某处找到提示。
我的问题是:是否有一个文件可以将此模式设置为 EAR 文件中包含的所有模块?
编辑:一点补充:http : //wildscribe.github.io/Wildfly/8.1.0.Final/subsystem/ejb3/index.html指出它显然是错误的。默认似乎default-mssing-method-permissions-deny-access是设置为true!