thuri · GitHub

@thuri

@thuri thuri commented

Dec 20, 2022

edited

Loading

Copy link Copy Markdown

Contributor

@thuri thuri changed the title normalization should not change KeyDataPair to NameValuePair Fixes #532 normalization should not change KeyDataPair to NameValuePair

Dec 20, 2022

rbri

@rbri rbri left a comment

Copy link Copy Markdown

Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks reasonable for me, thanks for this.
Please add yourself as author to all changed files and maybe also to the pom (if you are not already in the list)

@thuri

@rbri

Copy link Copy Markdown

Member

Jenkins will have a look at this....

@rbri

Copy link Copy Markdown

Member

sorry we are still at java8 :-)

/var/lib/jenkins/workspace/htmlunit_PR-533/src/test/java/com/gargoylesoftware/htmlunit/WebRequestTest.java:[437,42] cannot find symbol
symbol:   method of(com.gargoylesoftware.htmlunit.util.NameValuePair,com.gargoylesoftware.htmlunit.util.KeyDataPair)
location: interface java.util.List

@thuri

@thuri

@thuri

Copy link Copy Markdown

Contributor Author

Yeah I've seen that but somehow eclipse didn't warn me when i used Java 11 features.
I corrected the problematic part. At least I hope so

rbri

public KeyDataPair normalized() {
final KeyDataPair pair = new KeyDataPair(
this.getName(),
this.fileObject_ != null ? this.fileObject_ : new File(this.getValue()),

Copy link Copy Markdown

Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new File(...) might do some normalization on the file name leading in the end to some new value -> Testcase?
maybe it is better to have a private constructor that allows to pass the values 1:1?

What do you think?

@rbri

Copy link Copy Markdown

Member

tests are looking good !

this should prevent manipulation of fields and make sure that
"normalized" instances are identical copies if the source object is
normalized already

@thuri

Copy link Copy Markdown

Contributor Author

@rbri please have a look at the additional commit. Perhaps that is what you had in mind ...

@rbri

@rbri

Copy link Copy Markdown

Member

i have nothing in mind ;-)
thanks a lot - will inform when the new snapshot is availble

and all the best for 2023

@thuri

Copy link Copy Markdown

Contributor Author

Thanks a lot and the all the best for you too.

Read the original on github.com ↗