auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void connect( ChannelHandlerContext ctx, SocketAddress remoteAddress, SocketAddress localAddress, ChannelPromise callerPromise) throws Exception { this.ctx = ctx; initPromise = ctx.channel().newPromise(); ChannelPromise realConnectPromise = ctx.channel().newPromise(); super.connect(ctx, remoteAddress, localAddress, realConnectPromise); realConnectPromise.addListener(future -> onRealConnect(ctx)); @SuppressWarnings("deprecation") PromiseCombiner combiner = new PromiseCombiner(); combiner.addAll((Future) realConnectPromise, initPromise); combiner.finish(callerPromise); }

Target:
public void connect( ChannelHandlerContext ctx, SocketAddress remoteAddress, SocketAddress localAddress, ChannelPromise callerPromise) throws Exception { this.ctx = ctx; initPromise = ctx.channel().newPromise(); ChannelPromise realConnectPromise = ctx.channel().newPromise(); super.connect(ctx, remoteAddress, localAddress, realConnectPromise); realConnectPromise.addListener(future -> onRealConnect(ctx)); PromiseCombiner.combine(callerPromise, realConnectPromise, initPromise); }
Source:
protected Object decode(Channel channel, SocketAddress remoteAddress, Object msg) throws Exception { ChannelBuffer buf = (ChannelBuffer) msg; buf.readUnsignedShort(); int size = buf.readUnsignedByte(); if (size != CMD_RESPONSE_SIZE) { int type = buf.readUnsignedByte(); if (type == MSG_IMEI) { parseIdentification(channel, remoteAddress, buf); } else { return parseData(channel, remoteAddress, buf, type); } } else { return parseCommandResponse(channel, remoteAddress, buf); } return null; }

Target:
protected Object decode(Channel channel, SocketAddress remoteAddress, Object msg) throws Exception { ChannelBuffer buf = (ChannelBuffer) msg; buf.readUnsignedShort(); int size = buf.readUnsignedByte(); if (size != CMD_RESPONSE_SIZE) { int type = buf.readUnsignedByte(); if (type == MSG_IMEI) { getDeviceSession(channel, remoteAddress, buf.readBytes(15).toString(StandardCharsets.UTF_8)); } else { return decodeData(channel, remoteAddress, buf, type); } } else { return parseCommandResponse(channel, remoteAddress, buf); } return null; }
Source:
public Builder(Context context) { if (context == null) { throw new IllegalArgumentException("Context must not be null."); } if (!hasPermission(context, Manifest.permission.INTERNET)) { throw new IllegalArgumentException("INTERNET permission is required."); } this.context = context.getApplicationContext(); }

Target:
public Builder(Context context) { if (context == null) { throw new IllegalArgumentException("Context must not be null."); } this.context = context.getApplicationContext(); }
Source:
public Item next() { this.episode = episodes.next(); Item item = itemExtractor.extract(episode); List<Clip> clips = getClips( episode.getProgramme().getPid(), episode.getProgramme().getUri() ); item.setClips(clips); return item; }

Target:
public Item next() { NitroItemSource<Episode> episode = episodes.next(); Item item = itemExtractor.extract(episode); List<Clip> clips = getClips( episode.getProgramme().getPid(), episode.getProgramme().getUri() ); item.setClips(clips); return item; }
Source:
private boolean policyUnitEnabled(VM vm) { boolean usesNumaPinning = vm.getvNumaNodeList().stream() .anyMatch(node -> !node.getVdsNumaNodeList().isEmpty()); return vm.getVmType() == VmType.HighPerformance || vm.isUsingCpuPassthrough() || StringUtils.isNotEmpty(vm.getCpuPinning()) || usesNumaPinning; }

Target:
private boolean policyUnitEnabled(VM vm) { boolean usesNumaPinning = vmNumaNodeDao.getAllVmNumaNodeByVmId(vm.getId()).stream() .anyMatch(node -> !node.getVdsNumaNodeList().isEmpty()); return vm.getVmType() == VmType.HighPerformance || vm.isUsingCpuPassthrough() || StringUtils.isNotEmpty(vm.getCpuPinning()) || usesNumaPinning; }
Source:
public void displayEditSettingsWindow() { WebElement editBtn = browser.driver.findElement(By.id("editBtn")); editBtn.click(); WebDriverWait wait = new WebDriverWait(browser.driver, TestProperties.TEST_TIMEOUT); wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("editModal"))); }

Target:
public void displayEditSettingsWindow() { WebElement editBtn = browser.driver.findElement(By.id("editBtn")); editBtn.click(); waitForElementVisibility(By.id("editModal")); }
Source:
public static boolean isOnXParameterAnnotation(HighlightInfo highlightInfo, PsiFile file) { if (!(ANNOTATION_TYPE_EXPECTED.equals(highlightInfo.getDescription()) || CANNOT_RESOLVE_UNDERSCORES_MESSAGE.matcher(StringUtil.notNullize(highlightInfo.getDescription())).matches())) { return false; } PsiElement highlightedElement = file.findElementAt(highlightInfo.getStartOffset()); PsiNameValuePair nameValuePair = findContainingNameValuePair(highlightedElement); if (nameValuePair == null || !(nameValuePair.getContext() instanceof PsiAnnotationParameterList)) { return false; } String parameterName = nameValuePair.getFirstChild().getText(); if (!ONX_PARAMETERS.contains(parameterName)) { return false; } PsiElement containingAnnotation = nameValuePair.getContext().getPrevSibling().getContext(); return containingAnnotation instanceof PsiAnnotation && ONXABLE_ANNOTATIONS.contains(((PsiAnnotation) containingAnnotation).getQualifiedName()); }

Target:
public static boolean isOnXParameterAnnotation(HighlightInfo highlightInfo, PsiFile file) { if (!(ANNOTATION_TYPE_EXPECTED.equals(highlightInfo.getDescription()) || CANNOT_RESOLVE_UNDERSCORES_MESSAGE.matcher(StringUtil.notNullize(highlightInfo.getDescription())).matches())) { return false; } PsiElement highlightedElement = file.findElementAt(highlightInfo.getStartOffset()); PsiNameValuePair nameValuePair = findContainingNameValuePair(highlightedElement); if (nameValuePair == null || !(nameValuePair.getContext() instanceof PsiAnnotationParameterList)) { return false; } String parameterName = nameValuePair.getName(); if (!ONX_PARAMETERS.contains(parameterName)) { return false; } PsiElement containingAnnotation = nameValuePair.getContext().getContext(); return containingAnnotation instanceof PsiAnnotation && ONXABLE_ANNOTATIONS.contains(((PsiAnnotation) containingAnnotation).getQualifiedName()); }
Source:
public DocumentOperationsApplierForNonOverlappingRegions(final Document document) { this.document = Objects.requireNonNull(document); comparator = new DocumentOperationNonOverlappingRegionsComparator(); operations = new ArrayList<>(); applied = false; }

Target:
public DocumentOperationsApplierForNonOverlappingRegions(final Document document) { this.document = Objects.requireNonNull(document); operations = new ArrayList<>(); applied = false; }
Source:
public synchronized void initTrace(@Nullable IResource resource, @Nullable String path, @Nullable Class<? extends ITmfEvent> type) throws TmfTraceException { super.initTrace(resource, path, type); if (path == null) { throw new TmfTraceException("No path has been specified."); } Path filePath = checkNotNull(Paths.get(path)); if (filePath.getFileName().toString().endsWith(PCAPNG_EXTENSION)) { try { fPcapFile = new PcapNgFile(filePath); } catch (IOException | BadPcapFileException e) { throw new TmfTraceException(e.getMessage(), e); } } else { try { fPcapFile = new PcapOldFile(filePath); } catch (IOException | BadPcapFileException e) { throw new TmfTraceException(e.getMessage(), e); } } }

Target:
public synchronized void initTrace(@Nullable IResource resource, @Nullable String path, @Nullable Class<? extends ITmfEvent> type) throws TmfTraceException { super.initTrace(resource, path, type); if (path == null) { throw new TmfTraceException("No path has been specified."); } Path filePath = checkNotNull(Paths.get(path)); try { fPcapFile = PcapHelper.getPcapFile(filePath); } catch (IOException | BadPcapFileException e) { throw new TmfTraceException(e.getMessage(), e); } }
Source:
public void removeNodeFromParent(MutableTreeNode node) { super.removeNodeFromParent(node); if(node.getParent() == getRoot()) { ZAP.getEventBus().publishSyncEvent(SiteMapEventPublisher.getPublisher(), new Event(SiteMapEventPublisher.getPublisher(), SiteMapEventPublisher.SITE_REMOVED_EVENT, new Target((SiteNode)node))); } else { ZAP.getEventBus().publishSyncEvent(SiteMapEventPublisher.getPublisher(), new Event(SiteMapEventPublisher.getPublisher(), SiteMapEventPublisher.SITE_NODE_REMOVED_EVENT, new Target((SiteNode)node))); } }

Target:
public void removeNodeFromParent(MutableTreeNode node) { SiteNode parent=(SiteNode)node.getParent(); super.removeNodeFromParent(node); handleEvent(parent, (SiteNode)node, EventType.REMOVE); }
Source:
public String normalizeUserName(String name) { String normalized = ILLEGAL_USERNAME_CHARACTERS.matcher(name).replaceAll(""); String candidate = normalized.isEmpty() ? NameGenerator.generate("username", 4) : normalized; int i = 1; try { while (true) { userManager.getByName(candidate); candidate = normalized.isEmpty() ? NameGenerator.generate("username", 4) : normalized + String.valueOf(i++); } } catch (NotFoundException e) { return candidate; } catch (ServerException e) { LOG.warn("Error occured during username normalization", e); } return candidate; }

Target:
public String normalizeUserName(String name) throws ServerException { String normalized = ILLEGAL_USERNAME_CHARACTERS.matcher(name).replaceAll(""); String candidate = normalized.isEmpty() ? NameGenerator.generate("username", 4) : normalized; int i = 1; try { while (userExists(candidate)) { candidate = normalized.isEmpty() ? NameGenerator.generate("username", 4) : normalized + String.valueOf(i++); } } catch (ServerException e) { LOG.warn("Error occured during username normalization", e); throw e; } return candidate; }
Source:
private X createFinalizableObject(final AtomicBoolean finalized) { X result = new X() { @Override protected void finalize() throws Throwable { super.finalize(); System.err.println("finalizer running..."); finalized.set(true); } }; FinalizationTester.induceFinalization(); boolean wasFinalized = finalized.get(); if (wasFinalized) { fail("finalizer called early"); } return wasFinalized ? result : null; }

Target:
private X createFinalizableObject(final AtomicBoolean finalized) { X result = new X() { @Override protected void finalize() throws Throwable { super.finalize(); finalized.set(true); } }; FinalizationTester.induceFinalization(); boolean wasFinalized = finalized.get(); if (wasFinalized) { fail("finalizer called early"); } return wasFinalized ? result : null; }
Source:
public void start(Collection<? extends Location> locs) { super.start(locs); Iterable<String> memberHostNamesAndPorts = Iterables.transform(getMembers(), new Function<Entity, String>() { @Override public String apply(Entity entity) { return entity.getAttribute(MongoDBConfigServer.HOSTNAME) + ":" + entity.getAttribute(MongoDBConfigServer.PORT); } }); setAttribute(MongoDBConfigServerCluster.CONFIG_SERVER_ADDRESSES, memberHostNamesAndPorts); }

Target:
public void start(Collection<? extends Location> locs) { super.start(locs); Iterable<String> memberHostNamesAndPorts = Iterables.transform(getMembers(), new Function<Entity, String>() { @Override public String apply(Entity entity) { return entity.getAttribute(MongoDBConfigServer.HOSTNAME) + ":" + entity.getAttribute(MongoDBConfigServer.PORT); } }); setAttribute(MongoDBConfigServerCluster.CONFIG_SERVER_ADDRESSES, ImmutableList.copyOf(memberHostNamesAndPorts)); }
Source:
protected MessageBeans resolveMessage(String msg, Integer idOfMessage) throws InternalErrorException { List<PerunBean> listOfBeans; listOfBeans = AuditParser.parseLog(msg); MessageBeans beans = new MessageBeansImpl(); boolean shouldntAddVo = msg.matches("Group:(.*)created in Vo:(.*)"); if(!listOfBeans.isEmpty()){ int i=0; for(PerunBean p: listOfBeans) { if (shouldntAddVo && p.getBeanName().equals("Vo")) { continue; } i++; beans.addBean(p); } } return beans; }

Target:
protected MessageBeans resolveMessage(String msg, Integer idOfMessage) throws InternalErrorException { List<PerunBean> listOfBeans; listOfBeans = AuditParser.parseLog(msg); MessageBeans beans = new MessageBeansImpl(); if(!listOfBeans.isEmpty()){ int i=0; for(PerunBean p: listOfBeans) { i++; beans.addBean(p); } } return beans; }
Source:
protected void broadcastSGVToUI() { EGVRecord record=new EGVRecord(-1, TrendArrow.NONE,new Date(),new Date(), NoiseMode.NONE); broadcastSGVToUI(record, false, standardMinutes(5).getMillis() + TIME_SYNC_OFFSET, new Date().getTime(), null, 0); }

Target:
protected void broadcastSGVToUI() { EGVRecord record = new EGVRecord(-1, TrendArrow.NONE, new Date(), new Date(), G4Download.Noise.NO_NOISE); broadcastSGVToUI(record, false, standardMinutes(5).getMillis() + TIME_SYNC_OFFSET, new Date().getTime(), null, 0); }
Source:
HeronWorker lookupByWorkerId(String workerId) { HeronWorker worker; synchronized (workerMap) { worker = workerMap.get(workerId); } if (worker == null) { LOG.log(Level.WARNING, "Container for executor id: {0} not found.", workerId); } return worker; }

Target:
Optional<HeronWorker> lookupByWorkerId(String workerId) { HeronWorker worker; synchronized (workerMap) { worker = workerMap.get(workerId); } if (worker == null) { LOG.log(Level.WARNING, "Container for executor id: {0} not found.", workerId); } return Optional.fromNullable(worker); }
Source:
public void setS3CannedAcl(String acl) { if (acl.equalsIgnoreCase("private")) getS3Configuration().setCannedAcl(CannedAccessControlList.Private); else if (acl.equalsIgnoreCase("public-read") || acl.equalsIgnoreCase("publicread")) getS3Configuration().setCannedAcl(CannedAccessControlList.PublicRead); else if (acl.equalsIgnoreCase("public-read-write") || acl.equalsIgnoreCase("publicreadwrite")) getS3Configuration().setCannedAcl(CannedAccessControlList.PublicReadWrite); else if (acl.equalsIgnoreCase("authenticated-read") || acl.equalsIgnoreCase("authenticatedread")) getS3Configuration().setCannedAcl(CannedAccessControlList.AuthenticatedRead); else if (acl.equalsIgnoreCase("bucket-owner-read") || acl.equalsIgnoreCase("bucketownerread")) getS3Configuration().setCannedAcl(CannedAccessControlList.BucketOwnerRead); else if (acl.equalsIgnoreCase("bucket-owner-full-control") || acl.equalsIgnoreCase("bucketownerfullcontrol")) getS3Configuration().setCannedAcl(CannedAccessControlList.BucketOwnerFullControl); else if (acl.equalsIgnoreCase("log-delivery-write") || acl.equalsIgnoreCase("logdeliverywrite")) getS3Configuration().setCannedAcl(CannedAccessControlList.LogDeliveryWrite); else getS3Configuration().setCannedAcl(CannedAccessControlList.Private); }

Target:
public void setS3CannedAcl(String acl) { try { getS3Configuration().setCannedAclFromValue(acl); } catch (IllegalArgumentException ex) { System.err.println(String.format("Ignoring unrecognized canned ACL value %s", acl)); } }
Source:
private Pair<DiskImage, Long> getLatestOVFDisk(List<Disk> disks) { Date foundOvfDiskUpdateDate = new Date(); boolean isFoundOvfDiskUpdated = false; Long size = 0L; Disk ovfDisk = null; for (Disk disk : disks) { boolean isBetterOvfDiskFound = false; String diskDecription = ((DiskImage) disk).getDescription(); if (diskDecription.contains(OvfInfoFileConstants.OvfStoreDescriptionLabel)) { Map<String, Object> diskDescriptionMap; try { diskDescriptionMap = JsonHelper.jsonToMap(diskDecription); } catch (IOException e) { log.errorFormat("Exception while generating json containing ovf store info. Exception: {0}", e); continue; } if (!isDomainExistsInDiskDescription(diskDescriptionMap, getParameters().getStorageDomainId())) { log.warnFormat("The disk description does not contain the storage domain id {0}", getParameters().getStorageDomainId()); continue; } boolean isUpdated = Boolean.valueOf(diskDescriptionMap.get(OvfInfoFileConstants.IsUpdated).toString()); Date date = getDateFromDiskDescription(diskDescriptionMap); if (!isFoundOvfDiskUpdated && isUpdated) { isBetterOvfDiskFound = true; } else if (!isUpdated && date.after(foundOvfDiskUpdateDate)) { isBetterOvfDiskFound = true; } else if (isFoundOvfDiskUpdated && isUpdated && date.after(foundOvfDiskUpdateDate)) { isBetterOvfDiskFound = true; } if (isBetterOvfDiskFound) { isFoundOvfDiskUpdated = isUpdated; foundOvfDiskUpdateDate = date; ovfDisk = disk; size = new Long(diskDescriptionMap.get(OvfInfoFileConstants.Size).toString()); } } } return new Pair<>((DiskImage)ovfDisk, size); }

Target:
private Pair<DiskImage, Long> getLatestOVFDisk(List<Disk> disks) { Date foundOvfDiskUpdateDate = new Date(); boolean isFoundOvfDiskUpdated = false; Long size = 0L; Disk ovfDisk = null; for (Disk disk : disks) { boolean isBetterOvfDiskFound = false; String diskDecription = ((DiskImage) disk).getDescription(); if (diskDecription.contains(OvfInfoFileConstants.OvfStoreDescriptionLabel)) { Map<String, Object> diskDescriptionMap; try { diskDescriptionMap = JsonHelper.jsonToMap(diskDecription); } catch (IOException e) { log.warnFormat("Exception while generating json containing ovf store info. Exception: {0}", e); continue; } if (!isDomainExistsInDiskDescription(diskDescriptionMap, getParameters().getStorageDomainId())) { log.warnFormat("The disk description does not contain the storage domain id {0}", getParameters().getStorageDomainId()); continue; } boolean isUpdated = Boolean.valueOf(diskDescriptionMap.get(OvfInfoFileConstants.IsUpdated).toString()); Date date = getDateFromDiskDescription(diskDescriptionMap); if (isFoundOvfDiskUpdated && !isUpdated) { continue; } if ((isUpdated && !isFoundOvfDiskUpdated) || date.after(foundOvfDiskUpdateDate)) { isBetterOvfDiskFound = true; } if (isBetterOvfDiskFound) { isFoundOvfDiskUpdated = isUpdated; foundOvfDiskUpdateDate = date; ovfDisk = disk; size = new Long(diskDescriptionMap.get(OvfInfoFileConstants.Size).toString()); } } } return new Pair<>((DiskImage)ovfDisk, size); }
Source:
public ImmutableList<Account> getInactiveUsers(@Scope(OAuthScope.ADMINISTRATION_READ) final AccessToken accessToken, @QueryParam("battery") final Integer battery, @QueryParam("limit") final Integer limit){ Integer criticalBatteryLevel; if (battery == null) { criticalBatteryLevel = DEFAULT_CRITICAL_BATTERY_LEVEL; } else { criticalBatteryLevel = battery; } Integer inspectedPopulation; if (limit == null) { inspectedPopulation = DEFAULT_INSPECTED_POPULATION; } else { inspectedPopulation = Math.min(MAX_INSPECTED_POPULATION, limit); } return deviceDAOAdmin.getAccountsWithLowPillBattery(criticalBatteryLevel, inspectedPopulation); }

Target:
public ImmutableList<Account> getInactiveUsers(@Scope(OAuthScope.ADMINISTRATION_READ) final AccessToken accessToken, @QueryParam("battery") final Integer battery, @QueryParam("limit") final Integer limit){ final Integer criticalBatteryLevel = (battery == null) ? DEFAULT_CRITICAL_BATTERY_LEVEL : battery; final Integer inspectedPopulation = (limit == null) ? DEFAULT_INSPECTED_POPULATION : Math.min(MAX_INSPECTED_POPULATION, limit); return deviceDAOAdmin.getAccountsWithLowPillBattery(criticalBatteryLevel, inspectedPopulation); }
Source:
public boolean isSuccess() { return raw().isSuccessful(); }

Target:
public boolean isSuccess() { return rawResponse.isSuccessful(); }
Source:
private PostEntity.Data setUp(String wikiName) { siteId = Utils.excractSiteIdFromWikiName(wikiName); return DiscussionsOperations .using(userWithPosts, driver) .createPostWithUniqueData(siteId); }

Target:
private PostEntity.Data setUp(String wikiName) { siteId = Utils.excractSiteIdFromWikiName(wikiName); return DiscussionsClient .using(userWithPosts, driver) .createPostWithUniqueData(siteId); }
Source:
protected void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception { if (ess.getJails().getCount() == 1) { sender.sendMessage(tl("noJailsDefined")); } else { sender.sendMessage(tl("jailList", StringUtil.joinList(" ", ess.getJails().getList()))); } }

Target:
protected void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception { if (ess.getJails().getCount() == 0) { sender.sendMessage(tl("noJailsDefined")); } else { sender.sendMessage(tl("jailList", StringUtil.joinList(" ", ess.getJails().getList()))); } }
Source:
public EhcacheEntityResponse invoke(ClientDescriptor clientDescriptor, EhcacheEntityMessage message) { try { if (this.offHeapResourceIdentifiers.isEmpty()) { throw new ServerMisconfigurationException("Server started without any offheap resources defined." + " Check your server configuration and define at least one offheap resource."); } if (!invalidationForPassiveEvictedKeysSent.get()) { try { evictionInvalidationsInProgress.lock(); if (!invalidationForPassiveEvictedKeysSent.get()) { Set<String> caches = ehcacheStateService.getStores(); caches.stream() .flatMap(cache -> ehcacheStateService.getEvictionTracker(cache) .getTrackedEvictedKeys() .stream() .map(key -> new InvalidationTuple<>(cache, key, false))) .forEach(x -> { invalidateHashAfterEviction(x.getK(), x.getV()); LOGGER.debug("Sending invalidation for key and cache since it was evicted by Passive", x.getV(), x.getK()); }); invalidationForPassiveEvictedKeysSent.set(true); } } finally { evictionInvalidationsInProgress.unlock(); } } switch (message.getType()) { case LIFECYCLE_OP: return invokeLifeCycleOperation(clientDescriptor, (LifecycleMessage) message); case SERVER_STORE_OP: return invokeServerStoreOperation(clientDescriptor, (ServerStoreOpMessage) message); case STATE_REPO_OP: return invokeStateRepositoryOperation(clientDescriptor, (StateRepositoryOpMessage) message); case RETIREMENT_OP: return responseFactory.success(); default: throw new IllegalMessageException("Unknown message : " + message); } } catch (ClusterException e) { return responseFactory.failure(e); } catch (Exception e) { LOGGER.error("Unexpected exception raised during operation: " + message, e); return responseFactory.failure(new InvalidOperationException(e)); } }

Target:
public EhcacheEntityResponse invoke(ClientDescriptor clientDescriptor, EhcacheEntityMessage message) { try { if (this.offHeapResourceIdentifiers.isEmpty()) { throw new ServerMisconfigurationException("Server started without any offheap resources defined." + " Check your server configuration and define at least one offheap resource."); } switch (message.getType()) { case LIFECYCLE_OP: return invokeLifeCycleOperation(clientDescriptor, (LifecycleMessage) message); case SERVER_STORE_OP: return invokeServerStoreOperation(clientDescriptor, (ServerStoreOpMessage) message); case STATE_REPO_OP: return invokeStateRepositoryOperation(clientDescriptor, (StateRepositoryOpMessage) message); case RETIREMENT_OP: return responseFactory.success(); default: throw new IllegalMessageException("Unknown message : " + message); } } catch (ClusterException e) { return responseFactory.failure(e); } catch (Exception e) { LOGGER.error("Unexpected exception raised during operation: " + message, e); return responseFactory.failure(new InvalidOperationException(e)); } }
Source:
public void disconnect() { if (fControl != null) { fControl.setState(TerminalState.CLOSED); } fGdbTerminalCtrlMngr.removePageTerminalControl(fControl); }

Target:
public void disconnect() { fGdbTerminalCtrlConnector.removePageTerminalControl(fControl); if (fControl != null) { fControl.setState(TerminalState.CLOSED); } }
Source:
public int onStartCommand(Intent intent, int flags, int startId) { if (intent != null) { String action = intent.getAction(); if (action != null) { switch (action) { case ACTION_STOP: stop(); break; case ACTION_PAUSE: pause(); break; case ACTION_RESUME: resume(); break; } } MediaButtonReceiver.handleIntent(mediaSession, intent); } enableMediaSession(); return super.onStartCommand(intent, flags, startId); }

Target:
public int onStartCommand(Intent intent, int flags, int startId) { if (intent != null) { String action = intent.getAction(); if (action != null) { switch (action) { case ACTION_STOP: stop(); break; case ACTION_PAUSE: pause(); break; case ACTION_RESUME: resume(); break; } } MediaButtonReceiver.handleIntent(mediaSession, intent); } return super.onStartCommand(intent, flags, startId); }
Source:
public String toString() { return ToStringBuilder.forInstance(this) .append("storageDomainId", storageDomainId) .append("imageGroupId", imageGroupId) .append("baseImageId", baseImageId) .append("topImageId", topImageId) .append("baseImageGeneration", baseImageGeneration) .build(); }

Target:
public String toString() { return ToStringBuilder.forInstance(this) .append("storageDomainId", storageDomainId) .append("imageGroupId", imageGroupId) .append("baseImage", baseImage) .append("topImage", topImage) .append("baseImageGeneration", baseImageGeneration) .build(); }
Source:
public void placeBlock(GlowPlayer player, GlowBlockState state, BlockFace face, ItemStack holding, Vector clickedLoc) { super.placeBlock(player, state, face, holding, clickedLoc); MaterialData data = state.getData(); if (data instanceof Stairs) { ((Stairs) data).setFacingDirection(getOppositeDirection(player)); if (face == BlockFace.DOWN || face != BlockFace.UP && clickedLoc.getY() >= 8) { ((Stairs) data).setInverted(true); } state.setData(data); } else { GlowServer.logger.warning("Placing Stairs: MaterialData was of wrong type"); } }

Target:
public void placeBlock(GlowPlayer player, GlowBlockState state, BlockFace face, ItemStack holding, Vector clickedLoc) { super.placeBlock(player, state, face, holding, clickedLoc); MaterialData data = state.getData(); if (data instanceof Stairs) { ((Stairs) data).setFacingDirection(player.getDirection()); if (face == BlockFace.DOWN || face != BlockFace.UP && clickedLoc.getY() >= 8) { ((Stairs) data).setInverted(true); } state.setData(data); } else { GlowServer.logger.warning("Placing Stairs: MaterialData was of wrong type"); } }
Source:
private static RexNode canonizeNode(RexBuilder rexBuilder, RexNode condition) { switch (condition.getKind()) { case AND: case OR: { RexCall call = (RexCall) condition; SortedMap<String, RexNode> newOperands = new TreeMap<>(); for (RexNode operand : call.operands) { operand = canonizeNode(rexBuilder, operand); newOperands.put(operand.toString(), operand); } if (newOperands.size() < 2) { return newOperands.values().iterator().next(); } return rexBuilder.makeCall(call.getOperator(), ImmutableList.copyOf(newOperands.values())); } case EQUALS: case NOT_EQUALS: case LESS_THAN: case GREATER_THAN: case LESS_THAN_OR_EQUAL: case GREATER_THAN_OR_EQUAL: { RexCall call = (RexCall) condition; RexNode left = call.getOperands().get(0); left = canonizeNode(rexBuilder, left); RexNode right = call.getOperands().get(1); right = canonizeNode(rexBuilder, right); call = (RexCall) rexBuilder.makeCall(call.getOperator(), left, right); if (left.toString().compareTo(right.toString()) <= 0) { return call; } return RexUtil.invert(rexBuilder, call); } case PLUS: case TIMES: RexCall call = (RexCall) condition; RexNode left = call.getOperands().get(0); RexNode right = call.getOperands().get(1); left = canonizeNode(rexBuilder, left); right = canonizeNode(rexBuilder, right); if (left.toString().compareTo(right.toString()) <= 0) { return rexBuilder.makeCall(call.getOperator(), left, right); } else { return rexBuilder.makeCall(call.getOperator(), right, left); } default: return condition; } }

Target:
private static RexNode canonizeNode(RexBuilder rexBuilder, RexNode condition) { switch (condition.getKind()) { case AND: case OR: { RexCall call = (RexCall) condition; SortedMap<String, RexNode> newOperands = new TreeMap<>(); for (RexNode operand : call.operands) { operand = canonizeNode(rexBuilder, operand); newOperands.put(operand.toString(), operand); } if (newOperands.size() < 2) { return newOperands.values().iterator().next(); } return rexBuilder.makeCall(call.getOperator(), ImmutableList.copyOf(newOperands.values())); } case EQUALS: case NOT_EQUALS: case LESS_THAN: case GREATER_THAN: case LESS_THAN_OR_EQUAL: case GREATER_THAN_OR_EQUAL: { RexCall call = (RexCall) condition; RexNode left = canonizeNode(rexBuilder, call.getOperands().get(0)); RexNode right = canonizeNode(rexBuilder, call.getOperands().get(1)); call = (RexCall) rexBuilder.makeCall(call.getOperator(), left, right); if (left.toString().compareTo(right.toString()) <= 0) { return call; } return RexUtil.invert(rexBuilder, call); } case PLUS: case TIMES: RexCall call = (RexCall) condition; RexNode left = call.getOperands().get(0); RexNode right = call.getOperands().get(1); left = canonizeNode(rexBuilder, left); right = canonizeNode(rexBuilder, right); RexNode newCall; if (left.toString().compareTo(right.toString()) <= 0) { newCall = rexBuilder.makeCall(call.getOperator(), left, right); } else { newCall = rexBuilder.makeCall(call.getOperator(), right, left); } if (!SqlTypeUtil.equalSansNullability(rexBuilder.getTypeFactory(), newCall.getType(), call.getType())) { newCall = call; } return newCall; default: return condition; } }
Source:
public String toString() { boolean first = true; String format = "SettingsDto{host='%s', port='%s', username='%s', password='%s', additionalProperties={"; for (Entry<String, String> prop : this.additionalProperties.entrySet()) { if (!first) { format += ", "; } else { first = false; } format += prop.getKey() + ": " + prop.getValue(); } format += "}, logAddress='%s', logSubject='%s', logBody='%s', logPurgeEnable='%s', logPurgeTime='%s', logPurgeTimeMultiplier='%s'}"; return String.format( format, host, port, username, password, logAddress, logSubject, logBody, logPurgeEnable, logPurgeTime, logPurgeTimeMultiplier); }

Target:
public String toString() { return String.format( "SettingsDto{host='%s', port='%s', username='%s', password='%s', additionalProperties='%s', logAddress='%s', logSubject='%s', logBody='%s', logPurgeEnable='%s', logPurgeTime='%s', logPurgeTimeMultiplier='%s'}", host, port, username, password, additionalProperties, logAddress, logSubject, logBody, logPurgeEnable, logPurgeTime, logPurgeTimeMultiplier); }
Source:
public static final List<Serializable> getValues() { List<Serializable> values = new ArrayList<>(); values.add(null); values.add(Boolean.TRUE); values.add("toto"); values.add("toto, tutu, tata"); values.add(new ArrayList<>(Arrays.asList("true", "false"))); values.add(new String[] { "tutu", "toto" }); return values; }

Target:
public static final List<Serializable> getValues() { List<Serializable> values = new ArrayList<>(); values.add(null); values.add(Boolean.TRUE); values.add("toto"); values.add("toto, tutu, tata"); values.add(new String[] { "tutu", "toto" }); values.add(new String[] { "tutu", null, "toto" }); values.add(new ArrayList<>(Arrays.asList("true", "false"))); return values; }
Source:
private Duration(int months, int days, long nanoseconds) { assert (months >= 0 && days >= 0 && nanoseconds >= 0) || ((months <= 0 && days <= 0 && nanoseconds <= 0)); this.months = months; this.days = days; this.nanoseconds = nanoseconds; }

Target:
private Duration(int months, int days, long nanoseconds) { if ((months < 0 || days < 0 || nanoseconds < 0) && ((months > 0 || days > 0 || nanoseconds > 0))) { throw new IllegalArgumentException(String.format( "All values must be either negative or positive, got %d months, %d days, %d nanoseconds", months, days, nanoseconds)); } this.months = months; this.days = days; this.nanoseconds = nanoseconds; }
Source:
protected void configure() { bind(I18n.class).toProvider(I18nProvider.class).in(ServletScopes.REQUEST); bind(JsonProvider.class); configureEventHandlers(); bind(EventManager.class).asEagerSingleton(); bind(EventReceiver.class).asEagerSingleton(); bind(EventCurator.class); Multibinder<Report> reports = Multibinder.newSetBinder(binder(), Report.class); reports.addBinding().to(ConsumerStatusReport.class); bind(ReportFactory.class); bind(StatusResource.class); bind(EventResource.class); bind(ReportsResource.class); }

Target:
protected void configure() { bind(I18n.class).toProvider(I18nProvider.class).in(ServletScopes.REQUEST); bind(JsonProvider.class); configureEventHandlers(); bind(EventManager.class).asEagerSingleton(); bind(EventReceiver.class).asEagerSingleton(); Multibinder<Report> reports = Multibinder.newSetBinder(binder(), Report.class); reports.addBinding().to(ConsumerStatusReport.class); bind(ReportFactory.class); bind(StatusResource.class); bind(EventResource.class); bind(ReportsResource.class); }
Source:
public DescriptionEditFragment createFragment() { invokeSource = (InvokeSource) getIntent().getSerializableExtra(INTENT_EXTRA_INVOKE_SOURCE); if (invokeSource == InvokeSource.EDIT_FEED_TITLE_DESC) { SuggestedEditsFunnel.get().getAddDescriptionStats().click(); } else if (invokeSource == InvokeSource.EDIT_FEED_TRANSLATE_TITLE_DESC) { SuggestedEditsFunnel.get().getTranslateDescriptionStats().click(); } return DescriptionEditFragment.newInstance(GsonUnmarshaller.unmarshal(PageTitle.class, getIntent().getStringExtra(EXTRA_TITLE)), getIntent().getStringExtra(EXTRA_HIGHLIGHT_TEXT), getIntent().getBooleanExtra(EXTRA_REVIEW_ENABLE, false), getIntent().getCharSequenceExtra(EXTRA_TRANSLATION_SOURCE_DESCRIPTION), getIntent().getStringExtra(EXTRA_TRANSLATION_SOURCE_LANGUAGE_CODE), invokeSource); }

Target:
public DescriptionEditFragment createFragment() { invokeSource = (InvokeSource) getIntent().getSerializableExtra(INTENT_EXTRA_INVOKE_SOURCE); SuggestedEditsFunnel.get().click(invokeSource); return DescriptionEditFragment.newInstance(GsonUnmarshaller.unmarshal(PageTitle.class, getIntent().getStringExtra(EXTRA_TITLE)), getIntent().getStringExtra(EXTRA_HIGHLIGHT_TEXT), getIntent().getBooleanExtra(EXTRA_REVIEW_ENABLE, false), getIntent().getCharSequenceExtra(EXTRA_TRANSLATION_SOURCE_DESCRIPTION), getIntent().getStringExtra(EXTRA_TRANSLATION_SOURCE_LANGUAGE_CODE), invokeSource); }
Source:
public void generatesDeclarations(Boolean withExterns, String expected) { Options opts = new Options(!withExterns); List<SourceFile> sourceFiles = new ArrayList<>(); for (File nonroot : getSubject().nonroots) { sourceFiles.add(SourceFile.fromFile(nonroot, UTF_8)); } List<String> roots = new ArrayList<>(); for (File root : getSubject().roots) { sourceFiles.add(SourceFile.fromFile(root, UTF_8)); roots.add(root.getPath()); } String actual = new DeclarationGenerator(opts) .generateDeclarations(sourceFiles, NO_EXTERNS, new Depgraph(roots)) .replaceAll("[ ]* if (!actual.equals(expected)) { failureStrategy.failComparing("compilation result doesn't match", expected, actual); } }

Target:
public void generatesDeclarations(Boolean withExterns, String expected) { Options opts = new Options(!withExterns); List<SourceFile> sourceFiles = new ArrayList<>(); for (File nonroot : getSubject().nonroots) { sourceFiles.add(SourceFile.fromFile(nonroot, UTF_8)); } List<String> roots = new ArrayList<>(); for (File root : getSubject().roots) { sourceFiles.add(SourceFile.fromFile(root, UTF_8)); roots.add(root.getPath()); } String actual = new DeclarationGenerator(opts) .generateDeclarations(sourceFiles, NO_EXTERNS, new Depgraph(roots)); actual = DeclarationGenerator.GOLDEN_FILE_COMMENTS_REGEXP.matcher(actual).replaceAll(""); if (!actual.equals(expected)) { failureStrategy.failComparing("compilation result doesn't match", expected, actual); } }
Source:
public static <T extends TransitionFactoryData> TransitionFactory<T> of( TransitionFactory<T> transitionFactory1, TransitionFactory<T> transitionFactory2) { Preconditions.checkNotNull(transitionFactory1); Preconditions.checkNotNull(transitionFactory2); if (transitionFactory1.isFinal()) { return transitionFactory1; } else if (NoTransition.isInstance(transitionFactory1)) { return transitionFactory2; } if (NoTransition.isInstance(transitionFactory2)) { return transitionFactory1; } else if (NullTransition.isInstance(transitionFactory2) || transitionFactory2.isHost()) { return transitionFactory2; } return create(transitionFactory1, transitionFactory2); }

Target:
public static <T extends TransitionFactoryData> TransitionFactory<T> of( TransitionFactory<T> transitionFactory1, TransitionFactory<T> transitionFactory2) { Preconditions.checkNotNull(transitionFactory1); Preconditions.checkNotNull(transitionFactory2); if (isFinal(transitionFactory1)) { return transitionFactory1; } else if (NoTransition.isInstance(transitionFactory1)) { return transitionFactory2; } if (NoTransition.isInstance(transitionFactory2)) { return transitionFactory1; } else if (isFinal(transitionFactory2)) { return transitionFactory2; } return create(transitionFactory1, transitionFactory2); }
Source:
public int getVersion() { Element ssNode = XmlUtils.getElementInFile(fFilePath.makeAbsolute().toOSString(), TmfXmlStrings.STATE_PROVIDER, fStateId); if (ssNode != null) { return Integer.valueOf(ssNode.getAttribute(TmfXmlStrings.VERSION)); } throw new IllegalStateException("The state provider XML node should have a version attribute"); }

Target:
public int getVersion() { Element ssNode = XmlUtils.getElementInFile(fFilePath.makeAbsolute().toOSString(), TmfXmlStrings.STATE_PROVIDER, fStateId); if (ssNode != null) { return Integer.parseInt(ssNode.getAttribute(TmfXmlStrings.VERSION)); } throw new IllegalStateException("The state provider XML node should have a version attribute"); }
Source:
public String getVocabularyLabel(String voc, String key) { try (Session session = getDirService().open(voc)) { if (!session.hasEntry(key)) { log.warn("Unable to find the key '" + key + "' in the vocabulary '" + voc + "'."); return key; } DocumentModel doc = session.getEntry(key); DataModel dm = doc.getDataModels().values().iterator().next(); return (String) dm.getData("label"); } }

Target:
public String getVocabularyLabel(String voc, String key) { try (Session session = getDirService().open(voc)) { if (!session.hasEntry(key)) { log.debug("Unable to find the key '" + key + "' in the vocabulary '" + voc + "'."); return key; } DocumentModel doc = session.getEntry(key); DataModel dm = doc.getDataModels().values().iterator().next(); return (String) dm.getData("label"); } }
Source:
public int getContentVersion() { return 0; }

Target:
public int getContentVersion() { return 1; }
Source:
private void stage(final Repository repository, final List<IFile> modifiedFiles, final List<IFile> untrackedFiles) { final Collection<IFile> targets = new ArrayList<IFile>(modifiedFiles); targets.addAll(untrackedFiles); Job job = new Job(UIText.StagingView_StagingJobLabel) { @Override protected IStatus run(IProgressMonitor monitor) { SubMonitor subMonitor = SubMonitor.convert(monitor); if (subMonitor.isCanceled()) { return Status.CANCEL_STATUS; } subMonitor.beginTask(NLS.bind( UIText.StagingView_StagingJobTaskName, repository .getDirectory().getParentFile().getName()), modifiedFiles.size() + untrackedFiles.size()); AddToIndexOperation indexOperation = new AddToIndexOperation( modifiedFiles); try { indexOperation.execute(subMonitor.newChild( modifiedFiles.size(), SubMonitor.SUPPRESS_NONE)); if (subMonitor.isCanceled()) { reload(repository, modifiedFiles); return Status.CANCEL_STATUS; } modified.get(repository).removeAll(modifiedFiles); untracked.get(repository).removeAll(untrackedFiles); staged.get(repository).addAll(modifiedFiles); staged.get(repository).addAll(untrackedFiles); refreshUI(repository); } catch (CoreException e) { return new Status(IStatus.ERROR, Activator.getPluginId(), "Failed to stage files", e); } finally { subMonitor.done(); } return Status.OK_STATUS; } }; job.setRule(new MultiRule(targets.toArray(new IFile[targets.size()]))); job.schedule(); }

Target:
private void stage(final Repository repository, final List<IFile> modifiedFiles, final List<IFile> untrackedFiles) { final Collection<IFile> targets = new ArrayList<IFile>(modifiedFiles); targets.addAll(untrackedFiles); Job job = new Job(UIText.StagingView_StagingJobLabel) { @Override protected IStatus run(IProgressMonitor monitor) { SubMonitor subMonitor = SubMonitor.convert(monitor); if (subMonitor.isCanceled()) return Status.CANCEL_STATUS; subMonitor.beginTask(NLS.bind( UIText.StagingView_StagingJobTaskName, repository .getDirectory().getParentFile().getName()), modifiedFiles.size() + untrackedFiles.size()); AddToIndexOperation indexOperation = new AddToIndexOperation( modifiedFiles); try { indexOperation.execute(subMonitor.newChild( modifiedFiles.size(), SubMonitor.SUPPRESS_NONE)); if (subMonitor.isCanceled()) { reload(repository, modifiedFiles); return Status.CANCEL_STATUS; } modified.get(repository).removeAll(modifiedFiles); untracked.get(repository).removeAll(untrackedFiles); staged.get(repository).addAll(modifiedFiles); staged.get(repository).addAll(untrackedFiles); refreshUI(repository); } catch (CoreException e) { return new Status(IStatus.ERROR, Activator.getPluginId(), UIText.StagingView_FailedToStageFiles, e); } finally { subMonitor.done(); } return Status.OK_STATUS; } }; job.setRule(new MultiRule(targets.toArray(new IFile[targets.size()]))); job.schedule(); }
Source:
@Test public void testClearErases() throws IOException { QueueFile queue = new QueueFile(file); byte[] expected = values[253]; queue.add(expected); byte[] data = new byte[expected.length]; queue.raf.seek(QueueFile.Element.HEADER_LENGTH + 16); queue.raf.readFully(data, 0, expected.length); assertThat(data).isEqualTo(expected); queue.clear(); queue.raf.seek(16 + QueueFile.Element.HEADER_LENGTH); queue.raf.readFully(data, 0, expected.length); assertThat(data).isEqualTo(new byte[expected.length]); }

Target:
@Test public void testClearErases() throws IOException { QueueFile queue = new QueueFile(file); byte[] expected = values[253]; queue.add(expected); byte[] data = new byte[expected.length]; queue.raf.seek(HEADER_LENGTH + Element.HEADER_LENGTH); queue.raf.readFully(data, 0, expected.length); assertThat(data).isEqualTo(expected); queue.clear(); queue.raf.seek(HEADER_LENGTH + Element.HEADER_LENGTH); queue.raf.readFully(data, 0, expected.length); assertThat(data).isEqualTo(new byte[expected.length]); }
Source:
public ShowFindDialogAction(@NonNull TimeGraphViewer timeGraphViewer) { fFilterDialog = TimeGraphFindDialog.getInstance(timeGraphViewer.getControl().getShell(), this); fTimeGraphViewer = timeGraphViewer; setText("search"); setToolTipText("Show search dialog"); setImageDescriptor(Activator.getDefault().getImageDescripterFromPath(ITmfImageConstants.IMG_UI_SEARCH)); }

Target:
public ShowFindDialogAction(@NonNull TimeGraphViewer timeGraphViewer) { fFilterDialog = TimeGraphFindDialog.getInstance(timeGraphViewer.getControl().getShell(), this); fTimeGraphViewer = timeGraphViewer; setText(Messages.ShowFindDialogAction_Search); setToolTipText(Messages.ShowFindDialogAction_Show_search_dialog); setImageDescriptor(Activator.getDefault().getImageDescripterFromPath(ITmfImageConstants.IMG_UI_SEARCH)); }
Source:
public void testUnmarshallDateObject() { String expectedString = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n" + "<date-object>\n" + " <localDate>2017-01-01</localDate>\n" + " <localDateTime>2017-01-01T10:10:10</localDateTime>\n" + " <localTime>10:10:10</localTime>\n" + "</date-object>\n"; Set<Class<?>> extraClasses = new HashSet<Class<?>>(); extraClasses.add(DateObject.class); Marshaller marshaller = MarshallerFactory.getMarshaller( extraClasses, MarshallingFormat.JAXB, getClass().getClassLoader() ); DateObject dateObject = marshaller.unmarshall( expectedString, DateObject.class ); assertNotNull( dateObject ); assertEquals( "2017-01-01", dateObject.getLocalDate().toString() ); assertEquals( "2017-01-01T10:10:10", dateObject.getLocalDateTime().toString() ); assertEquals( "10:10:10", dateObject.getLocalTime().toString() ); }

Target:
public void testUnmarshallDateObject() { String expectedString = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n" + "<date-object>\n" + " <localDate>2017-01-01</localDate>\n" + " <localDateTime>2017-01-01T10:10:10</localDateTime>\n" + " <localTime>10:10:10</localTime>\n" + " <offsetDateTime>2017-01-01T10:10:10+01:00</offsetDateTime>\n" + "</date-object>\n"; Set<Class<?>> extraClasses = new HashSet<Class<?>>(); extraClasses.add(DateObject.class); Marshaller marshaller = MarshallerFactory.getMarshaller( extraClasses, MarshallingFormat.JAXB, getClass().getClassLoader() ); DateObject dateObject = marshaller.unmarshall( expectedString, DateObject.class ); assertNotNull( dateObject ); assertEquals( LocalDate.of( 2017, 1, 1 ), dateObject.getLocalDate() ); assertEquals( LocalDateTime.of( 2017, 1, 1, 10, 10, 10 ), dateObject.getLocalDateTime() ); assertEquals( LocalTime.of( 10, 10, 10 ), dateObject.getLocalTime() ); assertEquals( OffsetDateTime.of( LocalDateTime.of( 2017, 1, 1, 10, 10, 10 ), ZoneOffset.ofHours( 1 ) ), dateObject.getOffsetDateTime() ); }
Source:
public boolean tableExists(Handle handle, String tableName) { String databaseCharset = handle .createQuery("SELECT @@character_set_database") .map(StringMapper.FIRST) .first(); if (!databaseCharset.matches("utf.*")) { throw new ISE( "Druid requires its MySQL database to be created with an UTF charset, found `%1$s`.%n" + "The recommended charset is `utf8mb4`.", databaseCharset ); } else if (!"utf8mb4".equals(databaseCharset)) { log.warn("The current database charset `%1$s` does not match the recommended charset `utf8mb4`", databaseCharset); } return !handle.createQuery("SHOW tables LIKE :tableName") .bind("tableName", tableName) .list() .isEmpty(); }

Target:
public boolean tableExists(Handle handle, String tableName) { String databaseCharset = handle .createQuery("SELECT @@character_set_database") .map(StringMapper.FIRST) .first(); if (!databaseCharset.matches("utf8.*")) { throw new ISE( "Druid requires its MySQL database to be created with an UTF8 charset, found `%1$s`. " + "The recommended charset is `utf8mb4`.", databaseCharset ); } else if (!"utf8mb4".equals(databaseCharset)) { log.warn("The current database charset `%1$s` does not match the recommended charset `utf8mb4`", databaseCharset); } return !handle.createQuery("SHOW tables LIKE :tableName") .bind("tableName", tableName) .list() .isEmpty(); }
Source:
public static void putDocument(String indexName, Document document) { Index index = getIndex(indexName); int delay = 2; for (int attempts = 0; attempts < MAX_RETRIES; attempts++) { try { PutResponse result = index.put(document); if (Config.PERSISTENCE_CHECK_DURATION > 0) { int elapsedTime = 0; boolean isSuccessful = result.getResults().get(0).getCode() == StatusCode.OK; while (!isSuccessful && elapsedTime < Config.PERSISTENCE_CHECK_DURATION) { ThreadHelper.waitBriefly(); result = index.put(document); isSuccessful = result.getResults().get(0).getCode() == StatusCode.OK; if (!isSuccessful) { elapsedTime += ThreadHelper.WAIT_DURATION; } } if (elapsedTime >= Config.PERSISTENCE_CHECK_DURATION) { log.info(String.format(ERROR_EXCEED_DURATION, document, indexName)); } } } catch (PutException e) { if (StatusCode.TRANSIENT_ERROR.equals(e.getOperationResult().getCode())) { ThreadHelper.waitFor(delay * 1000); delay *= 2; continue; } else { log.severe(String.format(ERROR_NON_TRANSIENT_BACKEND_ISSUE, document, indexName) + TeammatesException.toStringWithStackTrace(e)); break; } } } }

Target:
public static void putDocument(String indexName, Document document) { Index index = getIndex(indexName); int delay = 2; for (int attempts = 0; attempts < MAX_RETRIES; attempts++) { try { PutResponse result = index.put(document); if (Config.PERSISTENCE_CHECK_DURATION == 0) { continue; } int elapsedTime = 0; boolean isSuccessful = result.getResults().get(0).getCode() == StatusCode.OK; while (!isSuccessful && elapsedTime < Config.PERSISTENCE_CHECK_DURATION) { ThreadHelper.waitBriefly(); result = index.put(document); isSuccessful = result.getResults().get(0).getCode() == StatusCode.OK; if (!isSuccessful) { elapsedTime += ThreadHelper.WAIT_DURATION; } } if (elapsedTime >= Config.PERSISTENCE_CHECK_DURATION) { log.info(String.format(ERROR_EXCEED_DURATION, document, indexName)); } } catch (PutException e) { if (StatusCode.TRANSIENT_ERROR.equals(e.getOperationResult().getCode())) { ThreadHelper.waitFor(delay * 1000); delay *= 2; continue; } else { log.severe(String.format(ERROR_NON_TRANSIENT_BACKEND_ISSUE, document, indexName) + TeammatesException.toStringWithStackTrace(e)); break; } } } }
Source:
public Response remove() { get(); return performAction(VdcActionType.RemoveVm, new RemoveVmParameters(asGuid(id), false)); }

Target:
public Response remove() { get(); return performAction(VdcActionType.RemoveVm, new RemoveVmParameters(guid, false)); }
Source:
public void testNoRecordPublisherTypeInConfig() { Properties testConfig = TestUtils.getStandardProperties(); KinesisConfigUtil.validateEFOConfiguration(testConfig, new ArrayList<>()); }

Target:
public void testNoRecordPublisherTypeInConfig() { Properties testConfig = TestUtils.getStandardProperties(); ConsumerConfigConstants.RecordPublisherType recordPublisherType = KinesisConfigUtil.validateRecordPublisherType(testConfig); assertEquals(recordPublisherType, ConsumerConfigConstants.RecordPublisherType.POLLING); }