File tree 3 files changed +9
-5
lines changed
test-source-links/dotty/tools/scaladoc/source-links
3 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -140,4 +140,3 @@ object SourceLinks:
140
140
)
141
141
SourceLinks (sourceLinks)
142
142
}
143
-
Original file line number Diff line number Diff line change @@ -17,9 +17,9 @@ trait NameNormalizer { self: TastyParser =>
17
17
private val ignoredKeywords : Set [String ] = Set (" this" )
18
18
19
19
private def escapedName (name : String ) =
20
- val simpleIdentifierRegex = " ([([{}]) ]|[^A-Za-z0-9$]_)" .r
20
+ val complexIdentifierRegex = """ ([([{}]) ]|[^A-Za-z0-9$]_)"" " .r
21
21
name match
22
22
case n if ignoredKeywords(n) => n
23
- case n if keywords(termName(n)) || simpleIdentifierRegex .findFirstIn(n).isDefined => s " ` $n` "
23
+ case n if keywords(termName(n)) || complexIdentifierRegex .findFirstIn(n).isDefined => s " ` $n` "
24
24
case _ => name
25
25
}
Original file line number Diff line number Diff line change @@ -16,6 +16,8 @@ import org.junit.Test
16
16
17
17
class RemoteLinksTest :
18
18
19
+ class TimeoutException extends Exception
20
+
19
21
Random .setSeed(123L )
20
22
val mtslAll = membersToSourceLinks(using testDocContext())
21
23
@@ -44,20 +46,23 @@ class RemoteLinksTest:
44
46
catch
45
47
case e : java.lang.IllegalArgumentException =>
46
48
report.error(s " Could not open link for $link - invalid URL " )(using testContext)
49
+ case e : TimeoutException =>
50
+ report.error(s " Tried to open link $link 16 times but with no avail " )(using testContext)
47
51
case e : org.jsoup.HttpStatusException => e.getStatusCode match
48
52
case 404 => throw AssertionError (s " Page $link does not exists " )
49
53
case n => report.warning(s " Could not open link for $link, return code $n" )(using testContext)
50
54
}
51
55
assertNoErrors(testContext.reportedDiagnostics)
52
56
53
- private def getDocumentFromUrl (link : String ): Document =
57
+ private def getDocumentFromUrl (link : String , retries : Int = 16 ): Document =
54
58
try
59
+ if retries == 0 then throw TimeoutException ()
55
60
Jsoup .connect(link).get
56
61
catch
57
62
case e : org.jsoup.HttpStatusException => e.getStatusCode match
58
63
case 429 =>
59
64
Thread .sleep(10 )
60
- getDocumentFromUrl(link)
65
+ getDocumentFromUrl(link, retries - 1 )
61
66
case n =>
62
67
throw e
63
68
You can’t perform that action at this time.
0 commit comments