Skip to content

Commit 8dd1508

Browse files
Merge branch 'master' into FormatCodeTests
2 parents ef06718 + 86da4be commit 8dd1508

File tree

304 files changed

+1564
-1649
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

304 files changed

+1564
-1649
lines changed

generator/schema2template/src/main/java/schema2template/template/GrammarAdditionsFileHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ private void readAttributeSettings(Attributes attrs) throws SAXException {
167167
defaultValueByParentElement.put(elementName, defaultValue);
168168

169169
String repetition = attrs.getValue("repetition");
170-
if (repetition != null && repetition.length() > 0 && Boolean.valueOf(repetition)) {
170+
if (repetition != null && repetition.length() > 0 && Boolean.parseBoolean(repetition)) {
171171
mRepetitionAttributeNames.add(attrName);
172172
}
173173
}

odfdom/src/main/java/org/odftoolkit/odfdom/changes/Cell.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ public TableTableCellElement addCellStyleAndContent(
276276
} else if (oldTimeValue != null) {
277277
newValue = MapHelper.timeToDouble(oldTimeValue);
278278
} else if (oldBooleanValue != null) {
279-
newValue = Double.valueOf(oldBooleanValue ? 1 : 0);
279+
newValue = (double) (oldBooleanValue ? 1 : 0);
280280
}
281281

282282
if (newValue != null) {

odfdom/src/main/java/org/odftoolkit/odfdom/changes/ChangesFileSaxHandler.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -914,9 +914,7 @@ public void startElement(String uri, String localName, String qName, Attributes
914914
if (anchorHorOffset != 0) {
915915
drawingProps.put("anchorHorOffset", anchorHorOffset);
916916
}
917-
} catch (IndexOutOfBoundsException ex) {
918-
LOG.log(Level.SEVERE, null, ex);
919-
} catch (JSONException ex) {
917+
} catch (IndexOutOfBoundsException | JSONException ex) {
920918
LOG.log(Level.SEVERE, null, ex);
921919
}
922920
}

odfdom/src/main/java/org/odftoolkit/odfdom/changes/JsonOperationConsumer.java

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1343,9 +1343,7 @@ public static void addStyles(
13431343
OdfOfficeStyles styles = null;
13441344
try {
13451345
styles = doc.getStylesDom().getOrCreateOfficeStyles();
1346-
} catch (SAXException ex) {
1347-
LOG.log(Level.SEVERE, null, ex);
1348-
} catch (IOException ex) {
1346+
} catch (SAXException | IOException ex) {
13491347
LOG.log(Level.SEVERE, null, ex);
13501348
}
13511349
if (attrs != null) {
@@ -1740,12 +1738,12 @@ static void format(
17401738
}
17411739
double heightFactor = 1;
17421740
double widthFactor = 1;
1743-
if (newHeight > 0 && newHeight != gHeight.intValue()) {
1744-
heightFactor = (double) newHeight / (double) gHeight.intValue();
1741+
if (newHeight > 0 && newHeight != gHeight) {
1742+
heightFactor = newHeight / (double) gHeight;
17451743
targetNode.setUserData("groupHeight", newHeight, null);
17461744
}
1747-
if (newWidth > 0 && newWidth != gWidth.intValue()) {
1748-
widthFactor = (double) newWidth / (double) gWidth.intValue();
1745+
if (newWidth > 0 && newWidth != gWidth) {
1746+
widthFactor = newWidth / (double) gWidth;
17491747
targetNode.setUserData("groupWidth", newHeight, null);
17501748
}
17511749
Node child = targetNode.getFirstChild();
@@ -3340,19 +3338,7 @@ public static void addField(
33403338
Constructor<OdfElement> constructor = fieldClass.getConstructor(types);
33413339
newFieldElement = constructor.newInstance(xmlDoc);
33423340
}
3343-
} catch (InstantiationException e) {
3344-
LOG.log(Level.SEVERE, null, e);
3345-
} catch (IllegalAccessException e) {
3346-
LOG.log(Level.SEVERE, null, e);
3347-
} catch (IllegalArgumentException e) {
3348-
LOG.log(Level.SEVERE, null, e);
3349-
} catch (InvocationTargetException e) {
3350-
LOG.log(Level.SEVERE, null, e);
3351-
} catch (NoSuchMethodException e) {
3352-
LOG.log(Level.SEVERE, null, e);
3353-
} catch (SecurityException e) {
3354-
LOG.log(Level.SEVERE, null, e);
3355-
} catch (ClassNotFoundException e) {
3341+
} catch (InstantiationException | ClassNotFoundException | SecurityException | NoSuchMethodException | InvocationTargetException | IllegalArgumentException | IllegalAccessException e) {
33563342
LOG.log(Level.SEVERE, null, e);
33573343
}
33583344
setFieldAttributes(newFieldElement, attrs, currentMap, contentDom);
@@ -5335,7 +5321,7 @@ else if (key.equals("underline")) {
53355321
}
53365322
if (noProof != null || language != null) {
53375323
Object newLanguage = language;
5338-
if ((noProof instanceof Boolean && ((Boolean) noProof).booleanValue())
5324+
if ((noProof instanceof Boolean && (Boolean) noProof)
53395325
|| ((language instanceof String) && ((String) language).equals("none"))) {
53405326
propertiesElement.setFoLanguageAttribute("zxx");
53415327
propertiesElement.setStyleLanguageAsianAttribute("zxx");

odfdom/src/main/java/org/odftoolkit/odfdom/changes/JsonOperationProducer.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1074,9 +1074,7 @@ static Map<String, Object> getAutomaticStyleHierarchyProps(OdfStylableElement st
10741074
jsonCellProps.put("formatCode", formatCode);
10751075
allHardFormatting.put("cell", jsonCellProps);
10761076
}
1077-
} catch (SAXException ex) {
1078-
LOG.log(Level.SEVERE, null, ex);
1079-
} catch (IOException ex) {
1077+
} catch (SAXException | IOException ex) {
10801078
LOG.log(Level.SEVERE, null, ex);
10811079
}
10821080
}

odfdom/src/main/java/org/odftoolkit/odfdom/changes/MapHelper.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1646,7 +1646,7 @@ private static void extractTabulatorPosition(
16461646

16471647
// convert xmlschema-2 date to double
16481648
public static Double dateToDouble(Object value) {
1649-
Double ret = Double.valueOf(0.);
1649+
Double ret = 0.;
16501650
if (value != null && value instanceof String) {
16511651
// ISO 8601 formatter for date-time without time zone.
16521652
FastDateFormat fdf = DateFormatUtils.ISO_8601_EXTENDED_DATETIME_FORMAT;
@@ -1666,7 +1666,7 @@ public static Double dateToDouble(Object value) {
16661666
// convert xmlschema-2 duration to double
16671667

16681668
public static Double timeToDouble(Object value) {
1669-
Double ret = Double.valueOf(0.);
1669+
Double ret = 0.;
16701670
if (value != null && value instanceof String) {
16711671
// PThhHmmMss.sssS
16721672
try {
@@ -2147,10 +2147,8 @@ public static String findOrCreateDataStyle(String code, long id, OdfFileDom file
21472147
ret = newDataStyleName;
21482148
}
21492149
}
2150-
} catch (SAXException e) {
2150+
} catch (SAXException | IOException e) {
21512151
LOG.log(Level.SEVERE, null, e);
2152-
} catch (IOException ex) {
2153-
LOG.log(Level.SEVERE, null, ex);
21542152
}
21552153
return ret;
21562154
}
@@ -2478,7 +2476,7 @@ public static String getMSLangCode(String language, String country) {
24782476
}
24792477
Integer entry = localeToLanguageMap.get(cmpString);
24802478
if (entry != null) {
2481-
return Integer.toHexString(entry.intValue());
2479+
return Integer.toHexString(entry);
24822480
}
24832481
return "";
24842482
}

odfdom/src/main/java/org/odftoolkit/odfdom/changes/ShapeProperties.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,14 +241,14 @@ public void addMemberPosSize(Object horiOffset, Object vertOffset, Object width,
241241
if (mVertOffsetMin == null) {
242242
mVertOffsetMin = (Integer) vertOffset;
243243
} else {
244-
mVertOffsetMin = Math.min(mVertOffsetMin, ((Integer) vertOffset).intValue());
244+
mVertOffsetMin = Math.min(mVertOffsetMin, (Integer) vertOffset);
245245
}
246246
}
247247
if (horiOffset != null) {
248248
if (mHoriOffsetMin == null) {
249249
mHoriOffsetMin = (Integer) horiOffset;
250250
} else {
251-
mHoriOffsetMin = Math.min(mHoriOffsetMin, ((Integer) horiOffset).intValue());
251+
mHoriOffsetMin = Math.min(mHoriOffsetMin, (Integer) horiOffset);
252252
}
253253
}
254254
if (width != null) {

odfdom/src/main/java/org/odftoolkit/odfdom/doc/OdfPresentationDocument.java

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -518,9 +518,6 @@ private boolean deleteLinkRef(DrawPageElement slideEle) {
518518
}
519519
}
520520
}
521-
} catch (XPathExpressionException e) {
522-
LOG.log(Level.SEVERE, null, e);
523-
success = false;
524521
} catch (Exception e) {
525522
LOG.log(Level.SEVERE, null, e);
526523
success = false;
@@ -1002,7 +999,7 @@ private void insertCollectedStyle(
1002999
Boolean isAppended = styleAppendMap.get(newStyleName);
10031000
// if styleAppendMap contain the newStyleName,
10041001
// means that cloneStyleElement has already been appended
1005-
if ((isAppended != null) && isAppended.booleanValue() == true) {
1002+
if ((isAppended != null) && isAppended == true) {
10061003
continue;
10071004
} else {
10081005
styleAppendMap.put(newStyleName, true);
@@ -1410,9 +1407,7 @@ private void setSlideLayout(DrawPageElement page, OdfSlide.SlideLayout slideLayo
14101407
OdfOfficeStyles styles = null;
14111408
try {
14121409
styles = this.getStylesDom().getOrCreateOfficeStyles();
1413-
} catch (SAXException ex) {
1414-
LOG.log(Level.SEVERE, null, ex);
1415-
} catch (IOException ex) {
1410+
} catch (SAXException | IOException ex) {
14161411
LOG.log(Level.SEVERE, null, ex);
14171412
}
14181413
String layoutName;

odfdom/src/main/java/org/odftoolkit/odfdom/doc/table/OdfTable.java

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -554,8 +554,6 @@ public static OdfTable newTable(OdfElement tableParent) {
554554
tableParent.appendChild(newTEle);
555555
return OdfTable.getInstance(newTEle);
556556

557-
} catch (DOMException e) {
558-
LOG.log(Level.SEVERE, e.getMessage(), e);
559557
} catch (Exception e) {
560558
LOG.log(Level.SEVERE, e.getMessage(), e);
561559
}
@@ -687,8 +685,6 @@ public static OdfTable newTable(
687685

688686
return OdfTable.getInstance(newTEle);
689687

690-
} catch (DOMException e) {
691-
LOG.log(Level.SEVERE, e.getMessage(), e);
692688
} catch (Exception e) {
693689
LOG.log(Level.SEVERE, e.getMessage(), e);
694690
}
@@ -798,8 +794,6 @@ public static OdfTable newTable(
798794
}
799795
}
800796
return table;
801-
} catch (DOMException e) {
802-
LOG.log(Level.SEVERE, e.getMessage(), e);
803797
} catch (Exception e) {
804798
LOG.log(Level.SEVERE, e.getMessage(), e);
805799
}
@@ -907,8 +901,6 @@ public static OdfTable newTable(
907901

908902
return table;
909903

910-
} catch (DOMException e) {
911-
LOG.log(Level.SEVERE, e.getMessage(), e);
912904
} catch (Exception e) {
913905
LOG.log(Level.SEVERE, e.getMessage(), e);
914906
}
@@ -1370,7 +1362,7 @@ public List<OdfTableColumn> insertColumnsBefore(int index, int columnCount) {
13701362

13711363
TableTableColumnElement newColumnEle =
13721364
(TableTableColumnElement) refColumn.getOdfElement().cloneNode(true);
1373-
newColumnEle.setTableNumberColumnsRepeatedAttribute(Integer.valueOf(columnCount));
1365+
newColumnEle.setTableNumberColumnsRepeatedAttribute(columnCount);
13741366
mTableElement.insertBefore(newColumnEle, positionCol.getOdfElement());
13751367

13761368
for (int i = 0; i < columnCount; i++) {
@@ -1410,7 +1402,7 @@ public List<OdfTableColumn> insertColumnsBefore(int index, int columnCount) {
14101402
} else {
14111403
TableTableColumnElement newColumnEle =
14121404
(TableTableColumnElement) refColumn.getOdfElement().cloneNode(true);
1413-
newColumnEle.setTableNumberColumnsRepeatedAttribute(Integer.valueOf(columnCount));
1405+
newColumnEle.setTableNumberColumnsRepeatedAttribute(columnCount);
14141406
mTableElement.insertBefore(newColumnEle, positionCol.getOdfElement());
14151407

14161408
for (int i = 0; i < columnCount; i++) {
@@ -1944,7 +1936,7 @@ public void setTableName(String tableName) {
19441936
*/
19451937
public boolean isProtected() {
19461938
if (mTableElement.getTableProtectedAttribute() != null) {
1947-
return mTableElement.getTableProtectedAttribute().booleanValue();
1939+
return mTableElement.getTableProtectedAttribute();
19481940
} else {
19491941
return false;
19501942
}

odfdom/src/main/java/org/odftoolkit/odfdom/doc/table/OdfTableCell.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ private TableTableRowElement findRowInTableHeaderRows(
297297
return tr;
298298
}
299299
if (m instanceof TableTableRowElement) {
300-
result += ((TableTableRowElement) m).getTableNumberRowsRepeatedAttribute().intValue();
300+
result += ((TableTableRowElement) m).getTableNumberRowsRepeatedAttribute();
301301
}
302302
}
303303
indexs[0] = result;
@@ -313,7 +313,7 @@ private TableTableRowElement findRowInTableRows(
313313
return tr;
314314
}
315315
if (m instanceof TableTableRowElement) {
316-
result += ((TableTableRowElement) m).getTableNumberRowsRepeatedAttribute().intValue();
316+
result += ((TableTableRowElement) m).getTableNumberRowsRepeatedAttribute();
317317
}
318318
}
319319
indexs[0] = result;
@@ -360,7 +360,7 @@ private TableTableRowElement findRowInTableRowGroup(
360360
indexs[0] = result;
361361
return tr;
362362
}
363-
result += ((TableTableRowElement) m).getTableNumberRowsRepeatedAttribute().intValue();
363+
result += ((TableTableRowElement) m).getTableNumberRowsRepeatedAttribute();
364364
}
365365
}
366366
indexs[0] = result;
@@ -412,7 +412,7 @@ public int getColumnIndex() {
412412
}
413413
if (n instanceof TableTableCellElementBase) {
414414
result +=
415-
((TableTableCellElementBase) n).getTableNumberColumnsRepeatedAttribute().intValue();
415+
((TableTableCellElementBase) n).getTableNumberColumnsRepeatedAttribute();
416416
}
417417
}
418418
return result;
@@ -1089,7 +1089,7 @@ int getColumnSpannedNumber() {
10891089
}
10901090
Integer value = ((TableTableCellElement) mCellElement).getTableNumberColumnsSpannedAttribute();
10911091
if (value != null) {
1092-
return value.intValue();
1092+
return value;
10931093
}
10941094
return DEFAULT_COLUMN_SPANNED_NUMBER;
10951095
}
@@ -1102,7 +1102,7 @@ int getColumnSpannedNumber() {
11021102
int getColumnsRepeatedNumber() {
11031103
Integer value = mCellElement.getTableNumberColumnsRepeatedAttribute();
11041104
if (value != null) {
1105-
return value.intValue();
1105+
return value;
11061106
}
11071107
return DEFAULT_COLUMNS_REPEATED_NUMBER;
11081108
}
@@ -1118,7 +1118,7 @@ int getRowSpannedNumber() {
11181118
}
11191119
Integer value = ((TableTableCellElement) mCellElement).getTableNumberRowsSpannedAttribute();
11201120
if (value != null) {
1121-
return value.intValue();
1121+
return value;
11221122
}
11231123
return DEFAULT_ROW_SPANNED_NUMBER;
11241124
}
@@ -1136,7 +1136,7 @@ void setColumnSpannedNumber(int spannedNum) {
11361136
splitRepeatedCells();
11371137
if (mCellElement instanceof TableTableCellElement) {
11381138
((TableTableCellElement) mCellElement)
1139-
.setTableNumberColumnsSpannedAttribute(new Integer(spannedNum));
1139+
.setTableNumberColumnsSpannedAttribute(spannedNum);
11401140
} else {
11411141
throw new IllegalArgumentException();
11421142
}
@@ -1152,7 +1152,7 @@ void setColumnsRepeatedNumber(int repeatedNum) {
11521152
if (repeatedNum < 1) {
11531153
repeatedNum = DEFAULT_COLUMNS_REPEATED_NUMBER;
11541154
}
1155-
mCellElement.setTableNumberColumnsRepeatedAttribute(new Integer(repeatedNum));
1155+
mCellElement.setTableNumberColumnsRepeatedAttribute(repeatedNum);
11561156
}
11571157

11581158
/**
@@ -1168,7 +1168,7 @@ void setRowSpannedNumber(int spannedNum) {
11681168
splitRepeatedCells();
11691169
if (mCellElement instanceof TableTableCellElement) {
11701170
((TableTableCellElement) mCellElement)
1171-
.setTableNumberRowsSpannedAttribute(new Integer(spannedNum));
1171+
.setTableNumberRowsSpannedAttribute(spannedNum);
11721172
} else {
11731173
throw new IllegalArgumentException();
11741174
}
@@ -1283,7 +1283,7 @@ public void setCurrencyFormat(String currencySymbol, String format) {
12831283

12841284
// set display text
12851285
if (value != null) {
1286-
setDisplayText(formatCurrency(currencyStyle, value.doubleValue()));
1286+
setDisplayText(formatCurrency(currencyStyle, value));
12871287
}
12881288
}
12891289

0 commit comments

Comments
 (0)