Author: keith Date: Tue Jul 15 02:04:01 2008 New Revision: 19308 URL: http://wso2.org/svn/browse/wso2?view=rev&revision=19308
Log: Throwing an error if anything goes wrong in here. We were not throwing the error previously Modified: trunk/mashup/java/modules/core/src/org/wso2/mashup/utils/CustomProtocolSocketFactory.java Modified: trunk/mashup/java/modules/core/src/org/wso2/mashup/utils/CustomProtocolSocketFactory.java URL: http://wso2.org/svn/browse/wso2/trunk/mashup/java/modules/core/src/org/wso2/mashup/utils/CustomProtocolSocketFactory.java?rev=19308&r1=19307&r2=19308&view=diff ============================================================================== --- trunk/mashup/java/modules/core/src/org/wso2/mashup/utils/CustomProtocolSocketFactory.java (original) +++ trunk/mashup/java/modules/core/src/org/wso2/mashup/utils/CustomProtocolSocketFactory.java Tue Jul 15 02:04:01 2008 @@ -20,6 +20,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.wso2.mashup.MashupConstants; +import org.wso2.mashup.MashupFault; import org.wso2.utils.ServerConfiguration; import org.wso2.utils.security.CryptoUtil; import org.wso2.utils.security.CryptoException; @@ -67,7 +68,7 @@ this.username = username; } - private SSLContext createSSLContext() { + private SSLContext createSSLContext() throws MashupFault { try { @@ -95,6 +96,10 @@ BufferedInputStream ksbufin = new BufferedInputStream(ksIn); String storePassword = keyStoreDO.getStorePassword(); String privateKeyPassword = keyStoreDO.getPrivateKeyPassword(); + if (MashupConstants.USER_KEY_STORE_PASS.equals(privateKeyPassword)) { + throw new MashupFault("You cannot communicate with https sites untill you " + + "specify your private key. Please do so by vising the cert_manager.jsp page"); + } CryptoUtil cryptoUtil = new CryptoUtil(new File(config.getFirstProperty( "Security.KeyStore.Location")).getAbsolutePath(), @@ -127,24 +132,29 @@ } catch (NoSuchAlgorithmException e) { log.error(e); + throw new MashupFault(e); } catch (KeyStoreException e) { log.error(e); + throw new MashupFault(e); } catch (CertificateException e) { log.error(e); + throw new MashupFault(e); } catch (UnrecoverableKeyException e) { log.error(e); + throw new MashupFault(e); } catch (KeyManagementException e) { log.error(e); + throw new MashupFault(e); } catch (IOException e) { log.error(e); + throw new MashupFault(e); } catch (CryptoException e) { log.error(e); + throw new MashupFault(e); } - - return null; } - private SSLContext getSSLContext() { + private SSLContext getSSLContext() throws MashupFault { if (this.sslcontext == null) { this.sslcontext = createSSLContext(); } _______________________________________________ Mashup-dev mailing list [email protected] http://wso2.org/cgi-bin/mailman/listinfo/mashup-dev
