Hi Roar,
thanks for the feedback. Based on my experience in GeoServer maintenance,
the block that should be removed is
the one in the catch block, and a solid exception should be re-thrown
instead. And then eventually fix whatever is making
serialization utils fail, since CatalogInfo objects are supposed to be
Serializable.

Why is that? Because GeoServer has grown very large, and has too many code
paths for people to remember.
When people add new properties to WMTSStoreInfo, will they remember to
update the cloning code you linked to?
Very unlikely I'm afraid, their objective and attention is somewhere else.

Now, one might suggest having a clone method in WMTSStoreInfo. That is just
slightly better, because CatalogInfo objects
today do not have a common cloning ability, it would be surprising to find
it only in one place.... it would have to be
implemented in all CatalogInfo to be something that devs remember about.

The funny thing is that GeoServer already has a generic ability to clone
every single attribute of a CatalogInfo as part
of the ModificationProxy machinery, the class is called
ModificationProxyCloner. But it's not public.
It would also be faster than SerializationUtils.

Long story short, if you want to make code changes, please try to go in the
direction of making the blocks as much
independent from each other as possible, as even the most experienced
GeoServer dev, nowadays, has only a vague notion
of how a code change in a given point might have repercussions (or required
subsequent code changes) in other parts.

Best regards
Andrea


On Wed, Feb 10, 2021 at 10:06 AM Roar Brænden <[email protected]>
wrote:

> Hi,
>
> There seems to be a problem with the headerName / headerValue fields of a
> WMTStoreInfo object within Geoserver. I've looked through the Geotools
> side, and it doesn't look like the problem is on that side.
>
> Looking at the code underneath ResourcePool.clone(WMTSStoreInfo) I see
> some weaknesses:
>
> https://github.com/geoserver/geoserver/blob/4d664c27a1d8617e1cab7e9560bb855a2eb742c9/src/main/src/main/java/org/geoserver/catalog/ResourcePool.java#L2802
>
> In the javadocs for SerializationUtils.clone it says:
> This is many times slower than writing clone methods by hand
> on all objects in your object graph. However, for complex object
> graphs, or for those that don't support deep cloning this can
> be a simple alternative implementation.
>
> Within the catch clause it seems like we're doing exactly that. Cloning
> the object by code, so why using SerializationUtils? What's missing is the
> headerName / headerValue, both within the catch block and the code
> thereafter. It would also be great to have a log-message saying that the
> SerializationUtils failed, and of what grounds.
>
> I'm not totally sure this is the cause of the bug in Paul Wittle's
> original question, but it seems like a potential stumbling block.
>
> Best regards,
>
> Roar Brænden
>
> 5. feb. 2021 kl. 18:30 skrev Paul Wittle <[email protected]
> >:
>
> Hi,
>
> Thanks for getting back to me but yes it was the “HTTP header name”/ “HTTP
> header value” options.
>
> Thanks,
> Paul
>
> *From:* Roar Brænden <[email protected]>
> *Sent:* 04 February 2021 22:21
> *To:* Paul Wittle <[email protected]>
> *Cc:* [email protected]
> *Subject:* Re: [Geoserver-users] WMTS Cascade
>
> Hi,
>
> What version are you on? It could certainly be a bug you spotted there.
>
> By "I use the HTTP header options" do you mean the Username / password
> fields, or the "HTTP header name" / "HTTP header value"?
>
> Regards,
>
> Roar Brænden
>
>
> 4. feb. 2021 kl. 17:09 skrev Paul Wittle <[email protected]
> >:
>
> Hi,
>
> When trying to connect to a WMTS service using the cascade option I can
> access the remote service if I put the authentication token into the URL
> but it doesn’t work if I use the HTTP header options. However if you put it
> into the URL it then doesn’t seem to be in the request URL’s when you try
> to actually access the layer via GeoServer.
>
> I set my logging to GEOTOOLS and found the request URL’s but the
> authentication token is missing.  Is that a bug or am I doing something
> wrong?
>
> Cheers,
> Paul
> This e-mail and any files transmitted with it are intended solely for the
> use of the individual or entity to whom they are addressed. It may contain
> unclassified but sensitive or protectively marked material and should be
> handled accordingly. Unless you are the named addressee (or authorised to
> receive it for the addressee) you may not copy or use it, or disclose it to
> anyone else. If you have received this transmission in error please notify
> the sender immediately. All traffic may be subject to recording and/or
> monitoring in accordance with relevant legislation. Any views expressed in
> this message are those of the individual sender, except where the sender
> specifies and with authority, states them to be the views of Dorset
> Council. Dorset Council does not accept service of documents by fax or
> other electronic means. Virus checking: Whilst all reasonable steps have
> been taken to ensure that this electronic communication and its attachments
> whether encoded, encrypted or otherwise supplied are free from computer
> viruses, Dorset Council accepts no liability in respect of any loss, cost,
> damage or expense suffered as a result of accessing this message or any of
> its attachments. For information on how Dorset Council processes your
> information, please see www.dorsetcouncil.gov.uk/416433
> _______________________________________________
> Geoserver-users mailing list
>
> Please make sure you read the following two resources before posting to
> this list:
> - Earning your support instead of buying it, but Ian Turton:
> http://www.ianturton.com/talks/foss4g.html#/
> - The GeoServer user list posting guidelines:
> http://geoserver.org/comm/userlist-guidelines.html
>
> If you want to request a feature or an improvement, also see this:
> https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer
>
>
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/geoserver-users
>
>
> This e-mail and any files transmitted with it are intended solely for the
> use of the individual or entity to whom they are addressed. It may contain
> unclassified but sensitive or protectively marked material and should be
> handled accordingly. Unless you are the named addressee (or authorised to
> receive it for the addressee) you may not copy or use it, or disclose it to
> anyone else. If you have received this transmission in error please notify
> the sender immediately. All traffic may be subject to recording and/or
> monitoring in accordance with relevant legislation. Any views expressed in
> this message are those of the individual sender, except where the sender
> specifies and with authority, states them to be the views of Dorset
> Council. Dorset Council does not accept service of documents by fax or
> other electronic means. Virus checking: Whilst all reasonable steps have
> been taken to ensure that this electronic communication and its attachments
> whether encoded, encrypted or otherwise supplied are free from computer
> viruses, Dorset Council accepts no liability in respect of any loss, cost,
> damage or expense suffered as a result of accessing this message or any of
> its attachments. For information on how Dorset Council processes your
> information, please see www.dorsetcouncil.gov.uk/416433
>
>
> _______________________________________________
> Geoserver-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/geoserver-devel
>


-- 

Regards, Andrea Aime

== GeoServer Professional Services from the experts! Visit
http://goo.gl/it488V for more information. == Ing. Andrea Aime @geowolf
Technical Lead GeoSolutions S.A.S. Via di Montramito 3/A 55054 Massarosa
(LU) phone: +39 0584 962313 fax: +39 0584 1660272 mob: +39 339 8844549
http://www.geo-solutions.it http://twitter.com/geosolutions_it
------------------------------------------------------- *Con riferimento
alla normativa sul trattamento dei dati personali (Reg. UE 2016/679 -
Regolamento generale sulla protezione dei dati “GDPR”), si precisa che ogni
circostanza inerente alla presente email (il suo contenuto, gli eventuali
allegati, etc.) è un dato la cui conoscenza è riservata al/i solo/i
destinatario/i indicati dallo scrivente. Se il messaggio Le è giunto per
errore, è tenuta/o a cancellarlo, ogni altra operazione è illecita. Le
sarei comunque grato se potesse darmene notizia. This email is intended
only for the person or entity to which it is addressed and may contain
information that is privileged, confidential or otherwise protected from
disclosure. We remind that - as provided by European Regulation 2016/679
“GDPR” - copying, dissemination or use of this e-mail or the information
herein by anyone other than the intended recipient is prohibited. If you
have received this email by mistake, please notify us immediately by
telephone or e-mail.*
_______________________________________________
Geoserver-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

Reply via email to