test_class.declarator: localJobManagerAddress = "akka.tcp://flink@127.0.0.1:1234/user/foobar"
test_class.modifier: static final
test_class.original_string: static final String localJobManagerAddress = "akka.tcp://flink@127.0.0.1:1234/user/foobar";
test_class.type: String
test_class.var_name: localJobManagerAddress
test_class.declarator: remoteURL = "127.0.0.2:1235"
test_class.modifier: static final
test_class.original_string: static final String remoteURL = "127.0.0.2:1235";
test_class.type: String
test_class.var_name: remoteURL
test_class.declarator: remotePath = "akka.tcp://flink@" + remoteURL + "/user/jobmanager"
test_class.modifier: static final
test_class.original_string: static final String remotePath = "akka.tcp://flink@" + remoteURL + "/user/jobmanager";
test_class.type: String
test_class.var_name: remotePath
test_class.file: flink-runtime-web/src/test/java/org/apache/flink/runtime/webmonitor/handlers/HandlerRedirectUtilsTest.java
test_class.identifier: HandlerRedirectUtilsTest
test_case.body: @Test
  	public void testGetRedirectAddressWithLocalAkkaPath() throws Exception {
  		ActorGateway leaderGateway = new DummyActorGateway("akka://flink/user/foobar");
  
  		Tuple2<ActorGateway, Integer> leader = new Tuple2<>(leaderGateway, 1235);
  
  		String redirectingAddress =HandlerRedirectUtils.getRedirectAddress(localJobManagerAddress, leader);
  
  		Assert.assertNull(redirectingAddress);
  	}
test_case.class_method_signature: HandlerRedirectUtilsTest.testGetRedirectAddressWithLocalAkkaPath()
test_case.full_signature: @Test public void testGetRedirectAddressWithLocalAkkaPath()
test_case.identifier: testGetRedirectAddressWithLocalAkkaPath
test_case.invocations: getRedirectAddress assertNull
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testGetRedirectAddressWithLocalAkkaPath()
focal_class.declarator: LOG = LoggerFactory.getLogger(HandlerRedirectUtils.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger LOG = LoggerFactory.getLogger(HandlerRedirectUtils.class);
focal_class.type: Logger
focal_class.var_name: LOG
focal_class.declarator: LeaderAddressHostPattern = Pattern.compile("^.+@(.+):([0-9]+)/user/.+$")
focal_class.modifier: private final static
focal_class.original_string: private final static Pattern LeaderAddressHostPattern = Pattern.compile("^.+@(.+):([0-9]+)/user/.+$");
focal_class.type: Pattern
focal_class.var_name: LeaderAddressHostPattern
focal_class.file: flink-runtime-web/src/main/java/org/apache/flink/runtime/webmonitor/handlers/HandlerRedirectUtils.java
focal_class.identifier: HandlerRedirectUtils
focal_class.class_method_signature: HandlerRedirectUtils.getRedirectAddress(
  			String localJobManagerAddress,
  			Tuple2<ActorGateway, Integer> leader)
focal_class.full_signature: public static String getRedirectAddress(
  			String localJobManagerAddress,
  			Tuple2<ActorGateway, Integer> leader)
focal_class.identifier: getRedirectAddress
focal_class.modifiers: public static
focal_class.parameters: (
  			String localJobManagerAddress,
  			Tuple2<ActorGateway, Integer> leader)
focal_class.return: String
focal_class.signature: String getRedirectAddress(
  			String localJobManagerAddress,
  			Tuple2<ActorGateway, Integer> leader)
focal_class.class_method_signature: HandlerRedirectUtils.getRedirectResponse(String redirectAddress, String path)
focal_class.full_signature: public static HttpResponse getRedirectResponse(String redirectAddress, String path)
focal_class.identifier: getRedirectResponse
focal_class.modifiers: public static
focal_class.parameters: (String redirectAddress, String path)
focal_class.return: HttpResponse
focal_class.signature: HttpResponse getRedirectResponse(String redirectAddress, String path)
focal_class.class_method_signature: HandlerRedirectUtils.getUnavailableResponse()
focal_class.full_signature: public static HttpResponse getUnavailableResponse()
focal_class.identifier: getUnavailableResponse
focal_class.modifiers: public static
focal_class.parameters: ()
focal_class.return: HttpResponse
focal_class.signature: HttpResponse getUnavailableResponse()
focal_method.body: public static String getRedirectAddress(
  			String localJobManagerAddress,
  			Tuple2<ActorGateway, Integer> leader) throws Exception {
  
  		final String leaderAddress = leader._1().path();
  		final int webMonitorPort = leader._2();
  
  		final String jobManagerName = localJobManagerAddress.substring(localJobManagerAddress.lastIndexOf("/") + 1);
  
  		if (!localJobManagerAddress.equals(leaderAddress) &&
  			!leaderAddress.equals(JobManager.getLocalJobManagerAkkaURL(Option.apply(jobManagerName)))) {
  			// We are not the leader and need to redirect
  			Matcher matcher = LeaderAddressHostPattern.matcher(leaderAddress);
  
  			if (matcher.matches()) {
  				String redirectAddress = String.format("%s:%d", matcher.group(1), webMonitorPort);
  				return redirectAddress;
  			}
  			else {
  				LOG.warn("Unexpected leader address pattern {}. Cannot extract host.", leaderAddress);
  			}
  		}
  
  		return null;
  	}
focal_method.class_method_signature: HandlerRedirectUtils.getRedirectAddress(
  			String localJobManagerAddress,
  			Tuple2<ActorGateway, Integer> leader)
focal_method.full_signature: public static String getRedirectAddress(
  			String localJobManagerAddress,
  			Tuple2<ActorGateway, Integer> leader)
focal_method.identifier: getRedirectAddress
focal_method.invocations: path _1 _2 substring lastIndexOf equals equals getLocalJobManagerAkkaURL apply matcher matches format group warn
focal_method.modifiers: public static
focal_method.parameters: (
  			String localJobManagerAddress,
  			Tuple2<ActorGateway, Integer> leader)
focal_method.return: String
focal_method.signature: String getRedirectAddress(
  			String localJobManagerAddress,
  			Tuple2<ActorGateway, Integer> leader)