You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2007/11/05 21:05:20 UTC
svn commit: r592135 - in /incubator/cxf/branches/2.0.x-fixes: ./
rt/transports/http/src/main/java/org/apache/cxf/configuration/jsse/spring/
systests/src/test/java/org/apache/cxf/systest/http/
systests/src/test/java/org/apache/cxf/systest/http/resources...
Author: dkulp
Date: Mon Nov 5 12:05:18 2007
New Revision: 592135
URL: http://svn.apache.org/viewvc?rev=592135&view=rev
Log:
Merged revisions 592134 via svnmerge from
https://svn.apache.org/repos/asf/incubator/cxf/trunk
........
r592134 | dkulp | 2007-11-05 14:57:22 -0500 (Mon, 05 Nov 2007) | 3 lines
[CXF-1096] Patch for tls keystore loading applied (Thanks Fred)
For command line tools, try to split on whitespace
........
Added:
incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/http/resources/resource-key-spec.xml
- copied unchanged from r592134, incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/http/resources/resource-key-spec.xml
Modified:
incubator/cxf/branches/2.0.x-fixes/ (props changed)
incubator/cxf/branches/2.0.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/configuration/jsse/spring/TLSParameterJaxBUtils.java
incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/http/HTTPSClientTest.java
incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/http/resources/jaxws-publish.xml
incubator/cxf/branches/2.0.x-fixes/tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/parser/CommandLineParser.java
incubator/cxf/branches/2.0.x-fixes/tools/common/src/test/java/org/apache/cxf/tools/common/toolspec/parser/CommandLineParserTest.java
Propchange: incubator/cxf/branches/2.0.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified: incubator/cxf/branches/2.0.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/configuration/jsse/spring/TLSParameterJaxBUtils.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/configuration/jsse/spring/TLSParameterJaxBUtils.java?rev=592135&r1=592134&r2=592135&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/configuration/jsse/spring/TLSParameterJaxBUtils.java (original)
+++ incubator/cxf/branches/2.0.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/configuration/jsse/spring/TLSParameterJaxBUtils.java Mon Nov 5 12:05:18 2007
@@ -31,12 +31,15 @@
import java.security.cert.CertificateFactory;
import java.security.cert.X509Certificate;
import java.util.Collection;
+import java.util.logging.Logger;
import javax.net.ssl.KeyManager;
import javax.net.ssl.KeyManagerFactory;
import javax.net.ssl.TrustManager;
import javax.net.ssl.TrustManagerFactory;
+import org.apache.cxf.common.classloader.ClassLoaderUtils;
+import org.apache.cxf.common.logging.LogUtils;
import org.apache.cxf.configuration.security.CertStoreType;
import org.apache.cxf.configuration.security.KeyManagersType;
import org.apache.cxf.configuration.security.KeyStoreType;
@@ -50,6 +53,9 @@
* with TLSClientParameters and TLSServerParameters respectively.
*/
public final class TLSParameterJaxBUtils {
+
+ private static final Logger LOG =
+ LogUtils.getL7dLogger(TLSParameterJaxBUtils.class);
private TLSParameterJaxBUtils() {
// empty
@@ -92,7 +98,6 @@
if (kst == null) {
return null;
}
-
String type = kst.isSetType()
? kst.getType()
: KeyStore.getDefaultType();
@@ -109,7 +114,15 @@
keyStore.load(new FileInputStream(kst.getFile()), password);
}
if (kst.isSetResource()) {
- keyStore.load(kst.getClass().getClassLoader().getResourceAsStream(kst.getResource()), password);
+ final java.io.InputStream is =
+ ClassLoaderUtils.getResourceAsStream(kst.getResource(), kst.getClass());
+ if (is == null) {
+ final String msg =
+ "Could not load keystore resource " + kst.getResource();
+ LOG.severe(msg);
+ throw new java.io.IOException(msg);
+ }
+ keyStore.load(is, password);
}
if (kst.isSetUrl()) {
keyStore.load(new URL(kst.getUrl()).openStream(), password);
@@ -131,11 +144,15 @@
return createTrustStore(new FileInputStream(pst.getFile()));
}
if (pst.isSetResource()) {
- return createTrustStore(
- pst.getClass().getClassLoader().getResourceAsStream(
- pst.getResource()
- )
- );
+ final java.io.InputStream is =
+ ClassLoaderUtils.getResourceAsStream(pst.getResource(), pst.getClass());
+ if (is == null) {
+ final String msg =
+ "Could not load truststore resource " + pst.getResource();
+ LOG.severe(msg);
+ throw new java.io.IOException(msg);
+ }
+ return createTrustStore(is);
}
if (pst.isSetUrl()) {
return createTrustStore(new URL(pst.getUrl()).openStream());
Modified: incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/http/HTTPSClientTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/http/HTTPSClientTest.java?rev=592135&r1=592134&r2=592135&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/http/HTTPSClientTest.java (original)
+++ incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/http/HTTPSClientTest.java Mon Nov 5 12:05:18 2007
@@ -112,4 +112,10 @@
testSuccessfulCall("resources/pkcs12.xml",
"https://localhost:9003/SoapContext/HttpsPort");
}
+
+ @Test
+ public final void testResourceKeySpecEndpoint() throws Exception {
+ testSuccessfulCall("resources/resource-key-spec.xml",
+ "https://localhost:9004/SoapContext/HttpsPort");
+ }
}
Modified: incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/http/resources/jaxws-publish.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/http/resources/jaxws-publish.xml?rev=592135&r1=592134&r2=592135&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/http/resources/jaxws-publish.xml (original)
+++ incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/http/resources/jaxws-publish.xml Mon Nov 5 12:05:18 2007
@@ -62,13 +62,13 @@
<httpj:engine port="9001">
<httpj:tlsServerParameters>
<sec:keyManagers keyPassword="password">
- <sec:keyStore type="JKS" password="password"
- file="src/test/java/org/apache/cxf/systest/http/resources/Bethal.jks"/>
- </sec:keyManagers>
- <sec:trustManagers>
- <sec:keyStore type="JKS" password="password"
- file="src/test/java/org/apache/cxf/systest/http/resources/Truststore.jks"/>
- </sec:trustManagers>
+ <sec:keyStore type="JKS" password="password"
+ file="src/test/java/org/apache/cxf/systest/http/resources/Bethal.jks"/>
+ </sec:keyManagers>
+ <sec:trustManagers>
+ <sec:keyStore type="JKS" password="password"
+ file="src/test/java/org/apache/cxf/systest/http/resources/Truststore.jks"/>
+ </sec:trustManagers>
</httpj:tlsServerParameters>
</httpj:engine>
</httpj:engine-factory>
@@ -79,13 +79,13 @@
<http:conduit name="{http://apache.org/hello_world/services}HttpsPort.http-conduit">
<http:tlsClientParameters>
<sec:keyManagers keyPassword="password">
- <sec:keyStore type="JKS" password="password"
- file="src/test/java/org/apache/cxf/systest/http/resources/Morpit.jks"/>
- </sec:keyManagers>
- <sec:trustManagers>
- <sec:keyStore type="JKS" password="password"
- file="src/test/java/org/apache/cxf/systest/http/resources/Truststore.jks"/>
- </sec:trustManagers>
+ <sec:keyStore type="JKS" password="password"
+ file="src/test/java/org/apache/cxf/systest/http/resources/Morpit.jks"/>
+ </sec:keyManagers>
+ <sec:trustManagers>
+ <sec:keyStore type="JKS" password="password"
+ file="src/test/java/org/apache/cxf/systest/http/resources/Truststore.jks"/>
+ </sec:trustManagers>
</http:tlsClientParameters>
</http:conduit>
Modified: incubator/cxf/branches/2.0.x-fixes/tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/parser/CommandLineParser.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/parser/CommandLineParser.java?rev=592135&r1=592134&r2=592135&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/parser/CommandLineParser.java (original)
+++ incubator/cxf/branches/2.0.x-fixes/tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/parser/CommandLineParser.java Mon Nov 5 12:05:18 2007
@@ -254,7 +254,9 @@
for (i = 0; i < tmpStr.length(); i = i + (totalLen - beforeDesSpan)) {
if (i + totalLen - beforeDesSpan < tmpStr.length()) {
addWhiteNamespace(strbuffer, beforeDesSpan);
- strbuffer.append(tmpStr.substring(i, i + totalLen - beforeDesSpan));
+ int lastIdx = i + totalLen - beforeDesSpan;
+ int lastIdx2 = splitAndAppendText(strbuffer, tmpStr, i, lastIdx);
+ i += lastIdx2 - lastIdx;
strbuffer.append(lineSeparator);
} else {
addWhiteNamespace(strbuffer, beforeDesSpan);
@@ -267,6 +269,21 @@
}
return strbuffer.toString();
+ }
+ private int splitAndAppendText(StringBuffer buffer, String tmpStr, int idx, int lastIdx) {
+ int origLast = lastIdx;
+ while (lastIdx > idx && !Character.isWhitespace(tmpStr.charAt(lastIdx))) {
+ --lastIdx;
+ }
+ if (lastIdx == idx) {
+ lastIdx = origLast;
+ }
+ buffer.append(tmpStr.substring(idx, lastIdx));
+
+ if (Character.isWhitespace(tmpStr.charAt(lastIdx))) {
+ lastIdx++;
+ }
+ return lastIdx;
}
private void addWhiteNamespace(StringBuffer strbuffer, int count) {
Modified: incubator/cxf/branches/2.0.x-fixes/tools/common/src/test/java/org/apache/cxf/tools/common/toolspec/parser/CommandLineParserTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/tools/common/src/test/java/org/apache/cxf/tools/common/toolspec/parser/CommandLineParserTest.java?rev=592135&r1=592134&r2=592135&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/tools/common/src/test/java/org/apache/cxf/tools/common/toolspec/parser/CommandLineParserTest.java (original)
+++ incubator/cxf/branches/2.0.x-fixes/tools/common/src/test/java/org/apache/cxf/tools/common/toolspec/parser/CommandLineParserTest.java Mon Nov 5 12:05:18 2007
@@ -311,6 +311,15 @@
assertNotNull(usage);
StringTokenizer st1 = new StringTokenizer(usage, System.getProperty("line.separator"));
assertEquals(13, st1.countTokens());
+
+ while (st1.hasMoreTokens()) {
+ String s = st1.nextToken();
+ if (s.indexOf("java package") != -1) {
+ s = s.trim();
+ assertTrue(s.charAt(s.length() - 1) != 'o');
+ }
+ }
+
}
}