commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ohe...@apache.org
Subject svn commit: r1460852 - in /commons/proper/configuration/trunk/src: main/java/org/apache/commons/configuration/ main/java/org/apache/commons/configuration/io/ test/java/org/apache/commons/configuration/
Date Mon, 25 Mar 2013 19:13:31 GMT
Author: oheger
Date: Mon Mar 25 19:13:30 2013
New Revision: 1460852

URL: http://svn.apache.org/r1460852
Log:
Added support for VerifiableOutputStream to FileHandler.
Moved VerifiableOutputStream to io package.

Added:
    commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/io/VerifiableOutputStream.java
      - copied, changed from r1460459, commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/VerifiableOutputStream.java
Removed:
    commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/VerifiableOutputStream.java
Modified:
    commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/AbstractFileConfiguration.java
    commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/DefaultFileSystem.java
    commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/io/FileHandler.java
    commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestPropertiesConfiguration.java

Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/AbstractFileConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/AbstractFileConfiguration.java?rev=1460852&r1=1460851&r2=1460852&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/AbstractFileConfiguration.java
(original)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/AbstractFileConfiguration.java
Mon Mar 25 19:13:30 2013
@@ -31,6 +31,7 @@ import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
 
+import org.apache.commons.configuration.io.VerifiableOutputStream;
 import org.apache.commons.configuration.reloading.InvariantReloadingStrategy;
 import org.apache.commons.configuration.reloading.ReloadingStrategy;
 import org.apache.commons.lang.StringUtils;

Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/DefaultFileSystem.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/DefaultFileSystem.java?rev=1460852&r1=1460851&r2=1460852&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/DefaultFileSystem.java
(original)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/DefaultFileSystem.java
Mon Mar 25 19:13:30 2013
@@ -27,6 +27,7 @@ import java.net.MalformedURLException;
 import java.net.URL;
 import java.net.URLConnection;
 
+import org.apache.commons.configuration.io.VerifiableOutputStream;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 

Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/io/FileHandler.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/io/FileHandler.java?rev=1460852&r1=1460851&r2=1460852&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/io/FileHandler.java
(original)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/io/FileHandler.java
Mon Mar 25 19:13:30 2013
@@ -880,6 +880,17 @@ public class FileHandler
         {
             out = spec.getFileSystem().getOutputStream(url);
             saveToStream(out, spec.getEncoding(), url);
+            if(out instanceof VerifiableOutputStream)
+            {
+                try
+                {
+                    ((VerifiableOutputStream) out).verify();
+                }
+                catch (IOException e)
+                {
+                    throw new ConfigurationException(e);
+                }
+            }
         }
         finally
         {

Copied: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/io/VerifiableOutputStream.java
(from r1460459, commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/VerifiableOutputStream.java)
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/io/VerifiableOutputStream.java?p2=commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/io/VerifiableOutputStream.java&p1=commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/VerifiableOutputStream.java&r1=1460459&r2=1460852&rev=1460852&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/VerifiableOutputStream.java
(original)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/io/VerifiableOutputStream.java
Mon Mar 25 19:13:30 2013
@@ -14,18 +14,17 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.configuration;
+package org.apache.commons.configuration.io;
 
-import java.io.OutputStream;
 import java.io.IOException;
+import java.io.OutputStream;
 
 /**
  * OutputStream that can be checked for errors after it is written to.
  * @since 1.7
- * @author <a
- * href="http://commons.apache.org/configuration/team-list.html">Commons Configuration
team</a>
+ * @version $Id$
  */
-abstract class VerifiableOutputStream extends OutputStream
+public abstract class VerifiableOutputStream extends OutputStream
 {
     public abstract void verify() throws IOException;
 }

Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestPropertiesConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestPropertiesConfiguration.java?rev=1460852&r1=1460851&r2=1460852&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestPropertiesConfiguration.java
(original)
+++ commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestPropertiesConfiguration.java
Mon Mar 25 19:13:30 2013
@@ -52,7 +52,6 @@ import org.apache.commons.configuration.
 import org.apache.commons.configuration.builder.combined.CombinedConfigurationBuilder;
 import org.apache.commons.configuration.io.FileHandler;
 import org.junit.Before;
-import org.junit.Ignore;
 import org.junit.Test;
 
 /**
@@ -705,8 +704,7 @@ public class TestPropertiesConfiguration
      * Tests saving a file-based configuration to a HTTP server when the server
      * reports a failure. This should cause an exception.
      */
-    //TODO add support for VerifiableOutputStream to FileHandler
-    @Test @Ignore
+    @Test
     public void testSaveToHTTPServerFail() throws Exception
     {
         MockHttpURLStreamHandler handler = new MockHttpURLStreamHandler(



Mime
View raw message