Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/test-gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ name: Java CI with Gradle

on:
push:
branches: [ trunk ]
branches: [ trunk, 5.5.x ]
pull_request:
branches: [ trunk ]
branches: [ trunk, 5.5.x ]

permissions: {}

Expand Down
12 changes: 6 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ allprojects {
// apply plugin: 'eclipse'
apply plugin: 'idea'

version = '5.5.0'
version = '5.5.1'
}

/**
Expand All @@ -107,10 +107,10 @@ subprojects {
apply plugin: 'com.adarshr.test-logger'

ext {
bouncyCastleVersion = '1.82'
commonsCodecVersion = '1.19.0'
bouncyCastleVersion = '1.83'
commonsCodecVersion = '1.20.0'
commonsCompressVersion = '1.28.0'
commonsIoVersion = '2.20.0'
commonsIoVersion = '2.21.0'
commonsMathVersion = '3.6.1'
junitVersion = '5.13.4'
log4jVersion = '2.24.3'
Expand All @@ -119,7 +119,7 @@ subprojects {
xmlbeansVersion = '5.3.0'
batikVersion = '1.19'
graphics2dVersion = '3.0.5'
pdfboxVersion = '3.0.5'
pdfboxVersion = '3.0.6'
saxonVersion = '12.9'
xmlSecVersion = '3.0.6'
apiGuardianVersion = '1.1.2'
Expand All @@ -132,7 +132,7 @@ subprojects {
JAVA9_OUT = layout.buildDirectory.dir('classes/java9/main/').get().asFile.absolutePath
TEST9_SRC = 'src/test/java9'
TEST9_OUT = layout.buildDirectory.dir('classes/java9/test/').get().asFile.absolutePath
VERSIONS9 = 'META-INF/versions/9'
VERSIONS9 = '/META-INF/versions/9'

NO_SCRATCHPAD = (findProperty("scratchpad.ignore") == "true")
SAXON_TEST = (findProperty("saxon.test") == "true")
Expand Down
2 changes: 1 addition & 1 deletion build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ under the License.

<description>The Apache POI project Ant build.</description>

<property name="version.id" value="5.5.0"/>
<property name="version.id" value="5.5.1"/>
<property name="release.rc" value=""/>

<property environment="env"/>
Expand Down
17 changes: 17 additions & 0 deletions jenkins/create_jobs.groovy
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */

// This script is used as input to the Jenkins Job DSL plugin to create all the build-jobs that
// Apache POI uses on the public Jenkins instance at https://ci-builds.apache.org/job/POI/
//
Expand Down
4 changes: 2 additions & 2 deletions osgi/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@
<groupId>org.apache.poi</groupId>
<artifactId>poi-bundle</artifactId>
<packaging>bundle</packaging>
<version>5.5.0</version>
<version>5.5.1</version>

<name>Apache POI OSGi bundle</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<poi.version>5.5.0</poi.version>
<poi.version>5.5.1</poi.version>
<pax.exam.version>4.14.0</pax.exam.version>
</properties>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public void setCollapsed(Boolean collapsed) {
* Use this to create new cells within the row and return it.
* <p>
* The cell that is returned is a {@link CellType#BLANK}. The type can be changed
* either through calling {@code setCellValue} or {@code setCellType}.
* either through calling {@code setCellValue} or {@code setCellFormula}.
*
* @param column - the column number this cell represents (zero-based)
* @return Cell a high level representation of the created cell.
Expand All @@ -128,7 +128,7 @@ public SXSSFCell createCell(int column)
* Use this to create new cells within the row and return it.
* <p>
* The cell that is returned is a {@link CellType#BLANK}. The type can be changed
* either through calling setCellValue or setCellType.
* either through calling setCellValue or setCellFormula.
*
* @param column - the column number this cell represents (zero-based)
* @return Cell a high level representation of the created cell.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ public int hashCode() {
* Use this to create new cells within the row and return it.
* <p>
* The cell that is returned is a {@link CellType#BLANK}. The type can be changed
* either through calling {@code setCellValue} or {@code setCellType}.
* either through calling {@code setCellValue} or {@code setCellFormula}.
* </p>
* @param columnIndex - the column number this cell represents
* @return Cell a high level representation of the created cell.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1144,8 +1144,8 @@ public boolean removeBodyElement(int pos) {
* copies content of a paragraph to an existing paragraph in the list paragraphs at position pos
*/
public void setParagraph(XWPFParagraph paragraph, int pos) {
paragraphs.set(pos, paragraph);
ctDocument.getBody().setPArray(pos, paragraph.getCTP());
paragraphs.set(pos, (XWPFParagraph) bodyElements.get(pos));
/* TODO update body element, update xwpf element, verify that
* incoming paragraph belongs to this document or if not, XML was
* copied properly (namespace-abbreviations, etc.)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1457,6 +1457,9 @@ private CTPBdr getCTPBrd(boolean create) {
*/
private CTSpacing getCTSpacing(boolean create) {
CTPPr pr = getCTPPr(create);
if (pr == null) {
return null;
}
CTSpacing ct = pr.getSpacing();
if (create && ct == null) {
ct = pr.addNewSpacing();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ void setup() throws IOException {
final XSSFRow row = sheet.createRow(nRow);
for (int nCol = 0; nCol < numCols; ++nCol) {
final XSSFCell cell = row.createCell(nCol);
cell.setCellType(CellType.STRING);
cell.setCellValue(String.format(Locale.US, "Row %d col %d", nRow, nCol));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -921,6 +921,50 @@ void testSearchText() throws Exception {
}
}

@Test
void testGettersWithEmptyParagraphProperties() throws IOException {
try (XWPFDocument doc = XWPFTestDataSamples.openSampleDocument("emptyPPr.docx")) {
XWPFParagraph p = doc.getParagraphArray(0);

assertNull(p.getNumID());
assertNull(p.getNumIlvl());
assertNull(p.getNumFmt());
assertNull(p.getNumLevelText());
assertNull(p.getNumStartOverride());
assertFalse(p.isKeepNext());

assertFalse(p.isAlignmentSet());
assertEquals(ParagraphAlignment.LEFT, p.getAlignment());
assertEquals(TextAlignment.AUTO, p.getVerticalAlignment());

assertEquals(Borders.NONE, p.getBorderTop());
assertEquals(Borders.NONE, p.getBorderBottom());
assertEquals(Borders.NONE, p.getBorderLeft());
assertEquals(Borders.NONE, p.getBorderRight());
assertEquals(Borders.NONE, p.getBorderBetween());

assertEquals(-1, p.getSpacingAfter());
assertEquals(-1, p.getSpacingAfterLines());
assertEquals(-1, p.getSpacingBefore());
assertEquals(-1, p.getSpacingBeforeLines());
assertEquals(-1, p.getSpacingBetween());
assertEquals(LineSpacingRule.AUTO, p.getSpacingLineRule());

assertEquals(-1, p.getIndentationLeft());
assertEquals(-1, p.getIndentationLeftChars());
assertEquals(-1, p.getIndentationRight());
assertEquals(-1, p.getIndentationRightChars());
assertEquals(-1, p.getIndentationHanging());
assertEquals(-1, p.getIndentationFirstLine());

assertFalse(p.isPageBreak());
assertFalse(p.isWordWrapped());

assertNull(p.getStyleID());
assertNull(p.getStyle());
}
}

private static void checkSearchText(XWPFParagraph paragraph, String search, int beginRun, int endRun, int beginText, int endText,
int beginChar, int endChar) {
TextSegment result = paragraph.searchText(search, new PositionInParagraph());
Expand Down
6 changes: 3 additions & 3 deletions poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFRow.java
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public final class HSSFRow implements Row, Comparable<HSSFRow> {
* Use this to create new cells within the row and return it.
* <p>
* The cell that is returned is a {@link CellType#BLANK}. The type can be changed
* either through calling <code>setCellValue</code> or <code>setCellType</code>.
* either through calling <code>setCellValue</code> or <code>setCellFormula</code>.
*
* @param column - the column number this cell represents
*
Expand All @@ -125,15 +125,15 @@ public final class HSSFRow implements Row, Comparable<HSSFRow> {
@Override
public HSSFCell createCell(int column)
{
return this.createCell(column,CellType.BLANK);
return this.createCell(column, CellType.BLANK);
}

/**
* Use this to create new cells within the row and return it.
* <p>
* The cell that is returned will be of the requested type.
* The type can be changed either through calling setCellValue
* or setCellType, but there is a small overhead to doing this,
* or setCellFormula, but there is a small overhead to doing this,
* so it is best to create the required type up front.
*
* @param columnIndex - the column number this cell represents
Expand Down
30 changes: 16 additions & 14 deletions poi/src/main/java/org/apache/poi/logging/NoOpLogger.java
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
/* Copyright 2004 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */

package org.apache.poi.logging;

Expand Down
30 changes: 16 additions & 14 deletions poi/src/main/java/org/apache/poi/logging/PoiLogManager.java
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
/* Copyright 2004 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */

package org.apache.poi.logging;

Expand Down
4 changes: 2 additions & 2 deletions poi/src/main/java/org/apache/poi/ss/usermodel/Row.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public interface Row extends Iterable<Cell> {
* Use this to create new cells within the row and return it.
* <p>
* The cell that is returned is a {@link CellType#BLANK}. The type can be changed
* either through calling <code>setCellValue</code> or <code>setCellType</code>.
* either through calling <code>setCellValue</code> or <code>setCellFormula</code>.
*
* @param column - the column number this cell represents
* @return Cell a high level representation of the created cell.
Expand All @@ -44,7 +44,7 @@ public interface Row extends Iterable<Cell> {
* <p>
* The cell that is returned will be of the requested type.
* The type can be changed either through calling setCellValue
* or setCellType, but there is a small overhead to doing this,
* or setCellFormula, but there is a small overhead to doing this,
* so it is best to create of the required type up front.
*
* @param column - the column number this cell represents
Expand Down
Binary file added test-data/document/emptyPPr.docx
Binary file not shown.