]> source.dussan.org Git - poi.git/commitdiff
update WriteAuthorAntTitle example to Java 1.6+
authorJaven O'Neal <onealj@apache.org>
Wed, 15 Jun 2016 03:29:31 +0000 (03:29 +0000)
committerJaven O'Neal <onealj@apache.org>
Wed, 15 Jun 2016 03:29:31 +0000 (03:29 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1748485 13f79535-47bb-0310-9956-ffa450edef68

src/examples/src/org/apache/poi/hpsf/examples/WriteAuthorAndTitle.java

index 0ba2bc9279975536d73032a6d4256c1f9c36e232..996aa9ff7b659fa35861781f56d8f28881d6e300 100644 (file)
@@ -347,7 +347,7 @@ public class WriteAuthorAndTitle
         /** Contains the directory paths that have already been created in the
          * output POI filesystem and maps them to their corresponding
          * {@link org.apache.poi.poifs.filesystem.DirectoryNode}s. */
-        private final Map paths = new HashMap();
+        private final Map<String, DirectoryEntry> paths = new HashMap<String, DirectoryEntry>();
 
 
 
@@ -381,7 +381,7 @@ public class WriteAuthorAndTitle
             {
                 /* Check whether this directory has already been created. */
                 final String s = path.toString();
-                DirectoryEntry de = (DirectoryEntry) paths.get(s);
+                DirectoryEntry de = paths.get(s);
                 if (de != null)
                     /* Yes: return the corresponding DirectoryEntry. */
                     return de;
@@ -411,10 +411,7 @@ public class WriteAuthorAndTitle
                  * exists. However, since we have full control about directory
                  * creation we can ensure that this will never happen. */
                 ex.printStackTrace(System.err);
-                throw new RuntimeException(ex.toString());
-                /* FIXME (2): Replace the previous line by the following once we
-                 * no longer need JDK 1.3 compatibility. */
-                // throw new RuntimeException(ex);
+                throw new RuntimeException(ex);
             }
         }
     }