auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void executeCommand(UICommand command) { super.executeCommand(command); if(command.equals(getNewSessionCommand())) { } else if(command.equals(getRemoveSessionCommand())) { } else if(command.equals(getStartSessionCommand())) { startGeoRepSession(); } else if(command.equals(getStopSessionCommand())) { } else if(command.equals(getSessionOptionsCommand())) { } else if(command.equals(getViewSessionDetailsCommand())) { } else if(command.getName().equalsIgnoreCase("createSession")) { setWindow(null); } else if(command.getName().equalsIgnoreCase("close")) { setWindow(null); } else if(command.getName().equalsIgnoreCase("closeConfirmWindow")) { setConfirmWindow(null); } else if(command.getName().equalsIgnoreCase("closeConfirmationWindow")) { closeConfirmationWindow(); } else if(command.getName().equalsIgnoreCase("onStartGeoRepSession")) { onStartGeoRepSession(); } else if(command.getName().equalsIgnoreCase("closeWindow")) { closeWindow(); } }

Target:
public void executeCommand(UICommand command) { super.executeCommand(command); if(command.equals(getNewSessionCommand())) { } else if(command.equals(getRemoveSessionCommand())) { } else if(command.equals(getStartSessionCommand())) { startGeoRepSession(); } else if(command.equals(getStopSessionCommand())) { } else if(command.equals(getSessionOptionsCommand())) { } else if(command.equals(getViewSessionDetailsCommand())) { } else if (command.equals(getRefreshSessionsCommand())) { refreshSessions(); } else if(command.getName().equalsIgnoreCase("createSession")) { setWindow(null); } else if(command.getName().equalsIgnoreCase("closeConfirmationWindow")) { closeConfirmationWindow(); } else if(command.getName().equalsIgnoreCase("onStartGeoRepSession")) { onStartGeoRepSession(); } else if(command.getName().equalsIgnoreCase("closeWindow")) { closeWindow(); } }
Source:
public void testThriftServerStop() throws Exception { int nThreads = NUM_CLIENTS; ExecutorService executorService = Executors.newFixedThreadPool(nThreads); for (int i = 0; i < nThreads; ++i) { executorService.submit(new Runnable() { @Override public void run() { try { TransactionSystemClient client1 = getClient(); CLIENTS_DONE_LATCH.countDown(); client1.startShort(); } catch (Exception e) { } } }); } CLIENTS_DONE_LATCH.await(); TimeUnit.SECONDS.sleep(1); expireZkSession(zkClientService); waitForThriftTermination(); zkClientService.stopAndWait(); STORAGE_WAIT_LATCH.countDown(); TimeUnit.SECONDS.sleep(1); Assert.assertEquals(Service.State.TERMINATED, txService.thriftRPCServerState()); }

Target:
public void testThriftServerStop() throws Exception { int nThreads = NUM_CLIENTS; ExecutorService executorService = Executors.newFixedThreadPool(nThreads); for (int i = 0; i < nThreads; ++i) { executorService.submit(new Runnable() { @Override public void run() { try { TransactionSystemClient txClient = getClient(); CLIENTS_DONE_LATCH.countDown(); txClient.startShort(); } catch (Exception e) { } } }); } CLIENTS_DONE_LATCH.await(); TimeUnit.SECONDS.sleep(1); expireZkSession(zkClientService); waitForThriftTermination(); zkClientService.stopAndWait(); STORAGE_WAIT_LATCH.countDown(); TimeUnit.SECONDS.sleep(1); Assert.assertEquals(Service.State.TERMINATED, txService.thriftRPCServerState()); }
Source:
public void testDownloadUrlWithChangeToken() throws IOException { String repositoryName = "test"; try (CloseableCoreSession session = CoreInstance.openCoreSession(repositoryName)) { Framework.getProperties().setProperty("nuxeo.url", "http://localhost:8080/nuxeo"); DocumentModel doc = session.createDocumentModel("/", "James-Bond", "File"); doc.setProperty("dublincore", "title", "Spectre"); FileBlob blob = new FileBlob("Synopsis"); String blobFilename = "synopsis.txt"; blob.setFilename(blobFilename); Map<String, Object> fileMap = new HashMap<>(); fileMap.put("file", blob); List<Map<String, Object>> docFiles = new ArrayList<>(); docFiles.add(fileMap); doc.setProperty("files", "files", docFiles); doc = session.createDocument(doc); session.save(); String url = downloadService.getDownloadUrl(repositoryName, doc.getId(), "file:content", "synopsis.txt", doc.getChangeToken()); String pattern = "nxfile/test/.*/file:content/synopsis.txt\\?changeToken=[0-9]+-[0-9]+"; assertTrue(url.matches(pattern)); } }

Target:
public void testDownloadUrlWithChangeToken() throws IOException { String repositoryName = "test"; try (CloseableCoreSession session = CoreInstance.openCoreSession(repositoryName)) { Framework.getProperties().setProperty("nuxeo.url", "http://localhost:8080/nuxeo"); DocumentModel doc = session.createDocumentModel("/", "James-Bond", "File"); doc.setProperty("dublincore", "title", "Spectre"); FileBlob blob = new FileBlob("Synopsis"); String blobFilename = "synopsis.txt"; blob.setFilename(blobFilename); Map<String, Object> fileMap = new HashMap<>(); fileMap.put("file", blob); List<Map<String, Object>> docFiles = new ArrayList<>(); docFiles.add(fileMap); doc.setProperty("files", "files", docFiles); doc = session.createDocument(doc); session.save(); String pattern = "nxfile/test/.*/file:content/synopsis.txt\\?changeToken=[^&]+"; String url = downloadService.getDownloadUrl(repositoryName, doc.getId(), "file:content", "synopsis.txt", doc.getChangeToken()); assertTrue(url.matches(pattern)); url = downloadService.getDownloadUrl(doc, "file:content", "synopsis.txt"); assertTrue(url.matches(pattern)); } }
Source:
public static PackageLibraryType typeOfLibrary(Session session, String library) { FileSystemItem projectDir = null; SessionInfo sessionInfo = session.getSessionInfo(); if (sessionInfo != null) projectDir = sessionInfo.getActiveProjectDir(); String rLibsUser = sessionInfo.getRLibsUser(); boolean hasRLibsUser = (rLibsUser != null && !rLibsUser.isEmpty()); if (StringUtil.isNullOrEmpty(library) || (projectDir != null && library.startsWith(projectDir.getPath()))) { return PackageLibraryType.Project; } else if (library.startsWith(FileSystemItem.HOME_PATH) || (hasRLibsUser && library.startsWith(rLibsUser))) { return PackageLibraryType.User; } else { return PackageLibraryType.System; } }

Target:
public static PackageLibraryType typeOfLibrary(Session session, String library) { FileSystemItem projectDir = null; SessionInfo sessionInfo = session.getSessionInfo(); if (sessionInfo != null) projectDir = sessionInfo.getActiveProjectDir(); String rLibsUser = sessionInfo.getRLibsUser(); boolean hasRLibsUser = !StringUtil.isNullOrEmpty(rLibsUser); if (StringUtil.isNullOrEmpty(library) || (projectDir != null && library.startsWith(projectDir.getPath()))) { return PackageLibraryType.Project; } else if (library.startsWith(FileSystemItem.HOME_PATH) || (hasRLibsUser && library.startsWith(rLibsUser))) { return PackageLibraryType.User; } else { return PackageLibraryType.System; } }
Source:
private Map<String, String> createInitParams() { String[] initParamKeys = securityFilterServiceReference.getPropertyKeys(); final String PROPERTY_INIT_PREFIX = "init-prefix"; String initPrefixProp = getStringProperty(securityFilterServiceReference, PROPERTY_INIT_PREFIX); if (initPrefixProp == null) { final String DEFAULT_INIT_PREFIX_PROP = "init."; initPrefixProp = DEFAULT_INIT_PREFIX_PROP; } Map<String, String> initParameters = new HashMap<>(); for (String key : initParamKeys) { String value = securityFilterServiceReference.getProperty(key) == null ? "" : securityFilterServiceReference.getProperty(key).toString(); final String HTTP_WHITEBOARD_SERVLET_INIT_PARAM_PREFIX = "servlet\\.init\\."; if (key.startsWith(initPrefixProp)) { initParameters.put(key.replaceFirst(initPrefixProp, ""), value); } else if (key.startsWith(HTTP_WHITEBOARD_SERVLET_INIT_PARAM_PREFIX)) { initParameters.put( key.replaceFirst(HTTP_WHITEBOARD_SERVLET_INIT_PARAM_PREFIX, ""), value); } } return initParameters; }

Target:
private Map<String, String> createInitParams() { String[] initParamKeys = securityFilterServiceReference.getPropertyKeys(); final String PROPERTY_INIT_PREFIX = "init-prefix"; String initPrefixProp = getStringProperty(securityFilterServiceReference, PROPERTY_INIT_PREFIX); if (initPrefixProp == null) { final String DEFAULT_INIT_PREFIX_PROP = "init."; initPrefixProp = DEFAULT_INIT_PREFIX_PROP; } Map<String, String> initParameters = new HashMap<>(); for (String key : initParamKeys) { String value = securityFilterServiceReference.getProperty(key) == null ? "" : securityFilterServiceReference.getProperty(key).toString(); final String HTTP_WHITEBOARD_SERVLET_INIT_PARAM_PREFIX = "servlet.init."; if (key.startsWith(initPrefixProp)) { initParameters.put(key.replaceFirst(initPrefixProp, ""), value); } else if (key.startsWith(HTTP_WHITEBOARD_SERVLET_INIT_PARAM_PREFIX)) { initParameters.put( key.replaceFirst(HTTP_WHITEBOARD_SERVLET_INIT_PARAM_PREFIX, ""), value); } } return initParameters; }
Source:
public ErrorTypeLocator getErrorTypeLocator() { return ErrorTypeLocator.builder(muleContext.getErrorTypeRepository()).build(); }

Target:
public ErrorTypeLocator getErrorTypeLocator() { return ((PrivilegedMuleContext) muleContext).getErrorTypeLocator(); }
Source:
public synchronized void queueIntent(IntentListener asker) { int newIdentId; do { newIdentId = StageActivity.randomGenerator.nextInt(100000); } while (intentListeners.containsKey(newIdentId)); intentListeners.put(newIdentId, asker); ArrayList<Object> params = new ArrayList<>(); params.add(newIdentId); if (StageActivity.messageHandler == null) { return; } Message message = StageActivity.messageHandler.obtainMessage(StageActivity.PERFORM_INTENT, params); message.sendToTarget(); }

Target:
public synchronized void queueIntent(IntentListener asker) { if (StageActivity.messageHandler == null) { return; } int newIdentId; do { newIdentId = StageActivity.randomGenerator.nextInt(Integer.MAX_VALUE); } while (intentListeners.containsKey(newIdentId)); intentListeners.put(newIdentId, asker); ArrayList<Object> params = new ArrayList<>(); params.add(newIdentId); Message message = StageActivity.messageHandler.obtainMessage(StageActivity.PERFORM_INTENT, params); message.sendToTarget(); }
Source:
private void checkSigOps() throws VerificationException { int sigOps = 0; for (Transaction tx : transactions) { sigOps += tx.getSigOpCount(); } if (sigOps > MAX_BLOCK_SIGOPS) { throw new VerificationException("Block had too many Signature Operations"); } }

Target:
private void checkSigOps() throws VerificationException { int sigOps = 0; for (Transaction tx : transactions) { sigOps += tx.getSigOpCount(); } if (sigOps > MAX_BLOCK_SIGOPS) throw new VerificationException("Block had too many Signature Operations"); }
Source:
public int hashCode() { return super.hashCode(); }

Target:
public int hashCode() { return 0; }
Source:
protected boolean inOrderTraversal(Node node, Callback callback, TraversalOrder order) { if (node == null) { return false; } Node first; Node second; if (order == TraversalOrder.FORWARD) { first = node.left; second = node.right; } else { first = node.right; second = node.left; } if (first != null && !inOrderTraversal(first, callback, order)) { return false; } if(!callback.process(node)) { return false; } if (second != null && !inOrderTraversal(second, callback, order)) { return false; } return true; }

Target:
private boolean inOrderTraversal(Node node, Callback callback, TraversalOrder order) { if (node == null) { return false; } Node first; Node second; if (order == TraversalOrder.FORWARD) { first = node.left; second = node.right; } else { first = node.right; second = node.left; } if (first != null && !inOrderTraversal(first, callback, order)) { return false; } if(!callback.process(node)) { return false; } if (second != null && !inOrderTraversal(second, callback, order)) { return false; } return true; }
Source:
protected void cleanUpInvoke() throws Exception { isRunning = false; setShouldInterruptOnCancel(false); Thread.interrupted(); tryShutdownTimerService(); Throwable suppressedThrowable = null; try { cancelables.close(); shutdownAsyncThreads(); } catch (Throwable t) { suppressedThrowable = ExceptionUtils.firstOrSuppressed(t, suppressedThrowable); } try { cleanup(); } catch (Throwable t) { suppressedThrowable = ExceptionUtils.firstOrSuppressed(t, suppressedThrowable); } try { disposeAllOperators(true); } catch (Throwable t) { suppressedThrowable = ExceptionUtils.firstOrSuppressed(t, suppressedThrowable); } if (operatorChain != null) { actionExecutor.run(() -> operatorChain.releaseOutputs()); } else { recordWriter.close(); } try { channelIOExecutor.shutdown(); } catch (Throwable t) { suppressedThrowable = ExceptionUtils.firstOrSuppressed(t, suppressedThrowable); } mailboxProcessor.close(); if (suppressedThrowable != null) { throw (Exception) suppressedThrowable; } }

Target:
protected void cleanUpInvoke() throws Exception { isRunning = false; setShouldInterruptOnCancel(false); Thread.interrupted(); Exception suppressedException = runAndSuppressThrowable(this::tryShutdownTimerService, null); suppressedException = runAndSuppressThrowable(cancelables::close, suppressedException); suppressedException = runAndSuppressThrowable(this::shutdownAsyncThreads, suppressedException); suppressedException = runAndSuppressThrowable(this::cleanup, suppressedException); suppressedException = runAndSuppressThrowable(this::disposeAllOperators, suppressedException); suppressedException = runAndSuppressThrowable(this::releaseOutputResources, suppressedException); suppressedException = runAndSuppressThrowable(channelIOExecutor::shutdown, suppressedException); suppressedException = runAndSuppressThrowable(mailboxProcessor::close, suppressedException); if (suppressedException != null) { throw suppressedException; } }
Source:
public boolean deleteDocument() { boolean result = false; if (selectedDocument != null) { result = wsService.deleteDocument(selectedDocument); if(result){ getDocuments().remove(selectedDocument); } selectedDocument = null; } else { addFacesMessageBy(GROWL_MESSAGE, msgForSelectDelete("Document")); } return result; }

Target:
public boolean deleteDocument() { boolean result = false; if (selectedDocument != null) { result = wsService.deleteDocument(selectedDocument); if(result){ refreshDocumentList(); } selectedDocument = null; } else { addFacesMessageBy(GROWL_MESSAGE, msgForSelectDelete("Document")); } return result; }
Source:
public void open_rules_configuration() { assumeTrue(isMarsOrGreater()); openRulesConfiguration(); SWTBotTree tree = bot.tree(1); SWTBotTreeItem javaNode = tree.getAllItems()[0]; assertThat(javaNode.getText()).isEqualTo("HTML"); javaNode.expand(); assertThat(javaNode.cell(0, 0)).isEqualTo("\"<!DOCTYPE>\" declarations should appear before \"<html>\" tags"); bot.button("Cancel").click(); }

Target:
public void open_rules_configuration() { assumeTrue(isMarsOrGreater()); openRulesConfiguration(); SWTBotTree tree = bot.tree(1); SWTBotTreeItem htmlNode = tree.getAllItems()[0]; assertThat(htmlNode.getText()).isEqualTo("HTML"); htmlNode.expand(); assertThat(htmlNode.cell(0, 0)).isEqualTo("\"<!DOCTYPE>\" declarations should appear before \"<html>\" tags"); bot.button("Cancel").click(); }
Source:
public Collection<ISourceContainer> resolveSourceContainers(File classesLocation, IProgressMonitor monitor) { Collection<ArtifactKey> classesArtifacts = INDENTIFIERER.identify(classesLocation, monitor); if (classesArtifacts == null) { return null; } List<ISourceContainer> result = new ArrayList<>(); for (ArtifactKey classesArtifact : classesArtifacts) { ISourceContainer container = resolveSourceContainer(classesArtifact, monitor); if (container != null) { result.add(container); } } return result; }

Target:
public Collection<ISourceContainer> resolveSourceContainers(File classesLocation, IProgressMonitor monitor) { Collection<ArtifactKey> classesArtifacts = INDENTIFIER.identify(classesLocation, monitor); if (classesArtifacts == null) { return null; } List<ISourceContainer> result = new ArrayList<>(); for (ArtifactKey classesArtifact : classesArtifacts) { ISourceContainer container = resolveSourceContainer(classesArtifact, monitor); if (container != null) { result.add(container); } } return result; }
Source:
private void createReviewedPanel(){ reviewedPanel = new FlowPanel(); reviewedCheckBox = new CheckBox(); reviewedCheckBox.addValueChangeHandler(new ValueChangeHandler<Boolean>() { @Override public void onValueChange(ValueChangeEvent<Boolean> event) { setReviewedByCurrentUser(event.getValue()); } }); Anchor reviewedAnchor = new Anchor(PatchUtil.C.reviewed()); reviewedAnchor.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { setReviewedByCurrentUser(true); } }); final PatchValidator unreviewedValidator = new PatchValidator() { public boolean isValid(Patch patch) { return !patch.isReviewedByCurrentUser(); } }; int nextUnreviewedPatchIndex = patchSetDetail.getNextPatch(patchIndex, true, unreviewedValidator, fileList.PREFERENCE_VALIDATOR); if (nextUnreviewedPatchIndex > -1) { final PatchLink reviewedLink = fileList.createLink(nextUnreviewedPatchIndex, getPatchScreenType(), null, null); reviewedLink.setText(""); reviewedAnchor.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { reviewedLink.go(); } }); } else { final ChangeLink upLink = new ChangeLink("", patchKey.getParentKey()); reviewedAnchor.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { upLink.go(); } }); } reviewedPanel.add(reviewedCheckBox); reviewedPanel.add(reviewedAnchor); }

Target:
private void createReviewedPanel(){ reviewedPanel = new FlowPanel(); reviewedCheckBox = new CheckBox(PatchUtil.C.reviewed() + " "); reviewedCheckBox.addValueChangeHandler(new ValueChangeHandler<Boolean>() { @Override public void onValueChange(ValueChangeEvent<Boolean> event) { setReviewedByCurrentUser(event.getValue()); } }); Anchor reviewedAnchor = new Anchor(PatchUtil.C.andContinue()); reviewedAnchor.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { setReviewedByCurrentUser(true); } }); final PatchValidator unreviewedValidator = new PatchValidator() { public boolean isValid(Patch patch) { return !patch.isReviewedByCurrentUser(); } }; int nextUnreviewedPatchIndex = patchSetDetail.getNextPatch(patchIndex, true, unreviewedValidator, fileList.PREFERENCE_VALIDATOR); if (nextUnreviewedPatchIndex > -1) { final PatchLink reviewedLink = fileList.createLink(nextUnreviewedPatchIndex, getPatchScreenType(), null, null); reviewedLink.setText(""); reviewedAnchor.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { reviewedLink.go(); } }); } else { final ChangeLink upLink = new ChangeLink("", patchKey.getParentKey()); reviewedAnchor.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { upLink.go(); } }); } reviewedPanel.add(reviewedCheckBox); reviewedPanel.add(reviewedAnchor); }
Source:
public static SchedulingPolicy map(ClusterPolicy entity, SchedulingPolicy template) { SchedulingPolicy model = template != null ? template : new SchedulingPolicy(); model.setId(entity.getId().toString()); model.setName(entity.getName()); model.setPolicy(entity.getName()); model.setDescription(entity.getDescription()); model.setLocked(entity.isLocked()); model.setDefaultPolicy(entity.isDefaultPolicy()); if (entity.getParameterMap() != null && !entity.getParameterMap().isEmpty()) { model.setProperties(CustomPropertiesParser.fromMap(entity.getParameterMap())); } return model; }

Target:
public static SchedulingPolicy map(ClusterPolicy entity, SchedulingPolicy template) { SchedulingPolicy model = template != null ? template : new SchedulingPolicy(); model.setId(entity.getId().toString()); model.setName(entity.getName()); model.setDescription(entity.getDescription()); model.setLocked(entity.isLocked()); model.setDefaultPolicy(entity.isDefaultPolicy()); if (entity.getParameterMap() != null && !entity.getParameterMap().isEmpty()) { model.setProperties(CustomPropertiesParser.fromMap(entity.getParameterMap())); } return model; }
Source:
protected void configure(HttpSecurity http) throws Exception { http.addFilterAfter(strongboxAuthenticationFilter(), ExceptionTranslationFilter.class) .sessionManagement() .sessionCreationPolicy(SessionCreationPolicy.STATELESS) .and() .exceptionHandling() .accessDeniedHandler(accessDeniedHandler()) .authenticationEntryPoint(customBasicAuthenticationEntryPoint()) .and() .authorizeRequests() .requestMatchers(EndpointRequest.toAnyEndpoint()) .hasAuthority("ADMIN") .and() .anonymous() .authenticationFilter(anonymousAuthenticationFilter()) .and() .cors() .and() .csrf() .disable(); }

Target:
protected void configure(HttpSecurity http) throws Exception { http.addFilterAfter(strongboxAuthenticationFilter(), ExceptionTranslationFilter.class) .sessionManagement() .sessionCreationPolicy(SessionCreationPolicy.STATELESS) .and() .exceptionHandling() .accessDeniedHandler(accessDeniedHandler()) .authenticationEntryPoint(customBasicAuthenticationEntryPoint()) .and() .anonymous() .authenticationFilter(anonymousAuthenticationFilter()) .and() .cors() .and() .csrf() .disable(); }
Source:
public MergeResult call() throws NoHeadException, ConcurrentRefUpdateException { checkCallable(); try { Ref head = repo.getRef(Constants.HEAD); if (head == null) throw new NoHeadException( "Commit on repo without HEAD currently not supported"); StringBuilder refLogMessage = new StringBuilder("merge "); refLogMessage.append(commit.getName() + ": "); RevWalk revWalk = new RevWalk(repo); RevCommit headCommit = revWalk.lookupCommit(head.getObjectId()); RevCommit srcCommit = revWalk.lookupCommit(commit.getLeaf() .getObjectId()); if (revWalk.isMergedInto(srcCommit, headCommit)) { return new MergeResult(headCommit, MergeResult.MergeStatus.ALREADY_UP_TO_DATE, mergeStrategy); } Commit newHeadCommit; MergeResult.MergeStatus mergeStatus = null; if (revWalk.isMergedInto(headCommit, srcCommit)) { newHeadCommit = repo.mapCommit(srcCommit); refLogMessage.append("Fast forward"); mergeStatus = MergeResult.MergeStatus.FAST_FORWARD; } else { return new MergeResult(null, MergeResult.MergeStatus.NOT_SUPPORTED, mergeStrategy, "only already-up-to-date and fast forward merges are available"); } checkoutNewHead(revWalk, headCommit, newHeadCommit); return updateHead(refLogMessage, newHeadCommit, mergeStatus); } catch (IOException e) { throw new JGitInternalException( "Exception caught during execution of merge command", e); } }

Target:
public MergeResult call() throws NoHeadException, ConcurrentRefUpdateException, CheckoutConflictException { checkCallable(); try { Ref head = repo.getRef(Constants.HEAD); if (head == null) throw new NoHeadException( "Commit on repo without HEAD currently not supported"); StringBuilder refLogMessage = new StringBuilder("merge "); RevWalk revWalk = new RevWalk(repo); RevCommit headCommit = revWalk.lookupCommit(head.getObjectId()); RevCommit newHeadCommit = null; MergeStatus mergeStatus = MergeResult.MergeStatus.ALREADY_UP_TO_DATE; boolean firstEntry=true; for (Map.Entry<String, AnyObjectId> commitEntry: commits.entrySet()) { if (!firstEntry) refLogMessage.append(", "); firstEntry = false; refLogMessage.append(commitEntry.getKey()); RevCommit srcCommit = revWalk.lookupCommit(commitEntry.getValue()); if (revWalk.isMergedInto(srcCommit, headCommit)) { } else if (revWalk.isMergedInto(headCommit, srcCommit)) { if (newHeadCommit == null || revWalk.isMergedInto(newHeadCommit, srcCommit)) newHeadCommit = srcCommit; mergeStatus = MergeResult.MergeStatus.FAST_FORWARD; } else { mergeStatus = MergeResult.MergeStatus.NOT_SUPPORTED; break; } } if (mergeStatus==MergeStatus.ALREADY_UP_TO_DATE) return new MergeResult(headCommit, mergeStatus, mergeStrategy); else if (mergeStatus==MergeStatus.FAST_FORWARD) { refLogMessage.append(": Fast forward"); checkoutNewHead(revWalk, headCommit, newHeadCommit); return updateHead(refLogMessage, newHeadCommit, head.getObjectId(), mergeStatus); } else return new MergeResult(null, MergeResult.MergeStatus.NOT_SUPPORTED, mergeStrategy, "only already-up-to-date and fast forward merges are available"); } catch (IOException e) { throw new JGitInternalException( "Exception caught during execution of merge command", e); } }
Source:
protected Stream<? extends DomainEventData<?>> readEventData(String aggregateIdentifier, long firstSequenceNumber) { logger.debug("Reading events for aggregate id {}", aggregateIdentifier); EventChannel eventChannel = connectionManager.getConnection(context).eventChannel(); AggregateEventStream aggregateStream; if (firstSequenceNumber >= 0) { aggregateStream = eventChannel.openAggregateStream(aggregateIdentifier, firstSequenceNumber); } else if (firstSequenceNumber == ALLOW_SNAPSHOTS_MAGIC_VALUE && !snapshotFilterSet) { aggregateStream = eventChannel.openAggregateStream(aggregateIdentifier, true); } else { aggregateStream = eventChannel.openAggregateStream(aggregateIdentifier); } return aggregateStream.asStream().map(GrpcBackedDomainEventData::new); }

Target:
protected Stream<? extends DomainEventData<?>> readEventData(String aggregateIdentifier, long firstSequenceNumber) { logger.debug("Reading events for aggregate id {}", aggregateIdentifier); EventChannel eventChannel = connectionManager.getConnection(context).eventChannel(); AggregateEventStream aggregateStream; if (firstSequenceNumber >= 0) { aggregateStream = eventChannel.openAggregateStream(aggregateIdentifier, firstSequenceNumber); } else if (firstSequenceNumber == ALLOW_SNAPSHOTS_MAGIC_VALUE && !snapshotFilterSet) { aggregateStream = eventChannel.openAggregateStream(aggregateIdentifier); } else { aggregateStream = eventChannel.openAggregateStream(aggregateIdentifier, WITHOUT_SNAPSHOTS); } return aggregateStream.asStream().map(GrpcBackedDomainEventData::new); }
Source:
private FileChannel createSpillingChannel() throws IOException { if (spillFile != null) { throw new IllegalStateException("Spilling file already exists."); } int maxAttempts = 10; for (int attempt = 0; attempt < maxAttempts; attempt++) { int dirIndex = rnd.nextInt(tempDirs.length); String directory = tempDirs[dirIndex]; File file = new File(directory, randomString(rnd) + ".inputchannel"); try { if (file.createNewFile()) { spillFile = new RefCountedFile(file); return new RandomAccessFile(file, "rw").getChannel(); } } catch (IOException e) { if (tempDirs.length <= 1) { throw e; } LOG.warn("Caught an IOException when creating spill file: " + directory + ". Attempt " + attempt, e); tempDirs = (String[]) ArrayUtils.remove(tempDirs, dirIndex); } } throw new IOException( "Could not find a unique file channel name in '" + Arrays.toString(tempDirs) + "' for spilling large records during deserialization."); }

Target:
private FileChannel createSpillingChannel() throws IOException { if (spillFile != null) { throw new IllegalStateException("Spilling file already exists."); } int maxAttempts = 10; int initialDirIndex = rnd.nextInt(tempDirs.length); for (int attempt = 0; attempt < maxAttempts; attempt++) { int dirIndex = (initialDirIndex + attempt) % tempDirs.length; String directory = tempDirs[dirIndex]; File file = new File(directory, randomString(rnd) + ".inputchannel"); try { if (file.createNewFile()) { spillFile = new RefCountedFile(file); return new RandomAccessFile(file, "rw").getChannel(); } } catch (IOException e) { if (tempDirs.length <= 1) { throw e; } LOG.warn("Caught an IOException when creating spill file: " + directory + ". Attempt " + attempt, e); tempDirs = (String[]) ArrayUtils.remove(tempDirs, dirIndex); } } throw new IOException( "Could not find a unique file channel name in '" + Arrays.toString(tempDirs) + "' for spilling large records during deserialization."); }
Source:
public QueueDepthTracker(long siteId, LinkedTransferQueue<SiteTasker> tasks) { super(siteId, false); m_historicalData = new ConcurrentLinkedDeque<>(); m_depth = new AtomicInteger(tasks.size()); m_lastWaitTime = 0; m_maxWaitLastLogTime = System.nanoTime(); m_recentMaxWaitTime = 0; m_recentTotalWaitTime = 0; m_recentPollCount = 0; m_tasks = tasks; }

Target:
public QueueDepthTracker(long siteId, LinkedTransferQueue<SiteTasker> tasks) { super(siteId, false); m_historicalData = new ArrayBlockingQueue<>(10); m_depth = new AtomicInteger(tasks.size()); m_lastWaitTime = 0; m_maxWaitLastLogTime = System.nanoTime(); m_recentMaxWaitTime = 0; m_recentTotalWaitTime = 0; m_recentPollCount = 0; m_tasks = tasks; }
Source:
private Map<String, ResourceAssignment> getBaselineAssignment( AssignmentMetadataStore assignmentMetadataStore, CurrentStateOutput currentStateOutput, Set<String> resources) throws HelixRebalanceException { Map<String, ResourceAssignment> currentBaseline; try { currentBaseline = assignmentMetadataStore.getBaseline(); if (currentBaseline.isEmpty()) { LOG.warn( "The current baseline assignment record is empty. Use the current states instead."); currentBaseline = getCurrentStateAssingment(currentStateOutput, resources); } } catch (Exception ex) { throw new HelixRebalanceException( "Failed to get the current baseline assignment because of unexpected error.", HelixRebalanceException.Type.INVALID_REBALANCER_STATUS, ex); } return currentBaseline; }

Target:
private Map<String, ResourceAssignment> getBaselineAssignment( AssignmentMetadataStore assignmentMetadataStore, CurrentStateOutput currentStateOutput, Set<String> resources) throws HelixRebalanceException { Map<String, ResourceAssignment> currentBaseline = Collections.emptyMap(); if (assignmentMetadataStore != null) { try { currentBaseline = assignmentMetadataStore.getBaseline(); } catch (HelixException ex) { LOG.error("Failed to get the current baseline assignment.", ex); } catch (Exception ex) { throw new HelixRebalanceException( "Failed to get the current baseline assignment because of unexpected error.", HelixRebalanceException.Type.INVALID_REBALANCER_STATUS, ex); } } if (currentBaseline.isEmpty()) { LOG.warn( "The current baseline assignment record is empty. Use the current states instead."); currentBaseline = getCurrentStateAssingment(currentStateOutput, resources); } return currentBaseline; }
Source:
private int predictSerializedSize() { int size = 0; size += 4; size += 1; size += 3; size += super.region.name().length; size += 1; size += 1; size += 1; size += 3; size += start_key.length; size += 3; size += stop_key.length; size += 1; size += 4; size += 4; size += 4; size += 1; size += 1; if (filter != null) { size += filter.predictSerializedSize(); } size += 8; size += 8; size += 1; size += 4; if (families != null) { size += families.length; for (int i = 0; i < families.length; i++) { byte[] family = families[i]; size += family.length; size += 4; if (qualifiers != null && qualifiers[i] != null) { size += 3 * qualifiers[i].length; for (byte[] qualifier : qualifiers[i]) { size += qualifier.length; } } } } return size; }

Target:
private int predictSerializedSize() { int size = 0; size += 4; size += 1; size += 3; size += super.region.name().length; size += 1; size += 1; size += 1; size += 3; size += start_key.length; size += 3; size += stop_key.length; size += 4; size += 4; size += 4; size += 1; size += 1; if (filter != null) { size += filter.predictSerializedSize(); } size += 8; size += 8; size += 1; size += 4; if (families != null) { size += families.length; for (int i = 0; i < families.length; i++) { byte[] family = families[i]; size += family.length; size += 4; if (qualifiers != null && qualifiers[i] != null) { size += 3 * qualifiers[i].length; for (byte[] qualifier : qualifiers[i]) { size += qualifier.length; } } } } return size; }
Source:
public void selectAll(){ for(int i = 0; i < mAdapter.getCount(); i++) { File file = (File) mAdapter.getItem(i); if(!file.isDirectory()){ ((ImageView) getView().findViewById(R.id.custom_checkbox)).setImageResource(R.drawable.ic_checkbox_marked); mCurrentListView.setItemChecked(i,true); mAdapter.checkFile(file); } } mAdapter.notifyDataSetChanged(); }

Target:
public void selectAll() { for (int i = 0; i < mAdapter.getCount(); i++) { File file = (File) mAdapter.getItem(i); if (!file.isDirectory() && !mAdapter.isAlreadyChecked(file)) { ((ImageView) getView().findViewById(R.id.custom_checkbox)).setImageResource(R.drawable.ic_checkbox_marked); mCurrentListView.setItemChecked(i, true); mAdapter.checkFile(file); } } mAdapter.notifyDataSetChanged(); }
Source:
public void shouldRaiseAlertWithLowConfidenceIfTestedUrlRespondsOkWithoutRelevantBinContent() throws HttpMalformedHeaderException { String servePath = "/shouldAlert"; String testPath = ".DS_Store"; String validDSStoreBinString = new String(new byte[] {0, 0, 0, 1, 'B', 'u', 'd', '1'}, StandardCharsets.US_ASCII); String inValidDSStoreBinString = new String(new byte[] {0, 0, 0, 2, 'B', 'u', 'd', '2'}, StandardCharsets.US_ASCII); HiddenFile hiddenFile = new HiddenFile( testPath, Collections.emptyList(), Collections.emptyList(), validDSStoreBinString, Collections.emptyList(), "ds_store"); this.nano.addHandler(new OkResponse(servePath)); this.nano.addHandler(new OkBinResponse('/' + testPath, inValidDSStoreBinString)); HttpMessage msg = this.getHttpMessage(servePath); rule.init(msg, this.parent); HiddenFilesScanRule.addTestPayload(hiddenFile); rule.scan(); assertThat(alertsRaised, hasSize(1)); Alert alert = alertsRaised.get(0); assertEquals(1, httpMessagesSent.size()); assertEquals(Alert.RISK_MEDIUM, alertsRaised.get(0).getRisk()); assertEquals(Alert.CONFIDENCE_LOW, alertsRaised.get(0).getConfidence()); assertEquals(rule.getReference(), alert.getReference()); }

Target:
public void shouldRaiseAlertWithLowConfidenceIfTestedUrlRespondsOkWithoutRelevantBinContent() throws HttpMalformedHeaderException { String servePath = "/shouldAlert"; String testPath = ".DS_Store"; String validDSStoreBinString = new String(new byte[] {0, 0, 0, 1, 'B', 'u', 'd', '1'}, StandardCharsets.US_ASCII); String invalidDSStoreBinString = new String(new byte[] {0, 0, 0, 2, 'B', 'u', 'd', '2'}, StandardCharsets.US_ASCII); HiddenFile hiddenFile = new HiddenFile( testPath, Collections.emptyList(), Collections.emptyList(), validDSStoreBinString, Collections.emptyList(), "ds_store"); this.nano.addHandler(new OkResponse(servePath)); this.nano.addHandler(new OkBinResponse('/' + testPath, invalidDSStoreBinString)); HttpMessage msg = this.getHttpMessage(servePath); rule.init(msg, this.parent); HiddenFilesScanRule.addTestPayload(hiddenFile); rule.scan(); assertThat(alertsRaised, hasSize(1)); Alert alert = alertsRaised.get(0); assertEquals(1, httpMessagesSent.size()); assertEquals(Alert.RISK_MEDIUM, alertsRaised.get(0).getRisk()); assertEquals(Alert.CONFIDENCE_LOW, alertsRaised.get(0).getConfidence()); assertEquals(rule.getReference(), alert.getReference()); }
Source:
public void killOlderThan(final long timestamp) throws IOException { File taskLogDir = config.getDirectory(); if (taskLogDir.exists()) { File[] files = taskLogDir.listFiles( new FileFilter() { @Override public boolean accept(File f) { return f.lastModified() < timestamp; } } ); for (File file : files) { log.info("Deleting local task log [%s].", file.getAbsolutePath()); FileUtils.forceDelete(file); if (Thread.currentThread().isInterrupted()) { throw new IOException( new InterruptedException("Thread interrupted. Couldn't delete all tasklogs.") ); } } } }

Target:
public void killOlderThan(final long timestamp) throws IOException { File taskLogDir = config.getDirectory(); if (taskLogDir.exists()) { if (!taskLogDir.isDirectory()) { throw new IOException(String.format("taskLogDir [%s] must be a directory.", taskLogDir)); } File[] files = taskLogDir.listFiles( new FileFilter() { @Override public boolean accept(File f) { return f.lastModified() < timestamp; } } ); for (File file : files) { log.info("Deleting local task log [%s].", file.getAbsolutePath()); FileUtils.forceDelete(file); if (Thread.currentThread().isInterrupted()) { throw new IOException( new InterruptedException("Thread interrupted. Couldn't delete all tasklogs.") ); } } } }
Source:
protected void prepareRoleForCommand() { roles role = getRole(); role.setId(Guid.NewGuid()); role.setInheritable(false); for (ActionGroup group : getParameters().getActionGroups()) { if (group.isInheritable()) { role.setInheritable(true); break; } } }

Target:
protected void prepareRoleForCommand() { roles role = getRole(); role.setId(Guid.NewGuid()); role.setAllowsViewingChildren(false); for (ActionGroup group : getParameters().getActionGroups()) { if (group.allowsViewingChildren()) { role.setAllowsViewingChildren(true); break; } } }
Source:
public synchronized long receive( long ticket, T batch ) { long time = nanoTime(); applyProcessorCount(); while ( queuedBatches.get() >= maxQueueLength ) { PARK.park( receiverThread = Thread.currentThread() ); } queuedBatches.incrementAndGet(); Unit unit = new Unit( ticket, batch, numberOfForkedProcessors ); Unit myHead = head.getAndSet( unit ); myHead.next = unit; return nanoTime() - time; }

Target:
public long receive( long ticket, T batch ) { long time = nanoTime(); while ( queuedBatches.get() >= maxQueueLength ) { PARK.park( receiverThread = Thread.currentThread() ); } long lock = applyProcessorCount( stripingLock.readLock() ); queuedBatches.incrementAndGet(); Unit unit = new Unit( ticket, batch, numberOfForkedProcessors ); Unit myHead = head.getAndSet( unit ); myHead.next = unit; stripingLock.unlock( lock ); return nanoTime() - time; }
Source:
public boolean templatesExist() { String groupFileName = CodeGenerator.TEMPLATE_ROOT + "/" + getLanguage() + "/" + getLanguage() + STGroup.GROUP_FILE_EXTENSION; URL url = Thread.currentThread().getContextClassLoader().getResource(groupFileName); STGroup result = null; try { result = new STGroupFile(url); } catch (IllegalArgumentException iae) { result = null; } return result!=null; }

Target:
public boolean templatesExist() { String groupFileName = CodeGenerator.TEMPLATE_ROOT + "/" + getLanguage() + "/" + getLanguage() + STGroup.GROUP_FILE_EXTENSION; STGroup result = null; try { result = new STGroupFile(groupFileName); } catch (IllegalArgumentException iae) { result = null; } return result!=null; }
Source:
protected static Ds3Type toDs3Type(final String componentType) { if (isEmpty(componentType)) { throw new IllegalArgumentException("Cannot generate Ds3Type from empty response component type"); } return new Ds3Type( componentType + NAMESPACE_ARRAY_RESPONSE_TYPES, ImmutableList.of( new Ds3Element( stripPath(componentType), "array", componentType, null)), null); }

Target:
protected static Ds3Type toDs3Type(final String componentType) { if (isEmpty(componentType)) { throw new IllegalArgumentException("Cannot generate Ds3Type from empty response component type"); } return new Ds3Type( componentType + NAMESPACE_ARRAY_RESPONSE_TYPES, ImmutableList.of( new Ds3Element( stripPath(componentType), "array", componentType))); }
Source:
public <T> InvocationHandler<T> apply(T next) { return new InvocationHandler<T>(next) { @Override public Object invoke(Method method, Object receiver, Object[] args) throws Throwable { System.out.printf("==== CALLING %s.%s ====\n", method.getDeclaringClass().getName(), method.getName()); if(method.getName() == "buyAlbum"){ throw new FRateLimitException("rate limit exceeded"); } Object ret = method.invoke(receiver, args); System.out.printf("==== CALLED %s.%s ====\n", method.getDeclaringClass().getName(), method.getName()); return ret; } }; }

Target:
public <T> InvocationHandler<T> apply(T next) { return new InvocationHandler<T>(next) { @Override public Object invoke(Method method, Object receiver, Object[] args) throws Throwable { System.out.printf("==== CALLING %s.%s ====\n", method.getDeclaringClass().getName(), method.getName()); Object ret = method.invoke(receiver, args); System.out.printf("==== CALLED %s.%s ====\n", method.getDeclaringClass().getName(), method.getName()); return ret; } }; }
Source:
public static void main(String[] args) { TextAnalyticsClient client = new TextAnalyticsClientBuilder() .credential(new AzureKeyCredential("{key}")) .endpoint("{endpoint}") .buildClient(); List<String> documents = Arrays.asList( "Old Faithful is a geyser at Yellowstone Park.", "Mount Shasta has lenticular clouds." ); AtomicInteger counter = new AtomicInteger(); for (RecognizeLinkedEntitiesResult entitiesResult : client.recognizeLinkedEntitiesBatch(documents, "en", null)) { System.out.printf("%nText = %s%n", documents.get(counter.getAndIncrement())); if (entitiesResult.isError()) { System.out.printf("Cannot recognize linked entities. Error: %s%n", entitiesResult.getError().getMessage()); } else { entitiesResult.getEntities().forEach(entity -> { System.out.println("Linked Entities:"); System.out.printf("\tName: %s, entity ID in data source: %s, URL: %s, data source: %s.%n", entity.getName(), entity.getDataSourceEntityId(), entity.getUrl(), entity.getDataSource()); entity.getMatches().forEach(entityMatch -> System.out.printf( "\tMatched entity: %s, confidence score: %f.%n", entityMatch.getText(), entityMatch.getConfidenceScore())); }); } } }

Target:
public static void main(String[] args) { TextAnalyticsClient client = new TextAnalyticsClientBuilder() .credential(new AzureKeyCredential("{key}")) .endpoint("{endpoint}") .buildClient(); List<String> documents = Arrays.asList( "Old Faithful is a geyser at Yellowstone Park.", "Mount Shasta has lenticular clouds." ); TextAnalyticsRequestOptions requestOptions = new TextAnalyticsRequestOptions().setIncludeStatistics(true).setModelVersion("latest"); RecognizeLinkedEntitiesResultCollection linkedEntitiesResultCollection = client.recognizeLinkedEntitiesBatch(documents, "en", requestOptions); System.out.printf("Results of Azure Text Analytics \"Linked Entities Recognition\" Model, version: %s%n", linkedEntitiesResultCollection.getModelVersion()); TextDocumentBatchStatistics batchStatistics = linkedEntitiesResultCollection.getStatistics(); System.out.printf("Documents statistics: document count = %s, erroneous document count = %s, transaction count = %s, valid document count = %s.%n", batchStatistics.getDocumentCount(), batchStatistics.getInvalidDocumentCount(), batchStatistics.getTransactionCount(), batchStatistics.getValidDocumentCount()); AtomicInteger counter = new AtomicInteger(); for (RecognizeLinkedEntitiesResult entitiesResult : linkedEntitiesResultCollection) { System.out.printf("%nText = %s%n", documents.get(counter.getAndIncrement())); if (entitiesResult.isError()) { System.out.printf("Cannot recognize linked entities. Error: %s%n", entitiesResult.getError().getMessage()); } else { entitiesResult.getEntities().forEach(entity -> { System.out.println("Linked Entities:"); System.out.printf("\tName: %s, entity ID in data source: %s, URL: %s, data source: %s.%n", entity.getName(), entity.getDataSourceEntityId(), entity.getUrl(), entity.getDataSource()); entity.getMatches().forEach(entityMatch -> System.out.printf( "\tMatched entity: %s, confidence score: %f.%n", entityMatch.getText(), entityMatch.getConfidenceScore())); }); } } }
Source:
protected void writeContent(AsyncWritableChannel writeChannel, ReadIntoCallbackWrapper callbackWrapper, HttpContent httpContent) { boolean retained = false; ByteBuffer[] contentBuffers; Callback<Long>[] writeCallbacks; boolean isLast = httpContent instanceof LastHttpContent; if (httpContent.content().nioBufferCount() > 0) { ReferenceCountUtil.retain(httpContent); retained = true; contentBuffers = httpContent.content().nioBuffers(); writeCallbacks = new ContentWriteCallback[contentBuffers.length]; int i = 0; for (; i < contentBuffers.length - 1; i++) { writeCallbacks[i] = new ContentWriteCallback(null, false, callbackWrapper); } writeCallbacks[i] = new ContentWriteCallback(httpContent, isLast, callbackWrapper); } else { nettyMetrics.contentCopyCount.inc(); logger.warn("HttpContent had to be copied because ByteBuf did not have a backing ByteBuffer"); ByteBuffer contentBuffer = ByteBuffer.allocate(httpContent.content().readableBytes()); httpContent.content().readBytes(contentBuffer); ContentWriteCallback writeCallback = new ContentWriteCallback(null, isLast, callbackWrapper); contentBuffers = new ByteBuffer[]{contentBuffer}; writeCallbacks = new ContentWriteCallback[]{writeCallback}; } boolean asyncWritesCalled = false; try { for (int i = 0; i < contentBuffers.length; i++) { writeChannel.write(contentBuffers[i], writeCallbacks[i]); } asyncWritesCalled = true; } finally { if (retained && !asyncWritesCalled) { ReferenceCountUtil.release(httpContent); } } }

Target:
protected void writeContent(AsyncWritableChannel writeChannel, ReadIntoCallbackWrapper callbackWrapper, HttpContent httpContent) { boolean retained = false; ByteBuffer[] contentBuffers; Callback<Long>[] writeCallbacks; boolean isLast = httpContent instanceof LastHttpContent; if (httpContent.content().nioBufferCount() > 0) { httpContent = ReferenceCountUtil.retain(httpContent); retained = true; contentBuffers = httpContent.content().nioBuffers(); writeCallbacks = new ContentWriteCallback[contentBuffers.length]; int i = 0; for (; i < contentBuffers.length - 1; i++) { writeCallbacks[i] = new ContentWriteCallback(null, false, callbackWrapper); } writeCallbacks[i] = new ContentWriteCallback(httpContent, isLast, callbackWrapper); } else { nettyMetrics.contentCopyCount.inc(); logger.warn("HttpContent had to be copied because ByteBuf did not have a backing ByteBuffer"); ByteBuffer contentBuffer = ByteBuffer.allocate(httpContent.content().readableBytes()); httpContent.content().readBytes(contentBuffer); ContentWriteCallback writeCallback = new ContentWriteCallback(null, isLast, callbackWrapper); contentBuffers = new ByteBuffer[]{contentBuffer}; writeCallbacks = new ContentWriteCallback[]{writeCallback}; } boolean asyncWritesCalled = false; try { for (int i = 0; i < contentBuffers.length; i++) { writeChannel.write(contentBuffers[i], writeCallbacks[i]); } asyncWritesCalled = true; } finally { if (retained && !asyncWritesCalled) { ReferenceCountUtil.release(httpContent); } } }
Source:
public void onCreate(Bundle icicle) { super.onCreate(icicle); String histFile = getArguments().getString(EXTRA_STATS); mStats = BatteryStatsHelper.statsFromFile(getActivity(), histFile); mBatteryBroadcast = getArguments().getParcelable(EXTRA_BROADCAST); TypedValue value = new TypedValue(); getContext().getTheme().resolveAttribute(android.R.attr.colorAccent, value, true); int accentColor = getContext().getColor(value.resourceId); if (!Utils.isWifiOnly(getContext())) { mHavePhoneSignal = true; } mChargingParser = new BatteryFlagParser(accentColor, false, HistoryItem.STATE_BATTERY_PLUGGED_FLAG); mScreenOn = new BatteryFlagParser(accentColor, false, HistoryItem.STATE_SCREEN_ON_FLAG); mGpsParser = new BatteryFlagParser(accentColor, false, HistoryItem.STATE_GPS_ON_FLAG); mFlashlightParser = new BatteryFlagParser(accentColor, true, HistoryItem.STATE2_FLASHLIGHT_FLAG); mCameraParser = new BatteryFlagParser(accentColor, true, HistoryItem.STATE2_CAMERA_FLAG); mWifiParser = new BatteryWifiParser(accentColor); mCpuParser = new BatteryFlagParser(accentColor, false, HistoryItem.STATE_CPU_RUNNING_FLAG); if (mHavePhoneSignal) { mPhoneParser = new BatteryCellParser(); } setHasOptionsMenu(true); }

Target:
public void onCreate(Bundle icicle) { super.onCreate(icicle); String histFile = getArguments().getString(EXTRA_STATS); mStats = BatteryStatsHelper.statsFromFile(getActivity(), histFile); mBatteryBroadcast = getArguments().getParcelable(EXTRA_BROADCAST); TypedValue value = new TypedValue(); getContext().getTheme().resolveAttribute(android.R.attr.colorAccent, value, true); int accentColor = getContext().getColor(value.resourceId); if (!Utils.isWifiOnly(getContext())) { mShowCellSignal = true; } else { mShowCellSignal = false; } mChargingParser = new BatteryFlagParser(accentColor, false, HistoryItem.STATE_BATTERY_PLUGGED_FLAG); mScreenOn = new BatteryFlagParser(accentColor, false, HistoryItem.STATE_SCREEN_ON_FLAG); mGpsParser = new BatteryFlagParser(accentColor, false, HistoryItem.STATE_GPS_ON_FLAG); mFlashlightParser = new BatteryFlagParser(accentColor, true, HistoryItem.STATE2_FLASHLIGHT_FLAG); mCameraParser = new BatteryFlagParser(accentColor, true, HistoryItem.STATE2_CAMERA_FLAG); mWifiParser = new BatteryWifiParser(accentColor); mCpuParser = new BatteryFlagParser(accentColor, false, HistoryItem.STATE_CPU_RUNNING_FLAG); if (mShowCellSignal) { mPhoneParser = new BatteryCellParser(); } setHasOptionsMenu(true); }
Source:
public Object optimize() { checkState(optimize, "evaluate() not allowed for interpreter"); return expression.accept(visitor, null); }

Target:
public Object optimize() { checkState(optimize, "optimize() not allowed for interpreter"); return expression.accept(visitor, null); }