auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
String getComparaDivisionName(DatabaseRegistryEntry compara_dbre) { Connection compara_con = compara_dbre.getConnection(); String sql_division = "SELECT meta_value FROM meta WHERE meta_key = 'division'"; String division = DBUtils.getRowColumnValue(compara_con, sql_division); if (division == null || division.isEmpty()) { Matcher m = EGC_DB.matcher(compara_dbre.getName()); if (m.matches()) { if (m.groupCount() > 1) { division = m.group(2); } else { division = m.group(1); } } else { m = EC_DB.matcher(compara_dbre.getName()); if (m.matches()) { division = "ensembl"; } else { ReportManager.problem(this, compara_dbre.getConnection(), "Cannot find the division name of this database: '" + compara_dbre.getName() + "'"); return null; } } } if (division.equals("ensembl")) { division = "vertebrates"; } return division; }

Target:
String getComparaDivisionName(DatabaseRegistryEntry compara_dbre) { Connection compara_con = compara_dbre.getConnection(); String sql_division = "SELECT meta_value FROM meta WHERE meta_key = 'division'"; String division = DBUtils.getRowColumnValue(compara_con, sql_division); if (! division.isEmpty()) { return division; } Matcher m = EGC_DB.matcher(compara_dbre.getName()); if (m.matches()) { if (m.groupCount() > 1) { return m.group(2); } else { return m.group(1); } } else { m = EC_DB.matcher(compara_dbre.getName()); if (m.matches()) { return "vertebrates"; } else { ReportManager.problem(this, compara_dbre.getConnection(), "Cannot find the division name of this database: '" + compara_dbre.getName() + "'"); return null; } } }
Source:
EventJsonSerializer(NodeInfo nodeInfo, @Nullable TraceToken token, EventTypeMetadata<T> eventTypeMetadata) { if (token == null) { this.token = null; } else if (token.size() == 1) { this.token = token.get("id"); } else { try { this.token = new ObjectMapperProvider().get().writeValueAsString(token); } catch (JsonProcessingException e) { throw new RuntimeException(e); } } this.eventTypeMetadata = requireNonNull(eventTypeMetadata, "eventTypeMetadata is null"); if (eventTypeMetadata.getHostField() == null) { hostName = nodeInfo.getInternalHostname(); } else { hostName = null; } }

Target:
EventJsonSerializer(NodeInfo nodeInfo, @Nullable TraceToken token, EventTypeMetadata<T> eventTypeMetadata) { if (token == null || eventTypeMetadata.getTraceTokenField() != null) { this.token = null; } else if (token.size() == 1) { this.token = token.get("id"); } else { this.token = TRACE_TOKEN_JSON_CODEC.toJson(token); } this.eventTypeMetadata = requireNonNull(eventTypeMetadata, "eventTypeMetadata is null"); if (eventTypeMetadata.getHostField() == null) { hostName = nodeInfo.getInternalHostname(); } else { hostName = null; } }
Source:
private List<DetailAST> findMatchingNodesByXpathQuery(DetailAST rootAST) { final XPathEvaluator xpathEvaluator = new XPathEvaluator(Configuration.newConfiguration()); try { final RootNode rootNode = new RootNode(rootAST); final XPathExpression xpathExpression = xpathEvaluator.createExpression(query); final XPathDynamicContext xpathDynamicContext = xpathExpression.createDynamicContext(rootNode); final List<Item> matchingItems = xpathExpression.evaluate(xpathDynamicContext); return matchingItems.stream() .map(item -> ((AbstractNode) item).getUnderlyingNode()) .collect(Collectors.toList()); } catch (XPathException ex) { throw new IllegalStateException("Evaluation of Xpath query failed: " + query, ex); } }

Target:
private List<DetailAST> findMatchingNodesByXpathQuery(DetailAST rootAST) { try { final RootNode rootNode = new RootNode(rootAST); final XPathDynamicContext xpathDynamicContext = xpathExpression.createDynamicContext(rootNode); final List<Item> matchingItems = xpathExpression.evaluate(xpathDynamicContext); return matchingItems.stream() .map(item -> ((AbstractNode) item).getUnderlyingNode()) .collect(Collectors.toList()); } catch (XPathException ex) { throw new IllegalStateException("Evaluation of Xpath query failed: " + query, ex); } }
Source:
public MeetupRsvpStream(File dataFile) throws Exception { Properties properties = new Properties(); properties.put("metadata.broker.list", KafkaStarterUtils.DEFAULT_KAFKA_BROKER); properties.put("serializer.class", "kafka.serializer.DefaultEncoder"); properties.put("request.required.acks", "1"); producer = StreamDataProvider.getStreamDataProducer(KafkaStarterUtils.KAFKA_PRODUCER_CLASS_NAME, properties); _dataFile = dataFile; _service = Executors.newFixedThreadPool(1); }

Target:
public MeetupRsvpStream(File dataFile) throws Exception { this(dataFile, false); }
Source:
public void setDisableCliSchedule(EntityModel<Boolean> value) { this.disableCliSchedule = value; this.disableCliSchedule.setIsAvailable(value.getEntity()); }

Target:
public void setDisableCliSchedule(EntityModel<Boolean> value) { this.disableCliSchedule = value; }
Source:
protected void EndWithFailure() { setVm(DbFacade.getInstance().getVmDAO().getById(getVmId())); vm_pools vmPool = getVmPool(); setSucceeded(Backend.getInstance().endAction(VdcActionType.RunVm, getParameters().getImagesParameters().get(0), getCompensationContext()).getSucceeded()); if (!getSucceeded()) { log.warn("AttachUserToVmFromPoolAndRunCommand::EndWitFailure: EndAction of RunVm Failed"); } detachUserFromVmFromPool(); }

Target:
protected void EndWithFailure() { setSucceeded(Backend.getInstance().endAction(VdcActionType.RunVm, getParameters().getImagesParameters().get(0), getCompensationContext()).getSucceeded()); if (!getSucceeded()) { log.warn("AttachUserToVmFromPoolAndRunCommand::EndWitFailure: EndAction of RunVm Failed"); } detachUserFromVmFromPool(); }
Source:
public TCCLObjectInputStream(InputStream in) throws IOException { super(in); this.classLoader = Thread.currentThread().getContextClassLoader(); }

Target:
public TCCLObjectInputStream(InputStream in) throws IOException { this(in, null); }
Source:
protected final StringBuilder appendOperands(StringBuilder sb) { List<String> operandDigests = new ArrayList<>(operands.size()); for (int i = 0; i < operands.size(); i++) { RexNode operand = operands.get(i); if (!(operand instanceof RexLiteral)) { operandDigests.add(operand.toString()); continue; } RexDigestIncludeType includeType = RexDigestIncludeType.OPTIONAL; if ((isA(SqlKind.AND) || isA(SqlKind.OR)) && operand.getType().getSqlTypeName() == SqlTypeName.BOOLEAN) { includeType = RexDigestIncludeType.NO_TYPE; } if (SIMPLE_BINARY_OPS.contains(getKind()) && operands.size() == 2) { RexNode otherArg = operands.get(1 - i); if ((!(otherArg instanceof RexLiteral) || ((RexLiteral) otherArg).digestIncludesType() == RexDigestIncludeType.NO_TYPE) && equalSansNullability(operand.getType(), otherArg.getType())) { includeType = RexDigestIncludeType.NO_TYPE; } } operandDigests.add(((RexLiteral) operand).computeDigest(includeType)); } int totalLength = (operandDigests.size() - 1) * 2; for (String s : operandDigests) { totalLength += s.length(); } sb.ensureCapacity(sb.length() + totalLength); if (SIMPLE_COMMUTATIVE_OPS.contains(op.getKind())) { operandDigests.sort(OPERAND_READABILITY_COMPARATOR); } for (int i = 0; i < operandDigests.size(); i++) { String op = operandDigests.get(i); if (i != 0) { sb.append(", "); } sb.append(op); } return sb; }

Target:
protected final StringBuilder appendOperands(StringBuilder sb) { if (operands.isEmpty()) { return sb; } List<String> operandDigests = new ArrayList<>(operands.size()); for (int i = 0; i < operands.size(); i++) { RexNode operand = operands.get(i); if (!(operand instanceof RexLiteral)) { operandDigests.add(operand.toString()); continue; } RexDigestIncludeType includeType = RexDigestIncludeType.OPTIONAL; if ((isA(SqlKind.AND) || isA(SqlKind.OR)) && operand.getType().getSqlTypeName() == SqlTypeName.BOOLEAN) { includeType = RexDigestIncludeType.NO_TYPE; } if (SIMPLE_BINARY_OPS.contains(getKind()) && operands.size() == 2) { RexNode otherArg = operands.get(1 - i); if ((!(otherArg instanceof RexLiteral) || ((RexLiteral) otherArg).digestIncludesType() == RexDigestIncludeType.NO_TYPE) && equalSansNullability(operand.getType(), otherArg.getType())) { includeType = RexDigestIncludeType.NO_TYPE; } } operandDigests.add(((RexLiteral) operand).computeDigest(includeType)); } int totalLength = (operandDigests.size() - 1) * 2; for (String s : operandDigests) { totalLength += s.length(); } sb.ensureCapacity(sb.length() + totalLength); sortOperandsIfNeeded(sb, operands, operandDigests); for (int i = 0; i < operandDigests.size(); i++) { String op = operandDigests.get(i); if (i != 0) { sb.append(", "); } sb.append(op); } return sb; }
Source:
public void commit_txn(CommitTxnRequest rqst) throws TException { getTxnHandler().commitTxn(rqst); MetaStoreListenerNotifier.notifyEvent(transactionalListeners, EventType.COMMIT_TXN, new CommitTxnEvent(rqst.getTxnid(), this)); }

Target:
public void commit_txn(CommitTxnRequest rqst) throws TException { getTxnHandler().commitTxn(rqst); if (listeners != null && !listeners.isEmpty()) { MetaStoreListenerNotifier.notifyEvent(listeners, EventType.COMMIT_TXN, new CommitTxnEvent(rqst.getTxnid(), this)); } }
Source:
private static Tree firstStatementParent(Tree node) { Tree current = node; while (true) { if (current instanceof StatementTree) { return current; } current = current.parent(); } }

Target:
private static Tree firstStatementParent(Tree node) { Tree current = node.parent(); while (current != null) { if (current instanceof StatementTree) { break; } current = current.parent(); } return current; }
Source:
public synchronized GrillResultSetMetadata getMetadata() throws GrillException { if (grillResultMeta == null) { grillResultMeta = new GrillResultSetMetadata() { @Override public List<ColumnDescriptor> getColumns() { try{ ResultSetMetaData rsmeta = getRsMetadata(); List<ColumnDescriptor> columns = new ArrayList<ColumnDescriptor>(rsmeta.getColumnCount()); System.out.println("Column count:" + rsmeta.getColumnCount()); for (int i = 1; i <= rsmeta.getColumnCount(); i++) { FieldSchema col = new FieldSchema(rsmeta.getColumnName(i), TypeInfoUtils.getTypeInfoFromTypeString( getHiveTypeForSQLType(i, rsmeta)).getTypeName(), rsmeta.getColumnTypeName(i)); columns.add(new ColumnDescriptor(col, i)); } return columns; } catch (Exception e) { LOG.error("Error getting JDBC type information: " + e.getMessage(), e); return null; } } }; } return grillResultMeta; }

Target:
public synchronized GrillResultSetMetadata getMetadata() throws GrillException { if (grillResultMeta == null) { grillResultMeta = new GrillResultSetMetadata() { @Override public List<ColumnDescriptor> getColumns() { try{ ResultSetMetaData rsmeta = getRsMetadata(); List<ColumnDescriptor> columns = new ArrayList<ColumnDescriptor>(rsmeta.getColumnCount()); for (int i = 1; i <= rsmeta.getColumnCount(); i++) { FieldSchema col = new FieldSchema(rsmeta.getColumnName(i), TypeInfoUtils.getTypeInfoFromTypeString( getHiveTypeForSQLType(i, rsmeta)).getTypeName(), rsmeta.getColumnTypeName(i)); columns.add(new ColumnDescriptor(col, i)); } return columns; } catch (Exception e) { LOG.error("Error getting JDBC type information: " + e.getMessage(), e); return null; } } }; } return grillResultMeta; }
Source:
private void handleUrlClicked(final String url) { Log.d(TAG, "handleUrlClicked() url: " + url); if(TextUtils.isEmpty(url)) return; AlertDialog.Builder builder = new AlertDialog.Builder(this); @SuppressLint("InflateParams") View v = getLayoutInflater().inflate(R.layout.dialog_title_url, null); TextView tv = (TextView)v.findViewById(R.id.tv_dialog_title_url); tv.setText(url); builder.setCustomTitle(v); builder.setItems( new CharSequence[]{ getString(R.string.d_urlAction_openInBrowser), getString(R.string.d_urlAction_addToWallabag), getString(R.string.d_urlAction_copytoclipboard), getString(R.string.menuShare), }, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { switch (which) { case 0: openURL(url); break; case 1: ServiceHelper.addLink(ReadArticleActivity.this, url); break; case 2: ClipboardManager clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE); ClipData clip = ClipData.newRawUri("wallabag", Uri.parse(url)); clipboard.setPrimaryClip(clip); break; case 3: Intent sendIntent = new Intent(); sendIntent.setAction(Intent.ACTION_SEND); sendIntent.putExtra(Intent.EXTRA_TEXT, url); sendIntent.setType("text/plan"); startActivity(sendIntent); } } }); builder.show(); }

Target:
private void handleUrlClicked(final String url) { Log.d(TAG, "handleUrlClicked() url: " + url); if(TextUtils.isEmpty(url)) return; AlertDialog.Builder builder = new AlertDialog.Builder(this); @SuppressLint("InflateParams") View v = getLayoutInflater().inflate(R.layout.dialog_title_url, null); TextView tv = (TextView)v.findViewById(R.id.tv_dialog_title_url); tv.setText(url); builder.setCustomTitle(v); builder.setItems( new CharSequence[]{ getString(R.string.d_urlAction_openInBrowser), getString(R.string.d_urlAction_addToWallabag), getString(R.string.d_urlAction_copyToClipboard), getString(R.string.menuShare) }, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { switch (which) { case 0: openURL(url); break; case 1: ServiceHelper.addLink(ReadArticleActivity.this, url); break; case 2: copyURLToClipboard(url); break; case 3: shareArticle(null, url); break; } } }); builder.show(); }
Source:
protected void reportMethodInvocabilityError( MethodInvocationTree node, AnnotatedTypeMirror found, AnnotatedTypeMirror expected) { AnnotationMirror expectedCM = expected.getAnnotation(CalledMethods.class); if (expectedCM != null) { AnnotationMirror foundCM = found.getAnnotation(CalledMethods.class); Set<String> foundMethods = foundCM == null ? Collections.emptySet() : new HashSet<>(atypeFactory.getAccumulatedValues(foundCM)); List<String> expectedMethods = atypeFactory.getAccumulatedValues(expectedCM); StringBuilder missingMethods = new StringBuilder(); for (String expectedMethod : expectedMethods) { if (!foundMethods.contains(expectedMethod)) { missingMethods.append(expectedMethod); missingMethods.append("() "); } } checker.reportError(node, FINALIZER_INVOCATION_INVALID, missingMethods.toString()); } else { super.reportMethodInvocabilityError(node, found, expected); } }

Target:
protected void reportMethodInvocabilityError( MethodInvocationTree node, AnnotatedTypeMirror found, AnnotatedTypeMirror expected) { AnnotationMirror expectedCM = expected.getAnnotation(CalledMethods.class); if (expectedCM != null) { AnnotationMirror foundCM = found.getAnnotation(CalledMethods.class); Set<String> foundMethods = foundCM == null ? Collections.emptySet() : new HashSet<>(atypeFactory.getAccumulatedValues(foundCM)); List<String> expectedMethods = atypeFactory.getAccumulatedValues(expectedCM); StringJoiner missingMethods = new StringJoiner(" "); for (String expectedMethod : expectedMethods) { if (!foundMethods.contains(expectedMethod)) { missingMethods.add(expectedMethod + "()"); } } checker.reportError(node, "finalizer.invocation.invalid", missingMethods.toString()); } else { super.reportMethodInvocabilityError(node, found, expected); } }
Source:
public void tearDown(ManagementClient managementClient, String containerId) throws Exception { Path logPath = LoggingUtil.getLogPath(managementClient, "periodic-rotating-file-handler", getHandlerName()); Files.deleteIfExists(logPath); Collection<String> categories = getCategories(); for (String category : categories) { if (category == null || category.length() == 0) { LOGGER.warn("Empty category name provided."); continue; } ModelNode op = org.jboss.as.controller.operations.common.Util.createRemoveOperation(PathAddress.pathAddress().append(SUBSYSTEM, "logging").append("logger", category)); applyUpdate(managementClient.getControllerClient(), op, false); } ModelNode removeTestLogOp = org.jboss.as.controller.operations.common.Util.createRemoveOperation(PathAddress.pathAddress().append(SUBSYSTEM, "logging") .append("periodic-rotating-file-handler", getHandlerName())); applyUpdate(managementClient.getControllerClient(), removeTestLogOp, false); }

Target:
public void tearDown(ManagementClient managementClient, String containerId) throws Exception { Path logPath = LoggingUtil.getLogPath(managementClient, "file-handler", getHandlerName()); final Operations.CompositeOperationBuilder builder = Operations.CompositeOperationBuilder.create(); ModelNode removeOp; while ((removeOp = removeOps.pollFirst()) != null) { builder.addStep(removeOp); } applyUpdate(managementClient.getControllerClient(), builder.build(), false); Files.deleteIfExists(logPath); }
Source:
public JavaLanguageModule() { super(NAME, null, TERSE_NAME, JavaRuleChainVisitor.class, "java"); addVersion("1.3", new JavaLanguageHandler(3), false); addVersion("1.4", new JavaLanguageHandler(4), false); addVersion("1.5", new JavaLanguageHandler(5), false); addVersion("1.6", new JavaLanguageHandler(6), false); addVersion("1.7", new JavaLanguageHandler(7), false); addVersion("1.8", new JavaLanguageHandler(8), false); addVersion("9", new JavaLanguageHandler(9), false); addVersion("10", new JavaLanguageHandler(10), false); addVersion("11", new JavaLanguageHandler(11), false); addVersion("12", new JavaLanguageHandler(12), false); addVersion("13", new JavaLanguageHandler(13), true); }

Target:
public JavaLanguageModule() { super(NAME, null, TERSE_NAME, JavaRuleChainVisitor.class, "java"); addVersion("1.3", new JavaLanguageHandler(3), false); addVersion("1.4", new JavaLanguageHandler(4), false); addVersion("1.5", new JavaLanguageHandler(5), false); addVersion("1.6", new JavaLanguageHandler(6), false); addVersion("1.7", new JavaLanguageHandler(7), false); addVersion("1.8", new JavaLanguageHandler(8), false); addVersion("9", new JavaLanguageHandler(9), false); addVersion("10", new JavaLanguageHandler(10), false); addVersion("11", new JavaLanguageHandler(11), false); addVersion("12", new JavaLanguageHandler(12), false); addVersion("12-preview", new JavaLanguageHandler(12, true), false); addVersion("13", new JavaLanguageHandler(13), true); addVersion("13-preview", new JavaLanguageHandler(13, true), false); }
Source:
public String getMessage() { return name; }

Target:
public String getMessage() { return message; }
Source:
public long getFirstStoredEntryId() { Long firstEntry = LedgerHandle.INVALID_ENTRY_ID; for (int bookieIndex : bookieIndexes) { Long firstStoredEntryForBookie = getFirstStoredEntryId(bookieIndex); if (firstStoredEntryForBookie != LedgerHandle.INVALID_ENTRY_ID) { if (firstEntry == LedgerHandle.INVALID_ENTRY_ID) { firstEntry = firstStoredEntryForBookie; } else { firstEntry = Math.min(firstEntry, firstStoredEntryForBookie); } } } return firstEntry; }

Target:
public long getFirstStoredEntryId() { long firstEntry = LedgerHandle.INVALID_ENTRY_ID; for (int bookieIndex : bookieIndexes) { Long firstStoredEntryForBookie = getFirstStoredEntryId(bookieIndex); if (firstStoredEntryForBookie != LedgerHandle.INVALID_ENTRY_ID) { if (firstEntry == LedgerHandle.INVALID_ENTRY_ID) { firstEntry = firstStoredEntryForBookie; } else { firstEntry = Math.min(firstEntry, firstStoredEntryForBookie); } } } return firstEntry; }
Source:
public NonNullList<ItemStack> getRemainingItems(@Nonnull CraftingInventory inv) { NonNullList<ItemStack> remaining = NonNullList.withSize(inv.getSizeInventory(), ItemStack.EMPTY); final MatchLocation offset = findMatch(inv); Preconditions.checkNotNull(offset); for(int x = 0; x < inv.getWidth(); ++x) for(int y = 0; y < inv.getHeight(); ++y) { final int invIndex = getInventoryIndex(inv, x, y); final int ingrIndex = offset.getListIndex(x, y); if(ingrIndex >= 0) { Ingredient ingr = getIngredients().get(ingrIndex); final ItemStack item = inv.getStackInSlot(invIndex); ItemStack result = ItemStack.EMPTY; if(ingr instanceof IngredientFluidStack) result = ((IngredientFluidStack)ingr).getExtractedStack(item).copy(); else if(item.hasContainerItem()) result = item.getContainerItem(); if(result==item) result = result.copy(); remaining.set(invIndex, result); } } return remaining; }

Target:
public NonNullList<ItemStack> getRemainingItems(@Nonnull CraftingInventory inv) { NonNullList<ItemStack> remaining = NonNullList.withSize(inv.getSizeInventory(), ItemStack.EMPTY); final MatchLocation offset = findMatch(inv); Preconditions.checkNotNull(offset); for(int x = 0; x < inv.getWidth(); ++x) for(int y = 0; y < inv.getHeight(); ++y) { final int invIndex = getInventoryIndex(inv, x, y); final int ingrIndex = offset.getListIndex(x, y); if(ingrIndex >= 0) { Ingredient ingr = getIngredients().get(ingrIndex); final ItemStack item = inv.getStackInSlot(invIndex); ItemStack result = ItemStack.EMPTY; if(ingr instanceof IngredientFluidStack) result = ((IngredientFluidStack)ingr).getExtractedStack(item.copy()); else if(item.hasContainerItem()) result = item.getContainerItem(); if(result==item) result = result.copy(); remaining.set(invIndex, result); } } return remaining; }
Source:
public void configure() throws Exception { String metacardRouteId = "metacard-" + UUID.randomUUID().toString(); from("catalog:postingest") .split(method(ResponseMetacardActionSplitter.class, "split(${body})")) .to("direct:" + metacardRouteId); from("direct:" + metacardRouteId) .setHeader(METACARD_TRANSFORMER_ID_RTE_PROP, simple(metacardTransformerId, String.class)) .setHeader( METACARD_BACKUP_INVALID_RTE_PROP, simple(String.valueOf(backupInvalidMetacards), Boolean.class)) .setHeader( METACARD_BACKUP_KEEP_DELETED_RTE_PROP, simple(String.valueOf(keepDeletedMetacards), Boolean.class)) .choice() .when(not(getShouldBackupPredicate())) .stop() .otherwise() .setHeader( TEMPLATED_STRING_HEADER_RTE_PROP, method(new MetacardTemplate(outputPathTemplate), "applyTemplate(${body})")) .to("catalog:metacardtransformer") .choice() .when( and( header(PostIngestConsumer.ACTION).isEqualTo(PostIngestConsumer.DELETE), not(getCheckDeletePredicate()))) .bean( MetacardFileStorageRoute.class, String.format( "deleteFile(%s, ${in.headers.%s)", getStartingDir(), TEMPLATED_STRING_HEADER_RTE_PROP)) .stop() .otherwise() .to( "file://" + getStartingDir() + "?fileName=${in.headers." + TEMPLATED_STRING_HEADER_RTE_PROP + "}"); LOGGER.trace("Starting metacard file storage route: {}", this); }

Target:
public void configure() throws Exception { routeIds.clear(); String metacardRouteId = "metacard-" + UUID.randomUUID().toString(); String route1Id = metacardRouteId + "1"; from("catalog:postingest") .routeId(route1Id) .split(method(ResponseMetacardActionSplitter.class, "split(${body})")) .to("direct:" + metacardRouteId); routeIds.add(route1Id); String route2Id = metacardRouteId + "2"; from("direct:" + metacardRouteId + "?block=true") .routeId(route2Id) .setHeader(METACARD_TRANSFORMER_ID_RTE_PROP, simple(metacardTransformerId, String.class)) .setHeader( METACARD_BACKUP_INVALID_RTE_PROP, simple(String.valueOf(backupInvalidMetacards), Boolean.class)) .setHeader( METACARD_BACKUP_KEEP_DELETED_RTE_PROP, simple(String.valueOf(keepDeletedMetacards), Boolean.class)) .choice() .when(not(getShouldBackupPredicate())) .stop() .otherwise() .setHeader( TEMPLATED_STRING_HEADER_RTE_PROP, method(new MetacardTemplate(outputPathTemplate), "applyTemplate(${body})")) .to("catalog:metacardtransformer") .choice() .when( and( header(PostIngestConsumer.ACTION).isEqualTo(PostIngestConsumer.DELETE), getCheckDeletePredicate())) .bean( MetacardFileStorageRoute.class, String.format( "deleteFile(%s, ${in.headers.%s})", URLEncoder.encode(getStartingDir(), StandardCharsets.UTF_8.name()), URLEncoder.encode(TEMPLATED_STRING_HEADER_RTE_PROP, StandardCharsets.UTF_8.name()))) .stop() .otherwise() .to( "file://" + getStartingDir() + "?fileName=${in.headers." + TEMPLATED_STRING_HEADER_RTE_PROP + "}"); routeIds.add(route2Id); LOGGER.trace("Starting metacard file storage route: {}", this); }
Source:
public void attemptsExperimentAgainAfterEnoughTimeHasElapsed() { enableExperiment(); throwOnFirstExperiment(); assertThatThrownBy(experimentSupplier::getAsInt).isEqualTo(RUNTIME_EXCEPTION); assertThat(experimentSupplier.getAsInt()).isEqualTo(FALLBACK_INT); when(clock.instant()).thenReturn(Instant.ofEpochSecond(1_000)); assertThat(experimentSupplier.getAsInt()).isEqualTo(EXPERIMENTAL_INT); }

Target:
public void attemptsExperimentAgainAfterEnoughTimeHasElapsed() { enableExperiment(); setTimeTo(Instant.ofEpochSecond(0)); throwOnExperiment(); assertThatThrownBy(proxyInstance::getAsInt).isEqualTo(RUNTIME_EXCEPTION); assertThat(proxyInstance.getAsInt()).isEqualTo(FALLBACK_RESULT); returnValueOnExperiment(); setTimeTo(Instant.ofEpochSecond(ExperimentRunningProxy.REFRESH_INTERVAL.getSeconds() - 1)); assertThat(proxyInstance.getAsInt()).isEqualTo(FALLBACK_RESULT); setTimeTo(Instant.ofEpochSecond(ExperimentRunningProxy.REFRESH_INTERVAL.getSeconds() + 1)); assertThat(proxyInstance.getAsInt()).isEqualTo(EXPERIMENTAL_RESULT); }
Source:
protected abstract TaskResult runTask(@NotNull TaskContext context) throws TaskException; protected abstract void initTask(@NotNull TaskContext context) throws TaskException; public TaskResult execute(@NotNull TaskContext context) throws TaskException { String buildInfoFromContext = ""; if (shouldRemoveBuildInfoFromContext()) { buildInfoFromContext = TaskUtils.getAndDeleteAggregatedBuildInfo(context); } initTask(context); ServerConfig server = getUsageServerConfig(); if (server != null) { reportUsage(server, getTaskUsageName(), getLog()); } TaskResult taskResult = runTask(context); GenericData gd = new GenericData(); try { if (StringUtils.isNotBlank(buildInfoFromContext)) { gd = BuildInfoExtractorUtils.jsonStringToGeneric(buildInfoFromContext, GenericData.class); } if (buildFromTask != null) { gd.addBuild(buildFromTask); } String aggregatedBuildInfo = ""; if (gd.getBuilds() != null) { aggregatedBuildInfo = BuildInfoExtractorUtils.buildInfoToJsonString(gd); } TaskUtils.addBuildInfoToContext(context, aggregatedBuildInfo); } catch (IOException ex) { throw new TaskException("Failed to add Build Info to context.", ex); } return taskResult; }

Target:
protected abstract TaskResult runTask(@NotNull TaskContext context) throws TaskException; protected abstract void initTask(@NotNull TaskContext context) throws TaskException; public TaskResult execute(@NotNull TaskContext context) throws TaskException { String buildInfoFromContext = ""; if (shouldRemoveBuildInfoFromContext()) { buildInfoFromContext = TaskUtils.getAndDeleteAggregatedBuildInfo(context); } initTask(context); ServerConfig server = getUsageServerConfig(); if (server != null) { reportUsage(server, getTaskUsageName(), getLog()); } TaskResult taskResult = runTask(context); if (StringUtils.isNotBlank(buildInfoFromContext) || taskBuildInfo != null) { aggregateBuildInfoAndAddToPlanContext(buildInfoFromContext, context); } return taskResult; }
Source:
public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); if (player == null) { return false; } Card card = player.getLibrary().getFromTop(game); if (card == null) { return false; } player.revealCards(source, new CardsImpl(card), game); if (card.isCreature()) { return player.moveCards(card, Zone.HAND, source, game); } return player.putCardsOnBottomOfLibrary(card, game, source, false); }

Target:
public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); if (player == null) { return false; } Card card = player.getLibrary().getFromTop(game); if (card == null) { return false; } player.revealCards(source, new CardsImpl(card), game); if (card.isCreature()) { return player.moveCards(card, Zone.HAND, source, game); } else { return player.putCardsOnBottomOfLibrary(card, game, source, false); } }
Source:
public boolean execute(CommandSender sender, String label, String[] args) { if (args.length == 0) { sender.sendMessage(ChatColor.RED + "Usage: " + usageMessage); return false; } final StringBuilder message = new StringBuilder("* ").append(CommandUtils.getName(sender)); Arrays.stream(args).forEach(parameter -> message.append(" ").append(parameter)); Bukkit.broadcastMessage(message.toString()); return true; }

Target:
public boolean execute(CommandSender sender, String label, String[] args) { if (!testPermission(sender)) return false; if (args.length == 0) { sender.sendMessage(ChatColor.RED + "Usage: " + usageMessage); return false; } final StringBuilder message = new StringBuilder("* ").append(CommandUtils.getName(sender)); Arrays.stream(args).forEach(parameter -> message.append(" ").append(parameter)); Bukkit.broadcastMessage(message.toString()); return true; }
Source:
protected void addMappingsToConcepts(List<Object> explicitItems) { log("Adding mappings to Concepts"); if (MetadataSharing.getInstance().isAddLocalMappings()) { ConceptPubSubService pubsubService = Context.getService(ConceptPubSubService.class); for (Object explicitItem : explicitItems) { if (explicitItem instanceof Concept) { pubsubService.addLocalMappingToConcept((Concept) explicitItem); } } } }

Target:
protected void addMappingsToConcepts(List<Object> explicitItems) { if (MetadataSharing.getInstance().isAddLocalMappings()) { log("Adding mappings to Concepts"); ConceptPubSubService pubsubService = Context.getService(ConceptPubSubService.class); for (Object explicitItem : explicitItems) { if (explicitItem instanceof Concept) { pubsubService.addLocalMappingToConcept((Concept) explicitItem); } } } }
Source:
private void handleMetadata(Versioned<LedgerMetadata> metadata, Throwable exception) { if (exception == null) { final Set<LedgerMetadataListener> listenerSet = listeners.get(ledgerId); if (null != listenerSet) { if (LOG.isDebugEnabled()) { LOG.debug("Ledger metadata is changed for : {}.", ledgerId, metadata.getValue()); } scheduler.submit(() -> { synchronized (listenerSet) { for (LedgerMetadataListener listener : listenerSet) { listener.onChanged(ledgerId, metadata); } } }); } } else if (exception instanceof BKException.BKNoSuchLedgerExistsException) { Set<LedgerMetadataListener> listenerSet = listeners.remove(ledgerId); if (null != listenerSet) { if (LOG.isDebugEnabled()) { LOG.debug("Removed ledger metadata listener set on ledger as its ledger is deleted : {}", ledgerId, listenerSet.size()); } } } else { LOG.warn("Failed on read ledger metadata of ledger {}", ledgerId, exception); scheduler.schedule(this, MS_CONNECT_BACKOFF_MS, TimeUnit.MILLISECONDS); } }

Target:
private void handleMetadata(Versioned<LedgerMetadata> metadata, Throwable exception) { if (exception == null) { final Set<LedgerMetadataListener> listenerSet = listeners.get(ledgerId); if (null != listenerSet) { if (LOG.isDebugEnabled()) { LOG.debug("Ledger metadata is changed for : {}.", ledgerId, metadata.getValue()); } scheduler.submit(() -> { synchronized (listenerSet) { for (LedgerMetadataListener listener : listenerSet) { listener.onChanged(ledgerId, metadata); } } }); } } else if (BKException.getExceptionCode(exception) == BKException.Code.NoSuchLedgerExistsException) { Set<LedgerMetadataListener> listenerSet = listeners.remove(ledgerId); if (null != listenerSet) { if (LOG.isDebugEnabled()) { LOG.debug("Removed ledger metadata listener set on ledger as its ledger is deleted : {}", ledgerId, listenerSet.size()); } } } else { LOG.warn("Failed on read ledger metadata of ledger {}: {}", ledgerId, BKException.getExceptionCode(exception)); scheduler.schedule(this, MS_CONNECT_BACKOFF_MS, TimeUnit.MILLISECONDS); } }
Source:
Point resizeCalculationsGTK3(long widget, int width, int height) { Point size = super.resizeCalculationsGTK3(widget, width, height); if (widget == handle && GTK.GTK_VERSION >= OS.VERSION(3, 22, 0)) { GtkRequisition naturalSize = new GtkRequisition(); GtkRequisition minimumSize = new GtkRequisition(); GTK.gtk_widget_get_preferred_size(handle, minimumSize, naturalSize); size.y = Math.max(size.y, minimumSize.height); } return size; }

Target:
Point resizeCalculationsGTK3(long widget, int width, int height) { Point size = super.resizeCalculationsGTK3(widget, width, height); if (widget == handle && GTK.GTK_VERSION >= OS.VERSION(3, 20, 0)) { GtkRequisition naturalSize = new GtkRequisition(); GtkRequisition minimumSize = new GtkRequisition(); GTK.gtk_widget_get_preferred_size(handle, minimumSize, naturalSize); size.y = Math.max(size.y, minimumSize.height); } return size; }
Source:
public void updateApplicationAction() { final ActionFactory factory = new ActionFactory(Globals.getKeyPrefs()); action.updateApplication(getApplicationByName(Globals.prefs.get(JabRefPreferences.PUSH_TO_APPLICATION))); if (menuItem != null) { factory.configureMenuItem( action.getActionInformation(), action, menuItem); } if (toolBarButton != null) { factory.configureIconButton( action.getActionInformation(), action, toolBarButton); } }

Target:
public void updateApplicationAction() { final ActionFactory factory = new ActionFactory(Globals.getKeyPrefs()); action.updateApplication(Globals.prefs.getActivePushToApplication(this)); if (menuItem != null) { factory.configureMenuItem(action.getActionInformation(), action, menuItem); } if (toolBarButton != null) { factory.configureIconButton(action.getActionInformation(), action, toolBarButton); } }
Source:
public String getToken() throws OAuthSystemException, OAuthProblemException { TmcSettings settings = TmcSettingsHolder.get(); OAuthClientRequest request = OAuthClientRequest .tokenLocation(settings.getOauthTokenUrl()) .setGrantType(GrantType.PASSWORD) .setClientId(settings.getOauthApplicationId()) .setClientSecret(settings.getOauthSecret()) .setUsername(settings.getUsername()) .setPassword(settings.getPassword()) .buildQueryMessage(); OAuthClient client = new OAuthClient(new URLConnectionClient()); String token = client.accessToken(request, OAuthJSONAccessTokenResponse.class) .getAccessToken(); return token; }

Target:
public String getToken() throws OAuthSystemException, OAuthProblemException { LOG.log(Level.INFO, "Fetching new oauth token from server"); OAuthClientRequest request = OAuthClientRequest .tokenLocation(settings.getOauthTokenUrl()) .setGrantType(GrantType.PASSWORD) .setClientId(settings.getOauthApplicationId()) .setClientSecret(settings.getOauthSecret()) .setUsername(settings.getUsername()) .setPassword(settings.getPassword()) .buildQueryMessage(); OAuthClient client = new OAuthClient(new URLConnectionClient()); String token = client.accessToken(request, OAuthJSONAccessTokenResponse.class) .getAccessToken(); return token; }
Source:
private String getBeanAsJson(TestBean bean) throws Exception { return new Jackson2JsonObjectMapper().toJson(bean); }

Target:
private String getBeanAsJson(TestBean bean) throws Exception { return JsonObjectMapperProvider.newInstance().toJson(bean); }
Source:
public void retrievesOrganizations() throws Exception { final Github github = new MkGithub(); final MkContainer container = new MkGrizzlyContainer().next( new MkAnswer.Simple( HttpURLConnection.HTTP_OK, Json.createArrayBuilder() .add(org(1, "org1")) .add(org(2, "org2")) .add(org(3, "org3")) .build().toString() ) ).start(); try { final Organizations orgs = new RtOrganizations( github, new ApacheRequest(container.home()) ); MatcherAssert.assertThat( orgs.iterate(), Matchers.<Organization>iterableWithSize(3) ); MatcherAssert.assertThat( container.take().uri().toString(), Matchers.endsWith("/user/orgs") ); } finally { container.stop(); } }

Target:
public void retrievesOrganizations() throws Exception { final Github github = new MkGithub(); final MkContainer container = new MkGrizzlyContainer().next( new MkAnswer.Simple( HttpURLConnection.HTTP_OK, Json.createArrayBuilder() .add(org(1, "org1")) .add(org(2, "org2")) .add(org(3, "org3")) .build().toString() ) ).start(); try { final Organizations orgs = new RtOrganizations( github, new ApacheRequest(container.home()) ); MatcherAssert.assertThat( orgs.iterate(), Matchers.<Organization>iterableWithSize(Tv.THREE) ); MatcherAssert.assertThat( container.take().uri().toString(), Matchers.endsWith("/user/orgs") ); } finally { container.stop(); } }
Source:
public void testsHeaderNotAvailable() throws IOException { MatcherAssert.assertThat( new RsWithBody("<html></html>"), new HmRsHeader( Matchers.not( Matchers.hasEntry( "cache-control", "no-cache, no-store" ) ) ) ); }

Target:
public void testsHeaderNotAvailable() throws Exception { MatcherAssert.assertThat( new RsWithBody("<html></html>"), new HmRsHeader( Matchers.not( Matchers.hasEntry( "cache-control", "no-cache, no-store" ) ) ) ); }
Source:
private ElementTreeSelectionDialog createWorkspaceFolderDialog(Shell shell, String selectedFile) { ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog( shell, new WorkbenchLabelProvider(), new WorkbenchContentProvider() ); dialog.setTitle("Select an workspace folder"); dialog.setMessage("Select a workspace folder to deploy"); dialog.setInput( ResourcesPlugin.getWorkspace().getRoot() ); dialog.addFilter(new ViewerFilter() { @Override public boolean select(Viewer viewer, Object parentElement, Object element) { return element instanceof IContainer; } }); dialog.setAllowMultiple( false ); org.eclipse.core.resources.IResource res = model.getDeployProject(); if (org.apache.commons.lang.StringUtils.isNotBlank(selectedFile)) { String prefix = "${workspace_loc:"; String path = selectedFile; if (selectedFile.startsWith(prefix) && selectedFile.endsWith("}")) { path = path.substring(prefix.length(), path.length()-1); } res = ResourcesPlugin.getWorkspace().getRoot().findMember(path); } if (res != null) { dialog.setInitialSelection(res); } return dialog; }

Target:
private ElementTreeSelectionDialog createWorkspaceFolderDialog(Shell shell, String selectedFile) { ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog( shell, new WorkbenchLabelProvider(), new WorkbenchContentProvider() ); dialog.setTitle("Select a workspace folder"); dialog.setMessage("Select a workspace folder to deploy"); dialog.setInput( ResourcesPlugin.getWorkspace().getRoot() ); dialog.addFilter(new ViewerFilter() { @Override public boolean select(Viewer viewer, Object parentElement, Object element) { return element instanceof IContainer; } }); dialog.setAllowMultiple( false ); org.eclipse.core.resources.IResource res = model.getDeployProject(); if (org.apache.commons.lang.StringUtils.isNotBlank(selectedFile)) { String path = VariablesHelper.getWorkspacePath(selectedFile); org.eclipse.core.resources.IResource member = ResourcesPlugin.getWorkspace().getRoot().findMember(path); if (member != null) { res = member; } } if (res != null) { dialog.setInitialSelection(res); } return dialog; }
Source:
public void cacheManagerStarted(GlobalComponentRegistry gcr) { BasicComponentRegistry bcr = gcr.getComponent(BasicComponentRegistry.class); ProtobufMetadataManagerImpl protobufMetadataManager = (ProtobufMetadataManagerImpl) bcr.getComponent(ProtobufMetadataManager.class).running(); protobufMetadataManager.startInternalCache(); GlobalConfiguration globalCfg = gcr.getGlobalConfiguration(); if (globalCfg.globalJmxStatistics().enabled()) { registerProtobufMetadataManagerMBean(protobufMetadataManager, globalCfg, bcr); } }

Target:
public void cacheManagerStarted(GlobalComponentRegistry gcr) { BasicComponentRegistry bcr = gcr.getComponent(BasicComponentRegistry.class); ProtobufMetadataManagerImpl protobufMetadataManager = (ProtobufMetadataManagerImpl) bcr.getComponent(ProtobufMetadataManager.class).running(); protobufMetadataManager.getCache(); GlobalConfiguration globalCfg = gcr.getGlobalConfiguration(); if (globalCfg.globalJmxStatistics().enabled()) { registerProtobufMetadataManagerMBean(protobufMetadataManager, globalCfg, bcr); } }
Source:
public void testGetPrincipalWithoutReferences() throws Exception { DocumentModel u1 = getUser("user1"); userManager.createUser(u1); DocumentModel g1 = getGroup("group1"); g1.setProperty("group", "members", Arrays.asList("user1")); userManager.createGroup(g1); DocumentModel g2 = getGroup("group2"); g2.setProperty("group", "members", Arrays.asList("user1")); userManager.createGroup(g2); NuxeoPrincipal principal1 = userManager.getPrincipal("user1"); assertEquals(3, principal1.getAllGroups().size()); principal1 = userManager.getPrincipal("user1", false); assertEquals(1, principal1.getAllGroups().size()); assertTrue(principal1.isMemberOf("defgr")); assertFalse(principal1.isMemberOf("group1")); }

Target:
public void testGetPrincipalWithoutReferences() throws Exception { DocumentModel u1 = getUser("user1"); userManager.createUser(u1); DocumentModel g1 = getGroup("group1"); g1.setProperty("group", "members", List.of("user1")); userManager.createGroup(g1); DocumentModel g2 = getGroup("group2"); g2.setProperty("group", "members", List.of("user1")); userManager.createGroup(g2); NuxeoPrincipal principal1 = userManager.getPrincipal("user1"); assertEquals(3, principal1.getAllGroups().size()); principal1 = userManager.getPrincipal("user1", false); assertEquals(1, principal1.getAllGroups().size()); assertTrue(principal1.isMemberOf("defgr")); assertFalse(principal1.isMemberOf("group1")); }
Source:
protected boolean canAuthenticate(final WebContext context) { val grantType = context.getRequestParameter(OAuth20Constants.GRANT_TYPE); val clientId = context.getRequestParameter(OAuth20Constants.CLIENT_ID); if (clientId.isPresent() && grantType.isPresent() && OAuth20Utils.isGrantType(grantType.get(), OAuth20GrantTypes.REFRESH_TOKEN) && context.getRequestParameter(OAuth20Constants.REFRESH_TOKEN).isPresent()) { val registeredService = OAuth20Utils.getRegisteredOAuthServiceByClientId(getServicesManager(), clientId.get()); if (registeredService != null && !OAuth20Utils.doesServiceNeedAuthentication(registeredService)) { return true; } } return false; }

Target:
protected boolean canAuthenticate(final WebContext context) { val grantType = context.getRequestParameter(OAuth20Constants.GRANT_TYPE); val clientId = context.getRequestParameter(OAuth20Constants.CLIENT_ID); if (clientId.isPresent() && grantType.isPresent() && OAuth20Utils.isGrantType(grantType.get(), OAuth20GrantTypes.REFRESH_TOKEN) && context.getRequestParameter(OAuth20Constants.REFRESH_TOKEN).isPresent()) { val registeredService = OAuth20Utils.getRegisteredOAuthServiceByClientId(getServicesManager(), clientId.get()); LOGGER.trace("Checking if the client is eligible for refresh token authentication", clientId.get()); if (registeredService != null && !OAuth20Utils.doesServiceNeedAuthentication(registeredService)) { return true; } } return false; }
Source:
public ICPPEvaluation resolveFunction(ICPPEvaluation[] args, IASTNode point) { LookupData data; ICPPFunction[] functions = null; if (fFunctionSet == null) { data = new LookupData(fName, null, point); } else { functions = fFunctionSet.getBindings(); data = new LookupData(functions[0].getNameCharArray(), fFunctionSet.getTemplateArguments(), point); data.foundItems = functions; } data.setFunctionArguments(false, args); if (fImpliedObjectType != null) data.setImpliedObjectType(fImpliedObjectType); try { if (fImpliedObjectType == null && !data.hasTypeOrMemberFunctionOrVariableResult()) { CPPSemantics.doKoenigLookup(data); Object[] foundItems = (Object[]) data.foundItems; if (foundItems != null && (functions == null || foundItems.length > functions.length)) { functions = Arrays.copyOf(foundItems, foundItems.length, ICPPFunction[].class); functions = new HashSet<ICPPFunction>(Arrays.asList(functions)).toArray(EMPTY_FUNCTION_ARRAY); } } IBinding binding = CPPSemantics.resolveFunction(data, functions, true); if (binding instanceof ICPPFunction && !(binding instanceof ICPPUnknownBinding)) return new EvalBinding(binding, null, getTemplateDefinition()); } catch (DOMException e) { CCorePlugin.log(e); } return this; }

Target:
public ICPPEvaluation resolveFunction(ICPPEvaluation[] args, IASTNode point) { LookupData data; ICPPFunction[] functions = null; if (fFunctionSet == null) { data = new LookupData(fName, null, point); } else { functions = fFunctionSet.getBindings(); data = new LookupData(functions[0].getNameCharArray(), fFunctionSet.getTemplateArguments(), point); data.foundItems = functions; } data.setFunctionArguments(false, args); if (fImpliedObjectType != null) data.setImpliedObjectType(fImpliedObjectType); try { if (fImpliedObjectType == null && !data.hasTypeOrMemberFunctionOrVariableResult()) { CPPSemantics.doKoenigLookup(data); Object[] foundItems = (Object[]) data.foundItems; if (foundItems != null && (functions == null || foundItems.length > functions.length)) { functions = Arrays.copyOf(foundItems, foundItems.length, ICPPFunction[].class); functions = ArrayUtil.removeDuplicates(functions); } } IBinding binding = CPPSemantics.resolveFunction(data, functions, true); if (binding instanceof ICPPFunction && !(binding instanceof ICPPUnknownBinding)) return new EvalBinding(binding, null, getTemplateDefinition()); } catch (DOMException e) { CCorePlugin.log(e); } return this; }
Source:
public Map<BoxedByteArray, byte[]> increment(Map<BoxedByteArray, T> writes) throws IOException, InterruptedException { ImmutableMap.Builder<BoxedByteArray, byte[]> successes = ImmutableMap.builder(); List<Row> increments = new ArrayList<>(); List<Map.Entry<BoxedByteArray, byte[]>> entries = writes.entrySet().stream() .map(e -> new AbstractMap.SimpleEntry<BoxedByteArray, byte[]>(e.getKey(), e.getValue().serialize())) .collect(Collectors.toList()); for (Map.Entry<BoxedByteArray, byte[]> entry : entries) { long amount = Bytes.toLong(entry.getValue()); Increment increment = new Increment(entry.getKey().bytes); increment.addColumn(cf, QUALIFIER, amount); incrementSize.update(amount); increments.add(increment); } Object[] objects = WithHTable.batch(pool, tableName, increments); for (int i = 0; i < objects.length; ++i) { if (objects[i] != null) { successes.put(entries.get(i)); } } return successes.build(); }

Target:
public Map<BoxedByteArray, byte[]> increment(Map<BoxedByteArray, T> writes) throws IOException, InterruptedException { ImmutableMap.Builder<BoxedByteArray, byte[]> successes = ImmutableMap.builder(); List<Row> increments = new ArrayList<>(); List<Map.Entry<BoxedByteArray, T>> entries = ImmutableList.copyOf(writes.entrySet()); for (Map.Entry<BoxedByteArray, T> entry : entries) { long amount = Bytes.toLong(entry.getValue().serialize()); Increment increment = new Increment(entry.getKey().bytes); increment.addColumn(cf, QUALIFIER, amount); incrementSize.update(amount); increments.add(increment); } Object[] objects = WithHTable.batch(pool, tableName, increments); for (int i = 0; i < objects.length; ++i) { if (objects[i] != null) { Result result = (Result) objects[i]; byte[] value = result.getValue(cf, QUALIFIER); successes.put(entries.get(i).getKey(), value); } } return successes.build(); }
Source:
public Structure placeStructure(Structure structure) { Vector2D topLeftMapCoordinates = structure.getMapCoordinates(); int range = 2; for (int x = 0; x < structure.getWidthInCells(); x++) { for (int y = 0; y < structure.getHeightInCells(); y++) { int cellX = topLeftMapCoordinates.getXAsInt() + x; int cellY = topLeftMapCoordinates.getYAsInt() + y; getCell(cellX, cellY).setEntity(structure); revealShroudFor(cellX, cellY, range); } } return structure; }

Target:
public Structure placeStructure(Structure structure) { Vector2D topLeftMapCoordinates = structure.getMapCoordinates(); for (int x = 0; x < structure.getWidthInCells(); x++) { for (int y = 0; y < structure.getHeightInCells(); y++) { int cellX = topLeftMapCoordinates.getXAsInt() + x; int cellY = topLeftMapCoordinates.getYAsInt() + y; getCell(cellX, cellY).setEntity(structure); revealShroudFor(cellX, cellY, structure.getSight()); } } return structure; }