auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private synchronized void refresh() { List<String> names; try { names = ZKUtil.listChildrenAndWatchForNewChildren(watcher, watcher.getZNodePaths().rsZNode); } catch (KeeperException e) { server.abort("Unexpected zk exception getting RS nodes", e); return; } Set<ServerName> servers = CollectionUtils.isEmpty(names) ? Collections.EMPTY_SET : names.stream().map(ServerName::parseServerName).collect(Collectors.toSet()); for (Iterator<ServerName> iter = regionServers.iterator(); iter.hasNext();) { ServerName sn = iter.next(); if (!servers.contains(sn)) { LOG.info("RegionServer ephemeral node deleted, processing expiration [{}]", sn); serverManager.expireServer(sn); iter.remove(); } } boolean newServerAdded = false; for (ServerName sn : servers) { if (regionServers.add(sn)) { newServerAdded = true; LOG.info("RegionServer ephemeral node created, adding [" + sn + "]"); } } if (newServerAdded && server.isInitialized()) { server.checkIfShouldMoveSystemRegionAsync(); } }

Target:
private synchronized void refresh() { List<String> names; try { names = ZKUtil.listChildrenAndWatchForNewChildren(watcher, watcher.getZNodePaths().rsZNode); } catch (KeeperException e) { server.abort("Unexpected zk exception getting RS nodes", e); return; } Set<ServerName> servers = CollectionUtils.isEmpty(names) ? Collections.emptySet() : names.stream().map(ServerName::parseServerName).collect(Collectors.toSet()); for (Iterator<ServerName> iter = regionServers.iterator(); iter.hasNext();) { ServerName sn = iter.next(); if (!servers.contains(sn)) { LOG.info("RegionServer ephemeral node deleted, processing expiration [{}]", sn); serverManager.expireServer(sn); iter.remove(); } } boolean newServerAdded = false; for (ServerName sn : servers) { if (regionServers.add(sn)) { newServerAdded = true; LOG.info("RegionServer ephemeral node created, adding [" + sn + "]"); } } if (newServerAdded && server.isInitialized()) { server.checkIfShouldMoveSystemRegionAsync(); } }
Source:
private MemcachedOperation toRequest(String commandName, Boolean endOfOp, ByteBuf buffer) throws UnknownOperationException { if (isTrace) log.tracef("Operation: '%s'", commandName); switch (commandName) { case "get" : return MemcachedOperation.GetRequest; case "set" : return MemcachedOperation.PutRequest; case "add" : return MemcachedOperation.PutIfAbsentRequest; case "delete" : return MemcachedOperation.RemoveRequest; case "replace" : return MemcachedOperation.ReplaceRequest; case "cas" : return MemcachedOperation.ReplaceIfUnmodifiedRequest; case "append" : return MemcachedOperation.AppendRequest; case "prepend" : return MemcachedOperation.PrependRequest; case "gets" : return MemcachedOperation.GetWithVersionRequest; case "incr" : return MemcachedOperation.IncrementRequest; case "decr" : return MemcachedOperation.DecrementRequest; case "flush_all" : return MemcachedOperation.FlushAllRequest; case "version" : return MemcachedOperation.VersionRequest; case "stats" : return MemcachedOperation.StatsRequest; case "verbosity" : return MemcachedOperation.VerbosityRequest; case "quit" : return MemcachedOperation.QuitRequest; default : if (!endOfOp) { String line = readDiscardedLine(buffer); log.debugf("Unexpected operation '%s', rest of line contains: %s", commandName, line); } System.out.printf("Readable bytes %d\n", buffer.readableBytes()); throw new UnknownOperationException("Unknown operation: " + commandName); } }

Target:
private MemcachedOperation toRequest(String commandName, Boolean endOfOp, ByteBuf buffer) throws UnknownOperationException { if (isTrace) log.tracef("Operation: '%s'", commandName); switch (commandName) { case "get" : return MemcachedOperation.GetRequest; case "set" : return MemcachedOperation.PutRequest; case "add" : return MemcachedOperation.PutIfAbsentRequest; case "delete" : return MemcachedOperation.RemoveRequest; case "replace" : return MemcachedOperation.ReplaceRequest; case "cas" : return MemcachedOperation.ReplaceIfUnmodifiedRequest; case "append" : return MemcachedOperation.AppendRequest; case "prepend" : return MemcachedOperation.PrependRequest; case "gets" : return MemcachedOperation.GetWithVersionRequest; case "incr" : return MemcachedOperation.IncrementRequest; case "decr" : return MemcachedOperation.DecrementRequest; case "flush_all" : return MemcachedOperation.FlushAllRequest; case "version" : return MemcachedOperation.VersionRequest; case "stats" : return MemcachedOperation.StatsRequest; case "verbosity" : return MemcachedOperation.VerbosityRequest; case "quit" : return MemcachedOperation.QuitRequest; default : if (!endOfOp) { String line = readDiscardedLine(buffer); log.debugf("Unexpected operation '%s', rest of line contains: %s", commandName, line); } throw new UnknownOperationException("Unknown operation: " + commandName); } }
Source:
private static MerkleTree build(DirectoryTree tree, DigestUtil digestUtil) { Preconditions.checkNotNull(tree); if (tree.isEmpty()) { return new MerkleTree(ImmutableMap.of(), ImmutableMap.of(), digestUtil.compute(new byte[0]), 0, 0); } Map<Digest, Directory> digestDirectoryMap = Maps.newHashMapWithExpectedSize(tree.numDirectories()); Map<Digest, PathOrBytes> digestPathMap = Maps.newHashMapWithExpectedSize(tree.numFiles()); Map<PathFragment, Digest> m = new HashMap<>(); AtomicLong inputBytes = new AtomicLong(0); tree.visit( (dirname, files, dirs) -> { Directory.Builder b = Directory.newBuilder(); for (DirectoryTree.FileNode file : files) { b.addFiles(buildProto(file)); digestPathMap.put(file.getDigest(), toPathOrBytes(file)); inputBytes.addAndGet(file.getDigest().getSizeBytes()); } for (DirectoryTree.DirectoryNode dir : dirs) { PathFragment subDirname = dirname.getRelative(dir.getPathSegment()); Digest protoDirDigest = Preconditions.checkNotNull(m.remove(subDirname), "protoDirDigest was null"); b.addDirectories(buildProto(dir, protoDirDigest)); inputBytes.addAndGet(protoDirDigest.getSizeBytes()); } Directory protoDir = b.build(); Digest protoDirDigest = digestUtil.compute(protoDir); digestDirectoryMap.put(protoDirDigest, protoDir); m.put(dirname, protoDirDigest); }); Digest rootDigest = m.get(PathFragment.EMPTY_FRAGMENT); return new MerkleTree(digestDirectoryMap, digestPathMap, rootDigest, tree.numFiles(), inputBytes.addAndGet(rootDigest.getSizeBytes())); }

Target:
private static MerkleTree build(DirectoryTree tree, DigestUtil digestUtil) { Preconditions.checkNotNull(tree); if (tree.isEmpty()) { return new MerkleTree(ImmutableMap.of(), ImmutableMap.of(), digestUtil.compute(new byte[0]), 0, 0); } Map<Digest, Directory> digestDirectoryMap = Maps.newHashMapWithExpectedSize(tree.numDirectories()); Map<Digest, PathOrBytes> digestPathMap = Maps.newHashMapWithExpectedSize(tree.numFiles()); Map<PathFragment, Digest> m = new HashMap<>(); AtomicLong inputBytes = new AtomicLong(0); tree.visit( (dirname, files, dirs) -> { Directory.Builder b = Directory.newBuilder(); for (DirectoryTree.FileNode file : files) { b.addFiles(buildProto(file)); digestPathMap.put(file.getDigest(), toPathOrBytes(file)); inputBytes.addAndGet(file.getDigest().getSizeBytes()); } for (DirectoryTree.DirectoryNode dir : dirs) { PathFragment subDirname = dirname.getRelative(dir.getPathSegment()); Digest protoDirDigest = Preconditions.checkNotNull(m.remove(subDirname), "protoDirDigest was null"); b.addDirectories(buildProto(dir, protoDirDigest)); inputBytes.addAndGet(protoDirDigest.getSizeBytes()); } Directory protoDir = b.build(); Digest protoDirDigest = digestUtil.compute(protoDir); digestDirectoryMap.put(protoDirDigest, protoDir); m.put(dirname, protoDirDigest); }); Digest rootDigest = m.get(PathFragment.EMPTY_FRAGMENT); inputBytes.addAndGet(rootDigest.getSizeBytes()); return new MerkleTree(digestDirectoryMap, digestPathMap, rootDigest, tree.numFiles(), inputBytes.get()); }
Source:
private boolean resolveIntent(Intent intent) { ResolveInfo resolveInfo = mContext.getPackageManager().resolveActivity(intent, 0); return (resolveInfo != null); }

Target:
private boolean resolveIntent(Intent intent) { final ResolveInfo resolveInfo = mContext.getPackageManager().resolveActivity(intent, 0); return resolveInfo != null; }
Source:
public String getToolTipText(Object element) { if (element instanceof TestCaseElement) { String ignoreReason= ((TestCaseElement) element).getIgnoreReason(); if (ignoreReason != null && ignoreReason.length() > 0) { return ignoreReason; } } return super.getToolTipText(element); }

Target:
public String getToolTipText(Object element) { if (element instanceof TestCaseElement) { String ignoreReason= ((TestCaseElement) element).getIgnoreReason(); if (ignoreReason != null && !ignoreReason.isEmpty()) { return ignoreReason; } } return super.getToolTipText(element); }
Source:
public PlacementResult<List<BookieSocketAddress>> newEnsemble(int ensembleSize, int writeQuorumSize, int ackQuorumSize, Map<String, byte[]> customMetadata, Set<BookieSocketAddress> excludeBookies) throws BKNotEnoughBookiesException { rwLock.readLock().lock(); try { Set<BookieSocketAddress> comprehensiveExclusionBookiesSet = addDefaultZoneBookiesIfMinNumRacksIsEnforced( excludeBookies); PlacementResult<List<BookieSocketAddress>> newEnsembleResult = newEnsembleInternal(ensembleSize, writeQuorumSize, ackQuorumSize, comprehensiveExclusionBookiesSet, null, null); return newEnsembleResult; } finally { rwLock.readLock().unlock(); } }

Target:
public PlacementResult<List<BookieSocketAddress>> newEnsemble(int ensembleSize, int writeQuorumSize, int ackQuorumSize, Map<String, byte[]> customMetadata, Set<BookieSocketAddress> excludeBookies) throws BKNotEnoughBookiesException { rwLock.readLock().lock(); try { Set<BookieSocketAddress> comprehensiveExclusionBookiesSet = addDefaultRackBookiesIfMinNumRacksIsEnforced( excludeBookies); PlacementResult<List<BookieSocketAddress>> newEnsembleResult = newEnsembleInternal(ensembleSize, writeQuorumSize, ackQuorumSize, comprehensiveExclusionBookiesSet, null, null); return newEnsembleResult; } finally { rwLock.readLock().unlock(); } }
Source:
private List<DiskImage> getImagesToPreview() { if (imagesToPreview == null) { List<DiskImage> allSnapshotsForVm = diskImageDao.getAllSnapshotsForVmSnapshot(getDstSnapshot().getId()); if (getParameters().getDiskIds() != null) { Map<Guid, DiskImage> guidDiskImageMap = allSnapshotsForVm.stream() .collect(Collectors.toMap(BaseDisk::getId, disk -> disk)); diskImagesForDiskIds = guidDiskImageMap.entrySet().stream() .filter(entry -> getParameters().getDiskIds().contains(entry.getKey())) .map(Map.Entry::getValue) .collect(Collectors.toList()); imagesToPreview = diskImagesForDiskIds; } else { imagesToPreview = allSnapshotsForVm; } } return imagesToPreview; }

Target:
private List<DiskImage> getImagesToPreview() { if (imagesToPreview == null) { List<DiskImage> allSnapshotsForVm = diskImageDao.getAllSnapshotsForVmSnapshot(getDstSnapshot().getId()); if (getParameters().getDiskIds() != null) { Map<Guid, DiskImage> guidDiskImageMap = allSnapshotsForVm.stream() .collect(Collectors.toMap(BaseDisk::getId, Function.identity())); imagesToPreview = guidDiskImageMap.entrySet().stream() .filter(entry -> getParameters().getDiskIds().contains(entry.getKey())) .map(Map.Entry::getValue) .collect(Collectors.toList()); } else { imagesToPreview = allSnapshotsForVm; } } return imagesToPreview; }
Source:
public void stopLoading() { this.stoppingThread = Thread.currentThread(); this.running = false; synchronized(this.stoppingThread) { try { this.stoppingThread.wait(1000); } catch (InterruptedException e) { } } }

Target:
public void stopLoading() { this.stoppingThread = Thread.currentThread(); this.running = false; synchronized(this.stoppingThread) { try { int waitTimeInMS = 1500; this.stoppingThread.wait(waitTimeInMS); } catch (InterruptedException e) { } } }
Source:
private void tryFlushingUpdatesToSOR(Cache<Long, String> cache) { int retryCount = 1000; int i = 0; while (true) { String value = "flush_queue_" + i; cache.put(KEY, value); try { Thread.sleep(100); } catch (InterruptedException e) { e.printStackTrace(); } if (value.equals(loaderWriter.load(KEY))) break; if (i > retryCount) { throw new RuntimeException("Couldn't flush updates to SOR after " + retryCount + " tries"); } i++; } }

Target:
private void tryFlushingUpdatesToSOR(Cache<Long, String> cache) throws Exception { int retryCount = 1000; int i = 0; while (true) { String value = "flush_queue_" + i; cache.put(KEY, value); Thread.sleep(100); String loadedValue = loaderWriter.load(KEY); if (loadedValue != null && loadedValue.startsWith("flush_queue")) { break; } if (i > retryCount) { throw new AssertionError("Couldn't flush updates to SOR after " + retryCount + " tries"); } i++; } }
Source:
public String docs() { return "{type: <macro> The entity type of the projectile | shootertype: <macro> The entity type of the shooter | world: <macro>}" + " This event is called when a projectile is launched." + " Cancelling the event will only cancel the launching of the projectile." + " For instance if a player shoot an arrow with a bow, the damages taken by its bow will not be cancelled." + " {id: The entityID of the projectile | type: The entity type of the projectile |" + " shooter: The entityID of the shooter (null if the projectile is launched by a dispenser) |" + " shootertype: The entity type of the shooter (null if the projectile is launched by a dispenser) |" + " player: the player which has launched the projectile (null if the shooter is not a player) |" + " location: from where the projectile is launched | velocity: the velocity of the projectile}" + " {velocity}" + " {}"; }

Target:
public String docs() { return "{type: <macro> The entity type of the projectile | shootertype: <macro> The entity type of the shooter | world: <macro>}" + " This event is called when a projectile is launched." + " Cancelling the event will only cancel the launching of the projectile." + " For instance when a player shoots an arrow with a bow, if the event is cancelled the bow will still take damage from use." + " {id: The entityID of the projectile | type: The entity type of the projectile |" + " shooter: The entityID of the shooter (null if the projectile is launched by a dispenser) |" + " shootertype: The entity type of the shooter (null if the projectile is launched by a dispenser) |" + " player: the player which has launched the projectile (null if the shooter is not a player) |" + " location: from where the projectile is launched | velocity: the velocity of the projectile}" + " {velocity}" + " {}"; }
Source:
private boolean isUpdate(Connection connection, String project, String name) { try { IDeploymentConfig dc = connection.getResource(ResourceKind.DEPLOYMENT_CONFIG, project, name); IDeploymentImageChangeTrigger trigger = (IDeploymentImageChangeTrigger) dc.getTriggers().stream() .filter(t->DeploymentTriggerType.IMAGE_CHANGE.equals(t.getType())).findFirst().orElse(null); DockerImageURI isTag = trigger.getFrom(); DockerImageURI uri = new DockerImageURI(null, trigger.getNamespace(), isTag.getName(), isTag.getTag()); return trigger != null && findImageStreamFor(trigger.getNamespace(), uri) != null; }catch(NotFoundException e) { } return false; }

Target:
private boolean isUpdate(Connection connection, String project, String name) { try { IDeploymentConfig dc = connection.getResource(ResourceKind.DEPLOYMENT_CONFIG, project, name); IDeploymentImageChangeTrigger trigger = (IDeploymentImageChangeTrigger) dc.getTriggers().stream() .filter(t->DeploymentTriggerType.IMAGE_CHANGE.equals(t.getType())).findFirst().orElse(null); return trigger != null && ResourceKind.IMAGE_STREAM_TAG.equals(trigger.getKind()) && connection.getResource(ResourceKind.IMAGE_STREAM, trigger.getNamespace(), trigger.getFrom().getName()) != null; }catch(OpenShiftException e) { if(e.getStatus() != null && e.getStatus().getCode() == IHttpConstants.STATUS_NOT_FOUND) { return false; } throw e; } }
Source:
public Map<String, String> getAgentProperties( @Valid final AgentClientMetadata agentClientMetadata ) { final HashSet<Tag> tags = Sets.newHashSet( Tag.of(AGENT_VERSION_METRIC_TAG_NAME, agentClientMetadata.getVersion().orElse("null")), Tag.of(AGENT_HOST_METRIC_TAG_NAME, agentClientMetadata.getHostname().orElse("null")) ); try { final Map<String, String> agentPropertiesMap = this.agentConfigurationService.getAgentProperties(); MetricsUtils.addSuccessTags(tags); return agentPropertiesMap; } catch (final Exception e) { MetricsUtils.addFailureTagsWithException(tags, e); throw e; } finally { this.meterRegistry.counter(GET_AGENT_PROPERTIES_COUNTER_METRIC_NAME, tags).increment(); } }

Target:
public Map<String, String> getAgentProperties( @Valid final AgentClientMetadata agentClientMetadata ) { final HashSet<Tag> tags = Sets.newHashSet( Tag.of(AGENT_VERSION_METRIC_TAG_NAME, agentClientMetadata.getVersion().orElse("null")) ); try { final Map<String, String> agentPropertiesMap = this.agentConfigurationService.getAgentProperties(); MetricsUtils.addSuccessTags(tags); return agentPropertiesMap; } catch (final Exception e) { MetricsUtils.addFailureTagsWithException(tags, e); throw e; } finally { this.meterRegistry.counter(GET_AGENT_PROPERTIES_COUNTER_METRIC_NAME, tags).increment(); } }
Source:
public void preview(IReport report, IStatus status, String serverName, List<IProcessorDescriptor> descriptors, IEclipseContext context, Shell parent) { StringBuilder text = new StringBuilder(); text.append("The following will be send to: ").append(serverName).append("\n\n"); List<StyleRange> styleRanges = new ArrayList<>(); for (SectionsProvider sectionsProvider : sectionProviders) { for (Section section : sectionsProvider.createSections(report, status, serverName, descriptors, context, parent)) { if (text.length() > 0) { text.append("\n"); } if (section.getHeadlineStyleRanges().isEmpty()) { section.getHeadlineStyleRanges().add(createHeadlineStyleRange(section.getHeadline())); } section.getHeadlineStyleRanges().forEach(x -> x.start += text.length()); styleRanges.addAll(section.getHeadlineStyleRanges()); text.append(section.getHeadline()).append("\n\n"); section.getTextStyleRanges().forEach(x -> x.start += text.length()); styleRanges.addAll(section.getTextStyleRanges()); text.append(section.getText().trim()).append("\n\n"); } } styledText.setText(text.toString()); styledText.setStyleRanges(styleRanges.toArray(new StyleRange[0])); }

Target:
public void preview(IReport report, IStatus status, String serverName, List<IProcessorDescriptor> descriptors, IEclipseContext context, Shell parent) { StringBuilder text = new StringBuilder(); text.append("The following will be send to: ").append(serverName).append(LF + LF); List<StyleRange> styleRanges = new ArrayList<>(); for (SectionsProvider sectionsProvider : sectionProviders) { for (Section section : sectionsProvider.createSections(report, status, serverName, descriptors, context, parent)) { if (text.length() > 0) { text.append(LF); } if (section.getHeadlineStyleRanges().isEmpty()) { section.getHeadlineStyleRanges().add(createHeadlineStyleRange(section.getHeadline())); } section.getHeadlineStyleRanges().forEach(x -> x.start += text.length()); styleRanges.addAll(section.getHeadlineStyleRanges()); text.append(section.getHeadline()).append(LF + LF); section.getTextStyleRanges().forEach(x -> x.start += text.length()); styleRanges.addAll(section.getTextStyleRanges()); text.append(section.getText().trim()).append(LF + LF); } } styledText.setText(text.toString()); styledText.setStyleRanges(styleRanges.toArray(new StyleRange[0])); }
Source:
public void run() throws Exception { List<String> argsList = (List <String>)args.get("__other__"); String action = argsList.remove(0); if(!actions.containsKey(action)) { throw new IllegalArgumentException( String.format("No such action '%1$s' exists for module '%2$s'", action, getName()) ); } actions.get(action).run(); }

Target:
public void run() throws Exception { List<String> argsList = (List <String>)args.get("__other__"); Runnable action = actions.get(argsList.remove(0)); if(action == null) { throw new IllegalArgumentException( String.format("No such action '%1$s' exists for module '%2$s'", action, getName()) ); } action.run(); }
Source:
public Result doWork() { final boolean[] result = new boolean[1]; String allergyUuid = getInputData().getString("allergy_uuid"); String patientUuid = getInputData().getString("patient_uuid"); deleteAllergy(restApi, allergyUuid, patientUuid, new CustomApiCallback() { @Override public void onSuccess() { result[0] = true; } @Override public void onFailure() { result[0] = false; } }); if (result[0]) { return Result.success(); } else { return Result.retry(); } }

Target:
public Result doWork() { final boolean[] result = new boolean[1]; String allergyUuid = getInputData().getString(ALLERGY_UUID); String patientUuid = getInputData().getString(PATIENT_UUID); deleteAllergy(restApi, allergyUuid, patientUuid, new CustomApiCallback() { @Override public void onSuccess() { result[0] = true; } @Override public void onFailure() { result[0] = false; } }); if (result[0]) { return Result.success(); } else { return Result.retry(); } }
Source:
public void visitToken(DetailAST ast) { final boolean isCommentEndOfLine = ast.getType() == TokenTypes.SINGLE_LINE_COMMENT || isBlockCommentEndOfLine(ast); final boolean isCommentOnOneLine = ast.getType() == TokenTypes.SINGLE_LINE_COMMENT || isBlockCommentOnOneLine(ast); final String commentContent = ast.getFirstChild().getText(); final boolean isCommentLegal = !isCommentEndOfLine || isCommentOnOneLine && isCommentMatchLegalPattern(commentContent); if (!isCommentLegal && !isBeforeCommentLegal(ast)) { log(ast, MSG_KEY); } }

Target:
public void visitToken(DetailAST ast) { final boolean isCommentEndOfLine = ast.getType() == TokenTypes.SINGLE_LINE_COMMENT || isBlockCommentEndOfLine(ast); final boolean isCommentOnOneLine = ast.getType() == TokenTypes.SINGLE_LINE_COMMENT || isBlockCommentOnOneLine(ast); final String commentContent = ast.getFirstChild().getText(); final boolean isSingleLineAndMatchLegalPattern = isCommentOnOneLine && isCommentMatchLegalPattern(commentContent); final boolean isCommentLegal = !isCommentEndOfLine || isSingleLineAndMatchLegalPattern; if (!isCommentLegal && !isBeforeCommentLegal(ast)) { log(ast, MSG_KEY); } }
Source:
@Test public void classNameFromClass() { assertThat(ClassName.get(Object.class).toString()) .isEqualTo("java.lang.Object"); assertThat(ClassName.get(OuterClass.InnerClass.class).toString()) .isEqualTo("com.squareup.javapoet.ClassNameTest.OuterClass.InnerClass"); try { assertThat((ClassName.get(new Object() {}.getClass())).toString()) .isEqualTo("com.squareup.javapoet.ClassNameTest$1"); } catch (IllegalArgumentException e) { fail(); } }

Target:
@Test public void classNameFromClass() { assertThat(ClassName.get(Object.class).toString()) .isEqualTo("java.lang.Object"); assertThat(ClassName.get(OuterClass.InnerClass.class).toString()) .isEqualTo("com.squareup.javapoet.ClassNameTest.OuterClass.InnerClass"); assertThat((ClassName.get(new Object() {}.getClass())).toString()) .isEqualTo("com.squareup.javapoet.ClassNameTest$1"); }
Source:
public void stop() throws TException { workerPool.shutdownNow(); try { shutdown.put(new Object()); } catch (InterruptedException ignored) { } }

Target:
public void stop() throws TException { workerPool.shutdown(); try { if (!workerPool.awaitTermination(30, TimeUnit.SECONDS)) { workerPool.shutdownNow(); } } catch (InterruptedException e) { workerPool.shutdownNow(); Thread.currentThread().interrupt(); } try { shutdown.put(new Object()); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } }
Source:
public APIRequest(String name, String context, String visibility, String version, String resource, String tiersCollection, URL endpointUrl) { this.name = name; this.context = context; this.visibility = visibility; this.version = version; this.resource = resource; this.tiersCollection = tiersCollection; try{ this.endpoint = new JSONObject("{\"production_endpoints\":{\"url\":\"" + endpointUrl + "\",\"config\":null},\"endpoint_type\":\"" + "http" + "\"}"); }catch (JSONException e){} constructSwagger(); }

Target:
public APIRequest(String name, String context, String visibility, String version, String resource, String tiersCollection, URL endpointUrl) { this.name = name; this.context = context; this.visibility = visibility; this.version = version; this.resource = resource; this.tiersCollection = tiersCollection; try { this.endpoint = new JSONObject("{\"production_endpoints\":{\"url\":\"" + endpointUrl + "\",\"config\":null},\"endpoint_type\":\"" + "http" + "\"}"); } catch (JSONException e) { log.error("JSON construct error", e); } constructSwagger(); }
Source:
public void commit() { if (!docs.isEmpty()) { QueryExpression combinedQuery; if (!queries.isEmpty()) { combinedQuery = Searches.combine(NaryLogicalOperator._or, queries); LOGGER.debug("Combined retrieval query:{}", combinedQuery); } else { combinedQuery = null; } List<ResultDocument> destResults = dest.getResultList(combinedQuery, ctx); int numSlots=0; for (DocAndQ parentDocAndQ : docs) { List<ChildSlot> slots=parentDocAndQ.doc.getSlots().get(aq.getReference()); if(slots!=null) numSlots+=slots.size(); } MemDocIndex docIndex=null; if(aq.getQuery()!=null&&memoryIndexThreshold>=0&&numSlots>memoryIndexThreshold) { KeySpec keySpec=aq.getIndexKeySpec(); LOGGER.debug("In-memory index key spec:{}",keySpec); if(keySpec!=null) { docIndex=new MemDocIndex(keySpec); for(ResultDocument child:destResults) { docIndex.add(child.getDoc()); } } } for (DocAndQ parentDocAndQ : docs) { associateDocs(parentDocAndQ.doc, destResults, aq,docIndex); } } docs = new ArrayList<>(); queries = new ArrayList<>(); }

Target:
public void commit() { if (!docs.isEmpty()) { QueryExpression combinedQuery; if (!queries.isEmpty()) { combinedQuery = Searches.combine(NaryLogicalOperator._or, queries); LOGGER.debug("Combined retrieval query:{}", combinedQuery); } else { combinedQuery = null; } List<ResultDocument> destResults = dest.getResultList(combinedQuery, ctx); int numSlots=0; for (DocAndQ parentDocAndQ : docs) { List<ChildSlot> slots=parentDocAndQ.doc.getSlots().get(aq.getReference()); if(slots!=null) numSlots+=slots.size(); } MemDocIndex docIndex=null; if(aq.getQuery()!=null&&numSlots>memoryIndexThreshold) { KeySpec keySpec=aq.getIndexKeySpec(); LOGGER.debug("In-memory index key spec:{}",keySpec); if(keySpec!=null) { docIndex=new MemDocIndex(keySpec); for(ResultDocument child:destResults) { docIndex.add(child.getDoc()); } } } for (DocAndQ parentDocAndQ : docs) { associateDocs(parentDocAndQ.doc, destResults, aq,docIndex); } } docs = new ArrayList<>(); queries = new ArrayList<>(); }
Source:
public ExtensionProxy activate(String extensionName) { ExtensionEntry entry = loadedEntries.get(extensionName); if (entry != null && entry.enabled) { entry.extension.getContext().put( TRACE_LOG_CONTEXT_KEY, LoggerFactory.getLogger( String.format( "%1$s.%2$s.%3$s", traceLog.getName(), entry.extension.getContext().get(Base.ContextKeys.EXTENSION_NAME), entry.extension.getContext().get(Base.ContextKeys.INSTANCE_NAME) ) ) ); try { ExtMap output = entry.extension.invoke( new ExtMap().mput( Base.InvokeKeys.COMMAND, Base.InvokeCommands.INITIALIZE ) ); } catch (Exception ex) { log.error( String.format( "Error in activating extension %1$s. Exception message is %2$s", entry.name, ex.getMessage() ) ); if (log.isDebugEnabled()) { log.error(ex.toString(), ex); } throw new RuntimeException(ex); } globalContext.<List<ExtMap>> get(Base.GlobalContextKeys.EXTENSIONS).add( new ExtMap().mput( Base.ExtensionRecord.INSTANCE_NAME, entry.extension.getContext().get(Base.ContextKeys.INSTANCE_NAME) ).mput( Base.ExtensionRecord.PROVIDES, entry.extension.getContext().get(Base.ContextKeys.PROVIDES) ).mput( Base.ExtensionRecord.EXTENSION, entry.extension.getExtension() ).mput( Base.ExtensionRecord.CONTEXT, entry.extension.getContext() ) ); entry.activated = true; dumpConfig(entry.extension); setChanged(); notifyObservers(); } return entry != null ? entry.extension : null; }

Target:
public ExtensionProxy activate(String extensionName) { ExtensionEntry entry = loadedEntries.get(extensionName); if (entry == null) { throw new RuntimeException(String.format("No extensioned with instance name %1$s could be found", extensionName)); } if (entry.enabled) { entry.extension.getContext().put( TRACE_LOG_CONTEXT_KEY, LogFactory.getLog( String.format( "%1$s.%2$s.%3$s", getTraceLog(), entry.extension.getContext().get(Base.ContextKeys.EXTENSION_NAME), entry.extension.getContext().get(Base.ContextKeys.INSTANCE_NAME) ) ) ); try { ExtMap output = entry.extension.invoke( new ExtMap().mput( Base.InvokeKeys.COMMAND, Base.InvokeCommands.INITIALIZE ) ); } catch (Exception ex) { log.log(Level.SEVERE, String.format( "Error in activating extension %1$s. Exception message is %2$s", entry.name, ex.getMessage() ) ); if (log.isLoggable(Level.FINEST)) { log.log(Level.FINEST, ex.toString(), ex); } throw new RuntimeException(ex); } synchronized (globalContext) { globalContext.<List<ExtMap>> get(Base.GlobalContextKeys.EXTENSIONS).add( new ExtMap().mput( Base.ExtensionRecord.INSTANCE_NAME, entry.extension.getContext().get(Base.ContextKeys.INSTANCE_NAME) ).mput( Base.ExtensionRecord.PROVIDES, entry.extension.getContext().get(Base.ContextKeys.PROVIDES) ).mput( Base.ExtensionRecord.EXTENSION, entry.extension.getExtension() ).mput( Base.ExtensionRecord.CONTEXT, entry.extension.getContext() ) ); } entry.activated = true; dumpConfig(entry.extension); setChanged(); notifyObservers(); } return entry != null ? entry.extension : null; }
Source:
public ModuleClassLoader getModuleClassLoader() { ModuleClassLoader result = null; synchronized (classLoaderMonitor) { result = classloader; if (result != null) { return result; } } final List<ClassLoaderHook> hooks = container.getConfiguration().getHookRegistry().getClassLoaderHooks(); final Generation generation = (Generation) wiring.getRevision().getRevisionInfo(); if (System.getSecurityManager() == null) { result = createClassLoaderPrivledged(parent, generation.getBundleInfo().getStorage().getConfiguration(), this, generation, hooks); } else { final ClassLoader cl = parent; result = AccessController.doPrivileged(new PrivilegedAction<ModuleClassLoader>() { @Override public ModuleClassLoader run() { return createClassLoaderPrivledged(cl, generation.getBundleInfo().getStorage().getConfiguration(), BundleLoader.this, generation, hooks); } }); } synchronized (classLoaderMonitor) { if (classloader == null) { classloader = result; for (ClassLoaderHook hook : hooks) { hook.classLoaderCreated(result); } } else { result = classloader; if (debug.DEBUG_LOADER) { Debug.println("BundleLoader[" + this + "].getModuleClassLoader() - created duplicate classloader"); } } } return result; }

Target:
public ModuleClassLoader getModuleClassLoader() { ModuleClassLoader result = classloader; if (result != null) { return result; } final List<ClassLoaderHook> hooks = container.getConfiguration().getHookRegistry().getClassLoaderHooks(); final Generation generation = (Generation) wiring.getRevision().getRevisionInfo(); if (System.getSecurityManager() == null) { result = createClassLoaderPrivledged(parent, generation.getBundleInfo().getStorage().getConfiguration(), this, generation, hooks); } else { final ClassLoader cl = parent; result = AccessController.doPrivileged(new PrivilegedAction<ModuleClassLoader>() { @Override public ModuleClassLoader run() { return createClassLoaderPrivledged(cl, generation.getBundleInfo().getStorage().getConfiguration(), BundleLoader.this, generation, hooks); } }); } synchronized (classLoaderCreatedMonitor) { if (classLoaderCreated == null) { classLoaderCreated = result; for (ClassLoaderHook hook : hooks) { hook.classLoaderCreated(result); } classloader = classLoaderCreated; } else { result = classLoaderCreated; if (debug.DEBUG_LOADER) { Debug.println("BundleLoader[" + this + "].getModuleClassLoader() - created duplicate classloader"); } } } return result; }
Source:
public DebugQuickAccessProvider() { super(DebugPlugin.getDefault().getLaunchManager().getLaunchMode("debug")); }

Target:
public DebugQuickAccessProvider() { super(DebugPlugin.getDefault().getLaunchManager().getLaunchMode(ILaunchManager.DEBUG_MODE)); }
Source:
public static DiscreteRandomProducer uniform(int numberOfValues, long seed) { return new DiscreteRandomProducer(seed, IntStream.range(0, numberOfValues) .mapToDouble(x -> 1.0 / numberOfValues) .toArray()); }

Target:
public static DiscreteRandomProducer uniform(int numberOfValues, long seed) { double[] probs = new double[numberOfValues]; Arrays.fill(probs, 1.0 / numberOfValues); return new DiscreteRandomProducer(seed, probs); }
Source:
protected void startRequest(@NonNull final String uri) { checkNotNull(uri); Log.v(TAG, "startRequest(" + uri + ")"); try { updateNetworkRequestStatus.accept(NetworkRequestStatus.ongoing(uri)); } catch (Exception e) { e.printStackTrace(); } }

Target:
protected void startRequest(@NonNull final String uri) { checkNotNull(uri); Log.v(TAG, "startRequest(" + uri + ")"); try { updateNetworkRequestStatus.accept(NetworkRequestStatus.ongoing(uri)); } catch (Exception e) { Log.e(TAG, e.getMessage()); } }
Source:
public void testOperators() throws Exception { assertEquals( Operator.EQUALS, Operator.resolve( "==" ) ); assertEquals( Operator.GREATER_THAN, Operator.resolve( ">" ) ); assertEquals( Operator.LESS_THAN, Operator.resolve( "<" ) ); assertEquals( Operator.GREATER_THAN_OR_EQUALS, Operator.resolve( ">=" ) ); assertEquals( Operator.LESS_THAN_OR_EQUALS, Operator.resolve( "<=" ) ); assertEquals( Operator.NOT_EQUALS, Operator.resolve( "!=" ) ); assertEquals( Operator.IN, Operator.resolve( "in" ) ); assertEquals( Operator.NOT_IN, Operator.resolve( "not in" ) ); assertEquals( Operator.AFTER, Operator.resolve( "after" ) ); assertEquals( Operator.BEFORE, Operator.resolve( "before" ) ); assertEquals( Operator.COINCIDES, Operator.resolve( "coincides" ) ); assertEquals( Operator.MATCHES, Operator.resolve( "matches" ) ); assertEquals( Operator.SOUNDSLIKE, Operator.resolve( "soundslike" ) ); }

Target:
public void testOperators() throws Exception { assertEquals( Operator.EQUALS, Operator.resolve( "==" ) ); assertEquals( Operator.GREATER_THAN, Operator.resolve( ">" ) ); assertEquals( Operator.LESS_THAN, Operator.resolve( "<" ) ); assertEquals( Operator.GREATER_OR_EQUAL, Operator.resolve( ">=" ) ); assertEquals( Operator.LESS_OR_EQUAL, Operator.resolve( "<=" ) ); assertEquals( Operator.NOT_EQUALS, Operator.resolve( "!=" ) ); assertEquals( Operator.IN, Operator.resolve( "in" ) ); assertEquals( Operator.NOT_IN, Operator.resolve( "not in" ) ); assertEquals( Operator.AFTER, Operator.resolve( "after" ) ); assertEquals( Operator.BEFORE, Operator.resolve( "before" ) ); assertEquals( Operator.COINCIDES, Operator.resolve( "coincides" ) ); assertEquals( Operator.MATCHES, Operator.resolve( "matches" ) ); assertEquals( Operator.SOUNDSLIKE, Operator.resolve( "soundslike" ) ); }
Source:
ProjectHierarchyIterator(ProjectCache c, AllProjectsName all, ProjectState firstResult) { cache = c; allProjectsName = all; seen = Sets.newLinkedHashSet(); seen.add(firstResult.getProject().getParent()); next = firstResult; }

Target:
ProjectHierarchyIterator(ProjectCache c, AllProjectsName all, ProjectState firstResult) { cache = c; allProjectsName = all; seen = Sets.newLinkedHashSet(); seen.add(firstResult.getProject().getNameKey()); next = firstResult; }
Source:
public Element getViewElement(String xmlTag) { String id = fId; if (id == null) { return null; } Element viewElement = XmlUtils.getElementInFile(fFilePath, xmlTag, id); return viewElement; }

Target:
public @Nullable Element getViewElement(String xmlTag) { String id = fId; if (id == null) { return null; } Element viewElement = XmlUtils.getElementInFile(fFilePath, xmlTag, id); return viewElement; }
Source:
static private void checkAccessPermission(Class<?> declaringClass, final int modifiers, boolean isAccessible) { final SecurityManager securityManager = System.getSecurityManager(); if (isAccessible && securityManager != null) { if ((modifiers & Modifier.PRIVATE) != 0 || ((modifiers & (Modifier.PUBLIC | Modifier.PROTECTED)) == 0 && packageCanNotBeAddedAnotherClass(declaringClass)) && !GroovyObject.class.isAssignableFrom(declaringClass)) { securityManager.checkPermission(REFLECT_PERMISSION); } else if ((modifiers & (Modifier.PROTECTED)) != 0 && declaringClass.equals(ClassLoader.class)){ securityManager.checkCreateClassLoader(); } } }

Target:
private static void checkAccessPermission(Class<?> declaringClass, final int modifiers, boolean isAccessible) { final SecurityManager securityManager = System.getSecurityManager(); if (securityManager != null && isAccessible) { if (((modifiers & Modifier.PRIVATE) != 0 || ((modifiers & (Modifier.PUBLIC | Modifier.PROTECTED)) == 0 && packageCanNotBeAddedAnotherClass(declaringClass))) && !GroovyObject.class.isAssignableFrom(declaringClass)) { securityManager.checkPermission(REFLECT_PERMISSION); } else if ((modifiers & (Modifier.PROTECTED)) != 0 && declaringClass.equals(ClassLoader.class)){ securityManager.checkCreateClassLoader(); } } }
Source:
public SessionId assertAuthenticatedSessionCorrespondsToNewRequest(SessionId session, String acrValuesStr) throws AcrChangedException { if (session != null && !session.getSessionAttributes().isEmpty() && session.getState() == SessionIdState.AUTHENTICATED) { final Map<String, String> sessionAttributes = session.getSessionAttributes(); String sessionAcr = getAcr(session); if (StringUtils.isBlank(sessionAcr)) { log.error("Failed to fetch acr from session, attributes: " + sessionAttributes); return session; } List<String> acrValuesList = acrValuesList(acrValuesStr); boolean isAcrChanged = !acrValuesList.isEmpty() && !acrValuesList.contains(sessionAcr); if (isAcrChanged) { Map<String, Integer> acrToLevel = externalAuthenticationService.acrToLevelMapping(); Integer sessionAcrLevel = acrToLevel.get(sessionAcr); for (String acrValue : acrValuesList) { Integer currentAcrLevel = acrToLevel.get(acrValue); log.info("Acr is changed. Session acr: " + sessionAcr + "(level: " + sessionAcrLevel + "), " + "current acr: " + acrValue + "(level: " + currentAcrLevel + ")"); if (currentAcrLevel == null) { AcrChangedException ex=new AcrChangedException(); ex.setMethodEnabled(false); throw ex; } if (sessionAcrLevel < currentAcrLevel) { throw new AcrChangedException(); } } return session; } reinitLogin(session, false); } return session; }

Target:
public SessionId assertAuthenticatedSessionCorrespondsToNewRequest(SessionId session, String acrValuesStr) throws AcrChangedException { if (session != null && !session.getSessionAttributes().isEmpty() && session.getState() == SessionIdState.AUTHENTICATED) { final Map<String, String> sessionAttributes = session.getSessionAttributes(); String sessionAcr = getAcr(session); if (StringUtils.isBlank(sessionAcr)) { log.error("Failed to fetch acr from session, attributes: " + sessionAttributes); return session; } List<String> acrValuesList = acrValuesList(acrValuesStr); boolean isAcrChanged = !acrValuesList.isEmpty() && !acrValuesList.contains(sessionAcr); if (isAcrChanged) { Map<String, Integer> acrToLevel = externalAuthenticationService.acrToLevelMapping(); Integer sessionAcrLevel = acrToLevel.get(sessionAcr); for (String acrValue : acrValuesList) { Integer currentAcrLevel = acrToLevel.get(acrValue); log.info("Acr is changed. Session acr: " + sessionAcr + "(level: " + sessionAcrLevel + "), " + "current acr: " + acrValue + "(level: " + currentAcrLevel + ")"); if (currentAcrLevel == null) { throw new AcrChangedException(false); } if (sessionAcrLevel < currentAcrLevel) { throw new AcrChangedException(); } } return session; } reinitLogin(session, false); } return session; }
Source:
public static Long fromHumanReadable(String v) { Matcher m = p.matcher(v); if (m.matches()) { MatchResult mr = m.toMatchResult(); long min = Long.parseLong(mr.group(1)); long sec = Long.parseLong(mr.group(2)); long par = 0; if (mr.group(4) != null) { String parPad = mr.group(4) + "000"; par = Long.parseLong(parPad.substring(0, 3)); } return Long.valueOf(((sec + (min * 60)) * 1000) + par); } try { return Long.valueOf(Long.parseLong(v)); } catch (Exception e) { return null; } }

Target:
public static Long fromHumanReadable(String v) { Matcher m = p.matcher(v); if (m.matches()) { MatchResult mr = m.toMatchResult(); long min = Long.parseLong(mr.group(1)); long sec = Long.parseLong(mr.group(2)); long par = 0; if (mr.group(4) != null) { String parPad = mr.group(4) + "000"; par = Long.parseLong(parPad.substring(0, 3)); } return ((sec + (min * 60)) * 1000) + par; } try { return Long.parseLong(v); } catch (Exception e) { return null; } }
Source:
public int getPriority() { return 100000; }

Target:
public int getPriority() { return 10000; }
Source:
public void truncate(long newTruncationPoint) { if (newTruncationPoint < getFirstDrId()) return; final Iterator<Range<Long>> iter = m_map.asRanges().iterator(); synchronized(m_map) { while (iter.hasNext()) { final Range<Long> next = iter.next(); if (end(next) < newTruncationPoint) { iter.remove(); } else if (next.contains(newTruncationPoint)) { iter.remove(); m_map.add(range(newTruncationPoint, end(next))); return; } else { break; } } m_map.add(range(newTruncationPoint, newTruncationPoint)); } }

Target:
public void truncate(long newTruncationPoint) { if (newTruncationPoint < getFirstDrId()) return; final Iterator<Range<Long>> iter = m_map.asRanges().iterator(); while (iter.hasNext()) { final Range<Long> next = iter.next(); if (end(next) < newTruncationPoint) { iter.remove(); } else if (next.contains(newTruncationPoint)) { iter.remove(); m_map.add(range(newTruncationPoint, end(next))); return; } else { break; } } m_map.add(range(newTruncationPoint, newTruncationPoint)); }
Source:
private Item getItemFromRegistry(String itemName) { Item item = null; try { if (itemRegistry != null) { item = itemRegistry.getItem(itemName); } } catch (ItemNotFoundException e1) { logger.error("Unable to get item type for {}", itemName); item = null; } return item; }

Target:
private Item getItemFromRegistry(String itemName) { Item item = null; try { if (itemRegistry != null) { item = itemRegistry.getItem(itemName); } } catch (ItemNotFoundException e1) { logger.error("Unable to get item from registry", itemName); } return item; }
Source:
public Task<Void> insertIptablesRules(final List<String> iptablesRules, final String installCommands, final SshMachineLocation machine) { return DynamicTasks.queue("insert rules", new Callable<Void>() { public Void call() { insertIptablesRulesImp(iptablesRules, installCommands, machine); return null; } }); }

Target:
private Task<Void> insertIptablesRules(final List<String> iptablesRules, final String installCommands, final SshMachineLocation machine) { return DynamicTasks.queue("insert rules", new Runnable() { public void run() { insertIptablesRulesImpl(iptablesRules, installCommands, machine); } }); }
Source:
private boolean updateControllerState(NotificationContext changeContext, PauseSignal signal, boolean statusFlag) { if (signal != null) { if (!statusFlag) { statusFlag = true; logger.info(String.format("controller is now %s", (signal instanceof MaintenanceSignal) ? "in maintenance mode" : "paused")); } } else { if (statusFlag) { statusFlag = false; logger.info("controller is now resumed from paused state"); String uid = UUID.randomUUID().toString().substring(0, 8); ClusterEvent event = new ClusterEvent(_clusterName, ClusterEventType.Resume, String.format("%s_%s", uid, Pipeline.Type.DEFAULT.name())); HelixManager manager = changeContext.getManager(); Optional<String> leaderSession = manager.getSessionIdIfLead(); if (!leaderSession.isPresent()) { logger.warn("Cluster manager is not leader for {}. Event is discarded.", manager.getInstanceName(), manager.getClusterName(), event); return false; } event.addAttribute(AttributeName.EVENT_SESSION.name(), leaderSession.get()); event.addAttribute(AttributeName.changeContext.name(), changeContext); event.addAttribute(AttributeName.helixmanager.name(), manager); event.addAttribute(AttributeName.AsyncFIFOWorkerPool.name(), _asyncFIFOWorkerPool); enqueueEvent(_eventQueue, event); enqueueEvent(_taskEventQueue, event.clone(String.format("%s_%s", uid, Pipeline.Type.TASK.name()))); } } return statusFlag; }

Target:
private boolean updateControllerState(NotificationContext changeContext, PauseSignal signal, boolean statusFlag) { if (signal != null) { if (!statusFlag) { statusFlag = true; logger.info(String.format("controller is now %s", (signal instanceof MaintenanceSignal) ? "in maintenance mode" : "paused")); } } else { if (statusFlag) { statusFlag = false; logger.info("controller is now resumed from paused state"); String uid = UUID.randomUUID().toString().substring(0, 8); ClusterEvent event = new ClusterEvent(_clusterName, ClusterEventType.Resume, String.format("%s_%s", uid, Pipeline.Type.DEFAULT.name())); event.addAttribute(AttributeName.EVENT_SESSION.name(), changeContext.getManager().getSessionIdIfLead()); event.addAttribute(AttributeName.changeContext.name(), changeContext); event.addAttribute(AttributeName.helixmanager.name(), changeContext.getManager()); event.addAttribute(AttributeName.AsyncFIFOWorkerPool.name(), _asyncFIFOWorkerPool); enqueueEvent(_eventQueue, event); enqueueEvent(_taskEventQueue, event.clone(String.format("%s_%s", uid, Pipeline.Type.TASK.name()))); } } return statusFlag; }
Source:
public void replayKafkaContentChanges( @RequestParam("since") String dateTimeString, HttpServletResponse response ) { if (this.replayBootstrapWorker != null) { response.setStatus(HttpStatus.BAD_REQUEST.value()); return; } DateTime since = DateTime.parse(dateTimeString); this.replayBootstrapWorker = replayConsumerFactory.apply( message -> { DateTime messageTime = message.getTimestamp().toDateTimeUTC(); if (messageTime.isBefore(since)) { log.debug( "Message from is before threshold {}, skipping", messageTime, since ); return; } ResourceRef updated = message.getUpdatedResource(); Content legacy; try { log.debug("Resolving content for at {}", updated.getId(), messageTime); legacy = legacyResolver.resolveIds( ImmutableList.of(updated.getId()) ).get().getResources().first().orNull(); } catch (InterruptedException | ExecutionException e) { throw new RuntimeException(e); } if (legacy == null) { return; } try { log.info( "Bootstrapping Asty content for at {}", updated.getId(), messageTime ); astyanaxStore.writeContent(legacy); } catch (WriteException e) { throw new RuntimeException(e); } } ); replayBootstrapWorker.startAsync().awaitRunning(); response.setStatus(HttpStatus.ACCEPTED.value()); }

Target:
public void replayKafkaContentChanges( @RequestParam("since") String dateTimeString, HttpServletResponse response ) { if (this.replayBootstrapListener != null) { response.setStatus(HttpStatus.BAD_REQUEST.value()); return; } DateTime since = DateTime.parse(dateTimeString); this.replayBootstrapListener = replayConsumerFactory.apply( message -> { DateTime messageTime = message.getTimestamp().toDateTimeUTC(); if (messageTime.isBefore(since)) { log.debug( "Message from is before threshold {}, skipping", messageTime, since ); return; } ResourceRef updated = message.getUpdatedResource(); Content legacy; try { log.debug("Resolving content for at {}", updated.getId(), messageTime); legacy = legacyResolver.resolveIds( ImmutableList.of(updated.getId()) ).get().getResources().first().orNull(); } catch (InterruptedException | ExecutionException e) { throw new RuntimeException(e); } if (legacy == null) { return; } try { log.info( "Bootstrapping Asty content for at {}", updated.getId(), messageTime ); astyanaxStore.writeContent(legacy); } catch (WriteException e) { throw new RuntimeException(e); } } ); replayBootstrapListener.startAsync().awaitRunning(); response.setStatus(HttpStatus.ACCEPTED.value()); }
Source:
public void clearExternalMusic() { synchronized (metadataMutex) { metadataList = getMyModifiableLibrary(); metadataMap.clear(); } new BroadcastIntent(ACTION_LIBRARY_UPDATED).send(this); }

Target:
public void clearExternalMusic() { metadataList = getMyModifiableLibrary(); metadataMap.clear(); orderAlphabetically(); new BroadcastIntent(ACTION_LIBRARY_UPDATED).send(this); }
Source:
public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putString(KEY_SMARTLOCK_HELPER_STATE, mSmartLockHelperState.name()); outState.putBoolean(KEY_SIGNUP_FROM_LOGIN_ENABLED, mIsSignupFromLoginEnabled); outState.putBoolean(KEY_SIGNUP_FROM_LOGIN_ENABLED, mIsSignupFromLoginEnabled); }

Target:
public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putString(KEY_SMARTLOCK_HELPER_STATE, mSmartLockHelperState.name()); outState.putBoolean(KEY_SIGNUP_FROM_LOGIN_ENABLED, mIsSignupFromLoginEnabled); }