auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public DecimalStatistics(BigDecimal minimum, BigDecimal maximum, long decimalSizeInBytes) { checkArgument(minimum == null || maximum == null || minimum.compareTo(maximum) <= 0, "minimum is not less than maximum"); this.minimum = minimum; this.maximum = maximum; int retainedSizeInBytes = 0; if (minimum != null) { retainedSizeInBytes += BIG_DECIMAL_INSTANCE_SIZE + decimalSizeInBytes; } if (maximum != null) { retainedSizeInBytes += BIG_DECIMAL_INSTANCE_SIZE + decimalSizeInBytes; } this.retainedSizeInBytes = retainedSizeInBytes + INSTANCE_SIZE; }

Target:
public DecimalStatistics(BigDecimal minimum, BigDecimal maximum, long decimalSizeInBytes) { checkArgument(minimum == null || maximum == null || minimum.compareTo(maximum) <= 0, "minimum is not less than maximum"); this.minimum = minimum; this.maximum = maximum; int retainedSizeInBytes = 0; if (minimum != null) { retainedSizeInBytes += BIG_DECIMAL_INSTANCE_SIZE + decimalSizeInBytes; } if (maximum != null && minimum != maximum) { retainedSizeInBytes += BIG_DECIMAL_INSTANCE_SIZE + decimalSizeInBytes; } this.retainedSizeInBytes = retainedSizeInBytes + INSTANCE_SIZE; }
Source:
FileAuditEndpoint(Builder builder) throws IOException { this.dateFormatSupplier = builder.dateFormatSupplier; this.syncOnAccept = builder.syncOnAccept; try (FileOutputStream fos = new FileOutputStream(builder.location.toFile(), true)) { this.fileDescriptor = fos.getFD(); this.outputStream = new BufferedOutputStream(fos); } }

Target:
FileAuditEndpoint(Builder builder) throws IOException { this.dateFormatSupplier = builder.dateFormatSupplier; this.syncOnAccept = builder.syncOnAccept; FileOutputStream fos = new FileOutputStream(builder.location.toFile(), true); try { this.fileDescriptor = fos.getFD(); } catch (IOException e) { fos.close(); throw e; } this.outputStream = new BufferedOutputStream(fos); }
Source:
private static long[][] buildFrequencies(final List<CramCompressionRecord> cramRecords) { final long[][] frequencies = new long[SYMBOL_SPACE_SIZE][SYMBOL_SPACE_SIZE]; for (final CramCompressionRecord record : cramRecords) { if (record.readFeatures != null) { for (final ReadFeature readFeature : record.readFeatures) { if (readFeature.getOperator() == Substitution.operator) { final Substitution substitution = ((Substitution) readFeature); final byte refBase = substitution.getReferenceBase(); final byte base = substitution.getBase(); frequencies[refBase][base]++; } } } } return frequencies; }

Target:
private static long[][] buildFrequencies(final List<CramCompressionRecord> cramRecords) { final long[][] frequencies = new long[SYMBOL_SPACE_SIZE][SYMBOL_SPACE_SIZE]; for (final CramCompressionRecord record : cramRecords) { if (record.readFeatures != null) { for (final ReadFeature readFeature : record.readFeatures) { if (readFeature.getOperator() == Substitution.operator) { final Substitution substitution = ((Substitution) readFeature); final byte refBase = substitution.getReferenceBase(); final byte base = substitution.getBase(); if (refBase <= 0 || base <= 0) { throw new IllegalArgumentException( String.format("CRAM: Attempt to generate a substitution code for invalid reference base with value '%d'", refBase)); } frequencies[refBase][base]++; } } } } return frequencies; }
Source:
public Messages add(Message message) { get(message.getSeverity()).add(message); unhandledErrors = true; return this; }

Target:
public Messages add(Message message) { get(message.getSeverity()).add(message); if(Severity.ERROR.equals(message.getSeverity())) { unhandledErrors = true; } return this; }
Source:
public String getDisplayedGenderType() { return gender == null || gender == Gender.OTHER ? Const.STUDENT_PROFILE_FIELD_NOT_FILLED : gender.name().toLowerCase(); }

Target:
public String getDisplayedGenderType() { return gender == null ? Const.STUDENT_PROFILE_FIELD_NOT_FILLED : gender.name().toLowerCase(); }
Source:
public Order cloneForDiscontinuing() { Order newOrder = new Order(); newOrder.setCareSetting(this.getCareSetting()); newOrder.setConcept(this.getConcept()); newOrder.setAction(Action.DISCONTINUE); newOrder.setPreviousOrder(this); newOrder.setPatient(this.getPatient()); newOrder.setOrderer(this.getOrderer()); newOrder.setStartDate(this.getStartDate()); return newOrder; }

Target:
public Order cloneForDiscontinuing() { Order newOrder = new Order(); newOrder.setCareSetting(this.getCareSetting()); newOrder.setConcept(this.getConcept()); newOrder.setAction(Action.DISCONTINUE); newOrder.setPreviousOrder(this); newOrder.setPatient(this.getPatient()); newOrder.setStartDate(this.getStartDate()); return newOrder; }
Source:
public void processTuple(byte[] inputTuple) { if (inputTuple == null) { this.admitError(null, "null tuple"); return; } String incomingString = ""; try { if (encoding != null) { incomingString = new String(inputTuple, encoding); } else { incomingString = new String(inputTuple, CharEncoding.UTF_8); } if (StringUtils.isBlank(incomingString)) { this.admitError(incomingString, "Blank tuple"); return; } logger.info("Input string ", incomingString); logger.info("Parsing with log format {}", this.geLogFileFormat()); if (this.logSchemaDetails != null && clazz != null) { if (parsedOutput.isConnected()) { parsedOutput.emit(objMapper.readValue(this.logSchemaDetails.createJsonFromLog(incomingString).toString().getBytes(), clazz)); parsedOutputCount++; } } } catch (NullPointerException | IOException | JSONException e) { this.admitError(incomingString, e.getMessage()); logger.error("Failed to parse log tuple {}, Exception = ", inputTuple, e); } }

Target:
public void processTuple(byte[] inputTuple) { if (inputTuple == null) { this.emitError(null, "null tuple"); return; } String incomingString = ""; try { incomingString = new String(inputTuple, encoding); if (StringUtils.isBlank(incomingString)) { this.emitError(incomingString, "Blank tuple"); return; } logger.debug("Input string ", incomingString); logger.debug("Parsing with log format {}", this.geLogFileFormat()); if (this.logSchemaDetails != null && clazz != null) { if (parsedOutput.isConnected()) { parsedOutput.emit(objMapper.readValue(this.logSchemaDetails.createJsonFromLog(incomingString).toString().getBytes(), clazz)); parsedOutputCount++; } } } catch (NullPointerException | IOException | JSONException e) { this.emitError(incomingString, e.getMessage()); logger.error("Failed to parse log tuple {}, Exception = ", inputTuple, e); } }
Source:
private synchronized boolean stopEventThread() { while (_eventThread.isAlive()) { try { _eventThread.interrupt(); _eventThread.join(EVENT_THREAD_SHORT_JOIN_TIMEOUT); } catch (InterruptedException e) { _log.warn("Exception caught while stopping coordinator", e); return true; } } return false; }

Target:
private synchronized boolean stopEventThread() { while (_eventThread.isAlive()) { try { _eventThread.interrupt(); _eventThread.join(EVENT_THREAD_SHORT_JOIN_TIMEOUT); } catch (InterruptedException e) { _log.warn("Exception caught while interrupting the event thread", e); return true; } } return false; }
Source:
public ValueAndTimestamp<V1> get(final K key) { final ValueAndTimestamp<V> valueAndTimestamp = parentGetter.get(key); return ValueAndTimestamp.make( valueTransformer.transform(key, getValueOrNull(valueAndTimestamp)), valueAndTimestamp == null ? context.timestamp() : valueAndTimestamp.timestamp()); }

Target:
public ValueAndTimestamp<V1> get(final K key) { final ValueAndTimestamp<V> valueAndTimestamp = parentGetter.get(key); return ValueAndTimestamp.make( valueTransformer.transform(key, getValueOrNull(valueAndTimestamp)), valueAndTimestamp == null ? UNKNOWN : valueAndTimestamp.timestamp()); }
Source:
protected void processAuthenticationResponse(HttpServletRequest request, HttpServletResponse response, AuthenticationContext context) throws AuthenticationFailedException { String token = request.getParameter("token"); String username = getLoggedInUser(context); if (token != null) { try { int tokenvalue = Integer.parseInt(token); if (!TOTPAuthenticatorServiceComponent.getTotpManager().isValidTokenLocalUser(tokenvalue, username)) { log.info("Authentication failed, user : "+username); throw new AuthenticationFailedException(); } } catch (TOTPException e) { throw new AuthenticationFailedException("TOTP Authentication process failed for user " + username, e); } } }

Target:
protected void processAuthenticationResponse(HttpServletRequest request, HttpServletResponse response, AuthenticationContext context) throws AuthenticationFailedException { String token = CharacterEncoder.getSafeText(request.getParameter("token")); String username = getLoggedInUser(context); if (token != null) { try { int tokenvalue = Integer.parseInt(token); if (!TOTPAuthenticatorServiceComponent.getTotpManager().isValidTokenLocalUser(tokenvalue, username)) { log.info("Authentication failed, user : "+username); throw new AuthenticationFailedException(); } } catch (TOTPException e) { throw new AuthenticationFailedException("TOTP Authentication process failed for user " + username, e); } } }
Source:
public static void addBrickViaUi(Class<?> brickHeaderClass, int brickCategoryId) { onView(withId(R.id.button_add)) .perform(click()); onData(allOf(Is.is(instanceOf(String.class)), Is.is(UiTestUtils.getResourcesString(brickCategoryId)))) .inAdapterView(BrickCategoryListMatchers.isBrickCategoryView()) .perform(click()); onData(Is.is(instanceOf(brickHeaderClass))).inAdapterView(BrickPrototypeListMatchers.isBrickPrototypeView()) .perform(click()); onData(instanceOf(Brick.class)) .inAdapterView(ScriptListMatchers.isScriptListView()).atPosition(1) .perform(click()); }

Target:
public void addBrickViaUi(Class<?> brickHeaderClass, int brickCategoryId) { onView(withId(R.id.button_add)) .perform(click()); onData(allOf(Is.is(instanceOf(String.class)), Is.is(UiTestUtils.getResourcesString(brickCategoryId)))) .inAdapterView(BrickCategoryListMatchers.isBrickCategoryView()) .perform(click()); onData(Is.is(instanceOf(brickHeaderClass))).inAdapterView(BrickPrototypeListMatchers.isBrickPrototypeView()) .perform(click()); onData(instanceOf(Brick.class)) .inAdapterView(ScriptListMatchers.isScriptListView()).atPosition(1) .perform(click()); }
Source:
public void execute(AmazonEC2 client, Pool pool, DelegateExecution execution) throws Exception { final String businessKey = execution.getProcessBusinessKey(); Optional<Object> alreadySent = Optional.fromNullable( execution.getVariable(ProcessVariables.SPOT_INSTANCE_REQUEST_IDS)); if (alreadySent.isPresent()) { try { Thread.sleep(60 * 1000); } catch (InterruptedException exception) { LOG.warn("Timeout to make describe calls consistent was interrupted", exception); } } DescribeSpotInstanceRequestsResult result = client.describeSpotInstanceRequests( new DescribeSpotInstanceRequestsRequest() .withFilters(new Filter() .withName("launch-group").withValues(businessKey) .withName("state").withValues("open", "active"))); List<SpotInstanceRequest> pending = result.getSpotInstanceRequests(); if (pending.size() > 0) { LOG.info("Not resending spot instance requests for businessKey: {}.", pending, businessKey); execution.setVariable(ProcessVariables.SPOT_INSTANCE_REQUEST_IDS, collectSpotInstanceRequestIds(pending)); return; } final RequestSpotInstancesRequest request = createSpotInstancesRequest(pool, execution); execution.setVariable(ProcessVariables.SPOT_REQUESTS_SENT, true); RequestSpotInstancesResult requestResult = client.requestSpotInstances(request); List<String> spotInstanceRequestIds = collectSpotInstanceRequestIds(requestResult.getSpotInstanceRequests()); execution.setVariable(ProcessVariables.SPOT_INSTANCE_REQUEST_IDS, spotInstanceRequestIds); }

Target:
public void execute(AmazonEC2 client, Pool pool, DelegateExecution execution) throws Exception { final String businessKey = execution.getProcessBusinessKey(); Optional<Object> alreadySent = Optional.fromNullable( execution.getVariable(ProcessVariables.SPOT_INSTANCE_REQUEST_IDS)); if (alreadySent.isPresent()) { DescribeSpotInstanceRequestsRequest describeRequest = new DescribeSpotInstanceRequestsRequest() .withFilters(new Filter() .withName("launch-group").withValues(businessKey) .withName("state").withValues("open", "active")); Stopwatch stopwatch = new Stopwatch().start(); while (stopwatch.elapsedTime(TimeUnit.MINUTES) < 2) { DescribeSpotInstanceRequestsResult result = client.describeSpotInstanceRequests(describeRequest); List<SpotInstanceRequest> pending = result.getSpotInstanceRequests(); if (pending.size() > 0) { LOG.info("Not resending spot instance requests for businessKey: {}.", pending, businessKey); execution.setVariable(ProcessVariables.SPOT_INSTANCE_REQUEST_IDS, collectSpotInstanceRequestIds(pending)); return; } LOG.info("The describe call has not returned anything yet, waiting 20s and retrying."); Uninterruptibles.sleepUninterruptibly(20, TimeUnit.SECONDS); } } final RequestSpotInstancesRequest request = createSpotInstancesRequest(pool, execution); execution.setVariable(ProcessVariables.SPOT_REQUESTS_SENT, true); RequestSpotInstancesResult requestResult = client.requestSpotInstances(request); List<String> spotInstanceRequestIds = collectSpotInstanceRequestIds(requestResult.getSpotInstanceRequests()); execution.setVariable(ProcessVariables.SPOT_INSTANCE_REQUEST_IDS, spotInstanceRequestIds); }
Source:
private XmlRpcStruct initNicStructure() { XmlRpcStruct map = new XmlRpcStruct(); VmNetworkInterface nic = getParameters().getNic(); VmDevice vmDevice = getParameters().getVmDevice(); map.add(VdsProperties.Type, VmDeviceType.INTERFACE.getName()); map.add(VdsProperties.Device, VmDeviceType.BRIDGE.getName()); map.add(VdsProperties.mac_addr, nic.getMacAddress()); if (nic.getNetworkName() != null) { map.add(VdsProperties.network, nic.getNetworkName()); } map.add(VdsProperties.linkState, nic.isLinked() ? "up" : "down"); addAddress(map, vmDevice.getAddress()); map.add(VdsProperties.SpecParams, vmDevice.getSpecParams()); map.add(VdsProperties.nic_type, VmInterfaceType.forValue(nic.getType()).name()); map.add(VdsProperties.DeviceId, vmDevice.getId().getDeviceId().toString()); if (vmDevice.getBootOrder() > 0) { map.add(VdsProperties.BootOrder, String.valueOf(vmDevice.getBootOrder())); } if (nic.isPortMirroring()) { map.add(VdsProperties.portMirroring, Collections.singletonList(nic.getNetworkName())); } VmInfoBuilder.addNetworkFiltersToNic(map, getParameters().getVm().getvds_group_compatibility_version()); return map; }

Target:
private XmlRpcStruct initNicStructure() { XmlRpcStruct map = new XmlRpcStruct(); VmNetworkInterface nic = getParameters().getNic(); VmDevice vmDevice = getParameters().getVmDevice(); map.add(VdsProperties.Type, VmDeviceType.INTERFACE.getName()); map.add(VdsProperties.Device, VmDeviceType.BRIDGE.getName()); map.add(VdsProperties.mac_addr, nic.getMacAddress()); if (nic.getNetworkName() != null) { map.add(VdsProperties.network, nic.getNetworkName()); } boolean linkingSupported = Config.<Boolean> GetValue(ConfigValues.NetworkLinkingSupported, getParameters().getVm().getvds_group_compatibility_version().getValue()); if (linkingSupported) { map.add(VdsProperties.linkActive, String.valueOf(nic.isLinked())); } addAddress(map, vmDevice.getAddress()); map.add(VdsProperties.SpecParams, vmDevice.getSpecParams()); map.add(VdsProperties.nic_type, VmInterfaceType.forValue(nic.getType()).name()); map.add(VdsProperties.DeviceId, vmDevice.getId().getDeviceId().toString()); if (vmDevice.getBootOrder() > 0) { map.add(VdsProperties.BootOrder, String.valueOf(vmDevice.getBootOrder())); } if (nic.isPortMirroring()) { map.add(VdsProperties.portMirroring, Collections.singletonList(nic.getNetworkName())); } VmInfoBuilder.addNetworkFiltersToNic(map, getParameters().getVm().getvds_group_compatibility_version()); return map; }
Source:
public WorldReflectionNode(Context context) { renderQueues = context.get(RenderQueuesHelper.class); worldRenderer = context.get(WorldRenderer.class); playerCamera = worldRenderer.getActiveCamera(); addDesiredStateChange(new ReflectedCamera(playerCamera)); addDesiredStateChange(new LookThrough(playerCamera)); renderingConfig = context.get(Config.class).getRendering(); requiresCondition(() -> renderingConfig.isReflectiveWater()); renderingConfig.subscribe(RenderingConfig.REFLECTIVE_WATER, this); DisplayResolutionDependentFBOs displayResolutionDependentFBOs = context.get(DisplayResolutionDependentFBOs.class); requiresFBO(new FBOConfig(REFLECTED_FBO, HALF_SCALE, FBO.Type.DEFAULT).useDepthBuffer(), displayResolutionDependentFBOs); addDesiredStateChange(new BindFBO(REFLECTED_FBO, displayResolutionDependentFBOs)); addDesiredStateChange(new SetViewportToSizeOf(REFLECTED_FBO, displayResolutionDependentFBOs)); addDesiredStateChange(new EnableFaceCulling()); addDesiredStateChange(new SetFacesToCull(GL_FRONT)); addDesiredStateChange(new EnableMaterial(CHUNK_MATERIAL)); chunkMaterial = getMaterial(CHUNK_MATERIAL); }

Target:
public WorldReflectionNode(Context context) { super(context); renderQueues = context.get(RenderQueuesHelper.class); worldRenderer = context.get(WorldRenderer.class); playerCamera = worldRenderer.getActiveCamera(); addDesiredStateChange(new ReflectedCamera(playerCamera)); addDesiredStateChange(new LookThrough(playerCamera)); renderingConfig = context.get(Config.class).getRendering(); requiresCondition(() -> renderingConfig.isReflectiveWater()); renderingConfig.subscribe(RenderingConfig.REFLECTIVE_WATER, this); DisplayResolutionDependentFBOs displayResolutionDependentFBOs = context.get(DisplayResolutionDependentFBOs.class); requiresFBO(new FBOConfig(REFLECTED_FBO, HALF_SCALE, FBO.Type.DEFAULT).useDepthBuffer(), displayResolutionDependentFBOs); addDesiredStateChange(new BindFBO(REFLECTED_FBO, displayResolutionDependentFBOs)); addDesiredStateChange(new SetViewportToSizeOf(REFLECTED_FBO, displayResolutionDependentFBOs)); addDesiredStateChange(new EnableFaceCulling()); addDesiredStateChange(new SetFacesToCull(GL_FRONT)); addDesiredStateChange(new EnableMaterial(CHUNK_MATERIAL)); chunkMaterial = getMaterial(CHUNK_MATERIAL); }
Source:
private boolean processTopicRemoved() throws InterruptedException { if (topicToRemove != null) { topics.remove(topicToRemove); messageStream.removeTopic(topicToRemove); Set<TopicPartition> removed = kafkaConsumer.assignment().stream().filter(partition -> !topics.contains(partition.topic())).collect(Collectors.toSet()); Map<TopicPartition, OffsetAndMetadata> offsets = acknowledgmentHandler.removePartitions(removed); removed.forEach(partition -> flowControl.remove(partition)); commitOffsets(offsets); topicToRemove = null; return true; } return false; }

Target:
private boolean processTopicRemoved() throws InterruptedException { if (topicToRemove != null) { topics.remove(topicToRemove); messageStream.removeTopic(topicToRemove); Set<TopicPartition> removed = kafkaConsumer.assignment().stream().filter(partition -> partition.topic().equals(topicToRemove)).collect(Collectors.toSet()); Map<TopicPartition, OffsetAndMetadata> offsets = acknowledgmentHandler.removePartitions(removed); removed.forEach(partition -> flowControl.remove(partition)); commitOffsets(offsets); topicToRemove = null; return true; } return false; }
Source:
private void addLeewayToDateClaims() { if (!claims.containsKey(PublicClaims.EXPIRES_AT)) { claims.put(PublicClaims.EXPIRES_AT, defaultLeeway); } if (!claims.containsKey(PublicClaims.NOT_BEFORE)) { claims.put(PublicClaims.NOT_BEFORE, defaultLeeway); } if (!claims.containsKey(PublicClaims.ISSUED_AT)) { claims.put(PublicClaims.ISSUED_AT, defaultLeeway); } if(ignoreIssuedAt) { claims.remove(PublicClaims.ISSUED_AT); } }

Target:
private void addLeewayToDateClaims() { if (!claims.containsKey(PublicClaims.EXPIRES_AT)) { claims.put(PublicClaims.EXPIRES_AT, defaultLeeway); } if (!claims.containsKey(PublicClaims.NOT_BEFORE)) { claims.put(PublicClaims.NOT_BEFORE, defaultLeeway); } if(ignoreIssuedAt) { claims.remove(PublicClaims.ISSUED_AT); return; } if (!claims.containsKey(PublicClaims.ISSUED_AT)) { claims.put(PublicClaims.ISSUED_AT, defaultLeeway); } }
Source:
public static boolean move(final File from, final File to) { if (to.exists()) { if (!to.delete()) { Log.d(K9.LOG_TAG, "Unable to delete file: " + to.getAbsolutePath()); } } if (!to.getParentFile().mkdirs()) { Log.d(K9.LOG_TAG, "Unable to make directories: " + to.getParentFile().getAbsolutePath()); } try { copyFile(from, to); boolean deleteFromOk = from.delete(); if (!deleteFromOk) { Log.e(K9.LOG_TAG, "Unable to delete source file after copying to destination!"); } return true; } catch (Exception e) { Log.w(K9.LOG_TAG, "cannot move " + from.getAbsolutePath() + " to " + to.getAbsolutePath(), e); return false; } }

Target:
public static boolean move(final File from, final File to) { if (to.exists()) { if (!to.delete()) { Log.d(K9.LOG_TAG, "Unable to delete file: " + to.getAbsolutePath()); } } if (!to.getParentFile().mkdirs()) { Log.d(K9.LOG_TAG, "Unable to make directories: " + to.getParentFile().getAbsolutePath()); } try { copyFile(from, to); boolean deleteFromFailed = !from.delete(); if (deleteFromFailed) { Log.e(K9.LOG_TAG, "Unable to delete source file after copying to destination!"); } return true; } catch (Exception e) { Log.w(K9.LOG_TAG, "cannot move " + from.getAbsolutePath() + " to " + to.getAbsolutePath(), e); return false; } }
Source:
private void checkPhysicalDragDrop(StructureTreeNode dragNode, StructureTreeNode dropNode) throws ClassCastException { MediaUnit dragUnit = (MediaUnit) dragNode.getDataObject(); MediaUnit dropUnit = (MediaUnit) dropNode.getDataObject(); StructuralElementViewInterface divisionView = dataEditor.getRuleset().getStructuralElementView( dropUnit.getType(), dataEditor.getAcquisitionStage(), dataEditor.getPriorityList()); LinkedList<MediaUnit> dragParents; if (divisionView.getAllowedSubstructuralElements().containsKey(dragUnit.getType())) { dragParents = MetadataEditor.getAncestorsOfMediaUnit(dragUnit, dataEditor.getWorkpiece().getMediaUnit()); if (dragParents.isEmpty()) { Helper.setErrorMessage("No parents of media unit " + dragUnit.getType() + " found!"); } else { MediaUnit parentUnit = dragParents.get(dragParents.size() - 1); if (parentUnit.getChildren().contains(dragUnit)) { preservePhysical(); return; } else { Helper.setErrorMessage("Parents of media unit " + dragUnit.getType() + " do not contain media " + "unit!"); } } } else { Helper.setErrorMessage("Media unit of type '" + dragUnit.getType() + "' NOT allowed as child of media unit of type '" + dropUnit.getType() + "!"); } show(); }

Target:
private void checkPhysicalDragDrop(StructureTreeNode dragNode, StructureTreeNode dropNode) { MediaUnit dragUnit = (MediaUnit) dragNode.getDataObject(); MediaUnit dropUnit = (MediaUnit) dropNode.getDataObject(); StructuralElementViewInterface divisionView = dataEditor.getRuleset().getStructuralElementView( dropUnit.getType(), dataEditor.getAcquisitionStage(), dataEditor.getPriorityList()); LinkedList<MediaUnit> dragParents; if (divisionView.getAllowedSubstructuralElements().containsKey(dragUnit.getType())) { dragParents = MetadataEditor.getAncestorsOfMediaUnit(dragUnit, dataEditor.getWorkpiece().getMediaUnit()); if (dragParents.isEmpty()) { Helper.setErrorMessage(Helper.getTranslation("dataEditor.noParentsError", Collections.singletonList(dragNode.getLabel()))); } else { MediaUnit parentUnit = dragParents.get(dragParents.size() - 1); if (parentUnit.getChildren().contains(dragUnit)) { preservePhysical(); return; } else { Helper.setErrorMessage(Helper.getTranslation("dataEditor.childNotContainedError", Collections.singletonList(dragUnit.getType()))); } } } else { Helper.setErrorMessage(Helper.getTranslation("dataEditor.forbiddenChildElement", Arrays.asList(dragNode.getLabel(), dropNode.getLabel()))); } show(); }
Source:
List<VariantEntity> findByComplexFiltersHelper(Query query, List<String> studies, List<String> consequenceType, RelationalOperator mafOperator, Double mafValue, RelationalOperator polyphenScoreOperator, Double polyphenScoreValue, RelationalOperator siftScoreOperator, Double siftScoreValue, List<String> exclude, Pageable pageable) { applyFilters(query, studies, consequenceType, mafOperator, mafValue, polyphenScoreOperator, polyphenScoreValue, siftScoreOperator, siftScoreValue); ArrayList<String> sortProps = new ArrayList<String>(); sortProps.add("chr"); sortProps.add("start"); query.with(new Sort(Sort.Direction.ASC, sortProps)); Pageable pageable1 = (pageable != null) ? pageable : new PageRequest(0, 10); query.with(pageable1); if (Objects.nonNull(exclude) && !exclude.isEmpty()) { exclude.forEach(e -> query.fields().exclude(e)); } return mongoTemplate.find(query, VariantEntity.class); }

Target:
List<VariantEntity> findByComplexFiltersHelper(Query query, List<String> studies, List<String> consequenceType, RelationalOperator mafOperator, Double mafValue, RelationalOperator polyphenScoreOperator, Double polyphenScoreValue, RelationalOperator siftScoreOperator, Double siftScoreValue, List<String> exclude, Pageable pageable) { applyFilters(query, studies, consequenceType, mafOperator, mafValue, polyphenScoreOperator, polyphenScoreValue, siftScoreOperator, siftScoreValue); ArrayList<String> sortProps = new ArrayList<String>(); sortProps.add("chr"); sortProps.add("start"); query.with(new Sort(Sort.Direction.ASC, sortProps)); Pageable pageable1 = (pageable != null) ? pageable : new PageRequest(0, 10); query.with(pageable1); if (exclude != null && !exclude.isEmpty()) { exclude.forEach(e -> query.fields().exclude(e)); } return mongoTemplate.find(query, VariantEntity.class); }
Source:
public void performSearch() { LOGGER.debug("Run search " + searchField.getText()); if (searchField.getText().isEmpty()) { currentResults.setText(""); setHintTooltip(null); stateManager.clearSearchQuery(); return; } if (regularExp.isSelected() && !validRegex()) { currentResults.setText(Localization.lang("Invalid Regex")); return ; } SearchQuery searchQuery = new SearchQuery(this.searchField.getText(), this.caseSensitive.isSelected(), this.regularExp.isSelected()); if (!searchQuery.isValid()) { informUserAboutInvalidSearchQuery(); return; } stateManager.setSearchQuery(searchQuery); }

Target:
public void performSearch() { LOGGER.debug("Run search " + searchField.getText()); if (searchField.getText().isEmpty()) { currentResults.setText(""); setHintTooltip(null); stateManager.clearSearchQuery(); return; } if (!regexValidator.getValidationStatus().isValid()) { currentResults.setText(Localization.lang("Invalid regular expression")); return; } SearchQuery searchQuery = new SearchQuery(this.searchField.getText(), this.caseSensitive.isSelected(), this.regularExp.isSelected()); if (!searchQuery.isValid()) { informUserAboutInvalidSearchQuery(); return; } stateManager.setSearchQuery(searchQuery); }
Source:
void close() throws IOException { for (Map.Entry<String, LogSegment> entry : segmentsByName.entrySet()) { entry.getValue().close(); } }

Target:
void close() throws IOException { for (LogSegment segment : segmentsByName.values()) { segment.flush(); segment.close(); } }
Source:
protected void channelRead0(ChannelHandlerContext ctx, Message msg) throws Exception { seenMessages.incrementAndGet(); final byte[] payload = msg.asBytes(); boolean sawKtTag = false; for (String tag : msg.getTags()) { if (tag.startsWith("kt:")) { sawKtTag = true; sendOrReportFailure(tag.substring(3), payload); } } if (!sawKtTag) { sendOrReportFailure(defaultTopic, payload); } if (propagate) { propagatedMessages.incrementAndGet(); msg.retain(); ctx.fireChannelRead(msg); } }

Target:
protected void channelRead0(ChannelHandlerContext ctx, Message msg) throws Exception { seenMessages.incrementAndGet(); final byte[] payload = msg.asBytes(); boolean sawKtTag = false; for (String tag : msg.getTags()) { if (tag.startsWith("kt:")) { sawKtTag = true; sendOrReportFailure(tag.substring(3), payload); } } if (!sawKtTag) { sendOrReportFailure(defaultTopic, payload); } if (propagate) { msg.retain(); ctx.fireChannelRead(msg); } }
Source:
public FigShareProfile extractUserProfile(final String body) { final FigShareProfile profile = newProfile(); final JsonNode json = JsonHelper.getFirstNode(body); if (json != null) { if (getProfileId() != null) { profile.setId(ProfileHelper.sanitizeIdentifier(profile, JsonHelper.getElement(json, getProfileId()))); } for (final String attribute : getPrimaryAttributes()) { convertAndAdd(profile, PROFILE_ATTRIBUTE, attribute, JsonHelper.getElement(json, attribute)); } for (final String attribute : getSecondaryAttributes()) { convertAndAdd(profile, PROFILE_ATTRIBUTE, attribute, JsonHelper.getElement(json, attribute)); } } else { raiseProfileExtractionJsonError(body); } return profile; }

Target:
public FigShareProfile extractUserProfile(final String body) { final FigShareProfile profile = newProfile(); final JsonNode json = JsonHelper.getFirstNode(body); if (json != null) { if (getProfileId() != null) { profile.setId(ProfileHelper.sanitizeIdentifier(profile, JsonHelper.getElement(json, getProfileId()))); } for (final String attribute : getPrimaryAttributes()) { convertAndAdd(profile, PROFILE_ATTRIBUTE, attribute, JsonHelper.getElement(json, attribute)); } } else { raiseProfileExtractionJsonError(body); } return profile; }
Source:
public void testUnmarshallTopLevelEventWithEdgesEmptyProperties() throws Exception { Diagram<Graph, Metadata> diagram = unmarshall(marshaller, BPMN_CATCHING_INTERMEDIATE_EVENT_FILE_PATH); assertDiagram(diagram, AMOUNT_OF_NODES_IN_DIAGRAM); IntermediateTimerEvent emptyEvent = getCatchingIntermediateNodeById(diagram, EMPTY_WITH_INCOME_TOP_LEVEL_EVENT_ID, HAS_INCOME_EDGE, HAS_OUTGOING_EDGE); assertGeneralSet(emptyEvent.getGeneral(), EMPTY_VALUE, EMPTY_VALUE); assertTimerEventEmpty(emptyEvent.getExecutionSet(), CANCELLING, ""); }

Target:
public void testUnmarshallTopLevelEventWithEdgesEmptyProperties() throws Exception { Diagram<Graph, Metadata> diagram = unmarshall(marshaller, BPMN_CATCHING_INTERMEDIATE_EVENT_FILE_PATH); assertDiagram(diagram, AMOUNT_OF_NODES_IN_DIAGRAM); IntermediateTimerEvent emptyEvent = getCatchingIntermediateNodeById(diagram, EMPTY_WITH_INCOME_TOP_LEVEL_EVENT_ID, HAS_INCOME_EDGE, HAS_OUTGOING_EDGE); assertGeneralSet(emptyEvent.getGeneral(), EMPTY_VALUE, EMPTY_VALUE); assertTimerEventEmpty(emptyEvent.getExecutionSet(), CANCELLING, EMPTY_VALUE); }
Source:
public void modifyAttribute(long t, ITmfStateValue value, int attributeQuark) throws TimeRangeException, AttributeNotFoundException, StateValueTypeException { if (value == null) { throw new IllegalArgumentException(); } try { transState.processStateChange(t, value, attributeQuark); } catch (TimeRangeException e) { throw new TimeRangeException(getSSID() + ' ' + e.getMessage(), e); } catch (AttributeNotFoundException e) { throw new AttributeNotFoundException(getSSID() + ' ' + e.getMessage(), e); } catch (StateValueTypeException e) { throw new StateValueTypeException(getSSID() + ' ' + e.getMessage(), e); } }

Target:
public void modifyAttribute(long t, ITmfStateValue value, int attributeQuark) throws TimeRangeException, AttributeNotFoundException, StateValueTypeException { if (value == null) { throw new IllegalArgumentException(); } transState.processStateChange(t, value, attributeQuark); }
Source:
static ItemStack empty() { return builder().itemType(ItemTypes.AIR).build(); }

Target:
static ItemStack empty() { return builder().itemType(ItemTypes.NONE).build(); }
Source:
public void testTLVEncodeProxy() { HAProxyMessageEncoder encoder = new HAProxyMessageEncoder(); EmbeddedChannel ch = new EmbeddedChannel(encoder); List<HAProxyTLV> tlvs = new ArrayList<HAProxyTLV>(); ByteBuf helloWorld = Unpooled.copiedBuffer("hello world", CharsetUtil.US_ASCII); HAProxyTLV alpnTlv = new HAProxyTLV(Type.PP2_TYPE_ALPN, (byte) 0x01, helloWorld.copy()); tlvs.add(alpnTlv); ByteBuf arbitrary = Unpooled.copiedBuffer("an arbitrary string", CharsetUtil.US_ASCII); HAProxyTLV authorityTlv = new HAProxyTLV(Type.PP2_TYPE_AUTHORITY, (byte) 0x01, arbitrary.copy()); tlvs.add(authorityTlv); HAProxyMessage message = new HAProxyMessage( HAProxyProtocolVersion.V2, HAProxyCommand.PROXY, HAProxyProxiedProtocol.TCP4, "192.168.0.1", "192.168.0.11", 56324, 443, tlvs); assertTrue(ch.writeOutbound(message)); ByteBuf byteBuf = ch.readOutbound(); assertEquals(byteBuf.getUnsignedShort(14), byteBuf.readableBytes() - V2_HEADER_BYTES_LENGTH); ByteBuf tlv = byteBuf.skipBytes(V2_HEADER_BYTES_LENGTH + IPv4_ADDRESS_BYTES_LENGTH); assertEquals(alpnTlv.typeByteValue(), tlv.readByte()); short bufLength = tlv.readShort(); assertEquals(helloWorld.array().length, bufLength); assertEquals(helloWorld, tlv.readBytes(bufLength)); assertEquals(authorityTlv.typeByteValue(), tlv.readByte()); bufLength = tlv.readShort(); assertEquals(arbitrary.array().length, bufLength); assertEquals(arbitrary, tlv.readBytes(bufLength)); }

Target:
public void testTLVEncodeProxy() { EmbeddedChannel ch = new EmbeddedChannel(INSTANCE); List<HAProxyTLV> tlvs = new ArrayList<HAProxyTLV>(); ByteBuf helloWorld = Unpooled.copiedBuffer("hello world", CharsetUtil.US_ASCII); HAProxyTLV alpnTlv = new HAProxyTLV(Type.PP2_TYPE_ALPN, (byte) 0x01, helloWorld.copy()); tlvs.add(alpnTlv); ByteBuf arbitrary = Unpooled.copiedBuffer("an arbitrary string", CharsetUtil.US_ASCII); HAProxyTLV authorityTlv = new HAProxyTLV(Type.PP2_TYPE_AUTHORITY, (byte) 0x01, arbitrary.copy()); tlvs.add(authorityTlv); HAProxyMessage message = new HAProxyMessage( HAProxyProtocolVersion.V2, HAProxyCommand.PROXY, HAProxyProxiedProtocol.TCP4, "192.168.0.1", "192.168.0.11", 56324, 443, tlvs); assertTrue(ch.writeOutbound(message)); ByteBuf byteBuf = ch.readOutbound(); assertEquals(byteBuf.getUnsignedShort(14), byteBuf.readableBytes() - V2_HEADER_BYTES_LENGTH); ByteBuf tlv = byteBuf.skipBytes(V2_HEADER_BYTES_LENGTH + IPv4_ADDRESS_BYTES_LENGTH); assertEquals(alpnTlv.typeByteValue(), tlv.readByte()); short bufLength = tlv.readShort(); assertEquals(helloWorld.array().length, bufLength); assertEquals(helloWorld, tlv.readBytes(bufLength)); assertEquals(authorityTlv.typeByteValue(), tlv.readByte()); bufLength = tlv.readShort(); assertEquals(arbitrary.array().length, bufLength); assertEquals(arbitrary, tlv.readBytes(bufLength)); byteBuf.release(); assertFalse(ch.finish()); }
Source:
private void updateDiskSize(DiskImage diskImage) { try { long sizeToAddInGigabytes = Long.parseLong(getSizeExtend().getEntity()); if (sizeToAddInGigabytes > 0) { diskImage.setSizeInGigabytes(diskImage.getSizeInGigabytes() + sizeToAddInGigabytes); } } catch (NumberFormatException ignored) { } }

Target:
private void updateDiskSize(DiskImage diskImage) { long sizeToAddInGigabytes; try { sizeToAddInGigabytes = Long.parseLong(getSizeExtend().getEntity()); } catch (NumberFormatException ignored) { return; } if (sizeToAddInGigabytes > 0) { diskImage.setSizeInGigabytes(diskImage.getSizeInGigabytes() + sizeToAddInGigabytes); } }
Source:
public void tearDown() { storageFactory.tearDown(); boundedContext.getEventBus().unregister(eventLogger); boundedContext.stop(); }

Target:
public void tearDown() { storageFactory.tearDown(); boundedContext.getEventBus().unregister(eventLogger); boundedContext.close(); }
Source:
void connectionChanged(Connection connection) { discoveryExecutor.execute( () -> { if (connection == null) { discoveryManager = null; return; } discoveryManager = ServiceDiscoveryManager.getInstanceFor(connection); presenceSarosSupport = new HashMap<>(); }); }

Target:
void connectionChanged(Connection connection) { discoveryExecutor.execute( () -> { if (connection == null) { discoveryManager = null; return; } discoveryManager = ServiceDiscoveryManager.getInstanceFor(connection); resourcesSarosSupport = new HashMap<>(); }); }
Source:
private void submitShutdownTask() { synchronized (this) { if (executor.isShutdown()) { return; } executor.submit(new Runnable() { public void run() { synchronized (Auditor.this) { LOG.error("Shutting down Auditor's Executor"); executor.shutdown(); } } }); } }

Target:
private void submitShutdownTask() { synchronized (this) { LOG.info("Executing submitShutdownTask"); if (executor.isShutdown()) { LOG.info("executor is already shutdown"); return; } executor.submit(new Runnable() { public void run() { synchronized (Auditor.this) { LOG.info("Shutting down Auditor's Executor"); executor.shutdown(); } } }); } }
Source:
private Map<String, Object> downloadFilesInFolder(String path) throws DropboxException { try { DbxEntry.WithChildren listing = client.getMetadataWithChildren(path); if (listing == null) { return Collections.emptyMap(); } else if (listing.children == null) { LOG.info("downloading a single file..."); Map.Entry<String, Object> entry = downloadSingleFile(path); return Collections.singletonMap(entry.getKey(), entry.getValue()); } Map<String, Object> result = new HashMap<>(); for (DbxEntry entry : listing.children) { if (entry.isFile()) { try { Map.Entry<String, Object> singleFile = downloadSingleFile(entry.path); result.put(singleFile.getKey(), singleFile.getValue()); } catch (DropboxException e) { LOG.warn("can't download from " + entry.path); } } else { Map<String, Object> filesInFolder = downloadFilesInFolder(entry.path); result.putAll(filesInFolder); } } return result; } catch (DbxException e) { throw new DropboxException(e); } }

Target:
private Map<String, Object> downloadFilesInFolder(String path) throws DropboxException { try { DbxEntry.WithChildren listing = client.getMetadataWithChildren(path); if (listing == null) { return Collections.emptyMap(); } else if (listing.children == null) { LOG.debug("downloading a single file..."); Map.Entry<String, Object> entry = downloadSingleFile(path); return Collections.singletonMap(entry.getKey(), entry.getValue()); } Map<String, Object> result = new HashMap<>(); for (DbxEntry entry : listing.children) { if (entry.isFile()) { try { Map.Entry<String, Object> singleFile = downloadSingleFile(entry.path); result.put(singleFile.getKey(), singleFile.getValue()); } catch (DropboxException e) { LOG.warn("Cannot download from path={}, reason={}. This exception is ignored.", entry.path, e.getMessage()); } } else { Map<String, Object> filesInFolder = downloadFilesInFolder(entry.path); result.putAll(filesInFolder); } } return result; } catch (DbxException e) { throw new DropboxException(e); } }
Source:
public void filterWorksCorrectly() throws LPFilterException { String filename = "src/test/resources/ppm/00_BH1.512.seed"; DataModule dm = new DataModule(); File dataToFilter = new File(filename); dm.loadAndParseDataForTesting(dataToFilter); FilterLP defaultLPFilter = new FilterLP(); PlotDataProvider pdp = dm.getAllChannels().get(0); defaultLPFilter.init(pdp); int sampleCount = pdp.getRawData().get(0).getSampleCount(); double[] initData = new double[sampleCount]; for (int i = 0; i < initData.length; ++i) { initData[i] = pdp.getRawData().get(0).getData().data[i]; } double[] filteredCalculated = defaultLPFilter.filter(initData, sampleCount); double[] filteredExpected = new double[]{ 0.000000, 0.000000, 0.000001, 0.000000, 0.000023, 0.000046, 0.000083, 0.000137 }; for (int i = 0; i < filteredExpected.length; ++i) { assertEquals(filteredExpected[i], filteredCalculated[i], 1E-5); } System.out.println(Arrays.toString(Arrays.copyOfRange(filteredExpected, 0, 100))); }

Target:
public void filterWorksCorrectly() throws LPFilterException { String filename = "src/test/resources/ppm/00_BH1.512.seed"; DataModule dm = new DataModule(); File dataToFilter = new File(filename); dm.loadAndParseDataForTesting(dataToFilter); FilterLP defaultLPFilter = new FilterLP(); PlotDataProvider pdp = dm.getAllChannels().get(0); defaultLPFilter.init(pdp); int sampleCount = pdp.getRawData().get(0).getSampleCount(); double[] initData = new double[sampleCount]; for (int i = 0; i < initData.length; ++i) { initData[i] = pdp.getRawData().get(0).getData().data[i]; } double[] filteredCalculated = defaultLPFilter.filter(initData, sampleCount); double[] filteredExpected = new double[]{ 0.000000, 0.000000, 0.000001, 0.000000, 0.000023, 0.000046, 0.000083, 0.000137 }; for (int i = 0; i < filteredExpected.length; ++i) { assertEquals(filteredExpected[i], filteredCalculated[i], 1E-5); } }
Source:
private Map<String, ContextSensitiveTokenType> createContextSensitiveTokenMap( ICPPParserExtensionConfiguration config) { Map<String, ContextSensitiveTokenType> result = new HashMap<String, ContextSensitiveTokenType>(); result.put(new String(Keywords.cOVERRIDE), ContextSensitiveTokenType.OVERRIDE); result.put(new String(Keywords.cFINAL), ContextSensitiveTokenType.FINAL); result.putAll(config.getAdditionalContextSensitiveKeywords()); return result; }

Target:
private Map<String, ContextSensitiveTokenType> createContextSensitiveTokenMap( ICPPParserExtensionConfiguration config) { Map<String, ContextSensitiveTokenType> result = new HashMap<String, ContextSensitiveTokenType>(); result.put(Keywords.OVERRIDE, ContextSensitiveTokenType.OVERRIDE); result.put(Keywords.FINAL, ContextSensitiveTokenType.FINAL); result.putAll(config.getAdditionalContextSensitiveKeywords()); return result; }
Source:
private static JCQueue createQueue(String name, int queueSize) { return new JCQueue(name, null, queueSize, 0, 1, new WaitStrategyPark(0), "test", "test", Collections.singletonList(1000), 1000, new StormMetricRegistry()); }

Target:
private static JCQueue createQueue(String name, int queueSize) { return new JCQueue(name, name, queueSize, 0, 1, new WaitStrategyPark(0), "test", "test", Collections.singletonList(1000), 1000, new StormMetricRegistry()); }
Source:
private MbusChannelElementsDto makeMbusChannelElementsDto(final SmartMeter mbusDevice) { final String mbusDeviceIdentification = mbusDevice.getDeviceIdentification(); final String mbusIdentificationNumber; if (mbusDevice.getMbusIdentificationNumber() == null) { mbusIdentificationNumber = null; } else { mbusIdentificationNumber = String.format("%08d", mbusDevice.getMbusIdentificationNumber()); } final String mbusManufacturerIdentification = mbusDevice.getMbusManufacturerIdentification(); final Short mbusVersion = mbusDevice.getMbusVersion(); final Short mbusDeviceTypeIdentification = mbusDevice.getMbusDeviceTypeIdentification(); final Short channel = mbusDevice.getChannel(); Short primaryAddress = null; if (mbusDevice.getMbusPrimaryAddress() != null) { primaryAddress = mbusDevice.getMbusPrimaryAddress(); } return new MbusChannelElementsDto(channel, primaryAddress, mbusDeviceIdentification, mbusIdentificationNumber, mbusManufacturerIdentification, mbusVersion, mbusDeviceTypeIdentification); }

Target:
private MbusChannelElementsDto makeMbusChannelElementsDto(final SmartMeter mbusDevice) { final String mbusDeviceIdentification = mbusDevice.getDeviceIdentification(); final String mbusIdentificationNumber; if (mbusDevice.getMbusIdentificationNumber() == null) { mbusIdentificationNumber = null; } else { mbusIdentificationNumber = String.format("%08d", mbusDevice.getMbusIdentificationNumber()); } final String mbusManufacturerIdentification = mbusDevice.getMbusManufacturerIdentification(); final Short mbusVersion = mbusDevice.getMbusVersion(); final Short mbusDeviceTypeIdentification = mbusDevice.getMbusDeviceTypeIdentification(); Short primaryAddress = null; if (mbusDevice.getMbusPrimaryAddress() != null) { primaryAddress = mbusDevice.getMbusPrimaryAddress(); } return new MbusChannelElementsDto(primaryAddress, mbusDeviceIdentification, mbusIdentificationNumber, mbusManufacturerIdentification, mbusVersion, mbusDeviceTypeIdentification); }
Source:
public static String getGitProp(String propertyToGet) { String propertyValue = null; try { Properties gitProps = new Properties(); InputStream is = ModuleBuilder.class.getResourceAsStream("git.properties"); gitProps.load(is); is.close(); propertyValue = gitProps.getProperty(propertyToGet); } catch (Exception e) { showError("Error while retrieving version information", e.getMessage()); } return propertyValue; }

Target:
public static String getGitProp(String propertyToGet) { String propertyValue = null; Properties gitProps = new Properties(); try { InputStream is = ModuleBuilder.class.getResourceAsStream("git.properties"); gitProps.load(is); is.close(); propertyValue = gitProps.getProperty(propertyToGet); } catch (Exception e) { showError("Error while retrieving version information from git.properties file: ", e.getMessage()); System.exit(1); } return propertyValue; }
Source:
private void handleExchangeFoodAction(ActionEvent e) { Shop shop = mule.getGameManager().getShop(); Player player = mule.getGameManager().getCurrentPlayer(); if (buyNotSell) { if (shop.stockOf(ResourceType.FOOD) > 0) { if (player.getMoney() >= shop.priceOf(ResourceType.FOOD)) { shop.buy(player, ResourceType.FOOD); System.out.println(player.getMoney()); } else { System.out.println("Player does not have enough money"); } } else { System.out.println("Shop is out of food"); } } else { if (player.stockOf(ResourceType.FOOD) > 0) { shop.sell(player, ResourceType.FOOD); System.out.println(player.getMoney()); } else { System.out.println("You are out of food"); } } mule.getGameManager().setLabels(); }

Target:
private void handleExchangeFoodAction(ActionEvent e) { shop = mule.getGameManager().getShop(); player = mule.getGameManager().getCurrentPlayer(); if (buyNotSell) { shop.buy(player, ResourceType.FOOD); } else { shop.sell(player, ResourceType.FOOD); } mule.getGameManager().setLabels(); }
Source:
private void alterGcAndTombstoneInternal( String keyspace, TableReference tableRef, int gcGraceSeconds, float tombstoneThresholdRatio) { try { clientPool.runWithRetry((FunctionCheckedException<Client, Void, Exception>) client -> { KsDef ks = client.describe_keyspace(keyspace); List<CfDef> cfs = ks.getCf_defs(); for (CfDef cf : cfs) { if (cf.getName().equalsIgnoreCase(internalTableName(tableRef))) { cf.setGc_grace_seconds(gcGraceSeconds); cf.setCompaction_strategy_options(ImmutableMap.of( "tombstone_threshold", String.valueOf(tombstoneThresholdRatio))); client.system_update_column_family(cf); CassandraKeyValueServices.waitForSchemaVersions( client, tableRef.getQualifiedName(), configManager.getConfig().schemaMutationTimeoutMillis()); log.trace("gc_grace_seconds is set to for {}.{}", SafeArg.of("gcGraceSeconds", gcGraceSeconds), UnsafeArg.of("keyspace", keyspace), UnsafeArg.of("table", tableRef)); log.trace("tombstone_threshold_ratio is set to for {}.{}", SafeArg.of("tombstoneThresholdRatio", tombstoneThresholdRatio), UnsafeArg.of("keyspace", keyspace), SafeArg.of("table", tableRef)); } } return null; }); } catch (Exception e) { log.error("Exception encountered while setting gc_grace_seconds:{} and tombstone_threshold:{} for {}.{}", SafeArg.of("gcGraceSeconds", gcGraceSeconds), SafeArg.of("tombstoneThresholdRatio", tombstoneThresholdRatio), UnsafeArg.of("keyspace", keyspace), UnsafeArg.of("table", tableRef), e); } }

Target:
private void alterGcAndTombstoneInternal( String keyspace, TableReference tableRef, int gcGraceSeconds, float tombstoneThresholdRatio) { try { clientPool.runWithRetry((FunctionCheckedException<Client, Void, Exception>) client -> { KsDef ks = client.describe_keyspace(keyspace); List<CfDef> cfs = ks.getCf_defs(); for (CfDef cf : cfs) { if (cf.getName().equalsIgnoreCase(internalTableName(tableRef))) { cf.setGc_grace_seconds(gcGraceSeconds); cf.setCompaction_strategy_options(ImmutableMap.of( "tombstone_threshold", String.valueOf(tombstoneThresholdRatio))); client.system_update_column_family(cf); CassandraKeyValueServices.waitForSchemaVersions( client, tableRef.getQualifiedName(), configManager.getConfig().schemaMutationTimeoutMillis()); log.trace("gc_grace_seconds is set to for {}.{}", SafeArg.of("gcGraceSeconds", gcGraceSeconds), UnsafeArg.of("keyspace", keyspace), UnsafeArg.of("table", tableRef)); log.trace("tombstone_threshold_ratio is set to for {}.{}", SafeArg.of("tombstoneThresholdRatio", tombstoneThresholdRatio), UnsafeArg.of("keyspace", keyspace), UnsafeArg.of("table", tableRef)); } } return null; }); } catch (Exception e) { log.error("Exception encountered while setting gc_grace_seconds:{} and tombstone_threshold:{} for {}.{}", SafeArg.of("gcGraceSeconds", gcGraceSeconds), SafeArg.of("tombstoneThresholdRatio", tombstoneThresholdRatio), UnsafeArg.of("keyspace", keyspace), UnsafeArg.of("table", tableRef), e); } }