-
Notifications
You must be signed in to change notification settings - Fork 821
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
Cannot decode base64 with java.util.base64. Removing org.postgresql.util.Base64 has a side effect #2447
Comments
seems to be related to 1994 |
What's the base64 text of the data? |
here is the String from the query |
Does that have a newline break in it? |
you must execute create extension postgis before restoring the dump |
And previously you were using the Specifically, I'm asking if this is happening within the driver's internal code or in your own code that is using that class. When that class was removed it was assumed that it was only to be used internally by the driver. It wasn't considered part of the public interface of the driver. |
here the test code complete
|
it seems that the string in PGAdmin is decodable, but it is not i read the result as byte array, it works properly with the org.postgresql.util.Base64 implementation. |
In fact a fast way to read postgis geometries is to encode geometries
encode(ST_AsEWKB(geom), 'base64')
The org.postgresql.util.Base64 decode well my data but not java.util.Base64
It seems that the encode method in PG does not do a correct job, and that the org.postgresql.util.Base64 treat and corrects effectively the error
I put a dump in the ticket to go further
Regards
De : Sehrope Sarkuni ***@***.***>
Envoyé : mercredi 9 février 2022 17:23
À : pgjdbc/pgjdbc ***@***.***>
Cc : Luc CHEVALLIER ***@***.***>; Author ***@***.***>
Objet : [/!\ SPAM suspecté ] Re: [pgjdbc/pgjdbc] Cannot decode base64 with java.util.base64. Removing org.postgresql.util.Base64 has a side effect (Issue #2447)
And previously you were using the org.postgresql.util.Base64 class to decode that data in your application code?
Specifically, I'm asking if this is happening within the driver's internal code or in your own code that is using that class.
When that class was removed it was assumed that it was only to be used internally by the driver. It wasn't considered part of the public interface of the driver.
—
Reply to this email directly, view it on GitHub<#2447 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AVXU7LBZ3GB4PTS23V4C3DTU2KIG3ANCNFSM5N5Y347A>.
Triage notifications on the go with GitHub Mobile for iOS<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675> or Android<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you authored the thread.Message ID: ***@***.******@***.***>>
|
I haven't looked at this, but Base64 has 3 types of encoding schemes. Have you tried if using |
Well Done ! |
I think we should resurrect |
Are we going to consider everything in |
Are there reasons to remove public classes/interfaces without going through the deprecation cycle? |
If they're not part of the public API then I see no reason to maintain them as deprecated. The class being "public" is a Java limitation to allow it to be used across package boundaries within the library. Nothing in that If the class was still in the tree and we hadn't published a version without it, then I'd probably be neutral on deprecating it first if it doesn't cause any maintenance headache (e.g. in this case it's entirely self contained class). But in this specific case we already removed it so the bar is higher to add it back. |
Please read https://stackoverflow.com/help/minimal-reproducible-example
Description
As org.postgresql.util.Base64 has been removed from the driver, it is impossible to read postgresql encoded base64 data in java
Driver Version?
42.3.2
Java Version?
Java 8
OS Version?
Windows
PostgreSQL Version?
11
the embbeded version of decoder can read this byte array without problem, but the java.utils.base64 cannot :
Logs
java.lang.IllegalArgumentException: Illegal base64 character a
at java.util.Base64$Decoder.decode0(Base64.java:714)
at java.util.Base64$Decoder.decode(Base64.java:526)
Using the following template code make sure the bug can be replicated in the driver alone.
The text was updated successfully, but these errors were encountered: