Skip to content
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

Accessing internet even when external links are disabled (1.4.20) #1706

Closed
tprochazka opened this issue Jan 20, 2021 · 6 comments
Closed

Accessing internet even when external links are disabled (1.4.20) #1706

tprochazka opened this issue Jan 20, 2021 · 6 comments
Labels

Comments

@tprochazka
Copy link

tprochazka commented Jan 20, 2021

I have forbidden internet access in the building environment.
So I'm using this setup

dokkaSourceSets.named("main") {
                    jdkVersion.set(8)
                    platform.set(org.jetbrains.dokka.Platform.jvm)

                    noJdkLink.set(false)
                    noStdlibLink.set(false)
                    noAndroidSdkLink.set(false)

                    mapOf(
                        "https://developer.android.com/reference/" to "... internal URL ...",
                        "https://kotlinlang.org/api/latest/jvm/stdlib/" to "... internal URL ..."
                    ).forEach {
                        externalDocumentationLink {
                            url.set(URL(it.key))
                            packageListUrl.set(URL(it.value))
                        }
                    }
                }

I tried use also dokkaSourceSets.configureEach {

But Dokka generation still ends with, but in the log is not clear on which URL it exactly fail.
Is there something else except this that can access the internet? I was using this in 0.X version and it was working.
Can you put the URL to this exception message, please?

[10:31:46]	[Step 2/2] Caused by: java.lang.RuntimeException: Unhandled HTTP code: 403
[10:31:46]	[Step 2/2] 	at org.jetbrains.dokka.base.resolvers.shared.UtilsKt$readContent$1.invoke(utils.kt:30)
[10:31:46]	[Step 2/2] 	at org.jetbrains.dokka.base.resolvers.shared.UtilsKt.readContent(utils.kt:36)
[10:31:46]	[Step 2/2] 	at org.jetbrains.dokka.base.resolvers.shared.UtilsKt.readContent$default(utils.kt:8)
[10:31:46]	[Step 2/2] 	at org.jetbrains.dokka.base.resolvers.shared.PackageList$Companion.load(PackageList.kt:17)
[10:31:46]	[Step 2/2] 	at org.jetbrains.dokka.base.resolvers.local.DefaultLocationProvider.<init>(DefaultLocationProvider.kt:28)
[10:31:46]	[Step 2/2] 	at org.jetbrains.dokka.javadoc.location.JavadocLocationProvider.<init>(JavadocLocationProvider.kt:16)
[10:31:46]	[Step 2/2] 	at org.jetbrains.dokka.javadoc.location.JavadocLocationProviderFactory.getLocationProvider(JavadocLocationProviderFactory.kt:9)
[10:31:46]	[Step 2/2] 	at org.jetbrains.dokka.javadoc.location.JavadocLocationProviderFactory.getLocationProvider(JavadocLocationProviderFactory.kt:7)
[10:31:46]	[Step 2/2] 	at org.jetbrains.dokka.base.renderers.PackageListService.createPackageList(PackageListService.kt:19)
[10:31:46]	[Step 2/2] 	at org.jetbrains.dokka.base.renderers.PackageListCreator.packageList(preprocessors.kt:27)
[10:31:46]	[Step 2/2] 	at org.jetbrains.dokka.base.renderers.PackageListCreator.invoke(preprocessors.kt:22)
[10:31:46]	[Step 2/2] 	at org.jetbrains.dokka.javadoc.renderer.KorteJavadocRenderer.render(KorteJavadocRenderer.kt:42)
[10:31:46]	[Step 2/2] 	at org.jetbrains.dokka.DokkaGenerator.render(DokkaGenerator.kt:126)
[10:31:46]	[Step 2/2] 	at org.jetbrains.dokka.DokkaGenerator$generate$1.invoke(DokkaGenerator.kt:54)
[10:31:46]	[Step 2/2] 	at org.jetbrains.dokka.DokkaGenerator$generate$1.invoke(DokkaGenerator.kt:22)
[10:31:46]	[Step 2/2] 	at org.jetbrains.dokka.DokkaGeneratorKt.timed(DokkaGenerator.kt:184)
[10:31:46]	[Step 2/2] 	at org.jetbrains.dokka.DokkaGeneratorKt.access$timed(DokkaGenerator.kt:1)
[10:31:46]	[Step 2/2] 	at org.jetbrains.dokka.DokkaGenerator.generate(DokkaGenerator.kt:26)
[10:31:46]	[Step 2/2] 	at org.jetbrains.dokka.DokkaBootstrapImpl.generate(DokkaBootstrapImpl.kt:78)
[10:31:46]	[Step 2/2] 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[10:31:46]	[Step 2/2] 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[10:31:46]	[Step 2/2] 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[10:31:46]	[Step 2/2] 	at java.lang.reflect.Method.invoke(Method.java:498)
@tprochazka tprochazka added the bug label Jan 20, 2021
@kamildoleglo
Copy link
Contributor

Can you please check if the issue persists with offlineMode.set(true)?

@kamildoleglo kamildoleglo added the awaiting response An issue/PR that cannot be completed without additional information or a discussion label Feb 4, 2021
@tprochazka
Copy link
Author

tprochazka commented Feb 23, 2021

Yes offlineMode.set(true) helps to not access the internet, so it will not fail in our case.
But I would expect that it will then completely ignore this

mapOf(
                    "https://developer.android.com/reference/" to "... internal URL ...",
                    "https://kotlinlang.org/api/latest/jvm/stdlib/" to "... internal URL ..."
                ).forEach {
                    externalDocumentationLink {
                        url.set(URL(it.key))
                        packageListUrl.set(URL(it.value))
                    }
                }

Right?
But rather to not have external links then build crash.

@kamildoleglo
Copy link
Contributor

If the internal URL has a file:// protocol, then Dokka will use them, regardless of the offlineMode state. If however, they have a regular https:// or something similar, then yes, they will be ignored

@tprochazka
Copy link
Author

But, the fact that it accessing something from the Internet with the setup from the original issue description is still a bug, right?
And probably also fact that it did not display which URL it trying to access.

@tprochazka
Copy link
Author

The issue still has the "awaiting response" flag. It is still true, please?

@IgnatBeresnev
Copy link
Member

But, the fact that it accessing something from the Internet with the setup from the original issue description is still a bug, right?

If I'm not mistaken, statement noAbc.set(false) evaluates to abc.set(true), so you've enabled external (i.e internet) links instead of disabling them:

noJdkLink.set(false)
noStdlibLink.set(false)
noAndroidSdkLink.set(false)

offlineMode.set(true) disables previously enabled internet links, that's why it helps and works as expected.

This behaviour and options have been properly documented in #2728, and we'll rename noStdlibLink-like properties to avoid double negation as part of #2515

All in all, it is confusing, but I wouldn't say it's a bug. I'll close the issue for now, but do let us know if you have any more questions or problems related to this

@IgnatBeresnev IgnatBeresnev removed the awaiting response An issue/PR that cannot be completed without additional information or a discussion label Dec 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants