Skip to content

Commit b7cab51

Browse files
Eugene Bochiloyulian-gaponenko
authored andcommitted
Fix sonarqube issues for new_lcns_base branch
DEVSIX-5570
1 parent bccd3a5 commit b7cab51

16 files changed

+42
-27
lines changed

src/main/java/com/itextpdf/html2pdf/actions/data/PdfHtmlProductData.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ This file is part of the iText (R) project.
2828
/**
2929
* Stores an instance of {@link ProductData} related to iText pdfHTML module.
3030
*/
31-
public class PdfHtmlProductData {
31+
public final class PdfHtmlProductData {
3232
private static final String PDF_HTML_PUBLIC_PRODUCT_NAME = "pdfHTML";
3333
private static final String PDF_HTML_VERSION = "4.0.0-SNAPSHOT";
3434
private static final int PDF_HTML_COPYRIGHT_SINCE = 2000;
@@ -37,6 +37,10 @@ public class PdfHtmlProductData {
3737
private static final ProductData PDF_HTML_PRODUCT_DATA = new ProductData(PDF_HTML_PUBLIC_PRODUCT_NAME,
3838
ProductNameConstant.PDF_HTML, PDF_HTML_VERSION, PDF_HTML_COPYRIGHT_SINCE, PDF_HTML_COPYRIGHT_TO);
3939

40+
private PdfHtmlProductData() {
41+
// Empty constructor.
42+
}
43+
4044
/**
4145
* Getter for an instance of {@link ProductData} related to iText pdfHTML module.
4246
*

src/main/java/com/itextpdf/html2pdf/actions/events/PdfHtmlProductEvent.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ This file is part of the iText (R) project.
3131
/**
3232
* Class represents events registered in iText pdfHTML module.
3333
*/
34-
public class PdfHtmlProductEvent extends AbstractProductProcessITextEvent {
34+
public final class PdfHtmlProductEvent extends AbstractProductProcessITextEvent {
3535
/**
3636
* Convert html event type.
3737
*/

src/main/java/com/itextpdf/html2pdf/attach/ProcessorContext.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ public class ProcessorContext {
126126

127127
/**
128128
* Indicates whether the document should be opened in immediate flush or not
129-
**/
129+
*/
130130
private boolean immediateFlush;
131131

132132
// Variable fields
@@ -464,8 +464,8 @@ public boolean isImmediateFlush() {
464464

465465
/**
466466
* Gets html meta info container.
467-
* <p>
468-
* Meta info will be used to determine event origin.
467+
*
468+
* <p>Meta info will be used to determine event origin.
469469
*
470470
* @return html meta info container
471471
*/
@@ -484,6 +484,7 @@ public void setMetaInfo(IMetaInfo metaInfo) {
484484

485485
/**
486486
* Check if the processor is currently processing an inline svg
487+
*
487488
* @return True if the processor is processing an inline Svg, false otherwise.
488489
*/
489490
public boolean isProcessingInlineSvg() {

src/main/java/com/itextpdf/html2pdf/attach/impl/DefaultHtmlProcessor.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -241,8 +241,8 @@ public List<com.itextpdf.layout.element.IElement> processElements(INode root) {
241241
*/
242242
@Override
243243
public Document processDocument(INode root, PdfDocument pdfDocument) {
244-
EventManager.getInstance().onEvent(PdfHtmlProductEvent.createConvertHtmlEvent(pdfDocument.getDocumentIdWrapper(),
245-
context.getMetaInfoContainer().getMetaInfo()));
244+
EventManager.getInstance().onEvent(PdfHtmlProductEvent.createConvertHtmlEvent(
245+
pdfDocument.getDocumentIdWrapper(), context.getMetaInfoContainer().getMetaInfo()));
246246

247247
context.reset(pdfDocument);
248248
if (!context.hasFonts()) {
@@ -269,8 +269,8 @@ public Document processDocument(INode root, PdfDocument pdfDocument) {
269269
++counter;
270270
doc.relayout();
271271
if (counter >= context.getLimitOfLayouts()) {
272-
logger.warn(
273-
MessageFormatUtil.format(Html2PdfLogMessageConstant.EXCEEDED_THE_MAXIMUM_NUMBER_OF_RELAYOUTS));
272+
logger.warn(MessageFormatUtil.format(
273+
Html2PdfLogMessageConstant.EXCEEDED_THE_MAXIMUM_NUMBER_OF_RELAYOUTS));
274274
break;
275275
}
276276
} while (((DocumentRenderer) doc.getRenderer()).isRelayoutRequired());
@@ -330,8 +330,10 @@ private void visit(INode node) {
330330
} else {
331331
context.getState().push(tagWorker);
332332
}
333-
if (context.getState().getStack().size() == 1 && tagWorker != null && tagWorker.getElementResult() != null) {
334-
tagWorker.getElementResult().setProperty(Property.META_INFO, new MetaInfoContainer(context.getMetaInfoContainer().getMetaInfo()));
333+
if (context.getState().getStack().size() == 1 &&
334+
tagWorker != null && tagWorker.getElementResult() != null) {
335+
tagWorker.getElementResult().setProperty(
336+
Property.META_INFO, new MetaInfoContainer(context.getMetaInfoContainer().getMetaInfo()));
335337
}
336338
if (tagWorker instanceof HtmlTagWorker) {
337339
((HtmlTagWorker) tagWorker).processPageRules(node, cssResolver, context);

src/main/java/com/itextpdf/html2pdf/attach/impl/DefaultTagWorkerFactory.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public class DefaultTagWorkerFactory implements ITagWorkerFactory {
6161
private static final ITagWorkerFactory INSTANCE = new DefaultTagWorkerFactory();
6262

6363
/** The default mapping. */
64-
TagProcessorMapping defaultMapping;
64+
private final TagProcessorMapping defaultMapping;
6565

6666
/**
6767
* Instantiates a new default tag worker factory.
@@ -105,6 +105,10 @@ public final ITagWorker getTagWorker(IElementNode tag, ProcessorContext context)
105105
return tagWorker;
106106
}
107107

108+
TagProcessorMapping getDefaultMapping() {
109+
return defaultMapping;
110+
}
111+
108112
/**
109113
* Gets the tag worker class for a specific element node.
110114
*

src/main/java/com/itextpdf/html2pdf/attach/impl/HtmlMetaInfoContainer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public HtmlMetaInfoContainer(IMetaInfo metaInfo) {
4141
}
4242

4343
/**
44-
* Return the IMetaInfo object
44+
* Return the IMetaInfo object.
4545
*
4646
* @return returns IMetaInfo
4747
*/

src/main/java/com/itextpdf/html2pdf/attach/impl/layout/PageTargetCountRenderer.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,8 @@ public LayoutResult layout(LayoutContext layoutContext) {
9393
@Override
9494
public void draw(DrawContext drawContext) {
9595
if (!TargetCounterHandler.isValueDefinedForThisId(this, target)) {
96-
LOGGER.warn(MessageFormatUtil.format(Html2PdfLogMessageConstant.CANNOT_RESOLVE_TARGET_COUNTER_VALUE, target));
96+
LOGGER.warn(MessageFormatUtil.format(
97+
Html2PdfLogMessageConstant.CANNOT_RESOLVE_TARGET_COUNTER_VALUE, target));
9798
}
9899
super.draw(drawContext);
99100
}

src/main/java/com/itextpdf/html2pdf/css/apply/impl/DefaultCssApplierFactory.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public class DefaultCssApplierFactory implements ICssApplierFactory {
5757
private static final ICssApplierFactory INSTANCE = new DefaultCssApplierFactory();
5858

5959
/** The default mapping of CSS keywords and CSS appliers. */
60-
TagProcessorMapping defaultMapping;
60+
private final TagProcessorMapping defaultMapping;
6161

6262
/**
6363
* Creates a new {@link DefaultCssApplierFactory} instance.
@@ -108,6 +108,10 @@ public ICssApplier getCustomCssApplier(IElementNode tag) {
108108
return null;
109109
}
110110

111+
TagProcessorMapping getDefaultMapping() {
112+
return defaultMapping;
113+
}
114+
111115
/**
112116
* Gets the css applier class.
113117
*

src/main/java/com/itextpdf/html2pdf/css/apply/util/CounterProcessorUtil.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ This file is part of the iText (R) project.
4747
import com.itextpdf.html2pdf.css.resolve.func.counter.CssCounterManager;
4848
import com.itextpdf.styledxmlparser.css.util.CssDimensionParsingUtils;
4949
import com.itextpdf.styledxmlparser.node.IElementNode;
50-
import com.itextpdf.styledxmlparser.node.INode;
5150

5251
import java.util.Map;
5352

src/main/java/com/itextpdf/html2pdf/css/apply/util/FontStyleApplierUtil.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,15 +242,16 @@ public static void applyFontStyles(Map<String, String> cssProps, ProcessorContex
242242
element.setProperty(Property.UNDERLINE, underlineList);
243243
}
244244

245-
String textIndent = cssProps.get(CssConstants.TEXT_INDENT);
245+
String textIndent = cssProps.get(CommonCssConstants.TEXT_INDENT);
246246
if (textIndent != null) {
247247
UnitValue textIndentValue = CssDimensionParsingUtils.parseLengthValueToPt(textIndent, em, rem);
248248
if (textIndentValue != null) {
249249
if (textIndentValue.isPointValue()) {
250250
element.setProperty(Property.FIRST_LINE_INDENT, textIndentValue.getValue());
251251
} else {
252252
logger.error(MessageFormatUtil.format(
253-
Html2PdfLogMessageConstant.CSS_PROPERTY_IN_PERCENTS_NOT_SUPPORTED, CssConstants.TEXT_INDENT));
253+
Html2PdfLogMessageConstant.CSS_PROPERTY_IN_PERCENTS_NOT_SUPPORTED,
254+
CommonCssConstants.TEXT_INDENT));
254255
}
255256
}
256257
}

0 commit comments

Comments
 (0)