Merge pull request #3 from jimmycasey/trunk

Fixed Spelling.
diff --git a/java/modules/core/src/main/java/org/apache/synapse/message/processors/sampler/SamplingJob.java b/java/modules/core/src/main/java/org/apache/synapse/message/processors/sampler/SamplingJob.java
index d901adc..8b87db6 100644
--- a/java/modules/core/src/main/java/org/apache/synapse/message/processors/sampler/SamplingJob.java
+++ b/java/modules/core/src/main/java/org/apache/synapse/message/processors/sampler/SamplingJob.java
@@ -23,6 +23,7 @@
 import org.apache.commons.logging.LogFactory;
 import org.apache.synapse.Mediator;
 import org.apache.synapse.MessageContext;
+import org.apache.synapse.SynapseException;
 import org.apache.synapse.message.processors.MessageProcessorConsents;
 import org.apache.synapse.message.processors.ScheduledMessageProcessor;
 import org.apache.synapse.message.store.MessageStore;
@@ -79,7 +80,12 @@
                                 if (processingSequence != null) {
                                     processingSequence.mediate(messageContext);
                                 }
-                            } catch (Throwable t) {
+                            } catch (SynapseException synError){
+                                if (!messageContext.getFaultStack().isEmpty()) {
+                                    messageContext.getFaultStack().pop().handleFault(messageContext,synError);
+                                }
+                                log.error("Error occurred while executing the message", synError);
+                            }catch (Throwable t) {
                                 log.error("Error occurred while executing the message", t);
                             }
                         }
diff --git a/java/modules/core/src/test/resources/identity.jks b/java/modules/core/src/test/resources/identity.jks
index 025f25e..e7e6514 100644
--- a/java/modules/core/src/test/resources/identity.jks
+++ b/java/modules/core/src/test/resources/identity.jks
Binary files differ
diff --git a/java/modules/core/src/test/resources/keystore.jks b/java/modules/core/src/test/resources/keystore.jks
index 3a6dd49..e7e6514 100644
--- a/java/modules/core/src/test/resources/keystore.jks
+++ b/java/modules/core/src/test/resources/keystore.jks
Binary files differ
diff --git a/java/modules/core/src/test/resources/trust.jks b/java/modules/core/src/test/resources/trust.jks
index 98c9a91..e7e6514 100644
--- a/java/modules/core/src/test/resources/trust.jks
+++ b/java/modules/core/src/test/resources/trust.jks
Binary files differ
diff --git a/java/modules/distribution/pom.xml b/java/modules/distribution/pom.xml
index 146a7d8..693567c 100644
--- a/java/modules/distribution/pom.xml
+++ b/java/modules/distribution/pom.xml
@@ -158,7 +158,7 @@
 
     <repositories>
         <!-- This is for xmltask -->
-        <repository>
+        <!--repository>
             <id>atlassian-developer-site</id>
             <name>Atlassian Maven 2 Contributor Repository</name>
             <url>http://maven.atlassian.com/repository/public</url>
@@ -168,7 +168,7 @@
             <snapshots>
                 <enabled>false</enabled>
             </snapshots>
-        </repository>
+        </repository-->
     </repositories>
 
     <build>
@@ -183,6 +183,7 @@
                             <goal>single</goal>
                         </goals>
                         <configuration>
+                            <tarLongFileMode>posix</tarLongFileMode>
                             <descriptors>
                                 <descriptor>src/main/assembly/bin.xml</descriptor>
                                 <descriptor>src/main/assembly/src.xml</descriptor>
diff --git a/java/modules/distribution/src/main/conf/identity.jks b/java/modules/distribution/src/main/conf/identity.jks
index 025f25e..e7e6514 100644
--- a/java/modules/distribution/src/main/conf/identity.jks
+++ b/java/modules/distribution/src/main/conf/identity.jks
Binary files differ
diff --git a/java/modules/distribution/src/main/conf/trust.jks b/java/modules/distribution/src/main/conf/trust.jks
index 98c9a91..e7e6514 100644
--- a/java/modules/distribution/src/main/conf/trust.jks
+++ b/java/modules/distribution/src/main/conf/trust.jks
Binary files differ
diff --git a/java/modules/integration/src/test/resources/identity.jks b/java/modules/integration/src/test/resources/identity.jks
index 025f25e..e7e6514 100644
--- a/java/modules/integration/src/test/resources/identity.jks
+++ b/java/modules/integration/src/test/resources/identity.jks
Binary files differ
diff --git a/java/modules/integration/src/test/resources/trust.jks b/java/modules/integration/src/test/resources/trust.jks
index 98c9a91..e7e6514 100644
--- a/java/modules/integration/src/test/resources/trust.jks
+++ b/java/modules/integration/src/test/resources/trust.jks
Binary files differ
diff --git a/java/modules/packaging/package-archetype/src/main/resources/archetype-resources/pom.xml b/java/modules/packaging/package-archetype/src/main/resources/archetype-resources/pom.xml
index 4bd6167..3f22961 100644
--- a/java/modules/packaging/package-archetype/src/main/resources/archetype-resources/pom.xml
+++ b/java/modules/packaging/package-archetype/src/main/resources/archetype-resources/pom.xml
@@ -38,7 +38,7 @@
                 </property>
             </activation>
             <repositories>
-                <repository>
+                <!--repository>
                     <id>apache-snapshots</id>
                     <name>Apache Maven 2 Snapshot Repository</name>
                     <url>http://people.apache.org/repo/m2-snapshot-repository/</url>
@@ -46,9 +46,9 @@
                         <updatePolicy>never</updatePolicy>
                     </releases>
                     <snapshots>
-                        <updatePolicy>interval:10080</updatePolicy> <!-- i.e. refresh weekly -->
+                        <updatePolicy>interval:10080</updatePolicy>
                     </snapshots>
-                </repository>
+                </repository-->
             </repositories>
         </profile>
     </profiles>
diff --git a/java/modules/samples/services/EJBSampleBeans/pom.xml b/java/modules/samples/services/EJBSampleBeans/pom.xml
index c1a6300..b63f46b 100644
--- a/java/modules/samples/services/EJBSampleBeans/pom.xml
+++ b/java/modules/samples/services/EJBSampleBeans/pom.xml
@@ -30,14 +30,14 @@
     <name>Apache Synapse - Samples - EJB</name>

     <description>Apache Synapse - Samples - EJB</description>

 

-    <repositories>

+    <!--repositories>

         <repository>

             <id>maven2-repository.dev.java.net</id>

             <name>Java.net Repository for Maven</name>

             <url>http://download.java.net/maven/2/</url>

             <layout>default</layout>

         </repository>

-    </repositories>

+    </repositories-->

 

     <build>

         <sourceDirectory>src</sourceDirectory>

diff --git a/java/modules/samples/services/SecureStockQuoteService/store.jks b/java/modules/samples/services/SecureStockQuoteService/store.jks
index 02d7c4e..fe3c5f8 100644
--- a/java/modules/samples/services/SecureStockQuoteService/store.jks
+++ b/java/modules/samples/services/SecureStockQuoteService/store.jks
Binary files differ
diff --git a/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/nhttp/util/RESTUtil.java b/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/nhttp/util/RESTUtil.java
index 9a7ecf3..b4e3946 100755
--- a/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/nhttp/util/RESTUtil.java
+++ b/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/nhttp/util/RESTUtil.java
@@ -53,6 +53,10 @@
  */
 public class RESTUtil {
 
+   private static RequestURIOperationDispatcher requestURIOperationDispatcher = new RequestURIOperationDispatcher();
+   private static HTTPLocationBasedDispatcher httpLocationBasedDispatcher = new HTTPLocationBasedDispatcher();
+   private static RequestURIBasedDispatcher requestDispatcher = new RequestURIBasedDispatcher();
+
     /**
      * This method will return the URI part for the GET HTTPRequest by converting
      * the SOAP infoset to the URL-encoded GET format
@@ -295,16 +299,11 @@
     }
     
     public static void dispatchAndVerify(MessageContext msgContext) throws AxisFault {
-        RequestURIBasedDispatcher requestDispatcher = new RequestURIBasedDispatcher();
         requestDispatcher.invoke(msgContext);
         AxisService axisService = msgContext.getAxisService();
         if (axisService != null) {
-            HTTPLocationBasedDispatcher httpLocationBasedDispatcher =
-                    new HTTPLocationBasedDispatcher();
             httpLocationBasedDispatcher.invoke(msgContext);
             if (msgContext.getAxisOperation() == null) {
-                RequestURIOperationDispatcher requestURIOperationDispatcher =
-                        new RequestURIOperationDispatcher();
                 requestURIOperationDispatcher.invoke(msgContext);
             }
 
diff --git a/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/TargetHandler.java b/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/TargetHandler.java
index 683c2b4..0758c85 100644
--- a/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/TargetHandler.java
+++ b/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/TargetHandler.java
@@ -477,13 +477,24 @@
     }
 
     public void exception(NHttpClientConnection conn, Exception e) {
+        ProtocolState state = TargetContext.getState(conn);
+
+        if (state == ProtocolState.REQUEST_HEAD || state == ProtocolState.REQUEST_BODY) {
+            informWriterError(conn);
+            log.warn("Exception occurred while writing the request data");
+        } else if (state == ProtocolState.RESPONSE_HEAD || state == ProtocolState.RESPONSE_BODY) {
+            informReaderError(conn);
+            log.warn("Exception occurred while reading the response data");
+        } else if (state == ProtocolState.REQUEST_DONE) {
+            log.warn("Exception occurred after writing the request data but before reading the response data");
+        }
+
         if (e instanceof HttpException) {
             exception(conn, (HttpException) e);
         } else if (e instanceof IOException) {
             exception(conn, (IOException) e);
         } else {
             log.error("Unexpected exception encountered in TargetHandler", e);
-            ProtocolState state = TargetContext.getState(conn);
             MessageContext requestMsgCtx = TargetContext.get(conn).getRequestMsgCtx();
             if (requestMsgCtx != null) {
                 targetErrorHandler.handleError(requestMsgCtx,
diff --git a/java/pom.xml b/java/pom.xml
index 075be18..d4fbae7 100644
--- a/java/pom.xml
+++ b/java/pom.xml
@@ -123,7 +123,7 @@
                 <repository>
                     <id>wso2-m2</id>
                     <name>WSO2 Maven 2 Repository</name>
-                    <url>http://dist.wso2.org/maven2/</url>
+                    <url>https://maven.wso2.org/nexus/content/groups/wso2-public/</url>
                     <releases>
                         <updatePolicy>never</updatePolicy>
                     </releases>
@@ -131,7 +131,7 @@
                         <enabled>false</enabled>
                     </snapshots>
                 </repository>
-                <repository>
+                <!--repository>
                     <id>wso2-m2-snapshots</id>
                     <name>WSO2 Maven 2 SNAPSHOTS Repository</name>
                     <url>http://dist.wso2.org/snapshots/maven2/</url>
@@ -142,7 +142,7 @@
                         <enabled>true</enabled>
                         <updatePolicy>interval:60</updatePolicy>
                     </snapshots>
-                </repository>
+                </repository-->
             </repositories>
         </profile>
         <profile>
@@ -1036,7 +1036,7 @@
         <repository>
             <id>wso2-m2</id>
             <name>WSO2 Maven 2 Repository</name>
-            <url>http://dist.wso2.org/maven2/</url>
+            <url>https://maven.wso2.org/nexus/content/groups/wso2-public/</url>
             <releases>
                 <updatePolicy>never</updatePolicy>
             </releases>
@@ -1044,7 +1044,7 @@
                 <enabled>false</enabled>
             </snapshots>
         </repository>
-        <repository>
+        <!--repository>
             <id>wso2-m2-snapshots</id>
             <name>WSO2 Maven 2 SNAPSHOTS Repository</name>
             <url>http://dist.wso2.org/snapshots/maven2/</url>
@@ -1055,7 +1055,7 @@
                 <enabled>true</enabled>
                 <updatePolicy>interval:10080</updatePolicy>
             </snapshots>
-        </repository>
+        </repository-->
     </repositories>
 
     <modules>
diff --git a/java/repository/conf/sample/resources/security/store.jks b/java/repository/conf/sample/resources/security/store.jks
index 02d7c4e..fe3c5f8 100644
--- a/java/repository/conf/sample/resources/security/store.jks
+++ b/java/repository/conf/sample/resources/security/store.jks
Binary files differ