Skip to content

Commit

Permalink
Remove pdfdata since it's long and useless and we also attach it to t…
Browse files Browse the repository at this point in the history
…he PO record

#5637
  • Loading branch information
TheBestPessimist committed Nov 25, 2019
1 parent c4760d0 commit b391dd8
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
Expand Up @@ -35,6 +35,12 @@
@Builder
public class DhlClientLogEvent
{
/**
* Regexp explanation: .*? means ungreedy (while .* means greedy).
*/
public static final String LABEL_DATA_REGEX = "(?m)<labelData>(.*?\\s*?)</labelData>";
public static final String LABEL_DATA_REPLACEMENT_TEXT = "<labelData>PDF TEXT REMOVED!</labelData>";

int deliveryOrderRepoId;
DhlClientConfig config;
Marshaller marshaller;
Expand Down Expand Up @@ -77,7 +83,9 @@ private String elementToString(@Nullable final Object element)
{
final StringResult result = new StringResult();
marshaller.marshal(element, result);
return result.toString();

// remove the pdfdata since it's long and useless and we also attach it to the PO record
return result.toString().replaceAll(LABEL_DATA_REGEX, LABEL_DATA_REPLACEMENT_TEXT);
}
catch (final Exception ex)
{
Expand Down
Expand Up @@ -35,6 +35,12 @@
@Builder
public class DpdClientLogEvent
{
/**
* Regexp explanation: .*? means ungreedy (while .* means greedy).
*/
public static final String PARCELLABELS_PDF_REGEX = "(?m)<parcellabelsPDF>(.*?\\s*?)</parcellabelsPDF>";
public static final String PARCELLABELS_PDF_REPLACEMENT_TEXT = "<parcellabelsPDF>PDF TEXT REMOVED!</parcellabelsPDF>";

int deliveryOrderRepoId;
DpdClientConfig config;
Marshaller marshaller;
Expand Down Expand Up @@ -77,7 +83,10 @@ private String elementToString(@Nullable final Object element)
{
final StringResult result = new StringResult();
marshaller.marshal(element, result);
return result.toString();

// remove the pdfdata since it's long and useless and we also attach it to the PO record
final String s = result.toString();
return s.replaceAll(PARCELLABELS_PDF_REGEX, PARCELLABELS_PDF_REPLACEMENT_TEXT);
}
catch (final Exception ex)
{
Expand Down

0 comments on commit b391dd8

Please sign in to comment.