Author: fanningpj
Date: Mon Dec 13 13:12:32 2021
New Revision: 1895881
URL: http://svn.apache.org/viewvc?rev=1895881&view=rev
Log:
[bug-65741] rework previous change
Modified:
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/internal/PackagePropertiesPart.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hsmf/MAPIMessage.java
poi/trunk/poi/src/test/java/org/apache/poi/hssf/usermodel/TestHSSFRichTextString.java
poi/trunk/poi/src/test/java/org/apache/poi/ss/usermodel/BaseTestDataValidation.java
poi/trunk/test-data/spreadsheet/extendedtextstrings.txt
poi/trunk/test-data/spreadsheet/richtextdata.txt
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=1895881&r1=1895880&r2=1895881&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:12:32 2021
@@ -236,7 +236,7 @@ public final class PackagePropertiesPart
}
/**
- * Get created date formated into a String.
+ * Get created date formatted into a String.
*
* @return A string representation of the created date.
*/
@@ -308,7 +308,7 @@ public final class PackagePropertiesPart
}
/**
- * Get last printed date formated into a String.
+ * Get last printed date formatted into a String.
*
* @return A string representation of the last printed date.
*/
@@ -326,7 +326,7 @@ public final class PackagePropertiesPart
}
/**
- * Get modified date formated into a String.
+ * Get modified date formatted into a String.
*
* @return A string representation of the modified date.
*/
@@ -379,7 +379,7 @@ public final class PackagePropertiesPart
*/
@Override
public void setCategoryProperty(String category) {
- this.category = setStringValue(category);
+ this.category = parseStringValue(category);
}
/**
@@ -395,7 +395,7 @@ public final class PackagePropertiesPart
*/
@Override
public void setContentStatusProperty(String contentStatus) {
- this.contentStatus = setStringValue(contentStatus);
+ this.contentStatus = parseStringValue(contentStatus);
}
/**
@@ -411,7 +411,7 @@ public final class PackagePropertiesPart
*/
@Override
public void setContentTypeProperty(String contentType) {
- this.contentType = setStringValue(contentType);
+ this.contentType = parseStringValue(contentType);
}
/**
@@ -428,12 +428,10 @@ public final class PackagePropertiesPart
*/
@Override
public void setCreatedProperty(String created) {
- if (created != null) {
- try {
- this.created = setDateValue(created);
- } catch (InvalidFormatException e) {
- throw new IllegalArgumentException("Date for created could not
be parsed: " + created, e);
- }
+ try {
+ this.created = parseDateValue(created);
+ } catch (InvalidFormatException e) {
+ throw new IllegalArgumentException("Date for created could not be
parsed: " + created, e);
}
}
@@ -443,8 +441,7 @@ public final class PackagePropertiesPart
*/
@Override
public void setCreatedProperty(Optional<Date> created) {
- if (created.isPresent())
- this.created = created;
+ this.created = created;
}
/**
@@ -453,7 +450,7 @@ public final class PackagePropertiesPart
*/
@Override
public void setCreatorProperty(String creator) {
- this.creator = setStringValue(creator);
+ this.creator = parseStringValue(creator);
}
/**
@@ -469,7 +466,7 @@ public final class PackagePropertiesPart
*/
@Override
public void setDescriptionProperty(String description) {
- this.description = setStringValue(description);
+ this.description = parseStringValue(description);
}
/**
@@ -485,7 +482,7 @@ public final class PackagePropertiesPart
*/
@Override
public void setIdentifierProperty(String identifier) {
- this.identifier = setStringValue(identifier);
+ this.identifier = parseStringValue(identifier);
}
/**
@@ -501,7 +498,7 @@ public final class PackagePropertiesPart
*/
@Override
public void setKeywordsProperty(String keywords) {
- this.keywords = setStringValue(keywords);
+ this.keywords = parseStringValue(keywords);
}
/**
@@ -517,7 +514,7 @@ public final class PackagePropertiesPart
*/
@Override
public void setLanguageProperty(String language) {
- this.language = setStringValue(language);
+ this.language = parseStringValue(language);
}
/**
@@ -533,7 +530,7 @@ public final class PackagePropertiesPart
*/
@Override
public void setLastModifiedByProperty(String lastModifiedBy) {
- this.lastModifiedBy = setStringValue(lastModifiedBy);
+ this.lastModifiedBy = parseStringValue(lastModifiedBy);
}
/**
@@ -552,13 +549,11 @@ public final class PackagePropertiesPart
*/
@Override
public void setLastPrintedProperty(String lastPrinted) {
- if (lastPrinted != null) {
- try {
- this.lastPrinted = setDateValue(lastPrinted);
- } catch (InvalidFormatException e) {
- throw new IllegalArgumentException("lastPrinted : "
- + e.getLocalizedMessage(), e);
- }
+ try {
+ this.lastPrinted = parseDateValue(lastPrinted);
+ } catch (InvalidFormatException e) {
+ throw new IllegalArgumentException("lastPrinted : "
+ + e.getLocalizedMessage(), e);
}
}
@@ -568,8 +563,7 @@ public final class PackagePropertiesPart
*/
@Override
public void setLastPrintedProperty(Optional<Date> lastPrinted) {
- if (lastPrinted.isPresent())
- this.lastPrinted = lastPrinted;
+ this.lastPrinted = lastPrinted;
}
/**
@@ -579,13 +573,11 @@ public final class PackagePropertiesPart
*/
@Override
public void setModifiedProperty(String modified) {
- if (modified != null) {
- try {
- this.modified = setDateValue(modified);
- } catch (InvalidFormatException e) {
- throw new IllegalArgumentException("modified : "
- + e.getLocalizedMessage(), e);
- }
+ try {
+ this.modified = parseDateValue(modified);
+ } catch (InvalidFormatException e) {
+ throw new IllegalArgumentException("modified : "
+ + e.getLocalizedMessage(), e);
}
}
@@ -595,8 +587,7 @@ public final class PackagePropertiesPart
*/
@Override
public void setModifiedProperty(Optional<Date> modified) {
- if (modified.isPresent())
- this.modified = modified;
+ this.modified = modified;
}
/**
@@ -612,7 +603,7 @@ public final class PackagePropertiesPart
*/
@Override
public void setRevisionProperty(String revision) {
- this.revision = setStringValue(revision);
+ this.revision = parseStringValue(revision);
}
/**
* Set subject.
@@ -620,7 +611,7 @@ public final class PackagePropertiesPart
*/
@Override
public void setSubjectProperty(String subject) {
- this.subject = setStringValue(subject);
+ this.subject = parseStringValue(subject);
}
/**
@@ -636,7 +627,7 @@ public final class PackagePropertiesPart
*/
@Override
public void setTitleProperty(String title) {
- this.title = setStringValue(title);
+ this.title = parseStringValue(title);
}
/**
@@ -652,7 +643,7 @@ public final class PackagePropertiesPart
*/
@Override
public void setVersionProperty(String version) {
- this.version = setStringValue(version);
+ this.version = parseStringValue(version);
}
/**
@@ -665,7 +656,7 @@ public final class PackagePropertiesPart
/**
* Convert a string value into a {@code Optional<String>}
*/
- private Optional<String> setStringValue(String s) {
+ private Optional<String> parseStringValue(String s) {
if (s == null || s.isEmpty()) {
return Optional.empty();
}
@@ -678,7 +669,7 @@ public final class PackagePropertiesPart
* @throws InvalidFormatException
* Throws if the date format is not valid.
*/
- private Optional<Date> setDateValue(String dateStr) throws
InvalidFormatException {
+ private Optional<Date> parseDateValue(String dateStr) throws
InvalidFormatException {
if (dateStr == null || dateStr.isEmpty()) {
return Optional.empty();
}
@@ -720,7 +711,7 @@ public final class PackagePropertiesPart
*
* @param d
* The Date to convert.
- * @return The formated date or null.
+ * @return The formatted date or null.
* @see java.text.SimpleDateFormat
*/
private static String getDateValue(Optional<Date> d) {
Modified:
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hsmf/MAPIMessage.java
URL:
http://svn.apache.org/viewvc/poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hsmf/MAPIMessage.java?rev=1895881&r1=1895880&r2=1895881&view=diff
==============================================================================
--- poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hsmf/MAPIMessage.java
(original)
+++ poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hsmf/MAPIMessage.java
Mon Dec 13 13:12:32 2021
@@ -269,7 +269,7 @@ public class MAPIMessage extends POIRead
/**
* Gets the display value of the "FROM" line of the outlook message
- * This is not the actual address that was sent from but the formated
display of the user name.
+ * This is not the actual address that was sent from but the formatted
display of the user name.
* @throws ChunkNotFoundException If the from-chunk does not exist and
* returnNullOnMissingChunk is set
*/
Modified:
poi/trunk/poi/src/test/java/org/apache/poi/hssf/usermodel/TestHSSFRichTextString.java
URL:
http://svn.apache.org/viewvc/poi/trunk/poi/src/test/java/org/apache/poi/hssf/usermodel/TestHSSFRichTextString.java?rev=1895881&r1=1895880&r2=1895881&view=diff
==============================================================================
---
poi/trunk/poi/src/test/java/org/apache/poi/hssf/usermodel/TestHSSFRichTextString.java
(original)
+++
poi/trunk/poi/src/test/java/org/apache/poi/hssf/usermodel/TestHSSFRichTextString.java
Mon Dec 13 13:12:32 2021
@@ -75,7 +75,7 @@ final class TestHSSFRichTextString {
/**
- * Test case proposed in Bug 40520: formated twice => will format whole
String
+ * Test case proposed in Bug 40520: formatted twice => will format whole
String
*/
@Test
void test40520_1() {
@@ -109,7 +109,7 @@ final class TestHSSFRichTextString {
}
/**
- * Test case proposed in Bug 40520: formated twice => will format whole
String
+ * Test case proposed in Bug 40520: formatted twice => will format whole
String
*/
@Test
void test40520_3() {
Modified:
poi/trunk/poi/src/test/java/org/apache/poi/ss/usermodel/BaseTestDataValidation.java
URL:
http://svn.apache.org/viewvc/poi/trunk/poi/src/test/java/org/apache/poi/ss/usermodel/BaseTestDataValidation.java?rev=1895881&r1=1895880&r2=1895881&view=diff
==============================================================================
---
poi/trunk/poi/src/test/java/org/apache/poi/ss/usermodel/BaseTestDataValidation.java
(original)
+++
poi/trunk/poi/src/test/java/org/apache/poi/ss/usermodel/BaseTestDataValidation.java
Mon Dec 13 13:12:32 2021
@@ -421,7 +421,7 @@ public abstract class BaseTestDataValida
CellStyle cellStyle_time = wb.createCellStyle();
cellStyle_time.setDataFormat(fmtTime);
- wf.createDVTypeRow("Date ( cells are already formated as date -
m/d/yyyy)");
+ wf.createDVTypeRow("Date ( cells are already formatted as date -
m/d/yyyy)");
wf.createHeaderRow();
ValidationAdder va = wf.createValidationAdder(cellStyle_date,
ValidationType.DATE);
@@ -435,7 +435,7 @@ public abstract class BaseTestDataValida
va.addValidation(OperatorType.LESS_OR_EQUAL, "2004/03/04", null,
ErrorStyle.STOP, "Less than or equal to 3/4/2004", "-", false, true, false);
// "Time" validation type
- wf.createDVTypeRow("Time ( cells are already formated as time -
h:mm)");
+ wf.createDVTypeRow("Time ( cells are already formatted as time -
h:mm)");
wf.createHeaderRow();
va = wf.createValidationAdder(cellStyle_time, ValidationType.TIME);
Modified: poi/trunk/test-data/spreadsheet/extendedtextstrings.txt
URL:
http://svn.apache.org/viewvc/poi/trunk/test-data/spreadsheet/extendedtextstrings.txt?rev=1895881&r1=1895880&r2=1895881&view=diff
==============================================================================
--- poi/trunk/test-data/spreadsheet/extendedtextstrings.txt (original)
+++ poi/trunk/test-data/spreadsheet/extendedtextstrings.txt Mon Dec 13 13:12:32
2021
@@ -21,9 +21,9 @@
41 74 20
41 74 20
-00 00 # Formatting run 1, first
formated char at 0
+00 00 # Formatting run 1, first
formatted char at 0
00 00 # Formatting run 1, Index
to font record
-02 00 # Formatting run 2, first
formated char at 2
+02 00 # Formatting run 2, first
formatted char at 2
00 00 # Formatting run 2, Index
to font record
FF FF FF # extended data
Modified: poi/trunk/test-data/spreadsheet/richtextdata.txt
URL:
http://svn.apache.org/viewvc/poi/trunk/test-data/spreadsheet/richtextdata.txt?rev=1895881&r1=1895880&r2=1895881&view=diff
==============================================================================
--- poi/trunk/test-data/spreadsheet/richtextdata.txt (original)
+++ poi/trunk/test-data/spreadsheet/richtextdata.txt Mon Dec 13 13:12:32 2021
@@ -17,7 +17,7 @@
41 74 20
41 74 20
-00 00 # Formatting run 1, first
formated char at 0
+00 00 # Formatting run 1, first
formatted char at 0
00 00 # Formatting run 1, Index
to font record
-02 00 # Formatting run 2, first
formated char at 2
+02 00 # Formatting run 2, first
formatted char at 2
00 00 # Formatting run 2, Index
to font record
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]