commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r995621 - in /commons/proper/sanselan/trunk/src/test/java/org/apache/sanselan/formats/jpeg: iptc/IptcUpdateTest.java xmp/JpegXmpRewriteTest.java
Date Fri, 10 Sep 2010 00:47:06 GMT
Author: sebb
Date: Fri Sep 10 00:47:06 2010
New Revision: 995621

URL: http://svn.apache.org/viewvc?rev=995621&view=rev
Log:
Avoid potential NPEs

Modified:
    commons/proper/sanselan/trunk/src/test/java/org/apache/sanselan/formats/jpeg/iptc/IptcUpdateTest.java
    commons/proper/sanselan/trunk/src/test/java/org/apache/sanselan/formats/jpeg/xmp/JpegXmpRewriteTest.java

Modified: commons/proper/sanselan/trunk/src/test/java/org/apache/sanselan/formats/jpeg/iptc/IptcUpdateTest.java
URL: http://svn.apache.org/viewvc/commons/proper/sanselan/trunk/src/test/java/org/apache/sanselan/formats/jpeg/iptc/IptcUpdateTest.java?rev=995621&r1=995620&r2=995621&view=diff
==============================================================================
--- commons/proper/sanselan/trunk/src/test/java/org/apache/sanselan/formats/jpeg/iptc/IptcUpdateTest.java
(original)
+++ commons/proper/sanselan/trunk/src/test/java/org/apache/sanselan/formats/jpeg/iptc/IptcUpdateTest.java
Fri Sep 10 00:47:06 2010
@@ -95,7 +95,9 @@ public class IptcUpdateTest extends Iptc
 					new JpegIptcRewriter().removeIPTC(byteSource, os);
 				} finally
 				{
-					os.close();
+				    if (os != null) {
+				        os.close();
+				    }
 					os = null;
 				}
 
@@ -152,7 +154,9 @@ public class IptcUpdateTest extends Iptc
 					new JpegIptcRewriter().removeIPTC(byteSource, os);
 				} finally
 				{
-					os.close();
+                    if (os != null) {
+                        os.close();
+                    }
 					os = null;
 				}
 
@@ -197,7 +201,9 @@ public class IptcUpdateTest extends Iptc
 					new JpegIptcRewriter().writeIPTC(byteSource, os, newData);
 				} finally
 				{
-					os.close();
+                    if (os != null) {
+                        os.close();
+                    }
 					os = null;
 				}
 
@@ -241,7 +247,9 @@ public class IptcUpdateTest extends Iptc
 					new JpegIptcRewriter().writeIPTC(byteSource, os, newData);
 				} finally
 				{
-					os.close();
+                    if (os != null) {
+                        os.close();
+                    }
 					os = null;
 				}
 
@@ -286,7 +294,9 @@ public class IptcUpdateTest extends Iptc
 							noIptcFile), os, newData);
 				} finally
 				{
-					os.close();
+                    if (os != null) {
+                        os.close();
+                    }
 					os = null;
 				}
 
@@ -385,7 +395,9 @@ public class IptcUpdateTest extends Iptc
 					new JpegIptcRewriter().writeIPTC(byteSource, os, newData);
 				} finally
 				{
-					os.close();
+                    if (os != null) {
+                        os.close();
+                    }
 					os = null;
 				}
 

Modified: commons/proper/sanselan/trunk/src/test/java/org/apache/sanselan/formats/jpeg/xmp/JpegXmpRewriteTest.java
URL: http://svn.apache.org/viewvc/commons/proper/sanselan/trunk/src/test/java/org/apache/sanselan/formats/jpeg/xmp/JpegXmpRewriteTest.java?rev=995621&r1=995620&r2=995621&view=diff
==============================================================================
--- commons/proper/sanselan/trunk/src/test/java/org/apache/sanselan/formats/jpeg/xmp/JpegXmpRewriteTest.java
(original)
+++ commons/proper/sanselan/trunk/src/test/java/org/apache/sanselan/formats/jpeg/xmp/JpegXmpRewriteTest.java
Fri Sep 10 00:47:06 2010
@@ -75,7 +75,9 @@ public class JpegXmpRewriteTest extends 
 					new JpegXmpRewriter().removeXmpXml(byteSource, os);
 				} finally
 				{
-					os.close();
+					if (os != null) {
+					    os.close();
+					}
 					os = null;
 				}
 
@@ -101,7 +103,9 @@ public class JpegXmpRewriteTest extends 
 							newXmpXml);
 				} finally
 				{
-					os.close();
+				    if (os != null) {
+				        os.close();
+				    }
 					os = null;
 				}
 
@@ -128,7 +132,9 @@ public class JpegXmpRewriteTest extends 
 							newXmpXml);
 				} finally
 				{
-					os.close();
+				    if (os != null) {
+				        os.close();
+				    }
 					os = null;
 				}
 



Mime
View raw message