Hi Bernd,

Thanks for the reply and I found why. As you mentioned, I put the code in a
wrong place in @BeforeClass, the connection has been started before I can
set it. THANKS !!

The reason why I would like to set that system property into the java code
is that only one single @Test needs to set that property. If I set it into
pom.xml, all tests under that pom.xml will have the property set, right ?
I checked here -->
http://maven.apache.org/surefire/maven-surefire-plugin/examples/system-properties.html
It seems we can not specify <systemPropertyVariables> set only for some
specified java files or tests, right ?

On Tue, Dec 30, 2014 at 7:23 AM, Bernd Eckenfels <e...@zusammenkunft.net>
wrote:

> Hello,
>
> it does not sound to be related to maven. This is more a surefire/junit
> thing. I guess you are initialising some JSSE/JCE related object before
> you can set the system property - and therefore it is ignored. (because
> some initialiser or just because another test is running before in the
> same JVM),
>
> I would stick with the systemProperty in POM. But if you want to make
> it programmatically try to squeece it into the setUpBeforeClass() or
> even having a custom @RunWith runner.
>
> BTW: I think the exceptin text is right, the problem is that
> disableSSLv3 is (Still) true.
>
> Greetings
> Bernd
>
>  Am Mon, 29 Dec 2014 18:18:01 +0800
> schrieb 李响 <wate...@gmail.com>:
>
> > Hi, I am using IBM JDK 7.1-2.0. Because SSL v3 is disabled by the
> > JDK, so I need to set com.ibm.jsse2.disableSSLv3 to false to enable
> > it when running some test cases.
> >
> > The project is managed by maven. I tried with:
> >
> > 1. mvn xxxx -Dcom.ibm.jsse2.disableSSLv3=false, or add
> > <com.ibm.jsse2.disableSSLv3>false</com.ibm.jsse2.disableSSLv3> into
> > <systemPropertyVariables> of pom.xml.
> >
> >   It works.
> >
> > 2. Modify the java source file of the test case
> >    I used : String
> > old=System.setProperty("com.ibm.jsse2.disableSSLv3", "false") and got
> > the exception:
> >
> > Caused by: java.lang.IllegalArgumentException: Only SSLv3 was enabled
> > while com.ibm.jsse2.disableSSLv3 is set to true (It should be "false"
> > here, seems a JDK bug, never mind)
> >         at com.ibm.jsse2.pb.a(pb.java:17)
> >         at com.ibm.jsse2.pb.<init>(pb.java:7)
> >         at com.ibm.jsse2.qc.setEnabledProtocols(qc.java:689)
> >         at
> >
> org.apache.flume.source.http.TestHTTPSource$DisabledProtocolsSocketFactory.createSocket(TestHTTPSource.java:514)
> > <-- sc.setEnabledProtocols(protocols), sc is an instance of SSLSocket
> >         at
> > com.ibm.net.ssl.www2.protocol.https.c.afterConnect(c.java:7) at
> > com.ibm.net.ssl.www2.protocol.https.d.connect(d.java:9) at
> >
> sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1103)
> >         at
> > com.ibm.net.ssl.www2.protocol.https.b.getOutputStream(b.java:84) at
> >
> org.apache.flume.source.http.TestHTTPSource.doTestHttps(TestHTTPSource.java:392)
> >         at
> >
> org.apache.flume.source.http.TestHTTPSource.testHttpsSSLv3(TestHTTPSource.java:321)
> >         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >         at
> >
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:95)
> >         at
> >
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:56)
> >         at java.lang.reflect.Method.invoke(Method.java:620)
> >         at
> >
> org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
> >         at
> >
> org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
> >         at
> >
> org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
> >         at
> >
> org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
> >         at
> >
> org.junit.internal.runners.statements.ExpectException.evaluate(ExpectException.java:22)
> >         ... 24 more
> >
> >    I printed the value of com.ibm.jsse2.disableSSLv3 before the line
> > 514 of TestHTTPSource.java,
> > and com.ibm.jsse2.disableSSLv3 is false, as expected.
> >
> >   It seems that com.ibm.jsse2.disableSSLv3=false do not take effect
> > here. Why ???? Is it because the program gets out of
> > TestHTTPSource.java and get into JDK, or something else, so the
> > system property does not take effect ??
> >
> > THANKS IN ADVANCE !
> >
>



-- 

                                               李响

手机 cellphone :+86-1368-113-8972
E-mail             :wate...@gmail.com
MSN               :wate...@hotmail.com

Reply via email to