Author: fanningpj
Date: Mon Dec 13 13:52:46 2021
New Revision: 1895882
URL: http://svn.apache.org/viewvc?rev=1895882&view=rev
Log:
[bug-65741] change some methods to throw checked exception
InvalidFormatException
Modified:
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/ooxml/POIXMLProperties.java
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/PackageProperties.java
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/internal/PackagePropertiesPart.java
Modified:
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/ooxml/POIXMLProperties.java
URL:
http://svn.apache.org/viewvc/poi/trunk/poi-ooxml/src/main/java/org/apache/poi/ooxml/POIXMLProperties.java?rev=1895882&r1=1895881&r2=1895882&view=diff
==============================================================================
---
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/ooxml/POIXMLProperties.java
(original)
+++
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/ooxml/POIXMLProperties.java
Mon Dec 13 13:52:46 2021
@@ -276,7 +276,7 @@ public class POIXMLProperties {
public void setCreated(Optional<Date> date) {
part.setCreatedProperty(date);
}
- public void setCreated(String date) {
+ public void setCreated(String date) throws InvalidFormatException {
part.setCreatedProperty(date);
}
public String getCreator() {
@@ -309,7 +309,7 @@ public class POIXMLProperties {
public void setLastPrinted(Optional<Date> date) {
part.setLastPrintedProperty(date);
}
- public void setLastPrinted(String date) {
+ public void setLastPrinted(String date) throws InvalidFormatException {
part.setLastPrintedProperty(date);
}
/** @since POI 3.15 beta 3 */
@@ -326,7 +326,7 @@ public class POIXMLProperties {
public void setModified(Optional<Date> date) {
part.setModifiedProperty(date);
}
- public void setModified(String date) {
+ public void setModified(String date) throws InvalidFormatException {
part.setModifiedProperty(date);
}
public String getSubject() {
Modified:
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/PackageProperties.java
URL:
http://svn.apache.org/viewvc/poi/trunk/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/PackageProperties.java?rev=1895882&r1=1895881&r2=1895882&view=diff
==============================================================================
---
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/PackageProperties.java
(original)
+++
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/PackageProperties.java
Mon Dec 13 13:52:46 2021
@@ -17,6 +17,8 @@
package org.apache.poi.openxml4j.opc;
+import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
+
import java.util.Date;
import java.util.Optional;
@@ -102,8 +104,10 @@ public interface PackageProperties {
/**
* Set the date of creation of the resource.
+ * @throws InvalidFormatException only since POI 5.2.0, used to throw
unchecked exception
+ * IllegalArgumentException if format was invalid
*/
- void setCreatedProperty(String created);
+ void setCreatedProperty(String created) throws InvalidFormatException;
/**
* Set the date of creation of the resource.
@@ -227,8 +231,10 @@ public interface PackageProperties {
/**
* Set the date and time of the last printing.
+ * @throws InvalidFormatException only since POI 5.2.0, used to throw
unchecked exception
+ * IllegalArgumentException if format was invalid
*/
- void setLastPrintedProperty(String lastPrinted);
+ void setLastPrintedProperty(String lastPrinted) throws
InvalidFormatException;
/**
* Set the date and time of the last printing.
@@ -243,8 +249,10 @@ public interface PackageProperties {
/**
* Set the date on which the resource was changed.
+ * @throws InvalidFormatException only since POI 5.2.0, used to throw
unchecked exception
+ * IllegalArgumentException if format was invalid
*/
- void setModifiedProperty(String modified);
+ void setModifiedProperty(String modified) throws InvalidFormatException;
/**
* Set the date on which the resource was changed.
Modified:
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/internal/PackagePropertiesPart.java
URL:
http://svn.apache.org/viewvc/poi/trunk/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/internal/PackagePropertiesPart.java?rev=1895882&r1=1895881&r2=1895882&view=diff
==============================================================================
---
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/internal/PackagePropertiesPart.java
(original)
+++
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/internal/PackagePropertiesPart.java
Mon Dec 13 13:52:46 2021
@@ -427,12 +427,8 @@ public final class PackagePropertiesPart
* @see
org.apache.poi.openxml4j.opc.PackageProperties#setCreatedProperty(java.util.Optional)
*/
@Override
- public void setCreatedProperty(String created) {
- try {
- this.created = parseDateValue(created);
- } catch (InvalidFormatException e) {
- throw new IllegalArgumentException("Date for created could not be
parsed: " + created, e);
- }
+ public void setCreatedProperty(String created) throws
InvalidFormatException {
+ this.created = parseDateValue(created);
}
/**
@@ -548,13 +544,8 @@ public final class PackagePropertiesPart
* @see
org.apache.poi.openxml4j.opc.PackageProperties#setLastPrintedProperty(java.util.Optional)
*/
@Override
- public void setLastPrintedProperty(String lastPrinted) {
- try {
- this.lastPrinted = parseDateValue(lastPrinted);
- } catch (InvalidFormatException e) {
- throw new IllegalArgumentException("lastPrinted : "
- + e.getLocalizedMessage(), e);
- }
+ public void setLastPrintedProperty(String lastPrinted) throws
InvalidFormatException {
+ this.lastPrinted = parseDateValue(lastPrinted);
}
/**
@@ -572,13 +563,8 @@ public final class PackagePropertiesPart
* @see
org.apache.poi.openxml4j.opc.PackageProperties#setModifiedProperty(java.util.Optional)
*/
@Override
- public void setModifiedProperty(String modified) {
- try {
- this.modified = parseDateValue(modified);
- } catch (InvalidFormatException e) {
- throw new IllegalArgumentException("modified : "
- + e.getLocalizedMessage(), e);
- }
+ public void setModifiedProperty(String modified) throws
InvalidFormatException {
+ this.modified = parseDateValue(modified);
}
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]