auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static List<Object> replaceByteBuffersByHexString(Object... values) { ArrayList<Object> boundValues = new ArrayList<>(Arrays.asList(values)); for (int valuePos = 0; valuePos < boundValues.size(); valuePos++) { Object boundValue = boundValues.get(valuePos); if (boundValue instanceof ByteBuffer) { ByteBuffer byteBuffer = (ByteBuffer) boundValue; byte[] extracted = new byte[min(byteBuffer.remaining(), HEX_STRING_LOG_LIMIT)]; byteBuffer.get(extracted).rewind(); boundValues.set(valuePos, Bytes.toHexString(extracted) + ((byteBuffer.remaining() > HEX_STRING_LOG_LIMIT) ? "..." : "")); } else if (boundValue instanceof byte[]) { byte[] byteArray = (byte[]) boundValue; boundValues.set(valuePos, Bytes.toHexString(((byteArray.length > HEX_STRING_LOG_LIMIT) ? Arrays.copyOfRange(byteArray, 0, HEX_STRING_LOG_LIMIT) : byteArray)) + ((byteArray.length > HEX_STRING_LOG_LIMIT) ? "..." : "")); } } return boundValues; }

Target:
public static List<Object> replaceByteBuffersByHexString(Object... values) { ArrayList<Object> boundValues = new ArrayList<>(Arrays.asList(values)); for (int valuePos = 0; valuePos < boundValues.size(); valuePos++) { Object boundValue = boundValues.get(valuePos); if (boundValue instanceof ByteBuffer) { ByteBuffer bbBoundedValue = (ByteBuffer) boundValue; byte[] firstBytes = new byte[min(bbBoundedValue.remaining(), HEX_STRING_LOG_LIMIT)]; bbBoundedValue.get(firstBytes).rewind(); boundValues.set(valuePos, toHexString(firstBytes, bbBoundedValue.remaining())); } else if (boundValue instanceof byte[]) { byte[] baBoundedValue = (byte[]) boundValue; byte[] firstBytes = baBoundedValue.length > HEX_STRING_LOG_LIMIT ? Arrays.copyOfRange(baBoundedValue, 0, HEX_STRING_LOG_LIMIT) : baBoundedValue; boundValues.set(valuePos, toHexString(firstBytes, baBoundedValue.length)); } } return boundValues; }
Source:
public void showAssigneePicker_pickAUser_userPickedAssigned() { TurboIssue issue = getIssueCell(0, 9).getIssue(); triggerAssigneePicker(issue); type("User 1"); push(KeyCode.ENTER); assertEquals("User 1", issue.getAssignee().get()); exitCleanly(); }

Target:
public void showAssigneePicker_pickAUser_userPickedAssigned() { TurboIssue issue = getIssueCell(0, 9).getIssue(); triggerAssigneePicker(issue); type("User 1"); push(KeyCode.ENTER); assertEquals("User 1", issue.getAssignee().get()); }
Source:
public static byte[] decode(String s) { int delta = s.endsWith("==") ? 2 : endsWithEqualSymbol(s); byte[] buffer = new byte[s.length() * 3 / 4 - delta]; int mask = 0xFF; int index = 0; for (int i = 0; i < s.length(); i += 4) { int c0 = toInt[s.charAt(i)]; int c1 = toInt[s.charAt(i + 1)]; buffer[index++] = (byte) (((c0 << 2) | (c1 >> 4)) & mask); if (index >= buffer.length) return buffer; int c2 = toInt[s.charAt(i + 2)]; buffer[index++] = (byte) (((c1 << 4) | (c2 >> 2)) & mask); if (index >= buffer.length) return buffer; int c3 = toInt[s.charAt(i + 3)]; buffer[index++] = (byte) (((c2 << 6) | c3) & mask); } return buffer; }

Target:
public static byte[] decode(String s) { int delta = s.endsWith("==") ? 2 : (s.endsWith("=") ? 1 : 0); byte[] buffer = new byte[s.length() * 3 / 4 - delta]; int mask = 0xFF; int index = 0; for (int i = 0; i < s.length(); i += 4) { int c0 = toInt[s.charAt(i)]; int c1 = toInt[s.charAt(i + 1)]; buffer[index++] = (byte) (((c0 << 2) | (c1 >> 4)) & mask); if (index >= buffer.length) { return buffer; } int c2 = toInt[s.charAt(i + 2)]; buffer[index++] = (byte) (((c1 << 4) | (c2 >> 2)) & mask); if (index >= buffer.length) { return buffer; } int c3 = toInt[s.charAt(i + 3)]; buffer[index++] = (byte) (((c2 << 6) | c3) & mask); } return buffer; }
Source:
public static void assertRunIsUnloadable(Class<? extends Runnable> runnable, ClassLoader parent) { System.setProperty("java.util.logging.manager", LogManager.class.getName()); assertThat(LogManager.getLogManager().getClass()).isSameAs(LogManager.class); WeakReference<ClassLoader> loader; try { loader = invokeRunFromNewClassLoader(runnable, parent); } catch (Exception e) { throw new AssertionError(e); } try { GarbageCollectors.blockOnGC(loader); } catch (ConditionTimeoutException t) { } assertThat(loader.get()) .withFailMessage(runnable + " includes state that couldn't be garbage collected") .isNull(); }

Target:
public static void assertRunIsUnloadable(Class<? extends Runnable> runnable, ClassLoader parent) { System.setProperty("java.util.logging.manager", LogManager.class.getName()); assertThat(LogManager.getLogManager().getClass()).isSameAs(LogManager.class); WeakReference<ClassLoader> loader; try { loader = invokeRunFromNewClassLoader(runnable, parent); } catch (Exception e) { throw new AssertionError(e); } GarbageCollectors.blockOnGC(loader); assertThat(loader.get()) .withFailMessage(runnable + " includes state that couldn't be garbage collected") .isNull(); }
Source:
public static Operation createDeploymentAddOperation(final Path content, final String name, final String runtimeName) { Assertions.requiresNotNullParameter(content, "content"); final ModelNode address = createAddress(DEPLOYMENT, name); final ModelNode addOperation = createAddOperation(address); if (runtimeName != null) { addOperation.get(RUNTIME_NAME).set(runtimeName); } final CompositeOperationBuilder builder = CompositeOperationBuilder.create(true); addContent(builder, addOperation, content); builder.addStep(addOperation); return builder.build(); }

Target:
public static Operation createDeploymentAddOperation(final Path content, final String name, final String runtimeName) { Assertions.requiresNotNullParameter(content, "content"); final ModelNode address = createAddress(DEPLOYMENT, name); final ModelNode addOperation = createAddOperation(address); if (runtimeName != null) { addOperation.get(RUNTIME_NAME).set(runtimeName); } final CompositeOperationBuilder builder = CompositeOperationBuilder.create(true); DeploymentContent.of(content).addContentToOperation(builder, addOperation); builder.addStep(addOperation); return builder.build(); }
Source:
public int numbered() { return getInt("numbered"); }

Target:
public boolean numbered() { return isNumbered(); }
Source:
public void testImportVMFromConfigurationWhenVMDoesNotExists() { initCommand(null); assertFalse(cmd.canDoAction()); Assert.assertTrue(cmd.getReturnValue() .getCanDoActionMessages() .contains(VdcBllMessages.ACTION_TYPE_FAILED_UNSUPPORTED_OVF.toString())); }

Target:
public void testImportVMFromConfigurationWhenVMDoesNotExists() { initCommand(null); assertFalse(cmd.canDoAction()); assertTrue(cmd.getReturnValue() .getCanDoActionMessages() .contains(VdcBllMessages.ACTION_TYPE_FAILED_UNSUPPORTED_OVF.toString())); }
Source:
public static boolean isNACKPacket(ByteArrayBuffer baf) { int rc = RTCPHeaderUtils.getReportCount(baf); return isRTPFBPacket(baf) && rc == FMT; }

Target:
public static boolean isNACKPacket(ByteArrayBuffer baf) { int rc = RTCPHeaderUtils.getReportCount(baf); return rc == FMT && isRTPFBPacket(baf); }
Source:
public ApiResponse getCountersForInterval(ArrayList<String> counterArray, Date startTime, Date endTime, String resolution) { String counters = "?counter=" + counterArray.get(0); for (int i = 1; i < counterArray.size(); i++) { counters += "&counter="; counters += counterArray.get(i); } counters += "&start_time="; counters += Long.toString(startTime.getTime()); counters += "&end_time="; counters += Long.toString(endTime.getTime()); counters += "&resolution="; counters += resolution; return apiRequest(HTTP_METHOD_GET, null, null, organizationId, applicationId, "counters", counters); }

Target:
public ApiResponse getCountersForInterval(ArrayList<String> counterArray, Date startTime, Date endTime, String resolution) { String counters = null; if (counterArray != null) { counters = "?counter=" + counterArray.get(0); for (int i = 1; i < counterArray.size(); i++) { counters += "&counter="; counters += counterArray.get(i); } if (startTime != null) { counters += "&start_time="; counters += startTime.getTime(); } if (endTime != null) { counters += "&end_time="; counters += endTime.getTime(); } counters += "&resolution="; counters += resolution; } return apiRequest(HTTP_METHOD_GET, null, null, organizationId, applicationId, "counters", counters); }
Source:
protected CompletionStage<Void> asyncWritePart(AsyncOutputStream entityStream, byte[] boundaryBytes, OutputPart part, MultivaluedMap<String, Object> headers) { headers.putAll(part.getHeaders()); headers.putSingle(HttpHeaderNames.CONTENT_TYPE, part.getMediaType()); Object entity = part.getEntity(); Class<?> entityType = part.getType(); Type entityGenericType = part.getGenericType(); AsyncMessageBodyWriter writer = (AsyncMessageBodyWriter) workers.getMessageBodyWriter(entityType, entityGenericType, null, part.getMediaType()); LogMessages.LOGGER.debugf("MessageBodyWriter: %s", writer.getClass().getName()); return entityStream.asyncWrite(boundaryBytes) .thenCompose(v -> entityStream.asyncWrite("\r\n".getBytes())) .thenCompose(v -> writer.asyncWriteTo(entity, entityType, entityGenericType, null, part.getMediaType(), headers, new HeaderFlushedAsyncOutputStream(headers, entityStream))) .thenCompose(v -> entityStream.asyncWrite("\r\n".getBytes())); }

Target:
protected CompletionStage<Void> asyncWritePart(AsyncOutputStream entityStream, byte[] boundaryBytes, OutputPart part, MultivaluedMap<String, Object> headers) { headers.putAll(part.getHeaders()); headers.putSingle(HttpHeaderNames.CONTENT_TYPE, part.getMediaType()); Object entity = part.getEntity(); Class<?> entityType = part.getType(); Type entityGenericType = part.getGenericType(); AsyncMessageBodyWriter writer = (AsyncMessageBodyWriter) workers.getMessageBodyWriter(entityType, entityGenericType, null, part.getMediaType()); LogMessages.LOGGER.debugf("MessageBodyWriter: %s", writer.getClass().getName()); return entityStream.asyncWrite(boundaryBytes) .thenCompose(v -> entityStream.asyncWrite(LINE_SEPARATOR_BYTES)) .thenCompose(v -> writer.asyncWriteTo(entity, entityType, entityGenericType, null, part.getMediaType(), headers, new HeaderFlushedAsyncOutputStream(headers, entityStream))) .thenCompose(v -> entityStream.asyncWrite(LINE_SEPARATOR_BYTES)); }
Source:
public static void checkMaxLength(String propertyName, String actualValue, int maxLength) throws MaxSizeExceededException{ if(actualValue.length() > maxLength) throw new MaxSizeExceededException("Length of '" + propertyName + "' is too long! MaxLength=" + maxLength + ", ActualLength=" + actualValue.length()); }

Target:
public static void checkMaxLength(String propertyName, String actualValue, int maxLength) throws MaxSizeExceededException { if (actualValue == null) { return; } if (actualValue.length() > maxLength) { throw new MaxSizeExceededException("Length of '" + propertyName + "' is too long! MaxLength=" + maxLength + ", ActualLength=" + actualValue.length()); } }
Source:
public Map<String, String[]> asMap() { Map<String, String[]> map = new HashMap<>(); if (href != null) { map.put("href", new String[]{ href.toString() }); } if (params != null) { for (Entry<String, String> entry : params.entrySet()) { map.put(entry.getKey(), new String[] { entry.getValue() }); } } return Collections.unmodifiableMap(map); }

Target:
public Map<String, String[]> asMap() { Map<String, String[]> map = new HashMap<>(); if (href != null) { map.put(HREF, new String[]{ href.toString() }); } if (params != null) { for (Entry<String, String> entry : params.entrySet()) { map.put(String.format(PARAMS_PREFIX, entry.getKey()), new String[] { entry.getValue() }); } } return Collections.unmodifiableMap(map); }
Source:
public void testDoNotPushdownPredicateIfNonFilteredAggregateIsPresent() { assertPlan( "SELECT sum(totalprice) FILTER(WHERE totalprice > 0), sum(custkey) FROM orders", anyTree( aggregation( ImmutableMap.of("sum_2", functionCall("sum", ImmutableList.of("sum_13")), "sum", functionCall("sum", ImmutableList.of("sum_12"))), exchange( aggregation( ImmutableMap.of("sum_12", functionCall("sum", ImmutableList.of("totalprice")), "sum_13", functionCall("sum", ImmutableList.of("custkey"))), project( tableScan( "orders", ImmutableMap.of("totalprice", "totalprice", "custkey", "custkey")))))))); }

Target:
public void testDoNotPushdownPredicateIfNonFilteredAggregateIsPresent() { assertPlanContainsNoFilter("SELECT sum(totalprice) FILTER(WHERE totalprice > 0), sum(custkey) FROM orders"); }
Source:
public void updateFeedbackResponseOptimized(FeedbackResponseAttributes newAttributes, FeedbackResponse fr, boolean keepUpdateTimestamp) throws InvalidParametersException, EntityDoesNotExistException { Assumption.assertNotNull( Const.StatusCodes.DBLEVEL_NULL_INPUT, newAttributes); if (!newAttributes.isValid()) { throw new InvalidParametersException(newAttributes.getInvalidityInfo()); } if (fr == null) { throw new EntityDoesNotExistException( ERROR_UPDATE_NON_EXISTENT + newAttributes.toString()); } fr.keepUpdateTimestamp = keepUpdateTimestamp; fr.setAnswer(newAttributes.responseMetaData); fr.setRecipientEmail(newAttributes.recipientEmail); fr.setGiverSection(newAttributes.giverSection); fr.setRecipientSection(newAttributes.recipientSection); log.info(newAttributes.getBackupIdentifier()); getPM().close(); }

Target:
private void updateFeedbackResponseOptimized(FeedbackResponseAttributes newAttributes, FeedbackResponse fr, boolean keepUpdateTimestamp) throws InvalidParametersException, EntityDoesNotExistException { Assumption.assertNotNull( Const.StatusCodes.DBLEVEL_NULL_INPUT, newAttributes); if (!newAttributes.isValid()) { throw new InvalidParametersException(newAttributes.getInvalidityInfo()); } if (fr == null) { throw new EntityDoesNotExistException( ERROR_UPDATE_NON_EXISTENT + newAttributes.toString()); } fr.keepUpdateTimestamp = keepUpdateTimestamp; fr.setAnswer(newAttributes.responseMetaData); fr.setRecipientEmail(newAttributes.recipientEmail); fr.setGiverSection(newAttributes.giverSection); fr.setRecipientSection(newAttributes.recipientSection); log.info(newAttributes.getBackupIdentifier()); getPM().close(); }
Source:
private boolean isValidTag(GoTag tag) { StringBuilder tagText = new StringBuilder(tag.getText().substring(1, tag.getTextLength() - 1)); while (tagText.length() > 0) { int i; i = 0; while (i < tagText.length() && tagText.charAt(i) == ' ') { i++; } tagText.delete(0, i); if (tagText.length() == 0) { return true; } i = 0; while (i < tagText.length() && tagText.charAt(i) > ' ' && tagText.charAt(i) != ':' && tagText.charAt(i) != '"' && tagText.charAt(i) != 0x7f) { i++; } if (i == 0 || (i + 1) > tagText.length() || tagText.charAt(i) != ':') { return false; } tagText.delete(0, i + 1); i = 1; while (i < tagText.length() && tagText.charAt(i) != '"') { if (tagText.charAt(i) == '\\') { i++; } i++; } if (i >= tagText.length()) { return false; } tagText.delete(0, i + 1); } return true; }

Target:
private boolean isValidTag(GoTag tag) { StringBuilder tagText = new StringBuilder(GoPsiImplUtil.unquote(tag.getText())); if (tagText.length() != tag.getText().length() - 2) { return false; } while (tagText.length() > 0) { int i; i = 0; while (i < tagText.length() && tagText.charAt(i) == ' ') { i++; } tagText.delete(0, i); if (tagText.length() == 0) { return true; } i = 0; while (i < tagText.length() && tagText.charAt(i) > ' ' && tagText.charAt(i) != ':' && tagText.charAt(i) != '"' && tagText.charAt(i) != 0x7f) { i++; } if (i == 0 || (i + 1) > tagText.length() || tagText.charAt(i) != ':') { return false; } tagText.delete(0, i + 1); i = 1; while (i < tagText.length() && tagText.charAt(i) != '"') { if (tagText.charAt(i) == '\\') { i++; } i++; } if (i >= tagText.length()) { return false; } String unquotedValue = GoPsiImplUtil.unquote(tagText.substring(0, i + 1)); if (unquotedValue.length() != i - 1) { return false; } tagText.delete(0, i + 1); } return true; }
Source:
private Result(EventProducer producer, Object rawMethodResult) { super(producer, rawMethodResult); List<Message> eventMessages = toMessages(rawMethodResult); List<Message> withoutEmpty = filterEmpty(eventMessages); checkResultNonEmpty(withoutEmpty, rawMethodResult, producer); setMessages(withoutEmpty); }

Target:
private Result(EventProducer producer, Object rawMethodResult) { super(producer, rawMethodResult); List<Message> eventMessages = toMessages(rawMethodResult); List<Message> filtered = filterEmpty(eventMessages); ensureNotEmptyIfNotProcessManager(filtered, rawMethodResult, producer); setMessages(filtered); }
Source:
public void addDataCollector(Module module, String monitoringManagerIp, int monitoringManagerPort, String influxdbIp, int influxdbPort) { if(module.getHost().getDeploymentType().equals("IaaS")){ logger.info("Generating required deployment script for the MODAClouds Data Collector."); Map<String, Object> dataCollector = this.generateDcNodeTemplate(this .getRequiredEnvVars(module, monitoringManagerIp, monitoringManagerPort, influxdbIp, influxdbPort), module); module.addDataCollector(dataCollector); } }

Target:
public void addDataCollector(Module module, String monitoringManagerIp, int monitoringManagerPort, String influxdbIp, int influxdbPort) { if(module.getHost().getDeploymentType().equals(DeploymentType.IaaS)){ logger.info("Generating required deployment script for the MODAClouds Data Collector."); Map<String, Object> dataCollector = this.generateDcNodeTemplate(this .getRequiredEnvVars(module, monitoringManagerIp, monitoringManagerPort, influxdbIp, influxdbPort), module); module.addDataCollector(dataCollector); } }
Source:
private LayoutAlgorithmTransition( LayoutModelAware<N, E, P> visualizationModel, LayoutAlgorithm<N, P> endLayoutAlgorithm) { if (log.isTraceEnabled()) { log.trace( "transition from to {}", visualizationModel.getLayoutAlgorithm(), endLayoutAlgorithm); } this.layoutModelAware = visualizationModel; this.layoutModel = visualizationModel.getLayoutModel(); layoutModel.stopRelaxer(); this.pointModel = layoutModel.getPointModel(); LayoutAlgorithm<N, P> transitionLayoutAlgorithm = new StaticLayoutAlgorithm(pointModel); visualizationModel.setLayoutAlgorithm(transitionLayoutAlgorithm); this.transitionLayoutModel = new LoadingCacheLayoutModel.Builder() .setGraph(visualizationModel.getNetwork().asGraph()) .setPointModel(layoutModel.getPointModel()) .setSize(layoutModel.getWidth(), layoutModel.getHeight(), layoutModel.getDepth()) .build(); transitionLayoutModel.accept(endLayoutAlgorithm); this.endLayoutAlgorithm = endLayoutAlgorithm; if (animator != null) { animator.stop(); } animator = new Animator(this); animator.start(); }

Target:
private LayoutAlgorithmTransition( LayoutModelAware<N, E, P> visualizationModel, LayoutAlgorithm<N, P> endLayoutAlgorithm) { if (log.isTraceEnabled()) { log.trace( "transition from to {}", visualizationModel.getLayoutAlgorithm(), endLayoutAlgorithm); } this.layoutModelAware = visualizationModel; this.layoutModel = visualizationModel.getLayoutModel(); layoutModel.stopRelaxer(); this.pointModel = layoutModel.getPointModel(); LayoutAlgorithm<N, P> transitionLayoutAlgorithm = new StaticLayoutAlgorithm(); visualizationModel.setLayoutAlgorithm(transitionLayoutAlgorithm); this.transitionLayoutModel = LoadingCacheLayoutModel.<N, P>builder() .setGraph(visualizationModel.getNetwork().asGraph()) .setLayoutModel(layoutModel) .build(); transitionLayoutModel.accept(endLayoutAlgorithm); this.endLayoutAlgorithm = endLayoutAlgorithm; if (animator != null) { animator.stop(); } animator = new Animator(this); animator.start(); }
Source:
public void invoke_put_once_when_calling_getDefaultState_in_multithreaded_environment() { int numberOfEntities = 1000; Collection<Callable<Object>> tasks = newArrayListWithExpectedSize(numberOfEntities); for (int i = 0; i < numberOfEntities; i++) { tasks.add(Executors.callable(() -> { TestEntity testEntity = Given.entityOfClass(TestEntity.class) .build(); testEntity.getDefaultState(); })); } runParallel(tasks); int expected = 1; verify(spyMap, times(expected)).put(any(), any()); assertEquals(expected, spyMap.size()); }

Target:
public void invoke_put_once_when_calling_getDefaultState_in_multithreaded_environment() { int numberOfEntities = 1000; Collection<Callable<Object>> tasks = newArrayListWithExpectedSize(numberOfEntities); for (int i = 0; i < numberOfEntities; i++) { tasks.add(callable(() -> { TestEntity testEntity = Given.entityOfClass(TestEntity.class) .build(); testEntity.getDefaultState(); })); } runParallel(tasks); int expected = 1; verify(spyMap, times(expected)).put(any(), any()); assertEquals(expected, spyMap.size()); }
Source:
protected void doInit() { super.doInit(); _tableSchema = ZKMetadataProvider.getTableSchema(_propertyStore, _tableNameWithType); Preconditions.checkState(_tableSchema != null, "Failed to find schema for table: %s", _tableNameWithType); _primaryKeyColumns = _tableSchema.getPrimaryKeyColumns(); Preconditions.checkState(!CollectionUtils.isEmpty(_primaryKeyColumns), "Primary key columns must be configured for dimension table: %s", _tableNameWithType); }

Target:
protected void doInit() { super.doInit(); _tableSchema = ZKMetadataProvider.getTableSchema(_propertyStore, _tableNameWithType); _primaryKeyColumns = _tableSchema.getPrimaryKeyColumns(); }
Source:
public DeploymentBody getDeploymentTemplate() { addStorageResource(); addPublicIpAddress(); addNetworkSecurityGroup(); addNetworkInterfaceCard(); addVirtualMachine(); DeploymentTemplate.TemplateParameters templateParameters = DeploymentTemplate.TemplateParameters.create(null); DeploymentTemplate.Parameters parameters = DeploymentTemplate.Parameters.create(null); if (keyVaultInUse()){ String[] keyVaultInfo = options.getKeyVaultIdAndSecret().split(":"); assert keyVaultInfo.length == 2; String vaultId = keyVaultInfo[0].trim(); String secretName = keyVaultInfo[1].trim(); templateParameters = DeploymentTemplate.TemplateParameters.create(TemplateParameterType.create("securestring")); parameters = DeploymentTemplate.Parameters.create(KeyVaultReference.create(KeyVaultReference.Reference.create(IdReference.create(vaultId), secretName))); } DeploymentTemplate template = DeploymentTemplate.builder() .schema("<LINK_0>") .contentVersion("1.0.0.0") .resources(resources) .variables(variables) .parameters(templateParameters) .build(); DeploymentBody body = DeploymentBody.create(template, DEPLOYMENT_MODE, parameters); return body; }

Target:
public DeploymentBody getDeploymentTemplate() { addStorageResource(); addPublicIpAddress(); addNetworkSecurityGroup(); addNetworkInterfaceCard(); addVirtualMachine(); DeploymentTemplate.TemplateParameters templateParameters = null; DeploymentTemplate.Parameters parameters = null; if (keyVaultInUse()){ String[] keyVaultInfo = options.getKeyVaultIdAndSecret().split(":"); Preconditions.checkArgument(keyVaultInfo.length == 2); String vaultId = keyVaultInfo[0].trim(); String secretName = keyVaultInfo[1].trim(); templateParameters = DeploymentTemplate.TemplateParameters.create(TemplateParameterType.create("securestring")); parameters = DeploymentTemplate.Parameters.create(KeyVaultReference.create(KeyVaultReference.Reference.create(IdReference.create(vaultId), secretName))); } else { templateParameters = DeploymentTemplate.TemplateParameters.create(null); parameters = DeploymentTemplate.Parameters.create(null); } DeploymentTemplate template = DeploymentTemplate.builder() .schema("<LINK_0>") .contentVersion("1.0.0.0") .resources(resources) .variables(variables) .parameters(templateParameters) .build(); DeploymentBody body = DeploymentBody.create(template, DEPLOYMENT_MODE, parameters); return body; }
Source:
public ProjectQualityGate getQualityGateBefore52() throws Exception { String url = serverUrl + API_MEASURES + "?componentKey=" + projectKey + "&metricKeys=alert_status"; String text = client.getHttp(url, username, password); JSONObject json = (JSONObject) JSONSerializer.toJSON(text); if (json.containsKey("errors")) { throw new MessageException(parseError(json)); } JSONObject component = json.getJSONObject("component"); String projectName = component.getString("name"); JSONArray measuresArray = component.getJSONArray("measures"); for (Object o : measuresArray) { JSONObject jsonObj = (JSONObject) o; String metric = jsonObj.getString("metric"); if ("alert_status".equals(metric)) { return new ProjectQualityGate(projectName, jsonObj.getString("value")); } } return null; }

Target:
public ProjectQualityGate getQualityGateBefore52() throws Exception { String url = serverUrl + API_RESOURCES + encode(projectKey); String text = client.getHttp(url, username, password); JSONArray resourceArray = (JSONArray) JSONSerializer.toJSON(text); if (resourceArray.size() != 1) { Logger.LOG.fine("Found " + resourceArray.size() + " resources for " + projectKey); return null; } JSONObject resource = resourceArray.getJSONObject(0); String projectName = resource.getString("name"); JSONArray measuresArray = resource.getJSONArray("msr"); for (Object o : measuresArray) { JSONObject jsonObj = (JSONObject) o; String key = jsonObj.getString("key"); if ("alert_status".equals(key)) { return new ProjectQualityGate(projectName, jsonObj.getString("data")); } } return null; }
Source:
private void checkGroupingSetsCount(GroupBy node) { int crossProduct = 1; for (GroupingElement element : node.getGroupingElements()) { try { int product = 1; if (element instanceof Cube) { int exponent = element.getColumns().size(); if (exponent > 30) { throw new ArithmeticException(); } product = 1 << exponent; } else if (element instanceof Rollup) { product = element.getColumns().size() + 1; } else if (element instanceof GroupingSets) { product = ((GroupingSets) element).getSets().size(); } crossProduct = Math.multiplyExact(crossProduct, product); } catch (ArithmeticException e) { throw new SemanticException(TOO_MANY_GROUPING_SETS, node, "GROUP BY has more than %s grouping sets but can contain at most %s", Integer.MAX_VALUE, getMaxGroupingSets(session)); } if (crossProduct > getMaxGroupingSets(session)) { throw new SemanticException(TOO_MANY_GROUPING_SETS, node, "GROUP BY has %s grouping sets but can contain at most %s", crossProduct, getMaxGroupingSets(session)); } } }

Target:
private void checkGroupingSetsCount(GroupBy node) { int crossProduct = 1; for (GroupingElement element : node.getGroupingElements()) { try { int product; if (element instanceof SimpleGroupBy) { product = 1; } else if (element instanceof Cube) { int exponent = element.getExpressions().size(); if (exponent > 30) { throw new ArithmeticException(); } product = 1 << exponent; } else if (element instanceof Rollup) { product = element.getExpressions().size() + 1; } else if (element instanceof GroupingSets) { product = ((GroupingSets) element).getSets().size(); } else { throw new UnsupportedOperationException("Unsupported grouping element type: " + element.getClass().getName()); } crossProduct = Math.multiplyExact(crossProduct, product); } catch (ArithmeticException e) { throw new SemanticException(TOO_MANY_GROUPING_SETS, node, "GROUP BY has more than %s grouping sets but can contain at most %s", Integer.MAX_VALUE, getMaxGroupingSets(session)); } if (crossProduct > getMaxGroupingSets(session)) { throw new SemanticException(TOO_MANY_GROUPING_SETS, node, "GROUP BY has %s grouping sets but can contain at most %s", crossProduct, getMaxGroupingSets(session)); } } }
Source:
private void tickIfNecessary() { State oldState = state.get(); long newTick = clock.nanoTime(); long age = newTick - oldState.lastTick; if (age > INTERVAL_SIZE) { long currentCount = currentInterval.longValue(); long newIntervalStartTick = newTick - age % INTERVAL_SIZE; long elapsedIntervals = Math.min(age / INTERVAL_SIZE, 12); int newOffset = (int) ((oldState.offset + elapsedIntervals) % 12); long newTotal; if (elapsedIntervals == 12) { newTotal = 0; } else { newTotal = oldState.totalCount + currentCount; for (int i = 1; i <= elapsedIntervals; i++) { newTotal -= previousIntervals.get((newOffset + 12 - i) % 12); } } State newState = new State(newIntervalStartTick, newOffset, newTotal); if (state.compareAndSet(oldState, newState)) { currentInterval.add(-currentCount); previousIntervals.set(oldState.offset, elapsedIntervals < 12 ? currentCount : 0); for (int i = 1; i < elapsedIntervals; i++) { previousIntervals.set((newOffset + 12 - i) % 12, 0); } } } }

Target:
private void tickIfNecessary() { State oldState = state.get(); long newTick = clock.nanoTime(); long age = newTick - oldState.lastTick; if (age >= INTERVAL_SIZE) { long currentCount = currentInterval.get(); long newIntervalStartTick = newTick - age % INTERVAL_SIZE; long elapsedIntervals = Math.min(age / INTERVAL_SIZE, 12); int newOffset = (int) ((oldState.offset + elapsedIntervals) % 12); long newTotal; if (elapsedIntervals == 12) { newTotal = 0; } else { newTotal = oldState.totalCount + currentCount; for (int i = 1; i <= elapsedIntervals; i++) { newTotal -= previousIntervals.get((newOffset + 12 - i) % 12); } } State newState = new State(newIntervalStartTick, newOffset, newTotal); if (state.compareAndSet(oldState, newState)) { currentInterval.addAndGet(-currentCount); previousIntervals.set(oldState.offset, elapsedIntervals < 12 ? currentCount : 0); for (int i = 1; i < elapsedIntervals; i++) { previousIntervals.set((newOffset + 12 - i) % 12, 0); } } } }
Source:
public void setAwake(Registration reg) { if (reg.usesQueueMode()) { if (!clientStatusList.containsKey(reg.getEndpoint())) { createPresenceStatusObject(reg); } boolean stateChanged = false; synchronized (this) { stateChanged = clientStatusList.get(reg.getEndpoint()).setAwake(); startClientAwakeTimer(reg); } if (stateChanged) { for (PresenceListener listener : listeners) { listener.onAwake(reg); } } } }

Target:
public void setAwake(Registration reg) { if (reg.usesQueueMode()) { PresenceStatus status = new PresenceStatus(); PresenceStatus previous = clientStatusList.putIfAbsent(reg.getEndpoint(), status); if (previous != null) { status = previous; } boolean stateChanged = false; synchronized (status) { stateChanged = status.setAwake(); startClientAwakeTimer(reg, status); } if (stateChanged) { for (PresenceListener listener : listeners) { listener.onAwake(reg); } } } }
Source:
public static Module module() { return new AbstractModule() { @Override protected void configure() { bind(ThreadLocalRequestContext.class); bind(RequestContext.class).annotatedWith(Names.named("FALLBACK")) .to(FallbackRequestContext.class); } @Provides RequestContext provideRequestContext( @Named("FALLBACK") RequestContext fallback) { return Objects.firstNonNull(local.get(), fallback); } @Provides CurrentUser provideCurrentUser(RequestContext ctx) { return ctx.getCurrentUser(); } @Provides IdentifiedUser provideCurrentUser(CurrentUser user) { if (user instanceof IdentifiedUser) { return (IdentifiedUser) user; } throw new ProvisionException(NotSignedInException.MESSAGE, new NotSignedInException()); } }; }

Target:
public static Module module() { return new AbstractModule() { @Override protected void configure() { bind(ThreadLocalRequestContext.class); bind(RequestContext.class).annotatedWith(Names.named(FALLBACK)) .to(FallbackRequestContext.class); } @Provides RequestContext provideRequestContext( @Named(FALLBACK) RequestContext fallback) { return Objects.firstNonNull(local.get(), fallback); } @Provides CurrentUser provideCurrentUser(RequestContext ctx) { return ctx.getCurrentUser(); } @Provides IdentifiedUser provideCurrentUser(CurrentUser user) { if (user instanceof IdentifiedUser) { return (IdentifiedUser) user; } throw new ProvisionException(NotSignedInException.MESSAGE, new NotSignedInException()); } }; }
Source:
public String toString() { StringBuilder builder = new StringBuilder(25); builder.append("refresh: "); builder.append(getRefresh()); builder.append(", filtered: "); builder.append(getRefresh()); return builder.toString(); }

Target:
public String toString() { StringBuilder builder = new StringBuilder(25); builder.append("refresh: "); builder.append(getRefresh()); builder.append(", filtered: "); builder.append(isFiltered()); return builder.toString(); }
Source:
public synchronized void shutdown() { if (!canShutdown()) { LOG.debug("ZooKeeper server is not running, so not proceeding to shutdown!"); return; } LOG.info("shutting down"); setState(State.SHUTDOWN); if (sessionTracker != null) { sessionTracker.shutdown(); } if (firstProcessor != null) { firstProcessor.shutdown(); } unregisterJMX(); }

Target:
public void shutdown() { shutdown(false); }
Source:
public void handleNewSession() throws Exception { listener.handleNewSession(null); }

Target:
public void handleNewSession() throws Exception { _listener.handleNewSession(null); }
Source:
public static List<BatchItem> from(final String events) { final List<BatchItem> batch = new ArrayList<>(); int objectStart = locateOpenSquareBracket(events) + 1; final int arrayEnd = locateClosingSquareBracket(objectStart, events); while (-1 != (objectStart = navigateToObjectStart(batch.isEmpty(), objectStart, arrayEnd, events))) { final int objectEnd = navigateToObjectEnd(objectStart, arrayEnd, events, batch::add); if (objectEnd == -1) { throw new JSONException("Unclosed object staring at " + objectStart + " found."); } objectStart = objectEnd + 1; } return batch; }

Target:
public static List<BatchItem> from(final String events) { final List<BatchItem> batch = new ArrayList<>(); int objectStart = locateOpenSquareBracket(events) + 1; final int arrayEnd = locateClosingSquareBracket(objectStart, events); while (-1 != (objectStart = navigateToObjectStart(objectStart, arrayEnd, events))) { final int objectEnd = navigateToObjectEnd(objectStart, arrayEnd, events, batch::add); if (objectEnd == -1) { throw new JSONException("Unclosed object staring at " + objectStart + " found."); } objectStart = objectEnd + 1; } return batch; }
Source:
public URI resolve(final URI uri, final Sid accountSid) { getHttpConnector(); String restcommAddress = null; if (accountSid != null && daoManager != null) { Sid organizationSid = daoManager.getAccountsDao().getAccount(accountSid).getOrganizationSid(); restcommAddress = daoManager.getOrganizationsDao().getOrganization(organizationSid).getDomainName(); } if (restcommAddress == null || restcommAddress.isEmpty()) { if (RestcommConfiguration.getInstance().getMain().isUseHostnameToResolveRelativeUrls()) { restcommAddress = RestcommConfiguration.getInstance().getMain().getHostname(); if (restcommAddress == null || restcommAddress.isEmpty()) { try { InetAddress addr = DNSUtils.getByName(selectedConnector.getAddress()); restcommAddress = addr.getCanonicalHostName(); } catch (UnknownHostException e) { logger.error("Unable to resolveWithBase: " + selectedConnector + " to hostname: " + e); restcommAddress = selectedConnector.getAddress(); } } } else { restcommAddress = selectedConnector.getAddress(); } } String base = selectedConnector.getScheme() + "://" + restcommAddress + ":" + selectedConnector.getPort(); try { return resolveWithBase(new URI(base), uri); } catch (URISyntaxException e) { throw new IllegalArgumentException("Badly formed URI: " + base, e); } }

Target:
public URI resolve(final URI uri, final Sid accountSid) { getHttpConnector(); String restcommAddress = null; if (accountSid != null && daoManager != null) { Sid organizationSid = daoManager.getAccountsDao().getAccount(accountSid).getOrganizationSid(); restcommAddress = daoManager.getOrganizationsDao().getOrganization(organizationSid).getDomainName(); } if (restcommAddress == null || restcommAddress.isEmpty()) { if (useHostnameToResolve) { restcommAddress = RestcommConfiguration.getInstance().getMain().getHostname(); if (restcommAddress == null || restcommAddress.isEmpty()) { try { InetAddress addr = DNSUtils.getByName(selectedConnector.getAddress()); restcommAddress = addr.getCanonicalHostName(); } catch (UnknownHostException e) { logger.error("Unable to resolveWithBase: " + selectedConnector + " to hostname: " + e); restcommAddress = selectedConnector.getAddress(); } } } else { restcommAddress = selectedConnector.getAddress(); } } String base = selectedConnector.getScheme() + "://" + restcommAddress + ":" + selectedConnector.getPort(); try { return resolveWithBase(new URI(base), uri); } catch (URISyntaxException e) { throw new IllegalArgumentException("Badly formed URI: " + base, e); } }
Source:
public Response toResponse(TooManyRequestsException exception) { return Response.status(429).build(); }

Target:
public Response toResponse(TooManyRequestsException exception) { return Response.status(HttpStatus.TOO_MANY_REQUESTS_429).build(); }
Source:
protected LevelsClass getListClass() { LevelsClass element = new LevelsClass(); element.fromString(Joiner.on(getSeparator()).join(FluentIterable.from(Arrays.asList( enumType.getEnumConstants())).transform(GET_ACCESS_LEVEL_ENUM_IDENTIFIERS))); return element; }

Target:
protected LevelsClass getListClass() { return new LevelsClass(); }
Source:
public void test() throws Exception { String projectKey = "tsproject"; SonarScanner build = SonarScanner.create() .setProjectKey(projectKey) .setSourceEncoding("UTF-8") .setSourceDirs(".") .setProjectDir(PROJECT_DIR); Tests.setProfile(projectKey, "eslint-based-rules-profile", "ts"); BuildResult result = orchestrator.executeBuild(build); List<Issues.Issue> issuesList = getIssues(projectKey); assertThat(issuesList).hasSize(1); assertThat(issuesList.get(0).getLine()).isEqualTo(2); assertThat(result.getLogsLines(log -> log.contains("Found 1 tsconfig.json files"))).hasSize(1); }

Target:
public void test() throws Exception { String projectKey = "tsproject"; SonarScanner build = SonarScanner.create() .setProjectKey(projectKey) .setSourceEncoding("UTF-8") .setSourceDirs(".") .setProjectDir(PROJECT_DIR); Tests.setProfile(projectKey, "eslint-based-rules-profile", "ts"); BuildResult result = orchestrator.executeBuild(build); List<Issues.Issue> issuesList = getIssues(projectKey); assertThat(issuesList).hasSize(1); assertThat(issuesList.get(0).getLine()).isEqualTo(2); assertThat(result.getLogsLines(log -> log.contains("Found 1 tsconfig.json file(s)"))).hasSize(1); }
Source:
private void disconnect() { if (zkHelixManager != null) { if (runningTasks.size() > 0) { for (int i = 0; i <= PARTICIPANT_SHUTDOWN_GRACE_RETRIES; i++) { logger.info("Shutting down gracefully [RETRY " + i + "]"); try { Thread.sleep(PARTICIPANT_SHUTDOWN_GRACE_PERIOD); } catch (InterruptedException e) { logger.warn("Waiting for running tasks failed [RETRY " + i + "]", e); } if (runningTasks.size() == 0) { break; } } synchronized (runningTasks) { for (AbstractTask runningTask : runningTasks) { logger.warn("Cancelling task with id: " + runningTask.getTaskId() + " forcefully"); runningTask.cancel(); } } } logger.info("Participant: " + participantName + ", has disconnected from cluster: " + clusterName); zkHelixManager.disconnect(); } }

Target:
private void disconnect() { if (zkHelixManager != null) { if (runningTasks.size() > 0) { for (int i = 0; i <= shutdownGraceRetries; i++) { logger.info("Shutting down gracefully [RETRY " + i + "]"); try { Thread.sleep(shutdownGracePeriod); } catch (InterruptedException e) { logger.warn("Waiting for running tasks failed [RETRY " + i + "]", e); } if (runningTasks.size() == 0) { break; } } } logger.info("Participant: " + participantName + ", has disconnected from cluster: " + clusterName); zkHelixManager.disconnect(); } }
Source:
private Map<String, String> getAzureObjectIdMap(Map<String, List<CloudIdentity>> cloudIdentityMapping) { ImmutableMap.Builder<String, String> azureObjectIdMap = ImmutableMap.builder(); cloudIdentityMapping.forEach((key, cloudIdentities) -> { Optional<String> azureObjectId = getOptionalAzureObjectId(cloudIdentities); if (azureObjectId.isPresent()) { azureObjectIdMap.put(key, azureObjectId.get()); } }); return azureObjectIdMap.build(); }

Target:
private Map<String, String> getAzureObjectIdMap(Map<String, List<CloudIdentity>> cloudIdentityMapping) { LOGGER.debug("Exracting Azure Object ID mapping from {}", cloudIdentityMapping); ImmutableMap.Builder<String, String> azureObjectIdMap = ImmutableMap.builder(); cloudIdentityMapping.forEach((key, cloudIdentities) -> { Optional<String> azureObjectId = getOptionalAzureObjectId(cloudIdentities); if (azureObjectId.isPresent()) { azureObjectIdMap.put(key, azureObjectId.get()); } }); return azureObjectIdMap.build(); }
Source:
public void testUDPtoHTTP() throws Exception { Axis2BackEndServerController axis2Server = getAxis2Server(); if (axis2Server == null) { fail("Failed to load the Axis2BackEndServerController"); } assertEquals(0, axis2Server.getMessageCount("SimpleStockQuoteService", "placeOrder")); String addUrl = "udp://localhost:9999?contentType=text/xml"; StockQuoteSampleClient client = getStockQuoteClient(); client.placeOrder(addUrl, null, null, "IBM"); Thread.sleep(2000); assertEquals(1, axis2Server.getMessageCount("SimpleStockQuoteService", "placeOrder")); }

Target:
public void testUDPtoHTTP() throws Exception { String trpUrl = "udp://localhost:9999?contentType=text/xml"; StockQuoteSampleClient client = getStockQuoteClient(); SampleClientResult result = client.placeOrder(null, trpUrl, null, "IBM"); assertResponseReceived(result); }
Source:
public void waitForInitialRemoteData_readOnlyFalse_upgradeSchema() { SyncCredentials credentials = SyncCredentials.usernamePassword(UUID.randomUUID().toString(), "password", true); SyncUser user = SyncUser.login(credentials, Constants.AUTH_URL); final SyncConfiguration config = configurationFactory.createSyncConfigurationBuilder(user, Constants.USER_REALM) .waitForInitialRemoteData(false) .schema(StringOnly.class) .schemaVersion(2) .build(); assertFalse(config.realmExists()); Realm realm = Realm.getInstance(config); try { assertEquals(0, realm.where(StringOnly.class).count()); } finally { realm.close(); user.logout(); } }

Target:
public void waitForInitialRemoteData_readOnlyFalse_upgradeSchema() { SyncCredentials credentials = SyncCredentials.usernamePassword(UUID.randomUUID().toString(), "password", true); SyncUser user = SyncUser.login(credentials, Constants.AUTH_URL); final SyncConfiguration config = configurationFactory.createSyncConfigurationBuilder(user, Constants.USER_REALM) .waitForInitialRemoteData() .schema(StringOnly.class) .schemaVersion(2) .build(); assertFalse(config.realmExists()); Realm realm = Realm.getInstance(config); try { assertEquals(0, realm.where(StringOnly.class).count()); } finally { realm.close(); user.logout(); } }
Source:
private String[] getApiRecordPath() { if (!API_BASEURL.equals(api2BaseUrl)) { return new String[]{"api", "v2"}; } else { return new String[]{}; } }

Target:
private String[] getApiRecordPath() { if (!API_BASEURL.equals(getApi2BaseUrl())) { return new String[]{"api", "v2"}; } else { return new String[]{}; } }
Source:
public void assertContainsExactly(AssertionInfo info, CharSequence actual, CharSequence[] values) { doCommonCheckForCharSequence(info, actual, values); List<String> actualAsList = splitCharSequencesToListOfElements(actual); List<String> valuesAsList = splitCharSequencesToListOfElements(values); if (actualAsList.size() != valuesAsList.size()) { throw failures.failure(info, shouldHaveSameSizeAs(actual, actualAsList.size(), valuesAsList.size())); } IterableDiff diff = diff(actualAsList, valuesAsList, comparisonStrategy); if (!diff.differencesFound()) { checkIdenticalElementsAreInSameOrder(info, actualAsList, valuesAsList); return; } throw failures .failure(info, shouldContainExactly(actual, asList(values), diff.missing, diff.unexpected, comparisonStrategy)); }

Target:
public void assertContainsExactly(AssertionInfo info, CharSequence actual, CharSequence[] values) { doCommonCheckForCharSequence(info, actual, values); List<String> actualAsList = splitCharSequencesToListOfElements(actual); List<String> valuesAsList = splitCharSequencesToListOfElements(values); IterableDiff diff = diff(actualAsList, valuesAsList, comparisonStrategy); if (!diff.differencesFound()) { checkIdenticalElementsAreInSameOrder(info, actualAsList, valuesAsList); return; } throw failures .failure(info, shouldContainExactly(actual, asList(values), diff.missing, diff.unexpected, comparisonStrategy)); }
Source:
public String process(String markupContent) { StringBuilder processedMarkup = new StringBuilder(markupContent.length()); LocationTrackingReader reader = new LocationTrackingReader(new StringReader(markupContent)); String line; try { line = reader.readLine(); while (line != null) { Matcher matcher = ATTRIBUTE_PATTERN.matcher(line); if (matcher.matches()) { String key = matcher.group(1); String value = matcher.group(2); if (value != null) { value = value.trim(); } attributes.put(key, value); } else { Matcher attrref = ATTRIBUTE_TOKEN_PATTERN.matcher(line); int offset = 0; while (attrref.find()) { String postfix = line.substring(offset, attrref.start()); if (postfix.endsWith("\\")) { processedMarkup.append(postfix.substring(0, postfix.length()-1)); offset = attrref.start(); } else { processedMarkup.append(postfix); String key = attrref.group(1); String value = attributes.get(key); if (value == null) { value = attrref.group(0); } processedMarkup.append(value); offset = attrref.end(); } } if (offset < line.length()) { processedMarkup.append(line.substring(offset)); } processedMarkup.append("\n"); } line = reader.readLine(); } reader.close(); } catch (IOException e) { throw new IllegalStateException(e); } return processedMarkup.toString(); }

Target:
public String process(String markupContent) { Map<String, String> attributes = new HashMap<String, String>(); StringBuilder processedMarkup = new StringBuilder(markupContent.length()); LocationTrackingReader reader = new LocationTrackingReader(new StringReader(markupContent)); String line; try { line = reader.readLine(); while (line != null) { Matcher matcher = ATTRIBUTE_PATTERN.matcher(line); if (matcher.matches()) { String key = matcher.group(1); String value = matcher.group(2); if (value != null) { value = value.trim(); } attributes.put(key, value); } else { Matcher attrref = ATTRIBUTE_TOKEN_PATTERN.matcher(line); int offset = 0; while (attrref.find()) { String postfix = line.substring(offset, attrref.start()); if (postfix.endsWith("\\")) { processedMarkup.append(postfix.substring(0, postfix.length() - 1)); offset = attrref.start(); } else { processedMarkup.append(postfix); String key = attrref.group(1); String value = attributes.get(key); if (value == null) { value = attrref.group(0); } processedMarkup.append(value); offset = attrref.end(); } } if (offset < line.length()) { processedMarkup.append(line.substring(offset)); } processedMarkup.append("\n"); } line = reader.readLine(); } reader.close(); } catch (IOException e) { throw new IllegalStateException(e); } return processedMarkup.toString(); }
Source:
@Override public void setOnMarkerClickListener(final OnMapMarkerClickListener listener) { googleMap.setOnMarkerClickListener(new GoogleMap.OnMarkerClickListener() { @Override public boolean onMarkerClick(Marker marker) { AirMapMarker<?> airMarker = markers.get(marker); if (airMarker != null) { listener.onMapMarkerClick(airMarker); } return listener.onMakerClickEventIsHandled(); } }); }

Target:
@Override public void setOnMarkerClickListener(final OnMapMarkerClickListener listener) { googleMap.setOnMarkerClickListener(new GoogleMap.OnMarkerClickListener() { @Override public boolean onMarkerClick(Marker marker) { AirMapMarker<?> airMarker = markers.get(marker); if (airMarker != null) { return listener.onMapMarkerClick(airMarker); } return false; } }); }