#775: ShortConverter.java
projectforge-business/src/main/java/org/projectforge/framework/xmlstream/converter/ShortConverter.java XmlStream type converter — converts XML string values ↔ Java Short for the XmlStream serialization framework. Source: projectforge-business/src/main/java/org/projectforge/framework/xmlstream/converter/ShortConverter.java 46 lines · 20 code · 22 comments · 4 blank
Part of the XmlStream converter registry. Extends
AbstractValueConverter<Short>. Handles nulls (empty string or NULL_IDENTIFIER → null), valid numbers (→ Short.valueOf), and malformed input (logs warning, returns 0). Registered in
XmlRegistry alongside 13 sibling converters.
Converter Family
| Converter | Java type | Doc |
|---|
| LongConverter | Long | #774 |
| ShortConverter | Short | #775 |
| IntegerConverter | Integer | #773 |
| BigDecimalConverter | BigDecimal | #772 |
Design — Degrading Gracefully
Unlike LongConverter which throws on malformed input, ShortConverter catches NumberFormatException and returns 0 with a warning log. This is a resilience over correctness choice: XML data for Short fields is typically small and unlikely to overflow, and a zero default is safer than crashing an entire import/export operation. The sibling IntegerConverter follows the same pattern.
Git History
868d6abb7 2025→2026 | 63081666f 2024→2025 | b6092df09 2023→2024 | cd27dd997 xstream→xmlstream rename | 000ca723d Remove pointless boolean expressions | a5bbdca6a Change logger to slf4j | 9ebb88522 Initial commit