Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#156: Throw Exception if PdfWriter.close() is called directly #1081

Conversation

asturio
Copy link
Member

@asturio asturio commented Feb 23, 2024

  • Throw an IllegalStateException if PdfWriter.close() is called before Document.close() is called.
  • Delete old *.lng files in src/main/java
  • Update *.lng files in src/main/resources
  • BoyScout rule in PdfWriter

Description of the new Feature

Calling PdfWriter.close() is actually not needed. An Exception will be thrown if this is done before Document.close() is called.
Calling PdfWriter.close() afterwards should be harmless.

Related Issue: #156

Unit-Tests for the new Feature

  • Unit-Tests added to the added feature

Compatibilities Issues

As PdfWriter.close() before Document.close() will produce incomplete PDFs, throwing an Exception will just be good for existing Wrong code.

- Throw an IllegalStateException if PdfWriter.close() is called before
  Document.close() is called.
- Delete old *.lng files in src/main/java
- Update *.lng files in src/main/resources
- BoyScout rule in PdfWriter
Copy link

codacy-production bot commented Feb 23, 2024

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
+1.31%
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (340661b) 50474 10240 20.29%
Head commit (a530578) 47280 (-3194) 10210 (-30) 21.59% (+1.31%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#1081) 0 0 ∅ (not applicable)

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences

You may notice some variations in coverage metrics with the latest Coverage engine update. For more details, visit the documentation

@asturio
Copy link
Member Author

asturio commented Feb 23, 2024

@andreasrosdal maybe you want to take a look?

Copy link

Quality Gate Passed Quality Gate passed

Issues
0 New issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

@asturio asturio added this to the 2.0.1 milestone Feb 23, 2024
@asturio asturio merged commit 6c675f7 into master Feb 26, 2024
10 checks passed
@asturio asturio deleted the feature/156-exception-if-pdfwriter.close-called-before-document.close branch February 26, 2024 11:05
asturio added a commit that referenced this pull request Feb 26, 2024
* #156: Throw Exception if PdfWriter.close() is called directly

- Throw an IllegalStateException if PdfWriter.close() is called before
  Document.close() is called.
- Delete old *.lng files in src/main/java
- Update *.lng files in src/main/resources
- BoyScout rule in PdfWriter

* #156: Throw Exception if PdfWriter.close() is called directly

- Codacy Issues

(cherry picked from commit 6c675f7)
asturio added a commit that referenced this pull request Feb 26, 2024
* #156: Throw Exception if PdfWriter.close() is called directly

- Throw an IllegalStateException if PdfWriter.close() is called before
  Document.close() is called.
- Delete old *.lng files in src/main/java
- Update *.lng files in src/main/resources
- BoyScout rule in PdfWriter

* #156: Throw Exception if PdfWriter.close() is called directly

- Codacy Issues

(cherry picked from commit 6c675f7)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

invalid pdf generation (can only be opened with some PDF renders)
1 participant