-
Notifications
You must be signed in to change notification settings - Fork 323
Closed
Milestone
Description
When there are routes with no paths and those with paths that overlap, DefaultRoutes.map
and DefaultRoutes.unmap
result in java.lang.IndexOutOfBoundsException: Source emitted more than one item
errors.
Scenario to reproduce
Given
$ cf create-route sandbox example.com --hostname myapp
$ cf create-route sandbox example.com --hostname myapp --path foo
On the command line
On the command line the follow operations will succeed.
$ cf map-route hello-cf-index example.com --hostname myapp
$ cf unmap-route hello-cf-index example.com --hostname myapp
Using the cf-java-client
If you trying to use DefaultRoutes.map to do the equivalent, a java.lang.IndexOutOfBoundsException: Source emitted more than one item
results.
CountDownLatch latch = new CountDownLatch(1);
cloudFoundryOperations
.routes()
.map(MapRouteRequest.builder()
.host("myapp")
.domain("example.com")
.applicationName("hello-cf-index")
.build())
.subscribe(System.out::println, Throwable::printStackTrace, () -> latch.countDown());;
latch.await();
Issue
It looks like the DefaultRoutes.requestRoutes method issues a query that doesn't look for an exact match and will return multiple results for the above scenario. But DefaultRoutes. getOrCreateRoute assumes the query will only return a single route.
An equivalent issue exists for DefaultRoutes.unmap
.
Metadata
Metadata
Assignees
Labels
No labels