mynttt / UpdateTool

A tool to update the IMDB ratings for Plex libraries that contain movies/series and use the IMDB agent to receive ratings
GNU General Public License v3.0
250 stars 12 forks source link

URLDecoder returning IllegalArgumentException - Illegal hex characters in escape (%) pattern - Error at index 1 in: "7" #65

Closed SereneScripts closed 3 years ago

SereneScripts commented 3 years ago

Issue: Since earlier this week, I am getting an IllegalArgumentException when running the tool through Terminal/CLI or through the GUI.

Environment: OS: MacOS Big Sur 11.4 Plex version: 1.23.5.4801 Java: 16 (have also tried with AdoptOpenJDK 11)

Stacktrace: [INFO ] - 2021-07-13 03:58:15 @ ImdbDockerImplementation$ImdbBatchJob.run: Job returned ERROR : URLDecoder: Illegal hex characters in escape (%) pattern - Error at index 1 in: "7" [ERROR] - 2021-07-13 03:58:15 @ ImdbDockerImplementation$ImdbBatchJob.run: IllegalArgumentException exception encountered... [ERROR] - 2021-07-13 03:58:15 @ ImdbDockerImplementation$ImdbBatchJob.run: Please contact the maintainer of the application with the stacktrace below if you think this is unwanted behavior. [ERROR] - 2021-07-13 03:58:15 @ ImdbDockerImplementation$ImdbBatchJob.run: ======================================== [ERROR] - 2021-07-13 03:58:15 @ ImdbDockerImplementation$ImdbBatchJob.run: java.lang.IllegalArgumentException: URLDecoder: Illegal hex characters in escape (%) pattern - Error at index 1 in: "7" at java.base/java.net.URLDecoder.decode(Unknown Source) at updatetool.common.ExtraData.of(ExtraData.java:99) at updatetool.imdb.ImdbTransformer.needsUpdate(ImdbTransformer.java:34) at java.base/java.util.function.Predicate.lambda$negate$1(Unknown Source) at java.base/java.util.stream.ReferencePipeline$2$1.accept(Unknown Source) at java.base/java.util.HashMap$EntrySpliterator.forEachRemaining(Unknown Source) at java.base/java.util.stream.AbstractPipeline.copyInto(Unknown Source) at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source) at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(Unknown Source) at java.base/java.util.stream.AbstractPipeline.evaluate(Unknown Source) at java.base/java.util.stream.ReferencePipeline.collect(Unknown Source) at updatetool.imdb.ImdbPipeline.transformMetadata(ImdbPipeline.java:171) at updatetool.imdb.ImdbPipeline.transformMetadata(ImdbPipeline.java:48) at updatetool.api.Pipeline.invoke(Pipeline.java:12) at updatetool.imdb.ImdbJobRunner.run(ImdbJobRunner.java:19) at updatetool.imdb.ImdbDockerImplementation$ImdbBatchJob.run(ImdbDockerImplementation.java:255) at updatetool.TaskWrapper.run(Main.java:252) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) at java.base/java.util.concurrent.FutureTask.run(Unknown Source) at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.base/java.lang.Thread.run(Unknown Source) [ERROR] - 2021-07-13 03:58:15 @ ImdbDockerImplementation$ImdbBatchJob.run: ======================================== [ERROR] - 2021-07-13 03:58:15 @ ImdbDockerImplementation$ImdbBatchJob.run: The application will terminate now.

Screen Shot 2021-07-13 at 12 03 49 AM

mynttt commented 3 years ago

Probably something really strange happening here. Could you send me your Plex Database so I can replicate this error?

mynttt commented 3 years ago

I just added a line to debug this. You don't need to send me the database. Just update to the newest version and run it. It will output the Strings causing this behavior. Post them here so I can inspect them.

SereneScripts commented 3 years ago

I just added a line to debug this. You don't need to send me the database. Just update to the newest version and run it. It will output the Strings causing this behavior. Post them here so I can inspect them.

[ERROR] - 2021-07-19 00:34:38 @ ExtraData.of: Tried to decode [KEY] := 's Judgement and Nami's Desire!!T%7oLuffy's Decision! Sanji on the Brink of Quitting!QQ6mLuffy's Back! Ivan-san Begins the Breako' [ERROR] - 2021-07-19 00:34:38 @ ExtraData.of: Tried to decode [VALUE] := '' [INFO ] - 2021-07-19 00:34:38 @ ImdbDockerImplementation$ImdbBatchJob.run: Job returned ERROR : URLDecoder: Illegal hex characters in escape (%) pattern - Error at index 1 in: "7" [ERROR] - 2021-07-19 00:34:38 @ ImdbDockerImplementation$ImdbBatchJob.run: IllegalArgumentException exception encountered... [ERROR] - 2021-07-19 00:34:38 @ ImdbDockerImplementation$ImdbBatchJob.run: Please contact the maintainer of the application with the stacktrace below if you think this is unwanted behavior. [ERROR] - 2021-07-19 00:34:38 @ ImdbDockerImplementation$ImdbBatchJob.run: ======================================== [ERROR] - 2021-07-19 00:34:38 @ ImdbDockerImplementation$ImdbBatchJob.run: java.lang.IllegalArgumentException: URLDecoder: Illegal hex characters in escape (%) pattern - Error at index 1 in: "7" at java.base/java.net.URLDecoder.decode(URLDecoder.java:232) at updatetool.common.ExtraData.of(ExtraData.java:100) at updatetool.imdb.ImdbTransformer.needsUpdate(ImdbTransformer.java:34) at java.base/java.util.function.Predicate.lambda$negate$1(Predicate.java:80) at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:176) at java.base/java.util.HashMap$EntrySpliterator.forEachRemaining(HashMap.java:1746) at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484) at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474) at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913) at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578) at updatetool.imdb.ImdbPipeline.transformMetadata(ImdbPipeline.java:171) at updatetool.imdb.ImdbPipeline.transformMetadata(ImdbPipeline.java:48) at updatetool.api.Pipeline.invoke(Pipeline.java:12) at updatetool.imdb.ImdbJobRunner.run(ImdbJobRunner.java:19) at updatetool.imdb.ImdbDockerImplementation$ImdbBatchJob.run(ImdbDockerImplementation.java:276) at updatetool.TaskWrapper.run(Main.java:252) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.lang.Thread.run(Thread.java:829) [ERROR] - 2021-07-19 00:34:38 @ ImdbDockerImplementation$ImdbBatchJob.run: ======================================== [ERROR] - 2021-07-19 00:34:38 @ ImdbDockerImplementation$ImdbBatchJob.run: The application will terminate now. UpdateTool stopped.

The error is pointing to an episode (or really multiple episodes. it looks like all of the titles are just concatenated together) of One Piece. It is matched using the TVDb agent.

SereneScripts commented 3 years ago

Had something to do with database corruption. I tried removing the show that was causing the issue and couldn't. Even after repairing the database through Plex official steps (and the output returning "OK", showing that the database was fine), I still couldn't remember the show. I reverted back to an older database (roughly 2 weeks old), deleted the show in question, ran a library refresh and then ran the update tool. Worked without issue.

You can close this issue, but I'm leaving this note here so you know.

mynttt commented 3 years ago

Thanks for your investigation! That makes sense as usually the values of the extra data field are created by Plex (which results in correct and "sane" data). Looks like the corruption messed something up and somehow sneaked some garbage data in that the url encoding library did not understand.

Glad it resolved itself!

austinarchibald commented 3 years ago

Update: Followed these instructions to repair database, and it is now working!

I'm now seeing this issue. I tried reverting to an old database, it seemed to work, but then stops working again (I believe once it loads in new content). I don't want to remove any files in question (although I could replace it with another copy/version if I knew which one was causing the issue?). Any tips @mynttt ? It quits every time I try to load it.

[INFO ] - 2021-09-10 21:47:04 @ ImdbPipeline.analyseDatabase: Filtered 4 invalid item(s).
[ERROR] - 2021-09-10 21:47:04 @ ExtraData.of: Tried to decode [KEY] := '1���%�00:15:20.086����%�00:15:18.918����%�00:15:14.497����%�00:15:09.784�7��%�00:14:54.640�2��%�00:14:53.768�(��%�00:14:51.516����%�00:14:43.966����%�00:14:19.275�
���%�00:14:18.691����%�00:14:17.190����%�00:13:58.129����%�00:13:49.954����%�00:13:32.770����%�00:13:24.095����%�00:12'
[ERROR] - 2021-09-10 21:47:04 @ ExtraData.of: Tried to decode [VALUE] := ''
[INFO ] - 2021-09-10 21:47:04 @ ImdbDockerImplementation$ImdbBatchJob.run: Job returned ERROR : URLDecoder: Illegal hex characters in escape (%) pattern - Error at index 0 in: "�0"
[ERROR] - 2021-09-10 21:47:04 @ ImdbDockerImplementation$ImdbBatchJob.run: IllegalArgumentException exception encountered...
[ERROR] - 2021-09-10 21:47:04 @ ImdbDockerImplementation$ImdbBatchJob.run: Please contact the maintainer of the application with the stacktrace below if you think this is unwanted behavior.
[ERROR] - 2021-09-10 21:47:04 @ ImdbDockerImplementation$ImdbBatchJob.run: ========================================
[ERROR] - 2021-09-10 21:47:04 @ ImdbDockerImplementation$ImdbBatchJob.run: java.lang.IllegalArgumentException: URLDecoder: Illegal hex characters in escape (%) pattern - Error at index 0 in: "�0"
at java.base/java.net.URLDecoder.decode(Unknown Source)
at updatetool.common.ExtraData.of(ExtraData.java:100)
at updatetool.imdb.ImdbTransformer.needsUpdate(ImdbTransformer.java:34)
at java.base/java.util.function.Predicate.lambda$negate$1(Unknown Source)
at java.base/java.util.stream.ReferencePipeline$2$1.accept(Unknown Source)
at java.base/java.util.HashMap$EntrySpliterator.forEachRemaining(Unknown Source)
at java.base/java.util.stream.AbstractPipeline.copyInto(Unknown Source)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source)
at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(Unknown Source)
at java.base/java.util.stream.AbstractPipeline.evaluate(Unknown Source)
at java.base/java.util.stream.ReferencePipeline.collect(Unknown Source)
at updatetool.imdb.ImdbPipeline.transformMetadata(ImdbPipeline.java:171)
at updatetool.imdb.ImdbPipeline.transformMetadata(ImdbPipeline.java:48)
at updatetool.api.Pipeline.invoke(Pipeline.java:12)
at updatetool.imdb.ImdbJobRunner.run(ImdbJobRunner.java:19)
at updatetool.imdb.ImdbDockerImplementation$ImdbBatchJob.run(ImdbDockerImplementation.java:276)
at updatetool.TaskWrapper.run(Main.java:252)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
[ERROR] - 2021-09-10 21:47:04 @ ImdbDockerImplementation$ImdbBatchJob.run: The application will terminate now.
mynttt commented 2 years ago

@austinarchibald I'll change it so it does not quit anymore with 1.6.1!

mynttt commented 2 years ago

@austinarchibald Add the capability DONT_THROW_ON_ENCODING_ERROR so it does not exit at that point anymore with 1.6.1!