auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
Class<?> getTypeParameterDescriptorForRelationship(String relationshipType, Direction relationshipDirection) { final boolean STRICT_MODE = true; final boolean INFERRED_MODE = false; try { FieldInfo fieldInfo = relationshipField(relationshipType, relationshipDirection, STRICT_MODE); if (fieldInfo != null && fieldInfo.getTypeDescriptor() != null) { return DescriptorMappings.getType(fieldInfo.getTypeDescriptor()); } if (!relationshipDirection.equals(Direction.INCOMING)) { fieldInfo = relationshipField(relationshipType, relationshipDirection, INFERRED_MODE); if (fieldInfo != null && fieldInfo.getTypeDescriptor() != null) { return DescriptorMappings.getType(fieldInfo.getTypeDescriptor()); } } } catch (RuntimeException e) { LOGGER.debug("Could not get class type for relationshipType and relationshipDirection ", className, relationshipType, relationshipDirection); } return null; }

Target:
Class<?> getTypeParameterDescriptorForRelationship(String relationshipType, Direction relationshipDirection) { final boolean STRICT_MODE = true; final boolean INFERRED_MODE = false; try { FieldInfo fieldInfo = relationshipField(relationshipType, relationshipDirection, STRICT_MODE); if (fieldInfo != null && fieldInfo.getTypeDescriptor() != null) { return DescriptorMappings.getType(fieldInfo.getTypeDescriptor()); } if (relationshipDirection != Direction.INCOMING) { fieldInfo = relationshipField(relationshipType, relationshipDirection, INFERRED_MODE); if (fieldInfo != null && fieldInfo.getTypeDescriptor() != null) { return DescriptorMappings.getType(fieldInfo.getTypeDescriptor()); } } } catch (RuntimeException e) { LOGGER.debug("Could not get class type for relationshipType and relationshipDirection ", className, relationshipType, relationshipDirection); } return null; }
Source:
Bitmap decodeContentStream(Uri path, PicassoBitmapOptions options) throws IOException { ContentResolver contentResolver = context.getContentResolver(); if (options != null && options.inJustDecodeBounds) { InputStream is = null; try { is = contentResolver.openInputStream(path); BitmapFactory.decodeStream(is, null, options); } finally { Utils.closeQuietly(is); } calculateInSampleSize(options); } InputStream is = null; try { is = contentResolver.openInputStream(path); return BitmapFactory.decodeStream(contentResolver.openInputStream(path), null, options); } finally { Utils.closeQuietly(is); } }

Target:
private Bitmap decodeContentStream(Uri path, PicassoBitmapOptions options) throws IOException { ContentResolver contentResolver = context.getContentResolver(); if (options != null && options.inJustDecodeBounds) { InputStream is = null; try { is = contentResolver.openInputStream(path); BitmapFactory.decodeStream(is, null, options); } finally { Utils.closeQuietly(is); } calculateInSampleSize(options); } InputStream is = null; try { is = contentResolver.openInputStream(path); return BitmapFactory.decodeStream(contentResolver.openInputStream(path), null, options); } finally { Utils.closeQuietly(is); } }
Source:
public void valueMapShouldReturnAProperDeserializedJsonMap() { String json = "{ \"fruit\" : \"pear\" , \"color\" : \"green\" }"; Map<String, Object> expected = new LinkedHashMap<String, Object>(); expected.put("fruit", "pear"); expected.put("color", "green"); ValueMap valueMap = new ValueMap().withJSON(KEY, json); Map<String,Object> actual = (Map<String,Object>)valueMap.get(KEY); assertThat(actual, is(expected)); }

Target:
public void valueMapShouldReturnAProperDeserializedJsonMap() { String json = "{ \"fruit\" : \"pear\" , \"color\" : \"green\" }"; ValueMap valueMap = new ValueMap().withJSON(KEY, json); Map<String,Object> actual = (Map<String,Object>)valueMap.get(KEY); assertThat(actual.size(), is(2)); assertThat((String)actual.get("fruit"), is("pear")); assertThat((String)actual.get("color"), is("green")); }
Source:
public CallStatus run() { if(stream) { context = metrics.startStreamingEntityRequest("find", entity, version); } LOGGER.debug("run: entity={}, version={}", entity, version); Error.reset(); Error.push("rest"); Error.push(getClass().getSimpleName()); Error.push(entity); try { FindRequest ireq; try { ireq = getJsonTranslator().parse(FindRequest.class, JsonUtils.json(request)); } catch (Exception e) { LOGGER.error("find:parse failure: {}", e); return new CallStatus(Error.get(RestCrudConstants.ERR_REST_FIND, "Error during the parse of the request")); } LOGGER.debug("Find request:{}", ireq); try { validateReq(ireq, entity, version); } catch (Exception e) { LOGGER.error("find:validate failure: {}", e); return new CallStatus(Error.get(RestCrudConstants.ERR_REST_FIND, "Request is not valid")); } addCallerId(ireq); if(stream) { streamResponse=getMediator(metrics).findAndStream(ireq); return new CallStatus(new Response()); } else { return new CallStatus(getMediator(metrics).find(ireq)); } } catch (Error e) { LOGGER.error("find:generic_error failure: {}", e); return new CallStatus(e); } catch (Exception e) { LOGGER.error("find:generic_exception failure: {}", e); return new CallStatus(Error.get(RestCrudConstants.ERR_REST_FIND, e.toString())); } }

Target:
public CallStatus run() { if (stream) { metricCtx = metrics.startStreamingEntityRequest("find", entity, version); } else { metricCtx = metrics.startEntityRequest("find", entity, version); } LOGGER.debug("run: entity={}, version={}", entity, version); Error.reset(); Error.push("rest"); Error.push(getClass().getSimpleName()); Error.push(entity); Response r = null; try { FindRequest ireq; try { ireq = getJsonTranslator().parse(FindRequest.class, JsonUtils.json(request)); } catch (Exception e) { Error error = Error.get(RestCrudConstants.ERR_REST_FIND, "Error during the parse of the request"); metricCtx.markRequestException(error); LOGGER.error("find:parse failure: {}", e); return new CallStatus(error); } LOGGER.debug("Find request:{}", ireq); try { validateReq(ireq, entity, version); } catch (Exception e) { Error error = Error.get(RestCrudConstants.ERR_REST_FIND, "Request is not valid"); metricCtx.markRequestException(error); LOGGER.error("find:validate failure: {}", e); return new CallStatus(error); } addCallerId(ireq); if(stream) { streamResponse = getMediator().findAndStream(ireq); return new CallStatus(new Response()); } else { r = getMediator().find(ireq); return new CallStatus(r); } } catch (Error e) { metricCtx.markRequestException(e); LOGGER.error("find:generic_error failure: {}", e); return new CallStatus(e); } catch (Exception e) { Error error = Error.get(RestCrudConstants.ERR_REST_FIND, e.toString()); metricCtx.markRequestException(error); LOGGER.error("find:generic_exception failure: {}", e); return new CallStatus(error); } finally { if (streamResponse == null) { if (r != null) { metricCtx.markAllErrorsAndEndRequestMonitoring(r.getErrors()); } else { metricCtx.endRequestMonitoring(); } } } }
Source:
protected void executeCommand() { VmPoolMap map = getVmPoolDAO().getVmPoolMapByVmGuid(getVmId()); List<DbUser> users = getDbUserDAO().getAllForVm(getVmId()); if (map != null && users != null && !users.isEmpty()) { VmPool pool = getVmPoolDAO().get(map.getvm_pool_id()); if (pool != null && pool.getVmPoolType() == VmPoolType.Automatic) { for (DbUser dbUser : users) { Backend.getInstance().runInternalAction(VdcActionType.DetachUserFromVmFromPool, new VmPoolSimpleUserParameters(map.getvm_pool_id(), dbUser.getId(), getVmId()), ExecutionHandler.createDefaultContexForTasks(getExecutionContext(), getLock())); } } } else { removeVmStatelessImages(); } QuotaManager.getInstance().rollbackQuotaByVmId(getVmId()); removeStatelessVmUnmanagedDevices(); applyNextRunConfiguration(); }

Target:
protected void executeCommand() { boolean statelessSnapshotRemoved = detachUsers(); if (!statelessSnapshotRemoved) { removeVmStatelessImages(); } QuotaManager.getInstance().rollbackQuotaByVmId(getVmId()); removeStatelessVmUnmanagedDevices(); applyNextRunConfiguration(); }
Source:
private void computeOverlaps() { SortedSet<RectangleNode> intersectingNodes = Sets.newTreeSet( RectangleStripOverlapRemover::compareRightRectangleBorders); double scanlinePos = Double.MIN_VALUE; for (RectangleNode currNode : rectangleNodes) { scanlinePos = currNode.rectangle.x; while (!intersectingNodes.isEmpty()) { RectangleNode intersectingRectangle = intersectingNodes.first(); if (intersectingRectangle.rectangle.x + intersectingRectangle.rectangle.width < scanlinePos) { intersectingNodes.remove(intersectingRectangle); } else { break; } } for (RectangleNode intersectingNode : intersectingNodes) { intersectingNode.overlappingNodes.add(currNode); currNode.overlappingNodes.add(intersectingNode); } intersectingNodes.add(currNode); } }

Target:
private void computeOverlaps() { SortedSet<RectangleNode> intersectingNodes = Sets.newTreeSet( RectangleStripOverlapRemover::compareRightRectangleBorders); double scanlinePos = Double.NEGATIVE_INFINITY; for (RectangleNode currNode : rectangleNodes) { scanlinePos = currNode.rectangle.x; while (!intersectingNodes.isEmpty()) { RectangleNode intersectingRectangle = intersectingNodes.first(); if (intersectingRectangle.rectangle.x + intersectingRectangle.rectangle.width < scanlinePos) { intersectingNodes.remove(intersectingRectangle); } else { break; } } for (RectangleNode intersectingNode : intersectingNodes) { intersectingNode.overlappingNodes.add(currNode); currNode.overlappingNodes.add(intersectingNode); } intersectingNodes.add(currNode); } }
Source:
public ConfigurableColumnTableViewerSupport(TableViewer viewer, TableColumnDescriptor[] columnDescriptors, File stateFile) { super(viewer, stateFile); this.table = viewer.getTable(); this.columnDescriptors = columnDescriptors; this.viewer = viewer; initializeViewerSupport(); createConfigureColumnsAction(getHeaderMenu()); }

Target:
public ConfigurableColumnTableViewerSupport(TableViewer viewer, TableColumnDescriptor[] columnDescriptors, File stateFile) { super(viewer, stateFile); this.columnDescriptors = columnDescriptors; this.viewer = viewer; createConfigureColumnsAction(getHeaderMenu()); }
Source:
static SwapBlockListResult swapBlocks(FSDirectory fsd, FSPermissionChecker pc, String src, String dst, long genTimestamp) throws IOException { final INodesInPath srcIIP = fsd.resolvePath(pc, src, DirOp.WRITE); final INodesInPath dstIIP = fsd.resolvePath(pc, dst, DirOp.WRITE); if (fsd.isPermissionEnabled()) { fsd.checkAncestorAccess(pc, srcIIP, FsAction.WRITE); fsd.checkAncestorAccess(pc, dstIIP, FsAction.WRITE); } if (NameNode.stateChangeLog.isDebugEnabled()) { NameNode.stateChangeLog.debug("DIR* FSDirectory.swapBlockList: " + srcIIP.getPath() + " and " + dstIIP.getPath()); } SwapBlockListResult result = null; fsd.writeLock(); try { result = swapBlockList(fsd, srcIIP, dstIIP, genTimestamp); } finally { fsd.writeUnlock(); } return result; }

Target:
static SwapBlockListResult swapBlocks(FSDirectory fsd, FSPermissionChecker pc, String src, String dst, long genTimestamp) throws IOException { final INodesInPath srcIIP = fsd.resolvePath(pc, src, DirOp.WRITE); final INodesInPath dstIIP = fsd.resolvePath(pc, dst, DirOp.WRITE); if (fsd.isPermissionEnabled()) { fsd.checkAncestorAccess(pc, srcIIP, FsAction.WRITE); fsd.checkAncestorAccess(pc, dstIIP, FsAction.WRITE); } if (NameNode.stateChangeLog.isDebugEnabled()) { NameNode.stateChangeLog.debug("DIR* FSDirectory.swapBlockList: " + srcIIP.getPath() + " and " + dstIIP.getPath()); } SwapBlockListResult result; fsd.writeLock(); try { result = swapBlockList(fsd, srcIIP, dstIIP, genTimestamp); } finally { fsd.writeUnlock(); } return result; }
Source:
private static Filter flatten(Filter root) { if (root instanceof BooleanFilter) { List<Filter> children = ((BooleanFilter)root).getFilters(); for (int i = 0; i < children.size(); ++i) { Filter child = flatten(children.get(i)); if (child.getClass() == root.getClass() && !(child instanceof NotFilter)) { boolean first = true; List<Filter> grandKids = ((BooleanFilter)child).getFilters(); for (Filter grandkid : grandKids) { if (first) { first = false; children.set(i, grandkid); } else { children.add(++i, grandkid); } } } else { children.set(i, child); } } if (children.size() == 1 && (root instanceof AndFilter || root instanceof OrFilter)) { return children.get(0); } } return root; }

Target:
private static Filter flatten(Filter root) { if (root instanceof BooleanFilter) { List<Filter> children = new ArrayList<>(); children.addAll(((BooleanFilter) root).getFilters()); for (int i = 0; i < children.size(); ++i) { Filter child = flatten(children.get(i)); if (child.getClass() == root.getClass() && !(child instanceof NotFilter)) { boolean first = true; List<Filter> grandKids = ((BooleanFilter)child).getFilters(); for (Filter grandkid : grandKids) { if (first) { first = false; children.set(i, grandkid); } else { children.add(++i, grandkid); } } } else { children.set(i, child); } } if (children.size() == 1 && (root instanceof AndFilter || root instanceof OrFilter)) { return children.get(0); } if (root instanceof AndFilter) { return new AndFilter(children); } else if (root instanceof OrFilter) { return new OrFilter(children); } } return root; }
Source:
default List<T> toList() { final List<T> list = new ArrayList<>(); while (hasNext()) list.add(next()); return list; }

Target:
default List<T> toList() { final List<T> list = new ArrayList<>(); while (hasNext()) list.add(next()); close(); return list; }
Source:
public TicketTransferToken setupForTransfer(Long ticketId, String goalUserName){ User u = userService.getUserByUsername(goalUserName).orElseThrow(() -> new UsernameNotFoundException("User " + goalUserName + " not found.")); Ticket t = ticketRepository.findOne(ticketId); if (tttRepository.findByTicketId(ticketId).isPresent()) { throw new IllegalStateException("Ticket " + ticketId + " is already set up for transfer!"); } else { TicketTransferToken ttt = new TicketTransferToken(u, t); tttRepository.save(ttt); try { String acceptUrl = acceptTransferUrl + "/?token=" + ttt.getToken(); mailService.sendTicketTransferMail(ttt.getTicket().getOwner(), ttt.getUser(), acceptUrl); } catch (MessagingException e) { e.printStackTrace(); } return ttt; } }

Target:
public TicketTransferToken setupForTransfer(Long ticketId, String goalUserName){ User u = userService.getUserByUsername(goalUserName).orElseThrow(() -> new UsernameNotFoundException("User " + goalUserName + " not found.")); Ticket t = ticketRepository.findOne(ticketId); List<TicketTransferToken> ticketTransferTokens = tttRepository.findAllByTicketId(ticketId).stream() .filter(Token::isValid) .collect(Collectors.toList()); if (!ticketTransferTokens.isEmpty()) { throw new DuplicateTicketTransferTokenException(ticketId); } else { TicketTransferToken ttt = new TicketTransferToken(u, t); tttRepository.save(ttt); try { String acceptUrl = acceptTransferUrl + "/?token=" + ttt.getToken(); mailService.sendTicketTransferMail(ttt.getTicket().getOwner(), ttt.getUser(), acceptUrl); } catch (MessagingException e) { e.printStackTrace(); } return ttt; } }
Source:
public void testDuplicateKeys() throws FileNotFoundException { String baseDir = System.getProperty("basedir"); assumeNotNull(baseDir); String fileName = "AppErrors.properties"; final File dir = new File(baseDir, "src/main/resources/bundles"); File file = new File(dir, fileName); DuplicateKeysCheck.assertNoDuplicateKeys(file.getAbsolutePath()); }

Target:
public void testDuplicateKeys() throws FileNotFoundException { String baseDir = System.getProperty("basedir"); assumeNotNull(baseDir); final File file = new File(baseDir, "src/main/resources/bundles/AppErrors.properties"); DuplicateKeysCheck.assertNoDuplicateKeys(file.getAbsolutePath()); }
Source:
public Dialog onCreateDialog(Bundle savedInstanceState) { if (underlyingDialog == null) { return super.onCreateDialog(savedInstanceState); } return underlyingDialog.getDialog(); }

Target:
public Dialog onCreateDialog(Bundle savedInstanceState) { if (underlyingDialog == null) { dismiss(); return super.onCreateDialog(savedInstanceState); } return underlyingDialog.getDialog(); }
Source:
protected final void fireErrors(String fileName) { final SortedSet<LocalizedMessage> errors = messageCollector .getMessages(); messageCollector.reset(); getMessageDispatcher().fireErrors(fileName, new FileProcessingResult(null, errors)); }

Target:
protected final void fireErrors(String fileName) { final SortedSet<LocalizedMessage> errors = new TreeSet<>(messageCollector); messageCollector.clear(); getMessageDispatcher().fireErrors(new FileProcessingResult(fileName, null, errors)); }
Source:
public void recordTimings(long totalUnaccountedCpuNanos, long totalUnaccountedUserNanos, long totalUnaccountedCpuWallNanos) { if (cpuUnaccountedWallNanos > 0) { operationTiming.recordEstimatedCpuTime(cpuMeasuredNanos + totalUnaccountedCpuNanos * (totalUnaccountedCpuWallNanos / cpuUnaccountedWallNanos)); operationTiming.recordEstimatedUserTime(userMeasuredNanos + totalUnaccountedUserNanos * (totalUnaccountedCpuWallNanos / cpuUnaccountedWallNanos)); } else { operationTiming.recordEstimatedCpuTime(cpuMeasuredNanos); operationTiming.recordEstimatedUserTime(userMeasuredNanos); } }

Target:
public void recordTimings(long totalUnaccountedCpuNanos, long totalUnaccountedUserNanos, long totalUnaccountedCpuWallNanos) { if (cpuUnaccountedWallNanos > 0) { double unaccountedCpuFraction = cpuUnaccountedWallNanos / (double) totalUnaccountedCpuWallNanos; operationTiming.recordEstimatedCpuTime((long) (cpuMeasuredNanos + totalUnaccountedCpuNanos * unaccountedCpuFraction)); operationTiming.recordEstimatedUserTime((long) (userMeasuredNanos + totalUnaccountedUserNanos * unaccountedCpuFraction)); } else { operationTiming.recordEstimatedCpuTime(cpuMeasuredNanos); operationTiming.recordEstimatedUserTime(userMeasuredNanos); } }
Source:
public void testFetchSize() throws SQLException { assumeCallableStatementsSupported(); CallableStatement call = con.prepareCall("{ ? = call testspg__getRefcursor () }"); call.registerOutParameter(1, cursorType); call.setFetchSize(2); call.execute(); ResultSet rs = (ResultSet) call.getObject(1); assertTrue(rs.next()); assertTrue(rs.getInt(1) == 1); assertTrue(rs.next()); assertTrue(rs.getInt(1) == 2); assertTrue(rs.next()); assertTrue(rs.getInt(1) == 3); assertTrue(rs.next()); assertTrue(rs.getInt(1) == 4); assertTrue(rs.next()); assertTrue(rs.getInt(1) == 6); assertTrue(rs.next()); assertTrue(rs.getInt(1) == 9); assertTrue(!rs.next()); rs.close(); call.close(); }

Target:
public void testFetchSize() throws SQLException { checkAndRunResult(3); }
Source:
private void setTarget(int x, int y, int z) { this.targetX = x; this.targetY = y; this.targetZ = z; Block b = worldObj.getBlock(x, y - 1, z); this.nextDigRequiredEnergy = DIG_BASE_REQUIRED_ENERGY + (b.getBlockHardness(null, 0, 0, 0) * DIG_HARDNESS_ENERGY_MULTIPLIER); }

Target:
private void setTarget(int x, int y, int z) { this.targetX = x; this.targetY = y; this.targetZ = z; Block b = worldObj.getBlock(x, y - 1, z); this.nextDigRequiredEnergy = DIG_BASE_REQUIRED_ENERGY + (b.getBlockHardness(worldObj, x, y - 1, z) * DIG_HARDNESS_ENERGY_MULTIPLIER); }
Source:
public YarnContainerHeartbeatServlet(YarnAppState yarnAppState, ReadableMetricsRegistry registry) { this.yarnAppState = yarnAppState; this.jsonResponse = new JSONObject(); this.heartbeatInvalidCount = registry.newCounter(GROUP, "heartbeats-invalid"); }

Target:
public YarnContainerHeartbeatServlet(YarnAppState yarnAppState, ReadableMetricsRegistry registry) { this.yarnAppState = yarnAppState; this.mapper = new ObjectMapper(); this.heartbeatsExpiredCount = registry.newCounter(GROUP, "heartbeats-expired"); }
Source:
protected <T> T wrapRead(Read<T> op) throws MessagingException { ReentrantReadWriteLock.ReadLock lock = this.lock.readLock(); lock.lock(); try { Preconditions.checkState(referenceCount > 0, "Attempt to read a disposed message"); return op.read(wrapped); } finally { lock.unlock(); } }

Target:
private <T> T wrapRead(Read<T> op) throws MessagingException { ReentrantReadWriteLock.ReadLock readLock = lock.readLock(); readLock.lock(); try { Preconditions.checkState(referenceCount > 0, "Attempt to read a disposed message"); return op.read(wrapped); } finally { readLock.unlock(); } }
Source:
public String getvm_host() { if (!StringHelper.isNullOrEmpty(this.getvm_ip())) { this.mVmDynamic.setvm_host(getvm_ip()); } else if (!StringHelper.isNullOrEmpty(getvm_domain())) { if (StringHelper.isNullOrEmpty(this.mVmDynamic.getvm_host()) || !this.mVmDynamic.getvm_host().contains(getvm_domain())) { this.mVmDynamic.setvm_host(getvm_name() + "." + getvm_domain()); } } if (StringHelper.isNullOrEmpty(this.mVmDynamic.getvm_host())) { this.mVmDynamic.setvm_host(getvm_name()); } return this.mVmDynamic.getvm_host(); }

Target:
public String getvm_host() { if (!StringHelper.isNullOrEmpty(this.getvm_ip())) { this.mVmDynamic.setvm_host(getvm_ip()); } else if (!StringHelper.isNullOrEmpty(getvm_domain())) { if (StringHelper.isNullOrEmpty(this.mVmDynamic.getvm_host()) || !this.mVmDynamic.getvm_host().endsWith(getvm_domain())) { this.mVmDynamic.setvm_host(getvm_host() + "." + getvm_domain()); } } if (StringHelper.isNullOrEmpty(this.mVmDynamic.getvm_host())) { this.mVmDynamic.setvm_host(getvm_name()); } return this.mVmDynamic.getvm_host(); }
Source:
private void addHosts(final MultipleHostsModel hostsModel) { hostsModel.startProgress(null); ArrayList<VdcActionParametersBase> parametersList = new ArrayList<VdcActionParametersBase>(); for (Object object : hostsModel.getHosts().getItems()) { HostDetailModel hostDetailModel = (HostDetailModel) ((EntityModel) object).getEntity(); VDS host = new VDS(); host.setVdsName(hostDetailModel.getName()); host.setHostName(hostDetailModel.getAddress()); host.setSshKeyFingerprint(hostDetailModel.getFingerprint()); host.setPort(54321); host.setVdsGroupId(hostsModel.getClusterModel().getClusterId()); host.setpm_enabled(false); AddVdsActionParameters parameters = new AddVdsActionParameters(); parameters.setVdsId(host.getId()); parameters.setvds(host); parameters.setRootPassword(hostDetailModel.getPassword()); parameters.setOverrideFirewall(false); parameters.setRebootAfterInstallation(hostsModel.getClusterModel().getEnableOvirtService().getIsSelected()); parametersList.add(parameters); } Frontend.RunMultipleAction(VdcActionType.AddVds, parametersList, true, new IFrontendMultipleActionAsyncCallback() { @Override public void executed(FrontendMultipleActionAsyncResult result) { hostsModel.stopProgress(); boolean isAllCanDoPassed = true; for (VdcReturnValueBase returnValueBase : result.getReturnValue()) { isAllCanDoPassed = isAllCanDoPassed && returnValueBase.getCanDoAction(); if (!isAllCanDoPassed) { break; } } if (isAllCanDoPassed) { cancel(); } } }, null); }

Target:
private void addHosts(final MultipleHostsModel hostsModel) { hostsModel.startProgress(null); ArrayList<VdcActionParametersBase> parametersList = new ArrayList<VdcActionParametersBase>(); for (Object object : hostsModel.getHosts().getItems()) { HostDetailModel hostDetailModel = (HostDetailModel) ((EntityModel) object).getEntity(); VDS host = new VDS(); host.setVdsName(hostDetailModel.getName()); host.setHostName(hostDetailModel.getAddress()); host.setSSHKeyFingerprint(hostDetailModel.getFingerprint()); host.setPort(54321); host.setVdsGroupId((Guid) hostsModel.getClusterModel().getClusterId()); host.setpm_enabled(false); AddVdsActionParameters parameters = new AddVdsActionParameters(); parameters.setVdsId(host.getId()); parameters.setvds(host); parameters.setRootPassword(hostDetailModel.getPassword()); parameters.setOverrideFirewall(false); parameters.setRebootAfterInstallation(hostsModel.getClusterModel().getEnableOvirtService().getIsSelected()); parametersList.add(parameters); } Frontend.RunMultipleAction(VdcActionType.AddVds, parametersList, true, new IFrontendMultipleActionAsyncCallback() { @Override public void executed(FrontendMultipleActionAsyncResult result) { hostsModel.stopProgress(); boolean isAllCanDoPassed = true; for (VdcReturnValueBase returnValueBase : result.getReturnValue()) { isAllCanDoPassed = isAllCanDoPassed && returnValueBase.getCanDoAction(); if (!isAllCanDoPassed) { break; } } if (isAllCanDoPassed) { cancel(); } } }, null); }
Source:
private void updateSubscribedTopics(final Set<String> topics, final String logPrefix) { final Collection<String> existingTopics = subscriptionUpdates(); if (!existingTopics.equals(topics)) { subscriptionUpdates.clear(); subscriptionUpdates.addAll(topics); log.debug("{}found topics possibly matching subscription", logPrefix, topics.size()); setRegexMatchedTopicsToSourceNodes(); setRegexMatchedTopicToStateStore(); } }

Target:
private void updateSubscribedTopics(final Set<String> topics, final String logPrefix) { subscriptionUpdates.clear(); subscriptionUpdates.addAll(topics); log.debug("{}found topics possibly matching subscription", logPrefix, topics.size()); setRegexMatchedTopicsToSourceNodes(); setRegexMatchedTopicToStateStore(); }
Source:
public void canDeclareSpecificComponentsAsSafe() { TableDefinition definition = new TableDefinition() {{ javaTableName(TABLE_REF.getTablename()); rowName(); rowComponent(ROW_NAME, ValueType.STRING, TableMetadataPersistence.ValueByteOrder.ASCENDING, true); columns(); column(COLUMN_NAME, COLUMN_SHORTNAME, ValueType.VAR_LONG); }}; assertRowComponentSafety(definition, true); assertNamedColumnSafety(definition, false); }

Target:
public void canDeclareSpecificComponentsAsSafe() { TableDefinition definition = new TableDefinition() {{ javaTableName(TABLE_REF.getTablename()); rowName(); rowComponent( ROW_NAME, ValueType.STRING, TableMetadataPersistence.ValueByteOrder.ASCENDING, LogSafety.SAFE); columns(); column(COLUMN_NAME, COLUMN_SHORTNAME, ValueType.VAR_LONG); }}; assertRowComponentSafety(definition, LogSafety.SAFE); assertNamedColumnSafety(definition, LogSafety.UNSAFE); }
Source:
public Map<String, EList<String>> getSortedPermitted() { TreeMap<String, EList<String>> sortedPermitted = new TreeMap<>(); Iterator<Entry<String, EList<String>>> iterator = super.getPermitted_labels().iterator(); while (iterator.hasNext()) { Entry<String, EList<String>> permittedlabel = iterator.next(); sortedPermitted.put(permittedlabel.getKey(), permittedlabel.getValue()); } return sortedPermitted; }

Target:
public Map<String, EList<String>> getSortedPermitted() { TreeMap<String, EList<String>> sortedPermitted = new TreeMap<>(); Iterator<Entry<String, EList<String>>> iterator = getPermitted_labels().iterator(); while (iterator.hasNext()) { Entry<String, EList<String>> permittedlabel = iterator.next(); sortedPermitted.put(permittedlabel.getKey(), permittedlabel.getValue()); } return sortedPermitted; }
Source:
public SecurityInfo add(SecurityInfo info) throws NonUniqueSecurityInfoException { byte[] data = serialize(info); try (Jedis j = pool.getResource()) { if (info.getIdentity() != null) { String oldEndpoint; if ((oldEndpoint = j.hget(PSKID_SEC, info.getIdentity())) != null && !oldEndpoint.equals(info.getEndpoint())) { throw new NonUniqueSecurityInfoException("PSK Identity " + info.getIdentity() + " is already used"); } j.hset(PSKID_SEC.getBytes(), info.getIdentity().getBytes(), info.getEndpoint().getBytes()); } j.set((SEC_EP + info.getEndpoint()).getBytes(), data); return null; } }

Target:
public SecurityInfo add(SecurityInfo info) throws NonUniqueSecurityInfoException { byte[] data = serialize(info); try (Jedis j = pool.getResource()) { if (info.getIdentity() != null) { String oldEndpoint = j.hget(PSKID_SEC, info.getIdentity()); if (oldEndpoint != null && !oldEndpoint.equals(info.getEndpoint())) { throw new NonUniqueSecurityInfoException("PSK Identity " + info.getIdentity() + " is already used"); } j.hset(PSKID_SEC.getBytes(), info.getIdentity().getBytes(), info.getEndpoint().getBytes()); } byte[] previousData = j.getSet((SEC_EP + info.getEndpoint()).getBytes(), data); SecurityInfo previous = previousData == null ? null : deserialize(previousData); String previousIdentity = previous == null ? null : previous.getIdentity(); if (previousIdentity != null && !previousIdentity.equals(info.getIdentity())) { j.hdel(PSKID_SEC, previousIdentity); } return previous; } }
Source:
protected void helpAction() { BrowserUtil.browse("<LINK_2>"); }

Target:
protected void helpAction() { BrowserUtil.browse("<LINK_1>"); }
Source:
Optional<CatchUpStorage> getStorage() { return Optional.ofNullable(storage); }

Target:
CatchUpStorage getStorage() { return checkNotNull(storage); }
Source:
public void connect() throws Exception { synchronized (connectionLock) { if (connectionStatus == STATUS.CONNECTED) { log.info("Already connected to Qpid Broker, ignoring this connect request"); } log.debug("creating connection"); try { connection = connectionFactory.createConnection(); } catch (JMSException ex) { log.error("Error connecting to Qpid, it is probably down"); throw ex; } connection.start(); log.debug("creating topic session"); session = createTopicSession(); log.info("AMQP session created successfully..."); Map<Target, Map<Type, TopicPublisher>> pm = Util.newMap(); buildAllTopicPublishers(pm); producerMap = pm; connectionStatus = STATUS.CONNECTED; } }

Target:
public void connect() throws Exception { synchronized (connectionLock) { connection = newConnection(); log.debug("creating topic session"); session = createTopicSession(); log.info("AMQP session created successfully..."); Map<Target, Map<Type, TopicPublisher>> pm = Util.newMap(); buildAllTopicPublishers(pm); producerMap = pm; connectionStatus = STATUS.CONNECTED; } }
Source:
public void testRefreshIsDebugEnabledFalse() throws Exception { configurator.setContext(context); ((LoggerContext) context).reset(); configurator.doConfigure(logbackUnitTestFilePath); Map<String, String> mapExpectedFirstFetch = new HashMap<String, String>(); mapExpectedFirstFetch.put("001", "firstRetrieve001"); mapExpectedFirstFetch.put("002", "firstRetrieve002"); mapExpectedFirstFetch.put("003", "firstRetrieve003"); Map<String, String> mapExpectedSecondFetch = new HashMap<String, String>(); mapExpectedSecondFetch.put("001", "secondRetrieve001"); mapExpectedSecondFetch.put("002", "secondRetrieve002"); mapExpectedSecondFetch.put("003", "secondRetrieve003"); AbstractReloadableCodeList reloadableCodeList = new ExtendedReloadableCodelist(); Map<String, String> mapResult1 = reloadableCodeList.asMap(); assertThat(mapResult1.size(), is(mapExpectedFirstFetch.size())); for (String key : mapResult1.keySet()) { assertThat(mapResult1.get(key), is(mapExpectedFirstFetch.get(key))); } assertFalse(logger.isDebugEnabled()); reloadableCodeList.afterPropertiesSet(); Map<String, String> mapResult2 = reloadableCodeList.asMap(); assertThat(mapResult2.size(), is(mapExpectedSecondFetch.size())); for (String key : mapResult2.keySet()) { assertThat(mapResult2.get(key), is(mapExpectedSecondFetch.get(key))); } ((LoggerContext) context).reset(); configurator.doConfigure(logbackDefaultFilePath); }

Target:
public void testRefreshIsDebugEnabledFalse() throws Exception { LogLevelChangeUtil.setLogLevel(LogLevelChangeUtil.LogLevel.INFO); Map<String, String> mapExpectedFirstFetch = new HashMap<String, String>(); mapExpectedFirstFetch.put("001", "firstRetrieve001"); mapExpectedFirstFetch.put("002", "firstRetrieve002"); mapExpectedFirstFetch.put("003", "firstRetrieve003"); Map<String, String> mapExpectedSecondFetch = new HashMap<String, String>(); mapExpectedSecondFetch.put("001", "secondRetrieve001"); mapExpectedSecondFetch.put("002", "secondRetrieve002"); mapExpectedSecondFetch.put("003", "secondRetrieve003"); AbstractReloadableCodeList reloadableCodeList = new ExtendedReloadableCodelist(); Map<String, String> mapResult1 = reloadableCodeList.asMap(); assertThat(mapResult1.size(), is(mapExpectedFirstFetch.size())); for (String key : mapResult1.keySet()) { assertThat(mapResult1.get(key), is(mapExpectedFirstFetch.get(key))); } assertThat(logger.isDebugEnabled(), is(false)); reloadableCodeList.afterPropertiesSet(); Map<String, String> mapResult2 = reloadableCodeList.asMap(); assertThat(mapResult2.size(), is(mapExpectedSecondFetch.size())); for (String key : mapResult2.keySet()) { assertThat(mapResult2.get(key), is(mapExpectedSecondFetch.get(key))); } LogLevelChangeUtil.resetLogLevel(); }
Source:
public void sendResponse(Send payloadToSend, NetworkRequest originalRequest, ServerNetworkResponseMetrics metrics) throws InterruptedException { if (!(originalRequest instanceof NettyServerRequest)) { throw new IllegalArgumentException("NetworkRequest should be NettyRequest"); } ChannelHandlerContext ctx = ((NettyServerRequest) originalRequest).getCtx(); http2ServerMetrics.requestTotalProcessingTime.update( System.currentTimeMillis() - originalRequest.getStartTimeInMs()); ctx.pipeline().writeAndFlush(payloadToSend); }

Target:
public void sendResponse(Send payloadToSend, NetworkRequest originalRequest, ServerNetworkResponseMetrics metrics) throws InterruptedException { if (!(originalRequest instanceof NettyServerRequest)) { throw new IllegalArgumentException("NetworkRequest should be NettyRequest"); } ChannelHandlerContext ctx = ((NettyServerRequest) originalRequest).getCtx(); http2ServerMetrics.requestTotalProcessingTime.update( System.currentTimeMillis() - originalRequest.getStartTimeInMs()); ctx.channel().writeAndFlush(payloadToSend); }
Source:
public synchronized void stop() { RuntimeException toThrow = null; try { if (process != null) { process.stop(); process.waitFor(); process = null; } } catch (Exception e) { toThrow = new RuntimeException("Could not stop container", e); } finally { if (closeConnectionBeforeStop) closeConnection(); final ExecutorService exec = executor; if (exec != null) { exec.shutdownNow(); executor = null; } if (closeClientConfig) { try { clientConfiguration.close(); } catch (Exception e) { if (toThrow == null) { toThrow = new RuntimeException("Could not stop client configuration", e); } } } } if (toThrow != null) { throw toThrow; } }

Target:
public synchronized void stop() { RuntimeException toThrow = null; try { if (process != null) { process.stop(); process.waitFor(); process = null; } } catch (Exception e) { toThrow = new RuntimeException("Could not stop container", e); } finally { closeConnection(); final ExecutorService exec = executor; if (exec != null) { exec.shutdownNow(); executor = null; } if (closeClientConfig) { try { clientConfiguration.close(); } catch (Exception e) { if (toThrow == null) { toThrow = new RuntimeException("Could not stop client configuration", e); } } } } if (toThrow != null) { throw toThrow; } }
Source:
public void updateQueryTag(String queryId, String queryTag) { Operation operation = queryIdOperation.get(queryId); if (operation != null) { if (queryTagToIdMap.get(queryTag) != null) { throw new RuntimeException("tag " + queryTag + " is already applied for query " + queryId); } queryTagToIdMap.put(queryTag, queryId); LOG.debug("Query " + queryId + " is updated with tag " + queryTag); return; } LOG.info("Query id is missing during query tag updation"); }

Target:
public void updateQueryTag(String queryId, String queryTag) { Operation operation = queryIdOperation.get(queryId); if (operation != null) { String queryIdTemp = queryTagToIdMap.get(queryTag); if (queryIdTemp != null) { throw new RuntimeException("tag " + queryTag + " is already applied for query " + queryIdTemp); } queryTagToIdMap.put(queryTag, queryId); LOG.info("Query " + queryId + " is updated with tag " + queryTag); return; } LOG.info("Query id is missing during query tag updation"); }
Source:
public void test01_01_requestControllerHandling() { driver.findElement(By.id("requestControllerHandling_01_01")).click(); dbLogProvider.waitForAssertion(); assertTrue(driver.getTitle().contains("terasoluna-gfw-functionaltest")); assertThat(dbLogProvider.countContainsMessageAndLevelsAndLogger( "\\[w.xx.0002\\] ResultMessages \\[type=error, list=\\[ResultMessage \\[code=null, args=\\[\\], text=Error\\]\\]\\]", "WARN", "org.terasoluna.gfw.common.exception.ExceptionLogger"), is(1L)); assertThat(dbLogProvider.countContainsMessageAndLevelsAndLogger( "\\[w.xx.0002\\] ResultMessages \\[type=error, list=\\[ResultMessage \\[code=null, args=\\[\\], text=Error\\]\\]\\]", "WARN", "org.terasoluna.gfw.common.exception.ExceptionLogger.Monitoring"), is(1L)); assertThat(driver.findElement(By.xpath(" }

Target:
public void test01_01_requestControllerHandling() { driver.findElement(By.id("requestControllerHandling_01_01")).click(); assertThat(driver.getTitle(), is("terasoluna-gfw-functionaltest")); assertThat(dbLogProvider.countContainsMessageAndLevelsAndLogger( "\\[w.xx.0002\\] ResultMessages \\[type=error, list=\\[ResultMessage \\[code=null, args=\\[\\], text=Error\\]\\]\\]", "WARN", "org.terasoluna.gfw.common.exception.ExceptionLogger"), is(1L)); assertThat(dbLogProvider.countContainsMessageAndLevelsAndLogger( "\\[w.xx.0002\\] ResultMessages \\[type=error, list=\\[ResultMessage \\[code=null, args=\\[\\], text=Error\\]\\]\\]", "WARN", "org.terasoluna.gfw.common.exception.ExceptionLogger.Monitoring"), is(1L)); assertThat(driver.findElement(By.xpath(" }
Source:
private Optional<IjFolder> tryCreateNewParentFolderFromChildrenResourceFolders( Path currentPath, ImmutableCollection<IjFolder> children, FolderTypeWithPackageInfo typeForMerging) { IjResourceFolderType ijResourceFolderType = typeForMerging.getIjResourceFolderType(); ImmutableList<IjFolder> childrenToMerge = children .stream() .filter(ijResourceFolderType::isIjFolderInstance) .collect(MoreCollectors.toImmutableList()); if (childrenToMerge.isEmpty()) { return Optional.empty(); } final Path resourcesRoot = ijResourceFolderType.getResourcesRootFromFolder(childrenToMerge.get(0)); if (!currentPath.startsWith(resourcesRoot)) { return Optional.empty(); } boolean childrenHaveSameResourcesRoot = childrenToMerge .stream() .allMatch( folder -> Objects.equals( resourcesRoot, ijResourceFolderType.getResourcesRootFromFolder(folder))); if (!childrenHaveSameResourcesRoot) { return Optional.empty(); } IjFolder mergedFolder = ijResourceFolderType .getFactory() .create( currentPath, resourcesRoot, childrenToMerge .stream() .flatMap(folder -> folder.getInputs().stream()) .collect(MoreCollectors.toImmutableSortedSet())); removeFolders(childrenToMerge); mergePathsMap.put(currentPath, mergedFolder); return Optional.of(mergedFolder); }

Target:
private Optional<IjFolder> tryCreateNewParentFolderFromChildrenResourceFolders( Path currentPath, ImmutableCollection<IjFolder> children, FolderTypeWithPackageInfo typeForMerging) { IjResourceFolderType ijResourceFolderType = typeForMerging.getIjResourceFolderType(); ImmutableList<IjFolder> childrenToMerge = children .stream() .filter(ijResourceFolderType::isIjFolderInstance) .collect(MoreCollectors.toImmutableList()); if (childrenToMerge.isEmpty()) { return Optional.empty(); } final Path resourcesRoot = ijResourceFolderType.getResourcesRootFromFolder(childrenToMerge.get(0)); if (resourcesRoot != null && !resourcesRoot.equals(Paths.get("")) && !currentPath.startsWith(resourcesRoot)) { return Optional.empty(); } boolean childrenHaveSameResourcesRoot = childrenToMerge .stream() .allMatch( folder -> Objects.equals( resourcesRoot, ijResourceFolderType.getResourcesRootFromFolder(folder))); if (!childrenHaveSameResourcesRoot) { return Optional.empty(); } IjFolder mergedFolder = ijResourceFolderType .getFactory() .create( currentPath, resourcesRoot, childrenToMerge .stream() .flatMap(folder -> folder.getInputs().stream()) .collect(MoreCollectors.toImmutableSortedSet())); removeFolders(childrenToMerge); mergePathsMap.put(currentPath, mergedFolder); return Optional.of(mergedFolder); }
Source:
public boolean authenticate(String username, String password) throws DirectoryException { Document user = getCollection().find(MongoDBSerializationHelper.fieldMapToBson(getIdField(), username)).first(); if (user == null) { return false; } if (isMultiTenant()) { String tenantId = getCurrentTenantId(); if (StringUtils.isNotBlank(tenantId)) { String entryTenantId = user.getString(TENANT_ID_FIELD); if (StringUtils.isNotBlank(entryTenantId) && !entryTenantId.equals(tenantId)) { return false; } } } String storedPassword = user.getString(getPasswordField()); return PasswordHelper.verifyPassword(password, storedPassword); }

Target:
public boolean authenticate(String username, String password) throws DirectoryException { Document user = getCollection().find(MongoDBSerializationHelper.fieldMapToBson(getIdField(), username)).first(); if (user == null) { return false; } String storedPassword = user.getString(getPasswordField()); if (isMultiTenant()) { if(!checkEntryTenantId(user.getString(TENANT_ID_FIELD))) { storedPassword = null; } } return PasswordHelper.verifyPassword(password, storedPassword); }
Source:
private boolean validatePackagePath() { File file = new File(PACKAGE_PATH_NAME); try { return ((file.exists() && file.isDirectory()) || (file.exists() && file.getPath().endsWith(".zip"))); } catch (Exception e) { return false; } }

Target:
private void validatePackagePath() { File file = new File(PACKAGE_PATH_NAME); if (file.exists()) { if (!(file.isDirectory() || file.getPath().endsWith(".zip"))) { logger.warn(PACKAGE_PATH_NAME + " must be a directory or a zip file."); throw new CLIException(REASON_INVALID_ARGUMENTS, String.format("'%s' must be a directory or a zip file.", PACKAGE_PATH_NAME)); } } else { logger.warn(PACKAGE_PATH_NAME + " is not a valid package."); throw new CLIException(REASON_INVALID_ARGUMENTS, String.format("'%s' is not a valid package.", PACKAGE_PATH_NAME)); } }
Source:
private synchronized void handleTestRunningState(String testID) { try { TestRunningState testRunningState = testModelDAO.getTestRunningState(testID); logger .info("handleTestRunningState for " + testID + " with state " + testRunningState.name()); if (!timeoutTasks.containsKey(testID)) { Time maxRunTime = testModelDAO.getMaxRunningTime(testID); TimeoutTask timeoutTask = new TimeoutTask(testID, this); ScheduledFuture<?> timeoutFuture = timeoutScheduledThreadPoolExecutor.schedule(timeoutTask, maxRunTime.toSecondsPart(), TimeUnit.SECONDS); timeoutTasks.put(testID, timeoutFuture); } switch (testRunningState) { case DETERMINE_EXPLORATION_STRATEGY: runningStatesHandler.determineExplorationStrategy(testID); break; case ADD_STORED_KNOWLEDGE: runningStatesHandler.addStoredKnowledge(testID); break; case DETERMINE_EXECUTE_VALIDATION_SET: runningStatesHandler.determineExecuteInitialValidationSet(testID); break; case DETERMINE_EXECUTE_EXPERIMENTS: runningStatesHandler.determineAndExecuteExperiments(testID); break; case HANDLE_EXPERIMENT_RESULT: runningStatesHandler.handleExperimentResult(testID); break; case VALIDATE_TERMINATION_CRITERIA: runningStatesHandler.validateTerminationCriteria(testID); break; case DERIVE_PREDICTION_FUNCTION: testModelDAO.setTestRunningState(testID, VALIDATE_PREDICTION_FUNCTION); runningStatesHandler.derivePredictionFunction(testID); break; case VALIDATE_PREDICTION_FUNCTION: runningStatesHandler.validatePredictionFunction(testID); break; case REMOVE_NON_REACHABLE_EXPERIMENTS: runningStatesHandler.removeNonReachableExperiments(testID); break; default: break; } } catch (BenchFlowTestIDDoesNotExistException e) { e.printStackTrace(); } }

Target:
protected synchronized BenchFlowTestState handleTestRunningState(String testID) throws BenchFlowTestIDDoesNotExistException { try { TestRunningState testRunningState = testModelDAO.getTestRunningState(testID); logger .info("handleTestRunningState for " + testID + " with state " + testRunningState.name()); switch (testRunningState) { case DETERMINE_EXPLORATION_STRATEGY: runningStatesHandler.determineExplorationStrategy(testID); break; case ADD_STORED_KNOWLEDGE: runningStatesHandler.addStoredKnowledge(testID); break; case DETERMINE_EXECUTE_VALIDATION_SET: runningStatesHandler.determineExecuteInitialValidationSet(testID); break; case DETERMINE_EXECUTE_EXPERIMENTS: runningStatesHandler.determineAndExecuteExperiments(testID); break; case HANDLE_EXPERIMENT_RESULT: runningStatesHandler.handleExperimentResult(testID); break; case VALIDATE_TERMINATION_CRITERIA: runningStatesHandler.validateTerminationCriteria(testID); break; case DERIVE_PREDICTION_FUNCTION: runningStatesHandler.derivePredictionFunction(testID); break; case VALIDATE_PREDICTION_FUNCTION: runningStatesHandler.validatePredictionFunction(testID); break; case REMOVE_NON_REACHABLE_EXPERIMENTS: runningStatesHandler.removeNonReachableExperiments(testID); break; default: break; } } catch (BenchFlowTestIDDoesNotExistException e) { e.printStackTrace(); } return testModelDAO.getTestState(testID); }
Source:
public void applyChangeSetToIndex(final IdAndVersion tableId, final SparseChangeSet rowset, final long changeSetVersionNumber) { final long currentVersion = tableIndexDao .getMaxCurrentCompleteVersionForTable(tableId); if (changeSetVersionNumber > currentVersion) { tableIndexDao .executeInWriteTransaction(new TransactionCallback<Void>() { @Override public Void doInTransaction(TransactionStatus status) { for(Grouping grouping: rowset.groupByValidValues()){ tableIndexDao.createOrUpdateOrDeleteRows(tableId, grouping); } Set<Long> fileHandleIds = rowset.getFileHandleIdsInSparseChangeSet(); if (!fileHandleIds.isEmpty()) { tableIndexDao.applyFileHandleIdsToTable( tableId, fileHandleIds); } tableIndexDao.setMaxCurrentCompleteVersionForTable( tableId, changeSetVersionNumber); for(ListColumnChanges listColumnChange : rowset.groupListColumnChanges()){ tableIndexDao.deleteFromListColumnIndexTable(tableId, listColumnChange.getColumnModel(), listColumnChange.getRowIds()); tableIndexDao.populateListColumnIndexTable(tableId, listColumnChange.getColumnModel(), listColumnChange.getRowIds()); } return null; } }); } }

Target:
public void applyChangeSetToIndex(final IdAndVersion tableId, final SparseChangeSet rowset, final long changeSetVersionNumber) { final long currentVersion = tableIndexDao .getMaxCurrentCompleteVersionForTable(tableId); if (changeSetVersionNumber > currentVersion) { tableIndexDao .executeInWriteTransaction(new TransactionCallback<Void>() { @Override public Void doInTransaction(TransactionStatus status) { for(Grouping grouping: rowset.groupByValidValues()){ tableIndexDao.createOrUpdateOrDeleteRows(tableId, grouping); } Set<Long> fileHandleIds = rowset.getFileHandleIdsInSparseChangeSet(); if (!fileHandleIds.isEmpty()) { tableIndexDao.applyFileHandleIdsToTable( tableId, fileHandleIds); } for(ListColumnChanges listColumnChange : rowset.groupListColumnChanges()){ tableIndexDao.deleteFromListColumnIndexTable(tableId, listColumnChange.getColumnModel(), listColumnChange.getRowIds()); tableIndexDao.populateListColumnIndexTable(tableId, listColumnChange.getColumnModel(), listColumnChange.getRowIds()); } tableIndexDao.setMaxCurrentCompleteVersionForTable( tableId, changeSetVersionNumber); return null; } }); } }
Source:
public void testNewFileNoWait() throws Exception { for (int i = 0; i < 5; i++) { long start = System.currentTimeMillis(); File f1 = createFile("newfile"); FileSnapshot save = FileSnapshot.save(f1); long res = FS.getFsTimerResolution(f1.toPath()).toMillis(); long end = System.currentTimeMillis(); if (end - start > 2 * res) { continue; } assertTrue(save.isModified(f1)); return; } fail("too much load for this test"); }

Target:
public void testNewFileNoWait() throws Exception { Assume.assumeTrue(fsAttrCache.getFsTimestampResolution() .compareTo(Duration.ofMillis(10)) > 0); for (int i = 0; i < 50; i++) { Instant start = Instant.now(); Path f1 = createFile("newfile"); FileSnapshot save = FileSnapshot.save(f1.toFile()); Duration res = FS.getFileStoreAttributes(f1) .getFsTimestampResolution(); Instant end = Instant.now(); if (Duration.between(start, end) .compareTo(res.multipliedBy(2)) > 0) { continue; } assertTrue(save.isModified(f1.toFile())); return; } fail("too much load for this test"); }