auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public InputStream getData() { switch (this.getUri().getScheme()) { case "http": case "https": try { final HttpURLConnection conn = (HttpURLConnection) this.uri.toURL().openConnection(); conn.setRequestMethod("GET"); this.headers.forEach(conn::setRequestProperty); conn.connect(); return conn.getInputStream(); } catch (final IOException e) { throw new RuntimeIOException("Could not retrieve data from block", e); } case "data": final String dataUri = this.uri.toString(); if (!dataUri.matches("^data:.*;base64,.*")) { throw new IllegalArgumentException("data URI must be base64 encoded: " + dataUri); } return new ByteArrayInputStream( Base64.getDecoder().decode(dataUri.replaceFirst("^data:.*;base64,", ""))); default: throw new IllegalArgumentException("Unrecognized URI scheme in data block: " + this.uri.getScheme()); } }

Target:
public InputStream getData() { switch (this.getUri().getScheme()) { case "http": case "https": try { final HttpURLConnection conn = (HttpURLConnection) this.uri.toURL().openConnection(); conn.setRequestMethod("GET"); this.headers.forEach(conn::setRequestProperty); conn.connect(); return conn.getInputStream(); } catch (final IOException e) { throw new RuntimeIOException("Could not retrieve data from block", e); } case "data": final String dataUri = this.uri.toString(); if (!dataUri.matches("^data:.*;base64,.*")) { throw new HtsgetMalformedResponseException("data URI must be base64 encoded: " + dataUri); } return new ByteArrayInputStream( Base64.getDecoder().decode(dataUri.replaceFirst("^data:.*;base64,", ""))); default: throw new HtsgetMalformedResponseException("Unrecognized URI scheme in data block: " + this.uri.getScheme()); } }
Source:
private void showHideJoinDashPayAction() { final Coin walletBalance = wallet.getBalance(Wallet.BalanceType.ESTIMATED); boolean canAffordIt = walletBalance.isGreaterThan(Constants.DASH_PAY_FEE) || walletBalance.equals(Constants.DASH_PAY_FEE); boolean visible = true ; joinDashPayAction.setVisibility(visible ? View.VISIBLE : View.GONE); findViewById(R.id.join_dashpay_action_space).setVisibility(joinDashPayAction.getVisibility()); }

Target:
private void showHideJoinDashPayAction() { if (syncComplete) { final Coin walletBalance = wallet.getBalance(Wallet.BalanceType.ESTIMATED); boolean canAffordIt = walletBalance.isGreaterThan(Constants.DASH_PAY_FEE) || walletBalance.equals(Constants.DASH_PAY_FEE); boolean visible = canAffordIt && config.getShowJoinDashPay(); joinDashPayAction.setVisibility(visible ? View.VISIBLE : View.GONE); } else { joinDashPayAction.setVisibility(View.GONE); } findViewById(R.id.join_dashpay_action_space).setVisibility(joinDashPayAction.getVisibility()); }
Source:
public Brand createOrUpdateBrand(ModelWithPayload<String> uriWithPayload) { String uri = uriWithPayload.getModel(); Object payload = (uriWithPayload.getPayload() != null) ? uriWithPayload.getPayload() : ""; Preconditions.checkArgument(canFetch(uri), "Cannot fetch C4 uri: %s as it is not in the expected format: %s",uri, BRAND_PAGE_PATTERN.toString()); try { log.info("Fetching C4 brand " + uri); Optional<Feed> source = feedClient.brandFeed(uri); if (source.isPresent()) { BrandSeriesAndEpisodes brandHierarchy = extractor.extract(source.get()); Brand brand = resolveAndUpdate(brandHierarchy.getBrand()); checkUri(brand); checkSource(brand); writer.createOrUpdate(brand, payload); write(brandHierarchy.getSeriesAndEpisodes(), brand); return brandHierarchy.getBrand(); } throw new FetchException("Failed to fetch " + uri); } catch (Exception e) { throw new RuntimeException(e); } }

Target:
public Brand createOrUpdateBrand(ModelWithPayload<String> uriWithPayload) { String uri = uriWithPayload.getModel(); Preconditions.checkArgument(canFetch(uri), "Cannot fetch C4 uri: %s as it is not in the expected format: %s",uri, BRAND_PAGE_PATTERN.toString()); try { log.info("Fetching C4 brand " + uri); Optional<Feed> source = feedClient.brandFeed(uri); if (source.isPresent()) { BrandSeriesAndEpisodes brandHierarchy = extractor.extract(source.get()); Brand brand = resolveAndUpdate(brandHierarchy.getBrand()); checkUri(brand); checkSource(brand); writer.createOrUpdate(brand, uriWithPayload.getPayload()); write(brandHierarchy.getSeriesAndEpisodes(), brand); return brandHierarchy.getBrand(); } throw new FetchException("Failed to fetch " + uri); } catch (Exception e) { throw new RuntimeException(e); } }
Source:
private Optional<RequestConfig> addJerseyRequestConfig(Configuration configuration) { RequestConfig.Builder requestConfig = RequestConfig.copy(client.getDefaultRequestConfig()); boolean modified = false; final Integer timeout = (Integer) configuration.getProperty(ClientProperties.READ_TIMEOUT); if (timeout != null) { requestConfig.setSocketTimeout(timeout); modified = true; } final Integer connectTimeout = (Integer) configuration.getProperty(ClientProperties.CONNECT_TIMEOUT); if (connectTimeout != null) { requestConfig.setConnectTimeout(connectTimeout); modified = true; } final Boolean followRedirects = (Boolean) configuration.getProperty(ClientProperties.FOLLOW_REDIRECTS); if (followRedirects != null) { requestConfig.setRedirectsEnabled(followRedirects); modified = true; } if (modified) { return Optional.of(requestConfig.build()); } return Optional.absent(); }

Target:
private Optional<RequestConfig> addJerseyRequestConfig(Configuration configuration) { final Integer timeout = (Integer) configuration.getProperty(ClientProperties.READ_TIMEOUT); final Integer connectTimeout = (Integer) configuration.getProperty(ClientProperties.CONNECT_TIMEOUT); final Boolean followRedirects = (Boolean) configuration.getProperty(ClientProperties.FOLLOW_REDIRECTS); if (timeout != null || connectTimeout != null || followRedirects != null) { RequestConfig.Builder requestConfig = RequestConfig.copy(defaultRequestConfig); if (timeout != null) { requestConfig.setSocketTimeout(timeout); } if (connectTimeout != null) { requestConfig.setConnectTimeout(connectTimeout); } if (followRedirects != null) { requestConfig.setRedirectsEnabled(followRedirects); } return Optional.of(requestConfig.build()); } return Optional.absent(); }
Source:
public void setCellDataValueByPosition(final int row, final int col, final String text) { assertIsLegalCell(row, col); assertNotNull(text); waitForEnabled(); if (hasStyle(widget, SWT.READ_ONLY)) throw new RuntimeException("This Nattable is read-only."); asyncExec(new VoidResult() { public void run() { click(row, col); ICellEditor editor = widget.getActiveCellEditor(); editor.setEditorValue(text); } }); notify(SWT.Modify); }

Target:
public void setCellDataValueByPosition(final int row, final int col, final String text) { assertIsLegalCell(row, col); Assert.isNotNull(text); waitForEnabled(); Assert.isTrue(hasStyle(widget, SWT.READ_ONLY)); asyncExec(new VoidResult() { public void run() { click(row, col); ICellEditor editor = widget.getActiveCellEditor(); editor.setEditorValue(text); } }); notify(SWT.Modify); }
Source:
private void validatePage() { String message = null; if (userText.getText().trim().length() == 0) message = Messages.CredentialsWizardPage_ErrorUser; if (message == null && passwordText.getText().trim().length() == 0) message = Messages.CredentialsWizardPage_ErrorPassword; setErrorMessage(message); setPageComplete(message == null); }

Target:
private void validatePage() { String message = null; if (userText.getText().trim().isEmpty()) { message = Messages.CredentialsWizardPage_ErrorUser; } else if (passwordText.getText().trim().isEmpty()) { message = Messages.CredentialsWizardPage_ErrorPassword; } setErrorMessage(message); setPageComplete(message == null); }
Source:
private static void alignStreamNode(StreamNode streamNode, StreamGraph streamGraph) { if (streamNode.getOperatorName().equals(KEYED_STREAM_VALUE_OPERATOR_NAME)) { StreamEdge downStreamEdge = streamNode.getOutEdges().get(0); StreamNode downStreamNode = streamGraph.getStreamNode(downStreamEdge.getTargetId()); downStreamEdge.setPartitioner(new ForwardPartitioner()); streamNode.setParallelism(downStreamNode.getParallelism()); streamNode.setCoLocationGroup(downStreamNode.getCoLocationGroup()); streamNode.setSlotSharingGroup(downStreamNode.getSlotSharingGroup()); } if (streamNode.getOperatorName().equals(STREAM_KEY_BY_MAP_OPERATOR_NAME)) { StreamEdge upStreamEdge = streamNode.getInEdges().get(0); StreamNode upStreamNode = streamGraph.getStreamNode(upStreamEdge.getSourceId()); upStreamEdge.setPartitioner(new ForwardPartitioner<>()); streamNode.setParallelism(upStreamNode.getParallelism()); streamNode.setSlotSharingGroup(upStreamNode.getSlotSharingGroup()); streamNode.setCoLocationGroup(upStreamNode.getCoLocationGroup()); } }

Target:
private static void alignStreamNode(StreamNode streamNode, StreamGraph streamGraph) { if (streamNode.getOperatorName().equals(KEYED_STREAM_VALUE_OPERATOR_NAME)) { StreamEdge downStreamEdge = streamNode.getOutEdges().get(0); StreamNode downStreamNode = streamGraph.getStreamNode(downStreamEdge.getTargetId()); chainStreamNode(downStreamEdge, streamNode, downStreamNode); downStreamEdge.setPartitioner(new ForwardPartitioner()); } if (streamNode.getOperatorName().equals(STREAM_KEY_BY_MAP_OPERATOR_NAME)) { StreamEdge upStreamEdge = streamNode.getInEdges().get(0); StreamNode upStreamNode = streamGraph.getStreamNode(upStreamEdge.getSourceId()); chainStreamNode(upStreamEdge, streamNode, upStreamNode); } }
Source:
static Optional<DataType> findDataType( CallContext callContext, boolean throwOnFailure, DataType actualDataType, LogicalTypeRoot expectedRoot, @Nullable Boolean expectedNullability) { final LogicalType actualType = actualDataType.getLogicalType(); return Optional.ofNullable(findDataTypeOfRoot(actualDataType, expectedRoot)) .map(newDataType -> { if (Objects.equals(expectedNullability, Boolean.TRUE)) { return newDataType.nullable(); } else if (Objects.equals(expectedNullability, Boolean.FALSE)) { return newDataType.notNull(); } return newDataType; }) .map(newDataType -> { final Class<?> clazz = actualDataType.getConversionClass(); final LogicalType newType = newDataType.getLogicalType(); if (newType.supportsInputConversion(clazz)) { return newDataType.bridgedTo(clazz); } return newDataType; }) .filter(newDataType -> { if (supportsImplicitCast(actualType, newDataType.getLogicalType())) { return true; } if (throwOnFailure) { throw callContext.newValidationError( "Unsupported argument type. Expected type root '%s' but actual type was '%s'.", expectedRoot, actualType); } return false; }); }

Target:
static Optional<DataType> findDataType( CallContext callContext, boolean throwOnFailure, DataType actualDataType, LogicalTypeRoot expectedRoot, @Nullable Boolean expectedNullability) { final LogicalType actualType = actualDataType.getLogicalType(); return Optional.ofNullable(findDataTypeOfRoot(actualDataType, expectedRoot)) .map(newDataType -> { if (Objects.equals(expectedNullability, Boolean.TRUE)) { return newDataType.nullable(); } else if (Objects.equals(expectedNullability, Boolean.FALSE)) { return newDataType.notNull(); } else if (actualType.isNullable()) { return newDataType.nullable(); } return newDataType.notNull(); }) .map(newDataType -> { final Class<?> clazz = actualDataType.getConversionClass(); final LogicalType newType = newDataType.getLogicalType(); if (newType.supportsOutputConversion(clazz)) { return newDataType.bridgedTo(clazz); } return newDataType; }) .filter(newDataType -> { if (supportsImplicitCast(actualType, newDataType.getLogicalType())) { return true; } if (throwOnFailure) { throw callContext.newValidationError( "Unsupported argument type. Expected type root '%s' but actual type was '%s'.", expectedRoot, actualType); } return false; }); }
Source:
public void testGroupInheritance() { SuperCar superCar = new SuperCar( "Morris", "DD-AB-123", 1 ); Set<String> messages = getMessages( validator.validate( superCar ) ); assertTrue( messages.contains( "must be greater than or equal to 2" ) ); messages = getMessages( validator.validate( superCar, RaceCarChecks.class ) ); assertTrue( messages.contains( "must be greater than or equal to 2" ) ); assertTrue( messages.contains( "Race car must have a safety belt" ) ); }

Target:
public void testGroupInheritance() { SuperCar superCar = new SuperCar( "Morris", "DD-AB-123", 1 ); assertEquals( "must be greater than or equal to 2", validator.validate( superCar ).iterator().next().getMessage() ); Iterator<ConstraintViolation<SuperCar>> iterator = validator.validate( superCar, RaceCarChecks.class ).iterator(); assertEquals( "Race car must have a safety belt", iterator.next().getMessage() ); assertEquals( "must be greater than or equal to 2", iterator.next().getMessage() ); }
Source:
private Map<String, String> extractOptions(URI dsnUri) { String query = dsnUri.getQuery(); if (query == null || query.isEmpty()) return Collections.emptyMap(); Map<String, String> queryOptions = new HashMap<>(); for (String optionPair : query.split("&")) { try { String[] pairDetails = optionPair.split("="); String key = URLDecoder.decode(pairDetails[0], "UTF-8"); String value = pairDetails.length > 1 ? URLDecoder.decode(pairDetails[1], "UTF-8") : null; queryOptions.put(key, value); } catch (UnsupportedEncodingException e) { throw new IllegalArgumentException("Impossible to decode the query parameter '" + optionPair + "'", e); } } return queryOptions; }

Target:
private static Map<String, String> extractOptions(URI dsnUri) { String query = dsnUri.getQuery(); if (query == null || query.isEmpty()) return Collections.emptyMap(); Map<String, String> queryOptions = new HashMap<>(); for (String optionPair : query.split("&")) { try { String[] pairDetails = optionPair.split("="); String key = URLDecoder.decode(pairDetails[0], "UTF-8"); String value = pairDetails.length > 1 ? URLDecoder.decode(pairDetails[1], "UTF-8") : null; queryOptions.put(key, value); } catch (UnsupportedEncodingException e) { throw new IllegalArgumentException("Impossible to decode the query parameter '" + optionPair + "'", e); } } return queryOptions; }
Source:
private FileMetadata putSingleFile(File inputFile, String dropboxPath, DropboxUploadMode mode) throws Exception { FileInputStream inputStream = new FileInputStream(inputFile); FileMetadata uploadedFile; try { WriteMode uploadMode; if (mode == DropboxUploadMode.force) { uploadMode = WriteMode.OVERWRITE; } else { uploadMode = WriteMode.ADD; } uploadedFile = client.files().upload(dropboxPath).uploadAndFinish(inputStream, inputFile.length()); return uploadedFile; } finally { IOHelper.close(inputStream); } }

Target:
private FileMetadata putSingleFile(File inputFile, String dropboxPath, DropboxUploadMode mode) throws Exception { FileInputStream inputStream = new FileInputStream(inputFile); FileMetadata uploadedFile; try { WriteMode uploadMode; if (mode == DropboxUploadMode.force) { uploadMode = WriteMode.OVERWRITE; } else { uploadMode = WriteMode.ADD; } uploadedFile = client.files().uploadBuilder(dropboxPath).withMode(uploadMode).uploadAndFinish(inputStream, inputFile.length()); return uploadedFile; } finally { IOHelper.close(inputStream); } }
Source:
public void checkIPAdress() { Set<ConstraintViolation<VmNic>> validate = validator.validate(createVmNic(), groups); assertEquals(validMacAddress, validate.isEmpty()); if (validMacAddress) { assertTrue(validate.isEmpty()); } else { assertEquals(1, validate.size()); assertTrue(validate.iterator().next().getMessage().equals(message)); } }

Target:
public void checkIPAdress() { Set<ConstraintViolation<VmNic>> validate = validator.validate(createVmNic(), groups); assertEquals(validMacAddress, validate.isEmpty()); if (validMacAddress) { assertTrue(validate.isEmpty()); } else { assertEquals(1, validate.size()); assertEquals(message, validate.iterator().next().getMessage()); } }
Source:
public static Map<String,Set<String>> addTagToTags(Map<String, Set<String>> tags, String name, String value) { if(tags == null){ tags = new HashMap<>(); } Set<String> values; if(!tags.containsKey(name)){ values = new HashSet<>(); }else{ values = tags.get(name); } values.add(value); tags.put(name, values); return tags; }

Target:
public static Map<String,Set<String>> addTagToTags(Map<String, Set<String>> tags, String name, String value) { if(tags == null){ tags = new HashMap<>(); } if(!tags.containsKey(name)){ tags.put(name, new HashSet<>()); } tags.get(name).add(value); return tags; }
Source:
private static Object getValueFromRow(final Row row, final String column) { if (column.equals(ColumnHolder.TIME_COLUMN_NAME)) { return row.getTimestampFromEpoch(); } else { Object raw = row.getRaw(column); if (raw instanceof List) { return ExpressionSelectors.coerceListDimToStringArray((List) raw); } return raw; } }

Target:
private static Object getValueFromRow(final Row row, final String column) { if (column.equals(ColumnHolder.TIME_COLUMN_NAME)) { return row.getTimestampFromEpoch(); } else { Object raw = row.getRaw(column); if (raw instanceof List) { return ExpressionSelectors.coerceListToArray((List) raw); } return raw; } }
Source:
public SyncHash.Tree getTreeHash(@Context UriInfo uriInfo) throws Exception { CanonicalPath path = CanonicalPath.fromPartiallyUntypedString(getPath(uriInfo, "/treeHash".length()), getTenantPath(), AbstractElement.class); if (path.getSegment().getElementType() == SegmentType.e) { throw new BadRequestException("Cannot get treeHash for environment"); } return inventory.inspect(path, Synced.Single.class).treeHash(); }

Target:
public SyncHash.Tree getTreeHash(@Context UriInfo uriInfo) throws Exception { CanonicalPath path = CanonicalPath.fromPartiallyUntypedString(getPath(uriInfo, "/treeHash".length()), getTenantPath(), AbstractElement.class); Class<?> eltType = Inventory.types().byPath(path).getElementType(); if (!Syncable.class.isAssignableFrom(eltType)) { throw new BadRequestException("Element not syncable - cannot get treeHash for path " + path); } return inventory.inspect(path, Synced.Single.class).treeHash(); }
Source:
public static Map<SimpleString, Consumer> groupMap(int groupBuckets) { if (groupBuckets == -1) { return new HashMap<>(); } else if (groupBuckets == 0) { return new NoOpMap<>(); } else { return new BucketMap<>(groupBuckets); } }

Target:
public static MessageGroups<Consumer> groupMap(int groupBuckets) { if (groupBuckets == -1) { return new SimpleMessageGroups<>(); } else if (groupBuckets == 0) { return DisabledMessageGroups.instance(); } else { return new BucketMessageGroups<>(groupBuckets); } }
Source:
public static BinLogPositionSourceOffset parse(String offset) { String[] a = offset.split(":"); String filename = a[0]; long position = Long.valueOf(a[1]); return new BinLogPositionSourceOffset(filename, position); }

Target:
public static BinLogPositionSourceOffset parse(String offset) { String[] a = offset.split(":"); String filename = a[0]; long position = Long.parseLong(a[1]); return new BinLogPositionSourceOffset(filename, position); }
Source:
public AppiumParallelMethodTestListener() throws Exception { try { reportManager = new ReportManager(); appiumServerManager = new AppiumServerManager(); prop = ConfigFileManager.getInstance(); deviceAllocationManager = DeviceAllocationManager.getInstance(); appiumDriverManager = new AppiumDriverManager(); mongoDbUrl = CapabilityManager.getInstance() .getMongoDbHostAndPort().get("atdHost"); mongoDbPort = CapabilityManager.getInstance() .getMongoDbHostAndPort().get("atdPort"); } catch (IOException e) { e.printStackTrace(); } }

Target:
public AppiumParallelMethodTestListener() throws Exception { try { reportManager = new ReportManager(); appiumServerManager = new AppiumServerManager(); deviceAllocationManager = DeviceAllocationManager.getInstance(); appiumDriverManager = new AppiumDriverManager(); atdHost = CapabilityManager.getInstance() .getMongoDbHostAndPort().get("atdHost"); atdPort = CapabilityManager.getInstance() .getMongoDbHostAndPort().get("atdPort"); } catch (IOException e) { e.printStackTrace(); } }
Source:
protected void handleGroupedCounterAspect(ITmfEvent event, ITmfStateSystemBuilder ss, CounterAspect aspect, int rootQuark) { int quark = rootQuark; for (Class<? extends ITmfEventAspect<?>> groupClass : aspect.getGroups()) { ITmfEventAspect<?> groupAspect = TmfTraceUtils.getEventAspectOfClassForEvent(event.getTrace(), Objects.requireNonNull(groupClass), event); if (groupAspect != null) { quark = ss.getQuarkRelativeAndAdd(quark, groupClass.getName()); quark = ss.getQuarkRelativeAndAdd(quark, String.valueOf(groupAspect.resolve(event))); } } handleCounterAspect(event, ss, aspect, quark); }

Target:
protected void handleGroupedCounterAspect(ITmfEvent event, ITmfStateSystemBuilder ss, CounterAspect aspect, int rootQuark) { int quark = rootQuark; for (Class<? extends ITmfEventAspect<?>> groupClass : aspect.getGroups()) { ITmfEventAspect<?> parentAspect = fAspectImpls.get(groupClass); if (parentAspect != null) { quark = ss.getQuarkRelativeAndAdd(quark, parentAspect.getName()); quark = ss.getQuarkRelativeAndAdd(quark, String.valueOf(parentAspect.resolve(event))); } } handleCounterAspect(event, ss, aspect, quark); }
Source:
public MockitoSessionBuilder strictness(Strictness strictness) { if (strictness==null){ strictness = STRICT_STUBS; } this.strictness = strictness; return this; }

Target:
public MockitoSessionBuilder strictness(Strictness strictness) { this.strictness = strictness; return this; }
Source:
public void end() { if (isInTransaction()) { if (transactionType().equals(WRITE)) { log.warn("end() called for WRITE transaction without commit or abort having been called causing a forced abort"); _abort() ; } finishTransaction(); return ; } }

Target:
public void end() { if (isInTransaction()) { if (transactionType().equals(WRITE)) { log.warn("end() called for WRITE transaction without commit or abort having been called causing a forced abort"); _abort() ; } else { _end() ; } finishTransaction(); } }
Source:
public Boolean getIsDeleted() { return isDeleted; }

Target:
public boolean getIsDeleted() { return isDeleted; }
Source:
public void writeData(ObjectDataOutput out) throws IOException { out.writeLong(creationTime); out.writeLong(expirationTime); out.writeLong(lastAccessTime); out.writeLong(accessHit); out.writeData(key); out.writeData(value); if (out.getVersion().isGreaterOrEqual(Version.of("3.11"))) { out.writeData(expiryPolicy); } }

Target:
public void writeData(ObjectDataOutput out) throws IOException { out.writeLong(creationTime); out.writeLong(expirationTime); out.writeLong(lastAccessTime); out.writeLong(accessHit); out.writeData(key); out.writeData(value); if (out.getVersion().isGreaterOrEqual(Versions.V3_11)) { out.writeData(expiryPolicy); } }
Source:
public DatalakeDrStatusResponse getRestoreStatusByRestoreId(String datalakeName, String restoreId, String actorCrn) { checkNotNull(datalakeName); checkNotNull(actorCrn); checkNotNull(restoreId); actorCrn = "crn:altus:iam:us-west-1:9d74eee4-1cad-45d7-b645-7ccf9edbb73d:user:8d1e890c-8a2e-4cf9-96bd-d50478bc027e"; datalakeName = "biglauer-az-dr-4-dl"; try (ManagedChannelWrapper channelWrapper = makeWrapper()) { RestoreDatalakeStatusRequest.Builder builder = RestoreDatalakeStatusRequest.newBuilder() .setDatalakeName(datalakeName); return statusConverter.convert( newStub(channelWrapper.getChannel(), UUID.randomUUID().toString(), actorCrn) .restoreDatalakeStatus(builder.build()) ); } }

Target:
public DatalakeDrStatusResponse getRestoreStatusByRestoreId(String datalakeName, String restoreId, String actorCrn) { if (!datalakeDrConfig.isConfigured()) { return missingConnectorResponse(); } checkNotNull(datalakeName); checkNotNull(actorCrn); checkNotNull(restoreId); try (ManagedChannelWrapper channelWrapper = makeWrapper()) { RestoreDatalakeStatusRequest.Builder builder = RestoreDatalakeStatusRequest.newBuilder() .setDatalakeName(datalakeName) .setRestoreId(restoreId); return statusConverter.convert( newStub(channelWrapper.getChannel(), UUID.randomUUID().toString(), actorCrn) .restoreDatalakeStatus(builder.build()) ); } }
Source:
private void logSkippedTypes() { List<Type> skippedTypes = getSkippedTypes(); if (skippedTypes.isEmpty()) { return; } List<String> skippedTypesAsStrings = skippedTypes.stream().map(Type::toString).collect(Collectors.toList()); getLog().info("Formatting is skipped for types: " + String.join(", ", skippedTypesAsStrings)); }

Target:
private void logSkippedTypes() { List<Type> skippedTypes = getSkippedTypes(); if (skippedTypes.isEmpty()) { return; } String skippedTypesStr = skippedTypes.stream().map(Type::toString).collect(Collectors.joining(", ")); getLog().info("Formatting is skipped for types: " + skippedTypesStr); }
Source:
public @NonNull PersistedList<BranchSource> getSourcesList() { return sources; }

Target:
public PersistedList<BranchSource> getSourcesList() { return sources; }
Source:
public RxDocumentServiceResponse(StoreResponse response) { String[] headerNames = response.getResponseHeaderNames(); String[] headerValues = response.getResponseHeaderValues(); this.headersMap = new HttpHeaders(); for (int i = 0; i < headerNames.length; i++) { headersMap.put(headerNames[i], headerValues[i]); } this.statusCode = response.getStatus(); this.storeResponse = response; }

Target:
public RxDocumentServiceResponse(StoreResponse response) { this.statusCode = response.getStatus(); this.storeResponse = response; this.headersMap = response.getHeaders(); }
Source:
public static GlusterBrickEntity findBrick(Collection<GlusterBrickEntity> bricks, Guid serverId, String brickDir) { for (GlusterBrickEntity brick : bricks) { if (brick.getServerId() != null && brick.getServerId().equals(serverId) && brick.getBrickDirectory().equals(brickDir)) { return brick; } } return null; }

Target:
public static GlusterBrickEntity findBrick(Collection<GlusterBrickEntity> bricks, Guid serverId, String brickDir) { for (GlusterBrickEntity brick : bricks) { if (Objects.equals(brick.getServerId(), serverId) && brick.getBrickDirectory().equals(brickDir)) { return brick; } } return null; }
Source:
protected RemoteCallback<List<String>> getRemoteCallback(Consumer<List<KieAssetsDropdownItem>> assetListConsumer) { return response -> { List<KieAssetsDropdownItem> toAccept = response.stream() .map(this::getKieAssetsDropdownItem) .filter(this::filterTargetDirectory) .sorted(Comparator.comparing(KieAssetsDropdownItem::getText, String.CASE_INSENSITIVE_ORDER)) .collect(Collectors.toList()); assetListConsumer.accept(toAccept); }; }

Target:
protected RemoteCallback<List<String>> getRemoteCallback(Consumer<List<KieAssetsDropdownItem>> assetListConsumer) { return response -> { List<KieAssetsDropdownItem> toAccept = response.stream() .map(this::getKieAssetsDropdownItem) .sorted(Comparator.comparing(KieAssetsDropdownItem::getText, String.CASE_INSENSITIVE_ORDER)) .collect(Collectors.toList()); assetListConsumer.accept(toAccept); }; }
Source:
private static ValueMismatch of(Message expected, Message actual, Message newValue, int version) { checkNotNull(expected); checkNotNull(actual); checkNotNull(newValue); final ValueMismatch.Builder builder = ValueMismatch.newBuilder() .setExpected(pack(expected)) .setActual(pack(actual)) .setNewValue(pack(newValue)) .setVersion(version); return builder.build(); }

Target:
private static ValueMismatch of(Message expected, Message actual, Message newValue, int version) { final ValueMismatch.Builder builder = ValueMismatch.newBuilder() .setExpected(pack(expected)) .setActual(pack(actual)) .setNewValue(pack(newValue)) .setVersion(version); return builder.build(); }
Source:
private static StringBuilder getQueryFilteringExpression(boolean hasUser, boolean hasTag, boolean hasDateFrom, boolean hasDateTo, SortSpecifierContainer sortParams) { StringBuilder result = new StringBuilder(); result.append("T.jobData.removedTime = -1 "); if (hasDateFrom && hasDateTo) { result.append("and ( ( startTime >= :dateFrom and startTime <= :dateTo ) " + "or ( scheduledTime >= :dateFrom and scheduledTime <= :dateTo ) " + "or ( finishedTime >= :dateFrom and finishedTime <= :dateTo ) ) "); } else if (hasDateFrom && !hasDateTo) { result.append("and ( startTime >= :dateFrom or finishedTime >= :dateFrom or scheduledTime >= :dateFrom ) "); } else if (!hasDateFrom && hasDateTo) { result.append("and ( startTime <= :dateTo or finishedTime <= :dateTo or scheduledTime >= :dateTo ) "); } else { } if (hasUser) { result.append("and T.jobData.owner = :user "); } if (hasTag) { result.append("and tag = :taskTag "); } result.append("and taskStatus in (:taskStatus) "); if (sortParams != null && !sortParams.getSortParameters().isEmpty()) { result.append("order by "); List<SortSpecifierContainer.SortSpecifierItem> items = sortParams.getSortParameters(); for (int i = 0; i < items.size(); i++) { SortSpecifierContainer.SortSpecifierItem item = items.get(i); String order = "ascending".compareTo(item.getOrder().toString()) == 0 ? "ASC" : "DESC"; result.append("T." + item.getField() + " " + order); if (i < items.size() - 1) result.append(","); } result.append(" "); } return result; }

Target:
private static StringBuilder getQueryFilteringExpression(boolean hasUser, boolean hasTag, boolean hasDateFrom, boolean hasDateTo, SortSpecifierContainer sortParams) { StringBuilder result = new StringBuilder(); result.append("T.jobData.removedTime = -1 "); if (hasDateFrom && hasDateTo) { result.append("and ( ( startTime >= :dateFrom and startTime <= :dateTo ) " + "or ( scheduledTime >= :dateFrom and scheduledTime <= :dateTo ) " + "or ( finishedTime >= :dateFrom and finishedTime <= :dateTo ) ) "); } else if (hasDateFrom && !hasDateTo) { result.append("and ( startTime >= :dateFrom or finishedTime >= :dateFrom or scheduledTime >= :dateFrom ) "); } else if (!hasDateFrom && hasDateTo) { result.append("and ( startTime <= :dateTo or finishedTime <= :dateTo or scheduledTime >= :dateTo ) "); } else { } if (hasUser) { result.append("and T.jobData.owner = :user "); } if (hasTag) { result.append("and tag = :taskTag "); } result.append("and taskStatus in (:taskStatus) "); if (!sortParams.getSortParameters().isEmpty()) { result.append("order by "); List<SortSpecifierContainer.SortSpecifierItem> items = sortParams.getSortParameters(); for (int i = 0; i < items.size(); i++) { SortSpecifierContainer.SortSpecifierItem item = items.get(i); String order = "ascending".compareTo(item.getOrder().toString()) == 0 ? "ASC" : "DESC"; result.append("T." + item.getField() + " " + order); if (i < items.size() - 1) result.append(","); } result.append(" "); } return result; }
Source:
public void testLayerEnabledServiceResponse() throws Exception { enableWFS(); String layerName = "cite:RoadSegments"; LayerInfo linfo = getCatalog().getLayerByName(layerName); ResourceInfo ri = linfo.getResource(); ri.setServiceConfiguration(false); ri.setDisabledServices(new ArrayList<>()); getCatalog().save(ri); getCatalog().save(linfo); Document doc = getAsDOM( "wfs?request=GetFeature&typeName=" + layerName + "&version=1.0.0&service=wfs"); assertXpathEvaluatesTo("1", "count( }

Target:
public void testLayerEnabledServiceResponse() throws Exception { enableWFS(); String layerName = "cite:RoadSegments"; FeatureTypeInfo ftinfo = getCatalog().getFeatureTypeByName(layerName); ftinfo.setServiceConfiguration(false); ftinfo.setDisabledServices(new ArrayList<>()); getCatalog().save(ftinfo); Document doc = getAsDOM( "wfs?request=GetFeature&typeName=" + layerName + "&version=1.0.0&service=wfs"); assertXpathEvaluatesTo("1", "count( doc = getAsDOM("wfs?service=WFS&version=1.1.0&request=getCapabilities"); XMLAssert.assertXpathExists( " }
Source:
public static boolean isJava8BelowUpdate45() { if(!JAVA_VERSION.equals("1.8")) { return false; } int beginIndex = JVM_VERSION.indexOf('_'); int endIndex = JVM_VERSION.indexOf('b'); if(beginIndex == -1 || endIndex == -1) { return false; } String updateVersion = JVM_VERSION.substring(beginIndex + 1, endIndex - 1); return 45 > Integer.valueOf(updateVersion); }

Target:
public static boolean isJava8BelowUpdate45() { return isJava8BelowUpdate45(JVM_VERSION); }
Source:
public static void beforeClass() { ports = AvailablePortHelper.getRandomAvailableTCPPorts(2); Properties redisProps = new Properties(); redisProps.put(DistributionConfig.REDIS_BIND_ADDRESS_NAME, "localhost"); MemberVM locator = cluster.startLocatorVM(0); redisProps.put(DistributionConfig.REDIS_PORT_NAME, Integer.toString(ports[0])); server1 = cluster.startServerVM(1, redisProps, locator.getPort()); redisProps.put(DistributionConfig.REDIS_PORT_NAME, Integer.toString(ports[1])); server2 = cluster.startServerVM(2, redisProps, locator.getPort()); }

Target:
public static void beforeClass() { ports = AvailablePortHelper.getRandomAvailableTCPPorts(2); Properties redisProps = new Properties(); redisProps.put(ConfigurationProperties.REDIS_BIND_ADDRESS, "localhost"); MemberVM locator = cluster.startLocatorVM(0); redisProps.put(ConfigurationProperties.REDIS_PORT, Integer.toString(ports[0])); server1 = cluster.startServerVM(1, redisProps, locator.getPort()); redisProps.put(ConfigurationProperties.REDIS_PORT, Integer.toString(ports[1])); server2 = cluster.startServerVM(2, redisProps, locator.getPort()); }
Source:
public boolean isMissingHookConflict() { return (this.conflictStatus & MISSING_HOOK.getValue()) == MISSING_HOOK.getValue(); }

Target:
public boolean isMissingHookConflict() { return (conflictStatus & MISSING_HOOK.getValue()) == MISSING_HOOK.getValue(); }
Source:
public Response getRowStats( @Context final HttpServletRequest req, @QueryParam("full") String full ) { IndexTaskUtils.datasourceAuthorizationCheck(req, Action.READ, getDataSource(), authorizerMapper); Map<String, Object> returnMap = Maps.newHashMap(); Map<String, Object> totalsMap = Maps.newHashMap(); Map<String, Object> averagesMap = Maps.newHashMap(); boolean needsDeterminePartitions = false; boolean needsBuildSegments = false; if (full != null) { needsDeterminePartitions = true; needsBuildSegments = true; } else { switch (ingestionState) { case DETERMINE_PARTITIONS: needsDeterminePartitions = true; break; case BUILD_SEGMENTS: case COMPLETED: needsBuildSegments = true; break; default: break; } } if (needsDeterminePartitions) { if (determinePartitionsMeters != null) { totalsMap.put( "determinePartitions", determinePartitionsMeters.getTotals() ); averagesMap.put( "determinePartitions", determinePartitionsMeters.getMovingAverages() ); } } if (needsBuildSegments) { if (buildSegmentsMeters != null) { totalsMap.put( "buildSegments", buildSegmentsMeters.getTotals() ); averagesMap.put( "buildSegments", buildSegmentsMeters.getMovingAverages() ); } } returnMap.put("totals", totalsMap); returnMap.put("averages", averagesMap); return Response.ok(returnMap).build(); }

Target:
public Response getRowStats( @Context final HttpServletRequest req, @QueryParam("full") String full ) { IndexTaskUtils.datasourceAuthorizationCheck(req, Action.READ, getDataSource(), authorizerMapper); Map<String, Object> returnMap = Maps.newHashMap(); Map<String, Object> totalsMap = Maps.newHashMap(); Map<String, Object> averagesMap = Maps.newHashMap(); boolean needsDeterminePartitions = false; boolean needsBuildSegments = false; if (full != null) { needsDeterminePartitions = true; needsBuildSegments = true; } else { switch (ingestionState) { case DETERMINE_PARTITIONS: needsDeterminePartitions = true; break; case BUILD_SEGMENTS: case COMPLETED: needsBuildSegments = true; break; default: break; } } if (needsDeterminePartitions) { totalsMap.put( RowIngestionMeters.DETERMINE_PARTITIONS, determinePartitionsMeters.getTotals() ); averagesMap.put( RowIngestionMeters.DETERMINE_PARTITIONS, determinePartitionsMeters.getMovingAverages() ); } if (needsBuildSegments) { totalsMap.put( RowIngestionMeters.BUILD_SEGMENTS, buildSegmentsMeters.getTotals() ); averagesMap.put( RowIngestionMeters.BUILD_SEGMENTS, buildSegmentsMeters.getMovingAverages() ); } returnMap.put("totals", totalsMap); returnMap.put("movingAverages", averagesMap); return Response.ok(returnMap).build(); }
Source:
private static void attach(String cameraId, UseCase useCase) { checkInitialized(); BaseCamera camera = sCameraX.getCameraRepository().getCamera(cameraId); if (camera == null) { throw new IllegalArgumentException("Invalid camera: " + cameraId); } useCase.addStateChangeListener(camera); useCase.attachCameraControl(cameraId, camera.getCameraControlInternal()); }

Target:
private static void attach(String cameraId, UseCase useCase) { CameraX cameraX = checkInitialized(); BaseCamera camera = cameraX.getCameraRepository().getCamera(cameraId); if (camera == null) { throw new IllegalArgumentException("Invalid camera: " + cameraId); } useCase.addStateChangeListener(camera); useCase.attachCameraControl(cameraId, camera.getCameraControlInternal()); }
Source:
public OAuthClientService getOAuthClientService(String handle) { OAuthClientServiceImpl clientImpl = null; try { clientImpl = oauthClientServiceCache.get(handle); if (clientImpl == null || clientImpl.isClosed()) { clientImpl = OAuthClientServiceImpl.getInstance(handle, oAuthStoreHandler, tokenExpiresInBuffer, httpClientFactory); oauthClientServiceCache.put(handle, clientImpl); } } catch (OAuthException e) { logger.error("Cannot get OAuth client service by handle {}", handle, e); } return clientImpl; }

Target:
public OAuthClientService getOAuthClientService(String handle) throws OAuthException { OAuthClientServiceImpl clientImpl = null; clientImpl = oauthClientServiceCache.get(handle); if (clientImpl == null || clientImpl.isClosed()) { clientImpl = OAuthClientServiceImpl.getInstance(handle, oAuthStoreHandler, tokenExpiresInBuffer, httpClientFactory); oauthClientServiceCache.put(handle, clientImpl); } return clientImpl; }
Source:
public void getNext(JCas aJCas) throws IOException, CollectionException { Resource res = nextFile(); initCas(aJCas, res); InputStream is = null; try { is = new BufferedInputStream(res.getInputStream()); Iterable<CSVRecord> records = CSVFormat.DEFAULT.withIgnoreHeaderCase() .parse(new InputStreamReader(is, "UTF-8")); List<String> headers = new ArrayList<>(); for (CSVRecord record : records) { if (headers.isEmpty()) { String documentName = record.get(0); String annotator = record.get(1); headers.add(documentName); headers.add(annotator); for (int c = 2; c < record.size(); c++) { headers.add(record.get(c)); } } else { String text = record.get(record.size() - 1); if (null != text && null == aJCas.getDocumentText()) { aJCas.setDocumentText(text); } createCodebookAnnotations(aJCas, headers, record); } } } catch (Exception e) { throw new CollectionException(e); } finally { closeQuietly(is); } }

Target:
public void getNext(JCas aJCas) throws IOException, CollectionException { Resource res = nextFile(); initCas(aJCas, res); try (InputStream is = new BufferedInputStream(res.getInputStream())) { Iterable<CSVRecord> records = CSVFormat.DEFAULT.withIgnoreHeaderCase() .parse(new InputStreamReader(is, "UTF-8")); List<String> headers = new ArrayList<>(); for (CSVRecord record : records) { if (headers.isEmpty()) { String documentName = record.get(0); String annotator = record.get(1); headers.add(documentName); headers.add(annotator); for (int c = 2; c < record.size(); c++) { headers.add(record.get(c)); } } else { String text = record.get(record.size() - 1); if (null != text && null == aJCas.getDocumentText()) { aJCas.setDocumentText(text); } createCodebookAnnotations(aJCas, headers, record); } } } catch (Exception e) { throw new CollectionException(e); } }
Source:
private boolean isVmRunning(VM vm) { return vm != null && vm.getStatus() == VMStatus.Up && vm.getRunOnVds() != null && !vm.getRunOnVds().equals(Guid.Empty); }

Target:
private boolean isVmRunning(VM vm) { return vm.getStatus() == VMStatus.Up && vm.getRunOnVds() != null && !vm.getRunOnVds().equals(Guid.Empty); }
Source:
private Group createAuthenticationGroup(final Composite parent) { final Group g = createGroup(parent, UIText.RepositorySelectionPage_groupAuthentication); newLabel(g, UIText.RepositorySelectionPage_promptUser + ":"); userText = new Text(g, SWT.BORDER); userText.setLayoutData(createFieldGridData()); userText.addModifyListener(new ModifyListener() { @Override public void modifyText(final ModifyEvent e) { Protocol protocol = getProtocol(); if (protocol != Protocol.HTTP && protocol != Protocol.HTTPS) setURI(uri.setUser(nullString(userText.getText()))); user = userText.getText(); } }); newLabel(g, UIText.RepositorySelectionPage_promptPassword + ":"); passText = new Text(g, SWT.BORDER | SWT.PASSWORD); passText.setLayoutData(createFieldGridData()); passText.addModifyListener(new ModifyListener() { @Override public void modifyText(final ModifyEvent e) { setURI(uri.setPass(null)); password = passText.getText(); } }); storeCheckbox = new Button(g, SWT.CHECK); storeCheckbox .setText(UIText.RepositorySelectionPage_storeInSecureStore); storeCheckbox.setSelection(storeInSecureStore); storeCheckbox.addSelectionListener(new SelectionListener() { @Override public void widgetSelected(SelectionEvent e) { storeInSecureStore = storeCheckbox.getSelection(); } @Override public void widgetDefaultSelected(SelectionEvent e) { storeInSecureStore = storeCheckbox.getSelection(); } }); return g; }

Target:
private Group createAuthenticationGroup(final Composite parent) { final Group g = createGroup(parent, UIText.RepositorySelectionPage_groupAuthentication); newLabel(g, UIText.RepositorySelectionPage_promptUser + ":"); userText = new Text(g, SWT.BORDER); userText.setLayoutData(createFieldGridData()); userText.addModifyListener(new ModifyListener() { @Override public void modifyText(final ModifyEvent e) { Protocol protocol = getProtocol(); if (protocol != Protocol.HTTP && protocol != Protocol.HTTPS) setURI(uri.setUser(nullString(userText.getText()))); user = userText.getText(); } }); newLabel(g, UIText.RepositorySelectionPage_promptPassword + ":"); passText = new Text(g, SWT.BORDER | SWT.PASSWORD); passText.setLayoutData(createFieldGridData()); passText.addModifyListener(new ModifyListener() { @Override public void modifyText(final ModifyEvent e) { setURI(uri.setPass(null)); password = passText.getText(); } }); storeCheckbox = new Button(g, SWT.CHECK); GridDataFactory.fillDefaults().span(2, 1).applyTo(storeCheckbox); storeCheckbox .setText(UIText.RepositorySelectionPage_storeInSecureStore); storeCheckbox.setSelection(storeInSecureStore); storeCheckbox.addSelectionListener(new SelectionListener() { @Override public void widgetSelected(SelectionEvent e) { storeInSecureStore = storeCheckbox.getSelection(); } @Override public void widgetDefaultSelected(SelectionEvent e) { storeInSecureStore = storeCheckbox.getSelection(); } }); return g; }
Source:
public boolean inIndex(String path) throws IOException { String repoPath = getRepoRelativePath(path); DirCache dc = DirCache.read(repository.getIndexFile(), repository.getFS()); DirCacheEntry dcEntry = dc.getEntry(repoPath); if (dcEntry == null) return false; Ref headRef = repository.getRef(HEAD); RevCommit commit = new RevWalk(repository).parseCommit(headRef.getObjectId()); TreeWalk tw = TreeWalk.forPath(repository, repoPath, commit.getTree()); return tw == null || !dcEntry.getObjectId().equals(tw.getObjectId(0)); }

Target:
public boolean inIndex(String path) throws IOException { String repoPath = getRepoRelativePath(path); DirCache dc = DirCache.read(repository.getIndexFile(), repository.getFS()); return dc.getEntry(repoPath) != null; }
Source:
public boolean add(VmNetworkInterface iface, CompensationContext compensationContext, boolean allocateMac) { boolean macAdded = false; if (!allocateMac && getMacPoolManager().IsMacInUse(iface.getMacAddress())) { AuditLogableBase logable = new AuditLogableBase(); logable.AddCustomValue("MACAddr", iface.getMacAddress()); logable.AddCustomValue("VmName", iface.getVmName()); log(logable, AuditLogType.MAC_ADDRESS_IS_IN_USE); } else { if (allocateMac) { iface.setMacAddress(MacPoolManager.getInstance().allocateNewMac()); } macAdded = getMacPoolManager().AddMac(iface.getMacAddress()); } getVmNetworkInterfaceDAO().save(iface); getVmNetworkStatisticsDAO().save(iface.getStatistics()); compensationContext.snapshotNewEntity(iface); compensationContext.snapshotNewEntity(iface.getStatistics()); return macAdded; }

Target:
public boolean add(VmNetworkInterface iface, CompensationContext compensationContext, boolean allocateMac) { boolean macAdded = false; if (!allocateMac && getMacPoolManager().IsMacInUse(iface.getMacAddress())) { AuditLogableBase logable = new AuditLogableBase(); logable.AddCustomValue("MACAddr", iface.getMacAddress()); logable.AddCustomValue("VmName", iface.getVmName()); log(logable, AuditLogType.MAC_ADDRESS_IS_IN_USE); } else { if (allocateMac) { iface.setMacAddress(getMacPoolManager().allocateNewMac()); macAdded = true; } else { macAdded = getMacPoolManager().AddMac(iface.getMacAddress()); } } getVmNetworkInterfaceDAO().save(iface); getVmNetworkStatisticsDAO().save(iface.getStatistics()); compensationContext.snapshotNewEntity(iface); compensationContext.snapshotNewEntity(iface.getStatistics()); return macAdded; }
Source:
public void handleResponse(AbstractResponse response) { AddOffsetsToTxnResponse addOffsetsToTxnResponse = (AddOffsetsToTxnResponse) response; Errors error = Errors.forCode(addOffsetsToTxnResponse.data.errorCode()); if (error == Errors.NONE) { log.debug("Successfully added partition for consumer group to transaction", builder.data.groupId()); pendingRequests.add(txnOffsetCommitHandler(result, offsets, groupMetadata)); transactionStarted = true; } else if (error == Errors.COORDINATOR_NOT_AVAILABLE || error == Errors.NOT_COORDINATOR) { lookupCoordinator(FindCoordinatorRequest.CoordinatorType.TRANSACTION, transactionalId); reenqueue(); } else if (error == Errors.COORDINATOR_LOAD_IN_PROGRESS || error == Errors.CONCURRENT_TRANSACTIONS) { reenqueue(); } else if (error == Errors.UNKNOWN_PRODUCER_ID || error == Errors.INVALID_PRODUCER_ID_MAPPING) { abortableErrorIfPossible(error.exception()); } else if (error == Errors.INVALID_PRODUCER_EPOCH) { fatalError(error.exception()); } else if (error == Errors.TRANSACTIONAL_ID_AUTHORIZATION_FAILED) { fatalError(error.exception()); } else if (error == Errors.GROUP_AUTHORIZATION_FAILED) { abortableError(new GroupAuthorizationException(builder.data.groupId())); } else { fatalError(new KafkaException("Unexpected error in AddOffsetsToTxnResponse: " + error.message())); } }

Target:
public void handleResponse(AbstractResponse response) { AddOffsetsToTxnResponse addOffsetsToTxnResponse = (AddOffsetsToTxnResponse) response; Errors error = Errors.forCode(addOffsetsToTxnResponse.data.errorCode()); if (error == Errors.NONE) { log.debug("Successfully added partition for consumer group to transaction", builder.data.groupId()); pendingRequests.add(txnOffsetCommitHandler(result, offsets, groupMetadata)); transactionStarted = true; } else if (error == Errors.COORDINATOR_NOT_AVAILABLE || error == Errors.NOT_COORDINATOR) { lookupCoordinator(FindCoordinatorRequest.CoordinatorType.TRANSACTION, transactionalId); reenqueue(); } else if (error == Errors.COORDINATOR_LOAD_IN_PROGRESS || error == Errors.CONCURRENT_TRANSACTIONS) { reenqueue(); } else if (error == Errors.UNKNOWN_PRODUCER_ID || error == Errors.INVALID_PRODUCER_ID_MAPPING) { abortableErrorIfPossible(error.exception()); } else if (error == Errors.INVALID_PRODUCER_EPOCH) { fatalError(error.exception()); } else if (error == Errors.TRANSACTIONAL_ID_AUTHORIZATION_FAILED) { fatalError(error.exception()); } else if (error == Errors.GROUP_AUTHORIZATION_FAILED) { abortableError(GroupAuthorizationException.forGroupId(builder.data.groupId())); } else { fatalError(new KafkaException("Unexpected error in AddOffsetsToTxnResponse: " + error.message())); } }
Source:
public List<Tag> getTagsOnCommit(final String revName) throws GitException, IOException, InterruptedException { return withRepository(new RepositoryCallback<List<Tag>>() { @Override public List<Tag> invoke(Repository db, VirtualChannel channel) throws IOException, InterruptedException { try { final ObjectId commit = db.resolve(revName); final List<Tag> ret = new ArrayList<Tag>(); for (final Map.Entry<String, Ref> tag : db.getTags().entrySet()) { Ref value = tag.getValue(); if (value != null) { final ObjectId tagId = value.getObjectId(); if (commit != null && commit.equals(tagId)) ret.add(new Tag(tag.getKey(), tagId)); } } return ret; } finally { db.close(); } } }); }

Target:
public List<Tag> getTagsOnCommit(final String revName) throws GitException, IOException, InterruptedException { return withRepository(new ListTags(revName)); }