auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected void setASTLevel(int level, boolean doRefresh) { int oldLevel= fCurrentASTLevel; fCurrentASTLevel= level; fDialogSettings.put(SETTINGS_JLS, fCurrentASTLevel); if (doRefresh && fTypeRoot != null && oldLevel != fCurrentASTLevel) { try { refreshAST(); } catch (CoreException e) { showAndLogError("Could not set AST to new level.", e); fCurrentASTLevel= oldLevel; } } for (ASTView.ASTLevelToggle curr : fASTVersionToggleActions) { curr.setChecked(curr.getLevel() == fCurrentASTLevel); } }

Target:
protected void setASTLevel(int level, boolean doRefresh) { int oldLevel= fCurrentASTLevel; fCurrentASTLevel= level; fDialogSettings.put(SETTINGS_JLS, fCurrentASTLevel); if (doRefresh && fTypeRoot != null && oldLevel != fCurrentASTLevel) { try { refreshAST(); } catch (CoreException e) { showAndLogError("Could not set AST to new level.", e); fCurrentASTLevel= oldLevel; } } for (ASTView.ASTLevelToggle action : fASTVersionToggleActions) { action.setChecked(action.getLevel() == fCurrentASTLevel); } }
Source:
public void receiveCaptureMessages() throws QueueException { List<QueueMessage> captureMessages = sqsQueueService.receiveMessages(this.captureQueueUrl, CAPTURE_MESSAGE_ATTRIBUTE_NAME); for (QueueMessage message: captureMessages) { try { cardCaptureMessageProcess.runCapture(message); sqsQueueService.deleteMessage(this.captureQueueUrl, message); } catch (Exception e) { logger.warn("Error capturing charge from SQS message [{}]", e); } } }

Target:
public List<QueueMessage> receiveCaptureMessages() throws QueueException { return sqsQueueService.receiveMessages(this.captureQueueUrl, CAPTURE_MESSAGE_ATTRIBUTE_NAME); }
Source:
protected void createNewClientId() throws Exception { String uri = BASE_PROFILE + uriEncode(_profileName) + "/" + BASE_CLIENTS; System.out.println("Request Url :"+ uri); try { JSONObject response = new JSONObject(doPost(uri, null)); System.out.println("Response is :"+ response.toString()); _clientId = response.getJSONObject("client").getString("uuid"); toggleProfile(true); } catch (Exception e) { e.printStackTrace(); throw new Exception("Could not create a proxy client"); } }

Target:
protected void createNewClientId() throws Exception { String uri = BASE_PROFILE + uriEncode(_profileName) + "/" + BASE_CLIENTS; try { JSONObject response = new JSONObject(doPost(uri, null)); _clientId = response.getJSONObject("client").getString("uuid"); toggleProfile(true); } catch (Exception e) { e.printStackTrace(); throw new Exception("Could not create a proxy client"); } }
Source:
public void testFindWorkingVersionTemplate() throws Exception{ Template template=new Template(); template.setTitle("TEST TEMPLATE VERSIONABLE"); template.setBody("<html><body> I'm mostly empty </body></html>"); template=APILocator.getTemplateAPI().saveTemplate(template, host, user, false); Versionable verAPI = APILocator.getVersionableAPI().findWorkingVersion(template.getIdentifier(), user, false); assertEquals(verAPI.getTitle(),template.getTitle()); assertEquals(verAPI.getInode(),template.getInode()); APILocator.getTemplateAPI().delete(template, user, false); }

Target:
public void testFindWorkingVersionTemplate() throws Exception{ Template template = new TemplateDataGen().nextPersisted(); Versionable verAPI = APILocator.getVersionableAPI().findWorkingVersion(template.getIdentifier(), user, false); assertEquals(verAPI.getTitle(),template.getTitle()); assertEquals(verAPI.getInode(),template.getInode()); APILocator.getTemplateAPI().delete(template, user, false); }
Source:
public String docs() { return "void {eventName, eventObject, [serverWide]} Manually triggers bound events." + " The event object passed to this function is sent directly as-is to the bound events." + " Check the documentation for each event to see what is required." + " No checks will be done on the data here," + " but it is not recommended to fail to send all parameters required." + " If serverWide is true, the event is triggered directly in the server," + " unless it is a CommandHelper specific event, in which case, serverWide is irrelevant." + " Defaults to false, which means that only CommandHelper code will receive the event." + " Throws a CastException when eventObject is not an array and not null." + " Throws a BindException when " + getName() + "() is not yet supported by the given event." + " Throws a CREIllegalArgumentException exception, if the event does not exist."; }

Target:
public String docs() { return "void {eventName, eventObject, [serverWide]} Manually triggers bound events." + " The event object passed to this function is sent directly as-is to the bound events." + " Check the documentation for each event to see what is required." + " No checks will be done on the data here," + " but it is not recommended to fail to send all parameters required." + " If serverWide is true, the event is triggered directly in the server," + " unless it is a CommandHelper specific event, in which case, serverWide is irrelevant." + " Defaults to false, which means that only CommandHelper code will receive the event." + " Throws a CastException when eventObject is not an array and not null." + " Throws a BindException when " + getName() + "() is not yet supported by the given event." + " Throws a IllegalArgumentException exception, if the event does not exist."; }
Source:
public <T> T encodeAndTransform( ServiceMessage message, BiFunction<ByteBuf, ByteBuf, T> transformer) throws MessageCodecException { ByteBuf dataBuffer = Unpooled.EMPTY_BUFFER; ByteBuf headersBuffer = Unpooled.EMPTY_BUFFER; if (message.hasData(ByteBuf.class)) { dataBuffer = message.data(); } else if (message.hasData()) { dataBuffer = ByteBufAllocator.DEFAULT.buffer(); try { DataCodec dataCodec = getDataCodecByContentType(message.dataFormatOrDefault()); dataCodec.encode(new ByteBufOutputStream(dataBuffer), message.data()); } catch (Throwable ex) { ReferenceCountUtil.safestRelease(dataBuffer); LOGGER.error("Failed to encode data on: {}, cause: {}", message, ex); throw new MessageCodecException( "Failed to encode data on message q=" + message.qualifier(), ex); } } if (!message.headers().isEmpty()) { headersBuffer = ByteBufAllocator.DEFAULT.buffer(); try { headersCodec.encode(new ByteBufOutputStream(headersBuffer), message.headers()); } catch (Throwable ex) { ReferenceCountUtil.safestRelease(headersBuffer); ReferenceCountUtil.safestRelease(dataBuffer); LOGGER.error("Failed to encode headers on: {}, cause: {}", message, ex); throw new MessageCodecException( "Failed to encode headers on message q=" + message.qualifier(), ex); } } return transformer.apply(dataBuffer, headersBuffer); }

Target:
public <T> T encodeAndTransform( ServiceMessage message, BiFunction<ByteBuf, ByteBuf, T> transformer) throws MessageCodecException { ByteBuf dataBuffer = Unpooled.EMPTY_BUFFER; ByteBuf headersBuffer = Unpooled.EMPTY_BUFFER; if (message.hasData(ByteBuf.class)) { dataBuffer = message.data(); } else if (message.hasData()) { dataBuffer = ByteBufAllocator.DEFAULT.buffer(); try { DataCodec dataCodec = getDataCodec(message.dataFormatOrDefault()); dataCodec.encode(new ByteBufOutputStream(dataBuffer), message.data()); } catch (Throwable ex) { ReferenceCountUtil.safestRelease(dataBuffer); LOGGER.error("Failed to encode data on: {}, cause: {}", message, ex.toString()); throw new MessageCodecException( "Failed to encode data on message q=" + message.qualifier(), ex); } } if (!message.headers().isEmpty()) { headersBuffer = ByteBufAllocator.DEFAULT.buffer(); try { headersCodec.encode(new ByteBufOutputStream(headersBuffer), message.headers()); } catch (Throwable ex) { ReferenceCountUtil.safestRelease(headersBuffer); ReferenceCountUtil.safestRelease(dataBuffer); LOGGER.error("Failed to encode headers on: {}, cause: {}", message, ex.toString()); throw new MessageCodecException( "Failed to encode headers on message q=" + message.qualifier(), ex); } } return transformer.apply(dataBuffer, headersBuffer); }
Source:
public void GIICompletesSuccessfullyWhenRunningDuringClearWithPersistentRegion() { if (regionShortcut == RegionShortcut.PARTITION) { regionShortcut = RegionShortcut.PARTITION_PERSISTENT; } else if (regionShortcut == RegionShortcut.REPLICATE) { regionShortcut = RegionShortcut.REPLICATE_PERSISTENT; } initDataStores(NUM_SERVERS); configureServers(regionShortcut); verifyRegionSizes(DATA_SIZE); dataStores[1].invoke(new SerializableRunnable() { @Override public void run() { PauseDuringGIICallback myAfterReceivedImageReply = new PauseDuringGIICallback( InitialImageOperation.GIITestHookType.AfterReceivedRequestImage, "_B__testPR_9"); InitialImageOperation.setGIITestHook(myAfterReceivedImageReply); } }); cluster.stop(2); createDelta(50); restartServerOnVM(2); AsyncInvocation async = createRegionAsync(dataStores[1]); invokeClear(dataStores[0]); dataStores[1].invoke(() -> InitialImageOperation.resetGIITestHook( InitialImageOperation.GIITestHookType.AfterReceivedRequestImage, true)); try { async.getResult(30000); } catch (InterruptedException ex) { Assert.fail("Async create interupted" + ex.getMessage()); } verifyRegionSizes(0); }

Target:
public void GIICompletesSuccessfullyWhenRunningDuringClearWithPersistentRegion() { if (regionShortcut == RegionShortcut.PARTITION) { regionShortcut = RegionShortcut.PARTITION_PERSISTENT; } else if (regionShortcut == RegionShortcut.REPLICATE) { regionShortcut = RegionShortcut.REPLICATE_PERSISTENT; } startServers(NUM_SERVERS); verifyRegionSizes(DATA_SIZE); serverVMs[1].invoke(() -> { PauseDuringGIICallback myAfterReceivedImageReply = new PauseDuringGIICallback( InitialImageOperation.GIITestHookType.AfterReceivedRequestImage, "_B__testPR_9"); InitialImageOperation.setGIITestHook(myAfterReceivedImageReply); }); cluster.stop(2); createDelta(50); restartServerOnVM(2); AsyncInvocation async = createRegionAsync(serverVMs[1]); invokeClear(serverVMs[0]); serverVMs[1].invoke(() -> InitialImageOperation.resetGIITestHook( InitialImageOperation.GIITestHookType.AfterReceivedRequestImage, true)); try { async.getResult(30000); } catch (InterruptedException ex) { Assert.fail("Async create interupted" + ex.getMessage()); } verifyRegionSizes(0); }
Source:
public void run() { StringBuilder err = new StringBuilder(); try (InputStream is = p.getErrorStream()) { int ch; while ((ch = is.read()) != -1) { err.append((char) ch); } } catch (IOException e) { final boolean processExited = waitForProcessCompletion(); if (!processExited) { setError(e, String.format("Command '%s' closed stderr stream but didn't exit within timeout %s seconds", desc, PROCESS_EXIT_TIMEOUT), -1); fail.set(true); } else if (p.exitValue() != 0) { setError(e, e.getMessage(), p.exitValue()); fail.set(true); } else { } } finally { final boolean processExited = waitForProcessCompletion(); if (!processExited) { setError(null, String.format("Command '%s' closed stderr stream but didn't exit within timeout %s seconds", desc, PROCESS_EXIT_TIMEOUT), -1); fail.set(true); } else if (err.length() > 0) { setError(null, err.toString(), p.exitValue()); if (p.exitValue() != 0) { fail.set(true); } } } }

Target:
public void run() { StringBuilder err = new StringBuilder(); try (InputStream is = p.getErrorStream()) { int ch; while ((ch = is.read()) != -1) { err.append((char) ch); } } catch (IOException e) { if (waitForProcessCompletion(e) && p.exitValue() != 0) { setError(e, e.getMessage(), p.exitValue()); fail.set(true); } else { } } finally { if (waitForProcessCompletion(null) && err.length() > 0) { setError(null, err.toString(), p.exitValue()); if (p.exitValue() != 0) { fail.set(true); } } } }
Source:
public static void main(String[] args) { ArrayList<String> tmpArgs = new ArrayList<String>(Arrays.asList(args)); int numThreads = 0; int delay = 0; try { int pos = tmpArgs.size() - 1; delay = Integer.parseInt(tmpArgs.get(pos)); tmpArgs.remove(pos); pos--; numThreads = Integer.parseInt(tmpArgs.get(pos)); tmpArgs.remove(pos); } catch (Exception e) { System.out.println("Please make sure that you set numthreads and sourcedelay properties in bin/samoa-threads.properties"); System.out.println(e.getStackTrace()); } args = tmpArgs.toArray(new String[0]); FlagOption suppressStatusOutOpt = new FlagOption("suppressStatusOut", 'S', SUPPRESS_STATUS_OUT_MSG); FlagOption suppressResultOutOpt = new FlagOption("suppressResultOut", 'R', SUPPRESS_RESULT_OUT_MSG); IntOption statusUpdateFreqOpt = new IntOption("statusUpdateFrequency", 'F', STATUS_UPDATE_FREQ_MSG, 1000, 0, Integer.MAX_VALUE); Option[] extraOptions = new Option[] { suppressStatusOutOpt, suppressResultOutOpt, statusUpdateFreqOpt }; StringBuilder cliString = new StringBuilder(); for (int i = 0; i < args.length; i++) { cliString.append(" ").append(args[i]); } logger.debug("Command line string = {}", cliString.toString()); System.out.println("Command line string = " + cliString.toString()); Task task = null; try { task = (Task) ClassOption.cliStringToObject(cliString.toString(), Task.class, extraOptions); logger.info("Sucessfully instantiating {}", task.getClass().getCanonicalName()); } catch (Exception e) { logger.error("Fail to initialize the task", e); System.out.println("Fail to initialize the task" + e); return; } task.setFactory(new ThreadsComponentFactory()); task.init(); ThreadsEngine.submitTopology(task.getTopology(), delay, numThreads); }

Target:
public static void main(String[] args) { ArrayList<String> tmpArgs = new ArrayList<String>(Arrays.asList(args)); int numThreads = 1; for (int i=0; i<tmpArgs.size()-1; i++) { if (tmpArgs.get(i).equals("-t")) { try { numThreads = Integer.parseInt(tmpArgs.get(i+1)); tmpArgs.remove(i+1); tmpArgs.remove(i); } catch (NumberFormatException e) { System.err.println("Invalid number of threads."); System.err.println(e.getStackTrace()); } } } logger.info("Number of threads:{}", numThreads); args = tmpArgs.toArray(new String[0]); StringBuilder cliString = new StringBuilder(); for (int i = 0; i < args.length; i++) { cliString.append(" ").append(args[i]); } logger.debug("Command line string = {}", cliString.toString()); System.out.println("Command line string = " + cliString.toString()); Task task = null; try { task = (Task) ClassOption.cliStringToObject(cliString.toString(), Task.class, null); logger.info("Sucessfully instantiating {}", task.getClass().getCanonicalName()); } catch (Exception e) { logger.error("Fail to initialize the task", e); System.out.println("Fail to initialize the task" + e); return; } task.setFactory(new ThreadsComponentFactory()); task.init(); ThreadsEngine.submitTopology(task.getTopology(), numThreads); }
Source:
public Set<Rule> rules() { return ImmutableSet.of(new ProjectExpressionRewrite(), new AggregationExpressionRewrite(), new FilterExpressionRewrite(), new TableScanExpressionRewrite(), new JoinExpressionRewrite(), new ValuesExpressionRewrite(), new ApplyExpressionRewrite()); }

Target:
public Set<Rule> rules() { return rules; }
Source:
protected void demandResolve(SynchronizedResourceSet resourceSet, URI uri, final ThreadSafeProgressMonitor monitor) { if (isInterruptedOrCanceled(monitor)) { demandResolvingAndUnloadingPoolShutdown(); return; } Collection<URI> uriCollection = dependencyProviderRegistry.getDependencies(uri); for (URI currentUri : uriCollection) { lock.lock(); try { if (resolvedResources.add(currentUri) && currentlyResolving.add(currentUri)) { monitor.setWorkRemaining(1000); ListenableFuture<?> future = resolvingPool.submit(new ResourceResolver(resourceSet, currentUri, monitor)); Futures.addCallback(future, new ResolvingFutureCallback(monitor, currentUri)); } } finally { lock.unlock(); } } }

Target:
protected void demandResolve(SynchronizedResourceSet resourceSet, URI uri, final ThreadSafeProgressMonitor monitor) { if (isInterruptedOrCanceled(monitor)) { demandResolvingAndUnloadingPoolShutdown(); return; } Collection<URI> uriCollection = dependencyProviderRegistry.getDependencies(uri); lock.lock(); try { for (URI currentUri : uriCollection) { if (resolvedResources.add(currentUri) && currentlyResolving.add(currentUri)) { monitor.setWorkRemaining(1000); ListenableFuture<?> future = resolvingPool.submit(new ResourceResolver(resourceSet, currentUri, monitor)); Futures.addCallback(future, new ResolvingFutureCallback(monitor, currentUri)); } } } finally { lock.unlock(); } }
Source:
private void assertGetResult(VM result) { assertNotNull(result); assertEquals("Vm db generation wasn't loaded as expected", new Long(1), result.getDbGeneration()); assertEquals(result, existingVm); }

Target:
private void assertGetResult(VM result) { assertNotNull(result); assertTrue("Vm db generation wasn't loaded as expected", result.getDbGeneration() == 1); assertEquals(result, existingVm); }
Source:
protected Scope visitAnalyze(Analyze node, Optional<Scope> scope) { analysis.setUpdateType("ANALYZE"); QualifiedObjectName tableName = createQualifiedObjectName(session, node, node.getTableName()); if (metadata.getView(session, tableName).isPresent()) { throw new SemanticException(NOT_SUPPORTED, node, "Analyzing views is not supported"); } validateProperties(node.getProperties(), scope); ConnectorId connectorId = metadata.getCatalogHandle(session, tableName.getCatalogName()) .orElseThrow(() -> new PrestoException(NOT_FOUND, "Catalog not found: " + tableName.getCatalogName())); Map<String, Object> analyzeProperties = metadata.getAnalyzePropertyManager().getProperties( connectorId, connectorId.getCatalogName(), mapFromProperties(node.getProperties()), session, metadata, analysis.getParameters()); analysis.setAnalyzeTarget(metadata.getTableHandleForStatisticsCollection(session, tableName, analyzeProperties) .orElseThrow(() -> (new SemanticException(MISSING_TABLE, node, "Table '%s' does not exist", tableName)))); analysis.addEmptyColumnReferencesForTable(accessControl, session.getIdentity(), tableName); accessControl.checkCanInsertIntoTable(session.getRequiredTransactionId(), session.getIdentity(), tableName); return createAndAssignScope(node, scope, Field.newUnqualified("rows", BIGINT)); }

Target:
protected Scope visitAnalyze(Analyze node, Optional<Scope> scope) { analysis.setUpdateType("ANALYZE"); QualifiedObjectName tableName = createQualifiedObjectName(session, node, node.getTableName()); if (metadata.getView(session, tableName).isPresent()) { throw new SemanticException(NOT_SUPPORTED, node, "Analyzing views is not supported"); } validateProperties(node.getProperties(), scope); ConnectorId connectorId = metadata.getCatalogHandle(session, tableName.getCatalogName()) .orElseThrow(() -> new PrestoException(NOT_FOUND, "Catalog not found: " + tableName.getCatalogName())); Map<String, Object> analyzeProperties = metadata.getAnalyzePropertyManager().getProperties( connectorId, connectorId.getCatalogName(), mapFromProperties(node.getProperties()), session, metadata, analysis.getParameters()); TableHandle tableHandle = metadata.getTableHandleForStatisticsCollection(session, tableName, analyzeProperties) .orElseThrow(() -> (new SemanticException(MISSING_TABLE, node, "Table '%s' does not exist", tableName))); analysis.addTableColumnReferences( accessControl, session.getIdentity(), ImmutableMultimap.<QualifiedObjectName, String>builder() .putAll(tableName, metadata.getColumnHandles(session, tableHandle).keySet()) .build()); try { accessControl.checkCanInsertIntoTable(session.getRequiredTransactionId(), session.getIdentity(), tableName); } catch (AccessDeniedException exception) { throw new AccessDeniedException(format("Cannot ANALYZE (missing insert privilege) table %s", tableName)); } analysis.setAnalyzeTarget(tableHandle); return createAndAssignScope(node, scope, Field.newUnqualified("rows", BIGINT)); }
Source:
public <B> Eval<B> bind(final F<A, Eval<B>> f) { if (isTrampoline()) { return bindTrampoline(f, (TrampolineEval<A>) this); } else { return bindTrampoline(f, pureTrampoline(this)); } }

Target:
public final <B> Eval<B> bind(final F<A, Eval<B>> f) { return new BindTrampolineEval<>(f, asTrampoline()); }
Source:
private void parseUpdate(final ReceiveCommand cmd) { RefControl ctl = projectControl.controlForRef(cmd.getRefName()); if (ctl.canUpdate()) { if (isHead(cmd) && !isCommit(cmd)) { return; } validateNewCommits(ctl, cmd); } else { if (GitRepositoryManager.REF_CONFIG.equals(ctl.getRefName())) { errors.put(Error.CONFIG_UPDATE, Collections.<String> emptyList()); } else { addError(Error.UPDATE, ctl.getRefName()); } reject(cmd, String.format("%s cannot update the reference as a fast forward", displayName(ctl))); } }

Target:
private void parseUpdate(final ReceiveCommand cmd) { RefControl ctl = projectControl.controlForRef(cmd.getRefName()); if (ctl.canUpdate()) { if (isHead(cmd) && !isCommit(cmd)) { return; } validateNewCommits(ctl, cmd); } else { if (GitRepositoryManager.REF_CONFIG.equals(ctl.getRefName())) { errors.put(Error.CONFIG_UPDATE, Collections.<String> emptyList()); } else { addError(Error.UPDATE, ctl); } reject(cmd, "can not update the reference as a fast forward"); } }
Source:
private String decode(final String resourceName) { try { return URLDecoder.decode(resourceName, "UTF-8"); } catch (Exception e) { return resourceName; } }

Target:
private String decode(final String resourceName) { try { return URLDecoder.decode(resourceName, "UTF-8"); } catch (UnsupportedEncodingException | IllegalArgumentException e) { return resourceName; } }
Source:
public void messageQueueTest() { MessageQueue msgQueue = new MessageQueue(); Message msg = new Message("MessageQueue Test"); msgQueue.submitMsg(msg); assertEquals(msg.getMsg(), msgQueue.retrieveMsg().getMsg()); }

Target:
public void messageQueueTest() { MessageQueue msgQueue = new MessageQueue(); msgQueue.submitMsg(new Message("MessageQueue Test")); assertEquals(msgQueue.retrieveMsg().getMsg(), "MessageQueue Test"); }
Source:
public User getOneWithFollowers(String userId) { User user = userRepository.findOneByUserId(userId); Hibernate.initialize(user.getFollowers()); return user; }

Target:
public User getOneWithFollowers(String userId) { User one = userRepository.findOneByUserId(userId); one.getFollowers().size(); return one; }
Source:
public void testReleasesItsComponents2() { ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer(); buffer.writeBytes(new byte[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}); ByteBuf s1 = buffer.readRetainedSlice(2); ByteBuf s2 = s1.readRetainedSlice(2); ByteBuf s3 = s2.readRetainedSlice(2); ByteBuf s4 = s3.readRetainedSlice(2); ByteBuf composite = PooledByteBufAllocator.DEFAULT.compositeBuffer() .addComponent(s1) .addComponents(s2, s3, s4) .order(ByteOrder.LITTLE_ENDIAN); assertEquals(1, composite.refCnt()); assertEquals(2, buffer.refCnt()); ReferenceCountUtil.release(composite); assertEquals(0, composite.refCnt()); assertEquals(1, buffer.refCnt()); ReferenceCountUtil.release(buffer); assertEquals(0, buffer.refCnt()); }

Target:
public void testReleasesItsComponents2() { ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer(); buffer.writeBytes(new byte[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}); ByteBuf s1 = buffer.readRetainedSlice(2); ByteBuf s2 = s1.readRetainedSlice(2); ByteBuf s3 = s2.readRetainedSlice(2); ByteBuf s4 = s3.readRetainedSlice(2); ByteBuf composite = Unpooled.compositeBuffer() .addComponent(s1) .addComponents(s2, s3, s4) .order(ByteOrder.LITTLE_ENDIAN); assertEquals(1, composite.refCnt()); assertEquals(2, buffer.refCnt()); composite.release(); assertEquals(0, composite.refCnt()); assertEquals(1, buffer.refCnt()); buffer.release(); assertEquals(0, buffer.refCnt()); }
Source:
private boolean httpAuthentication(Credentials creds) { return true; }

Target:
private boolean httpAuthentication(Credentials creds) { if (creds != null && creds.getUserPrincipal() != null) { return true; } else { return false; } }
Source:
public String logSelectQueriesForCurrentThread(int... theIndexes) { List<String> queries = getSelectQueriesForCurrentThread() .stream() .map(t -> CircularQueueCaptureQueriesListener.formatQueryAsSql(t)) .collect(Collectors.toList()); if (theIndexes != null && theIndexes.length > 0) { List<String> newList = new ArrayList<>(); for (int i = 0; i < theIndexes.length; i++) { newList.add(queries.get(theIndexes[i])); } queries = newList; } String queriesAsString = String.join("\n", queries); ourLog.info("Select Queries:\n{}", queriesAsString); return queriesAsString; }

Target:
public String logSelectQueriesForCurrentThread(int... theIndexes) { List<String> queries = getSelectQueriesForCurrentThread() .stream() .map(CircularQueueCaptureQueriesListener::formatQueryAsSql) .collect(Collectors.toList()); if (theIndexes != null && theIndexes.length > 0) { List<String> newList = new ArrayList<>(); for (int i = 0; i < theIndexes.length; i++) { newList.add(queries.get(theIndexes[i])); } queries = newList; } String queriesAsString = String.join("\n", queries); ourLog.info("Select Queries:\n{}", queriesAsString); return queriesAsString; }
Source:
public void restoreFragmentListeners() { FragmentManager fragmentManager = mainActivity.getSupportFragmentManager(); Fragment fragment = fragmentManager.findFragmentByTag(Constants.COLOR_PICKER_DIALOG_TAG); if (fragment != null) { setupColorPickerDialogListeners((ColorPickerDialog) fragment); } }

Target:
public void restoreFragmentListeners() { Fragment fragment = findFragmentByTag(Constants.COLOR_PICKER_DIALOG_TAG); if (fragment != null) { setupColorPickerDialogListeners((ColorPickerDialog) fragment); } }
Source:
public Set<String> listIndexes(final Connection db, String tableName) throws SQLException { Statement s = db.createStatement(); tableName = tableName.toUpperCase(); try { ResultSet rs = s.executeQuery(String.format( "SELECT distinct index_name FROM user_indexes " + "where table_name = '%s'", tableName)); try { Set<String> indexes = new HashSet<String>(); while (rs.next()) { indexes.add(rs.getString(1).toLowerCase()); } return indexes; } finally { rs.close(); } } finally { s.close(); } }

Target:
public Set<String> listIndexes(final Connection db, String tableName) throws SQLException { PreparedStatement s = db.prepareStatement("SELECT distinct index_name " + "FROM user_indexes WHERE table_name = ?"); try { s.setString(1, tableName.toUpperCase()); ResultSet rs = s.executeQuery(); try { Set<String> indexes = new HashSet<String>(); while (rs.next()) { indexes.add(rs.getString(1).toLowerCase()); } return indexes; } finally { rs.close(); } } finally { s.close(); } }
Source:
public boolean equals(Object object) { if (object == this) { return true; } if (object instanceof BlockSplitBloomFilter) { BlockSplitBloomFilter that = (BlockSplitBloomFilter) object; return Arrays.equals(this.bitset, that.bitset) && this.maximumBytes == that.maximumBytes && this.hashStrategy == that.hashStrategy; } return false; }

Target:
public boolean equals(Object object) { if (object == this) { return true; } if (object instanceof BlockSplitBloomFilter) { BlockSplitBloomFilter that = (BlockSplitBloomFilter) object; return Arrays.equals(this.bitset, that.bitset) && this.getAlgorithm() == that.getAlgorithm() && this.hashStrategy == that.hashStrategy; } return false; }
Source:
public Flux<BlobChangefeedPagedResponse> byPage(String continuationToken, int preferredPageSize) { if (continuationToken != null) { return Flux.error(new UnsupportedOperationException("continuationToken not supported. Use " + "client.getEvents(String) to pass in a cursor.")); } if (preferredPageSize <= 0) { return Flux.error(new IllegalArgumentException("preferredPageSize > 0 required but provided: " + preferredPageSize)); } preferredPageSize = Integer.min(preferredPageSize, defaultPageSize); return changefeed.getEvents() .window(preferredPageSize) .flatMap(eventWrappers -> { Flux<BlobChangefeedEventWrapper> cachedEventWrappers = eventWrappers.cache(); Mono<ChangefeedCursor> c = cachedEventWrappers.last() .map(BlobChangefeedEventWrapper::getCursor); Mono<List<BlobChangefeedEvent>> e = cachedEventWrappers .map(BlobChangefeedEventWrapper::getEvent) .collectList(); return Mono.zip(e, c); }) .map(tuple2 -> new BlobChangefeedPagedResponse(tuple2.getT1(), tuple2.getT2())); }

Target:
public Flux<BlobChangefeedPagedResponse> byPage(String continuationToken, int preferredPageSize) { if (continuationToken != null) { return FluxUtil.fluxError(logger, new UnsupportedOperationException("continuationToken not supported. Use " + "client.getEvents(String) to pass in a cursor.")); } if (preferredPageSize <= 0) { return FluxUtil.fluxError(logger, new IllegalArgumentException("preferredPageSize > 0 required but " + "provided: " + preferredPageSize)); } preferredPageSize = Integer.min(preferredPageSize, DEFAULT_PAGE_SIZE); Changefeed changefeed; if (cursor != null) { changefeed = changefeedFactory.getChangefeed(cursor); } else { changefeed = changefeedFactory.getChangefeed(startTime, endTime); } return changefeed.getEvents() .window(preferredPageSize) .concatMap(eventWrappers -> { Flux<BlobChangefeedEventWrapper> cachedEventWrappers = eventWrappers.cache(); Mono<ChangefeedCursor> c = cachedEventWrappers.last() .map(BlobChangefeedEventWrapper::getCursor); Mono<List<BlobChangefeedEvent>> e = cachedEventWrappers .map(BlobChangefeedEventWrapper::getEvent) .collectList(); return Mono.zip(e, c); }) .map(tuple2 -> new BlobChangefeedPagedResponse(tuple2.getT1(), tuple2.getT2())); }
Source:
public Iterable<PushCertificate> getAll(final String refName) { return new Iterable<PushCertificate>() { @Override public Iterator<PushCertificate> iterator() { final String path = pathName(refName); final RevWalk rw; try { if (reader == null) { load(); } if (commit != null) { rw = new RevWalk(reader); rw.setTreeFilter(AndTreeFilter.create( PathFilterGroup.create( Collections.singleton(PathFilter.create(path))), TreeFilter.ANY_DIFF)); rw.setRewriteParents(false); rw.markStart(rw.parseCommit(commit)); } else { rw = null; } } catch (IOException e) { throw new RuntimeException(e); } return new Iterator<PushCertificate>() { private PushCertificate added = getPending(refName); private PushCertificate next; @Override public boolean hasNext() { try { if (next == null) { if (added != null) { next = added; added = null; return true; } else if (rw == null) { return false; } try { RevCommit c = rw.next(); if (c != null) { try (TreeWalk tw = TreeWalk.forPath( rw.getObjectReader(), path, c.getTree())) { next = read(tw); } } else { next = null; } } catch (IOException e) { throw new RuntimeException(e); } } return next != null; } finally { if (next == null && rw != null) { rw.close(); } } } @Override public PushCertificate next() { hasNext(); PushCertificate n = next; if (n == null) { throw new NoSuchElementException(); } next = null; return n; } @Override public void remove() { throw new UnsupportedOperationException(); } }; } }; }

Target:
public Iterable<PushCertificate> getAll(final String refName) { return new Iterable<PushCertificate>() { @Override public Iterator<PushCertificate> iterator() { return new Iterator<PushCertificate>() { private final String path = pathName(refName); private PushCertificate next; private RevWalk rw; { try { if (reader == null) { load(); } if (commit != null) { rw = new RevWalk(reader); rw.setTreeFilter(AndTreeFilter.create( PathFilterGroup.create( Collections.singleton(PathFilter.create(path))), TreeFilter.ANY_DIFF)); rw.setRewriteParents(false); rw.markStart(rw.parseCommit(commit)); } else { rw = null; } } catch (IOException e) { throw new RuntimeException(e); } } @Override public boolean hasNext() { try { if (next == null) { if (rw == null) { return false; } try { RevCommit c = rw.next(); if (c != null) { try (TreeWalk tw = TreeWalk.forPath( rw.getObjectReader(), path, c.getTree())) { next = read(tw); } } else { next = null; } } catch (IOException e) { throw new RuntimeException(e); } } return next != null; } finally { if (next == null && rw != null) { rw.close(); rw = null; } } } @Override public PushCertificate next() { hasNext(); PushCertificate n = next; if (n == null) { throw new NoSuchElementException(); } next = null; return n; } @Override public void remove() { throw new UnsupportedOperationException(); } }; } }; }
Source:
private boolean notRacyClean(long read) { return read - lastModified > (fsTimestampResolution.toNanos() + 1) * 11 / 10_000_000; }

Target:
private boolean notRacyClean(long read) { long racyNanos = (fsTimestampResolution.toNanos() + 1) * 11 / 10; return (read - lastModified) * 1_000_000 > racyNanos; }
Source:
public static Date getDueDate(final Event event) { return event.getDueDateAmountMap().keySet().stream() .sorted(Comparator.reverseOrder()).findFirst().get().toDate(); }

Target:
public static Date getDueDate(final Event event) { return event.getDueDateAmountMap().keySet() .stream() .max(Comparator.naturalOrder()) .map(LocalDate::toDate) .orElseThrow(() -> new DomainException("key.return.argument", "No due date found for event " + event.getExternalId()); }
Source:
public static void addConfigDriveDisk(final VirtualMachineProfile profile, final DataStore dataStore) throws ResourceUnavailableException { boolean isoAvailable = false; final String isoPath = ConfigDrive.createConfigDrivePath(profile.getInstanceName()); for (DiskTO dataTo : profile.getDisks()) { if (dataTo.getPath().equals(isoPath)) { isoAvailable = true; break; } } if (!isoAvailable) { TemplateObjectTO dataTO = new TemplateObjectTO(); if (dataStore == null) { throw new ResourceUnavailableException("Config drive disk add failed, datastore not available", ConfigDriveNetworkElement.class, 0L); } dataTO.setDataStore(dataStore.getTO()); dataTO.setUuid(profile.getUuid()); dataTO.setPath(isoPath); dataTO.setFormat(Storage.ImageFormat.ISO); profile.addDisk(new DiskTO(dataTO, CONFIGDRIVEDISKSEQ.longValue(), isoPath, Volume.Type.ISO)); } else { LOG.warn("Config drive iso already is in VM profile."); } }

Target:
private void addConfigDriveDisk(final VirtualMachineProfile profile, final DataStore dataStore) throws ResourceUnavailableException { boolean isoAvailable = false; final String isoPath = ConfigDrive.createConfigDrivePath(profile.getInstanceName()); for (DiskTO dataTo : profile.getDisks()) { if (dataTo.getPath().equals(isoPath)) { isoAvailable = true; break; } } if (!isoAvailable) { TemplateObjectTO dataTO = new TemplateObjectTO(); if (dataStore == null) { throw new ResourceUnavailableException("Config drive disk add failed, datastore not available", ConfigDriveNetworkElement.class, 0L); } dataTO.setDataStore(dataStore.getTO()); dataTO.setUuid(profile.getUuid()); dataTO.setPath(isoPath); dataTO.setFormat(Storage.ImageFormat.ISO); profile.addDisk(new DiskTO(dataTO, CONFIGDRIVEDISKSEQ.longValue(), isoPath, Volume.Type.ISO)); } else { LOG.warn("Config drive iso already is in VM profile."); } }
Source:
public static List<File> getTestInputFiles(FilenameFilter filter) { File[] testFiles = getPackagePath().toFile().listFiles(filter); File[] testPartialFiles = getPackagePath().resolve("partial").toFile().listFiles(filter); File[] testMultifilePartailFiles = getPackagePath().resolve("multifilePartial").toFile().listFiles(filter); File[] testPartialCrossModuleTypeImportsFiles = getPackagePath().resolve("partialCrossModuleTypeImports").toFile().listFiles(filter); File[] testOutputBaseFiles = getPackagePath().resolve("outputBase").toFile().listFiles(filter); List<File> filesList = Lists.newArrayList(testFiles); filesList.addAll(Arrays.asList(testPartialFiles)); filesList.addAll(Arrays.asList(testMultifilePartailFiles)); filesList.addAll(Arrays.asList(testPartialCrossModuleTypeImportsFiles)); filesList.addAll(Arrays.asList(testOutputBaseFiles)); Stream<File> jsFiles = filesList.stream().filter(f -> !f.getName().endsWith(".zip")); Stream<File> zipFiles = filesList .stream() .filter(f -> f.getName().endsWith(".zip")) .map(File::getPath) .flatMap( f -> { try (ZipFile zipFile = new ZipFile(f)) { return zipFile .stream() .filter(e -> !e.isDirectory()) .filter(e -> e.getName().endsWith(".js")) .map(e -> f + "!/" + e.getName()) .map(Paths::get) .map(Path::toFile) .collect(Collectors.toList()) .stream(); } catch (IOException e) { throw new RuntimeException("failed to read zip file " + f, e); } }); return Stream.concat(jsFiles, zipFiles).collect(Collectors.toList()); }

Target:
public static List<File> getTestInputFiles(FilenameFilter filter) { File[] testFiles = getPackagePath().toFile().listFiles(filter); File[] testPartialFiles = getPackagePath().resolve("partial").toFile().listFiles(filter); File[] testMultifilePartailFiles = getPackagePath().resolve("multifilePartial").toFile().listFiles(filter); File[] testPartialCrossModuleTypeImportsFiles = getPackagePath().resolve("partialCrossModuleTypeImports").toFile().listFiles(filter); File[] testOutputBaseFiles = getPackagePath().resolve("outputBase").toFile().listFiles(filter); List<File> filesList = Lists.newArrayList(testFiles); filesList.addAll(Arrays.asList(testPartialFiles)); filesList.addAll(Arrays.asList(testMultifilePartailFiles)); filesList.addAll(Arrays.asList(testPartialCrossModuleTypeImportsFiles)); filesList.addAll(Arrays.asList(testOutputBaseFiles)); Stream<File> jsFiles = filesList.stream().filter(f -> !f.getName().endsWith(".zip")); Stream<File> zipFiles = filesList .stream() .filter(f -> f.getName().endsWith(".zip")) .map(File::getPath) .map(DeclarationGenerator::getJsEntryPathsFromZip) .flatMap(List::stream) .map(Path::toFile); return Stream.concat(jsFiles, zipFiles).collect(Collectors.toList()); }
Source:
public void testNetworkError() throws IOException, InterruptedException { initialize(); List<RequestInfo> requestInfoList = new ArrayList<RequestInfo>(); List<ResponseInfo> responseInfoList; int requestCount; requestInfoList.add(new RequestInfo(host2, port2, new MockSend(5))); requestInfoList.add(new RequestInfo(host2, port2, new MockSend(6))); requestCount = requestInfoList.size(); selector.setBeBad(true); do { responseInfoList = networkClient.sendAndPoll(requestInfoList); requestInfoList.clear(); for (ResponseInfo responseInfo : responseInfoList) { NetworkClientErrorCode error = responseInfo.getError(); ByteBuffer response = responseInfo.getResponse(); Assert.assertNotNull("Should have encountered an error", error); Assert.assertEquals("Should have received a connection unavailable error", NetworkClientErrorCode.NetworkError, error); Assert.assertNull("Should not have received a valid response", response); requestCount--; } } while (requestCount > 0); responseInfoList = networkClient.sendAndPoll(requestInfoList); requestInfoList.clear(); Assert.assertEquals("No responses are expected at this time", 0, responseInfoList.size()); selector.setBeBad(false); }

Target:
public void testNetworkError() throws IOException, InterruptedException { List<RequestInfo> requestInfoList = new ArrayList<RequestInfo>(); List<ResponseInfo> responseInfoList; requestInfoList.add(new RequestInfo(host2, port2, new MockSend(5))); requestInfoList.add(new RequestInfo(host2, port2, new MockSend(6))); int requestCount = requestInfoList.size(); int responseCount = 0; selector.setBeBad(true); do { responseInfoList = networkClient.sendAndPoll(requestInfoList); requestInfoList.clear(); for (ResponseInfo responseInfo : responseInfoList) { NetworkClientErrorCode error = responseInfo.getError(); ByteBuffer response = responseInfo.getResponse(); Assert.assertNotNull("Should have encountered an error", error); Assert.assertEquals("Should have received a connection unavailable error", NetworkClientErrorCode.NetworkError, error); Assert.assertNull("Should not have received a valid response", response); responseCount++; } } while (requestCount > responseCount); responseInfoList = networkClient.sendAndPoll(requestInfoList); requestInfoList.clear(); Assert.assertEquals("No responses are expected at this time", 0, responseInfoList.size()); selector.setBeBad(false); }
Source:
public void testFindByRegionsAndComplexFiltersExcludeMultiple() { List<Region> regions = new ArrayList<>(); regions.add(new Region("11", 183000, 183300)); List<String> exclude = new ArrayList<>(); exclude.add("files"); exclude.add("ids"); List<VariantEntity> variantEntityList = variantEntityRepository.findByRegionsAndComplexFilters(regions, null, null, VariantEntityRepository.RelationalOperator.NONE, null, VariantEntityRepository.RelationalOperator.NONE, null, VariantEntityRepository.RelationalOperator.NONE, null, exclude, new PageRequest(0, 100000000)); for (VariantEntity currVariantEntity : variantEntityList) { assertTrue(currVariantEntity.getSourceEntries().isEmpty()); assertTrue(currVariantEntity.getIds().isEmpty()); } exclude = new ArrayList<>(); variantEntityList = variantEntityRepository.findByRegionsAndComplexFilters(regions, null, null, VariantEntityRepository.RelationalOperator.NONE, null, VariantEntityRepository.RelationalOperator.NONE, null, VariantEntityRepository.RelationalOperator.NONE, null, exclude, new PageRequest(0, 100000000)); for (VariantEntity currVariantEntity : variantEntityList) { assertFalse(currVariantEntity.getSourceEntries().isEmpty()); assertFalse(currVariantEntity.getIds().isEmpty()); } }

Target:
public void testFindByRegionsAndComplexFiltersExcludeMultiple() { List<Region> regions = new ArrayList<>(); regions.add(new Region("11", 183000, 183300)); List<String> exclude = new ArrayList<>(); exclude.add("files"); exclude.add("ids"); List<VariantEntity> variantEntityList = variantEntityRepository.findByRegionsAndComplexFilters(regions, null, null, VariantEntityRepository.RelationalOperator.NONE, null, VariantEntityRepository.RelationalOperator.NONE, null, VariantEntityRepository.RelationalOperator.NONE, null, exclude, new PageRequest(0, 100000000)); for (VariantEntity currVariantEntity : variantEntityList) { assertTrue(currVariantEntity.getSourceEntries().isEmpty()); assertTrue(currVariantEntity.getIds().isEmpty()); } }
Source:
public AssumptionViolatedException(String assumption, boolean valueMatcher, Object value, Matcher<?> matcher) { if (value instanceof Throwable) { initCause((Throwable) value); } this.assumption = assumption; this.value = value; this.matcher = matcher; this.valueMatcher = valueMatcher; }

Target:
public AssumptionViolatedException(String assumption, boolean valueMatcher, Object value, Matcher<?> matcher) { this.assumption = assumption; this.value = value; this.matcher = matcher; this.valueMatcher = valueMatcher; }
Source:
public byte[] getCacheKey() { final byte[] aggBytes = StringUtils.toUtf8(aggregationName); final byte[] valBytes = Bytes.toArray(Collections.singletonList(value)); return ByteBuffer.allocate(1 + aggBytes.length + valBytes.length) .put(CACHE_KEY) .put(aggBytes) .put(valBytes) .array(); }

Target:
public byte[] getCacheKey() { final byte[] aggBytes = StringUtils.toUtf8(aggregationName); final byte[] valBytes = new byte[] { value.byteValue() }; return ByteBuffer.allocate(1 + aggBytes.length + valBytes.length) .put(CACHE_KEY) .put(aggBytes) .put(valBytes) .array(); }
Source:
public static List<ChromeCast> get() { synchronized (INSTANCE.chromeCasts) { return new ArrayList<ChromeCast>(INSTANCE.chromeCasts); } }

Target:
public static List<ChromeCast> get() { return new ArrayList<ChromeCast>(INSTANCE.chromeCasts); }
Source:
public CastFromHandWithoutPayingManaCostEffect(FilterCard filter, boolean fromHand, Duration duration) { super(duration, Outcome.Detriment); this.filter = filter; this.fromHand = fromHand; }

Target:
public CastFromHandWithoutPayingManaCostEffect(FilterCard filter, boolean fromHand, Duration duration) { super(duration, Outcome.Detriment); this.filter = filter; this.fromHand = fromHand; this.staticText = "You may cast " + filter.getMessage() + (fromHand ? " from your hand" : "") + " without paying their mana costs"; }
Source:
public GitSynchronizeData(Repository repository, String srcRev, String dstRev, boolean includeLocal) throws IOException { repo = repository; Ref srcRef = repo.getRef(srcRev); Ref dstRef = repo.getRef(dstRev); ObjectWalk ow = new ObjectWalk(repo); ow.markStart(ow.parseCommit(srcRef.getObjectId())); this.srcRev = ow.next(); ow.reset(); ow.markStart(ow.parseCommit(dstRef.getObjectId())); this.dstRev = ow.next(); this.includeLocal = includeLocal; repoParentPath = repo.getDirectory().getParentFile().getAbsolutePath(); projects = new HashSet<IProject>(); final IProject[] workspaceProjects = ResourcesPlugin.getWorkspace() .getRoot().getProjects(); for (IProject project : workspaceProjects) { RepositoryMapping mapping = RepositoryMapping.getMapping(project); if (mapping != null && mapping.getRepository() == repo) projects.add(project); } }

Target:
public GitSynchronizeData(Repository repository, String srcRev, String dstRev, boolean includeLocal) throws IOException { repo = repository; Ref srcRef = repo.getRef(srcRev); Ref dstRef = repo.getRef(dstRev); ObjectWalk ow = new ObjectWalk(repo); this.srcRev = ow.parseCommit(srcRef.getObjectId()); this.dstRev = ow.parseCommit(dstRef.getObjectId()); this.includeLocal = includeLocal; repoParentPath = repo.getDirectory().getParentFile().getAbsolutePath(); projects = new HashSet<IProject>(); final IProject[] workspaceProjects = ResourcesPlugin.getWorkspace() .getRoot().getProjects(); for (IProject project : workspaceProjects) { RepositoryMapping mapping = RepositoryMapping.getMapping(project); if (mapping != null && mapping.getRepository() == repo) projects.add(project); } }
Source:
public LogReplicationServerRouter(List<AbstractServer> servers) { this.serverEpoch = ((BaseServer) servers.get(0)).serverContext.getServerEpoch(); this.servers = ImmutableList.copyOf(servers); this.handlerMap = new EnumMap<>(CorfuMsgType.class); servers.forEach(server -> { try { server.getHandler().getHandledTypes().forEach(x -> handlerMap.put(x, server)); } catch (UnsupportedOperationException ex) { log.warn("No registered CorfuMsg handler for server {}", server); } }); this.serverAdapter = getAdapter(((BaseServer) servers.get(0)).serverContext); }

Target:
public LogReplicationServerRouter(List<AbstractServer> servers) { this.serverEpoch = ((BaseServer) servers.get(0)).serverContext.getServerEpoch(); this.servers = ImmutableList.copyOf(servers); this.handlerMap = new EnumMap<>(CorfuMsgType.class); servers.forEach(server -> { try { server.getHandler().getHandledTypes().forEach(x -> handlerMap.put(x, server)); } catch (UnsupportedOperationException ex) { log.error("No registered CorfuMsg handler for server {}", server, ex); } }); this.serverAdapter = getAdapter(((BaseServer) servers.get(0)).serverContext); }
Source:
public void assertIsEqualToNormalizingNewlines(AssertionInfo info, CharSequence actual, CharSequence expected) { String actualNormalized = actual.toString().replaceAll("\\r\\n", "\n"); String expectedNormalized = expected.toString().replaceAll("\\r\\n", "\n"); if(!actualNormalized.equals(expectedNormalized)) throw failures.failure(info, shouldBeEqual(actual, expected)); }

Target:
public void assertIsEqualToNormalizingNewlines(AssertionInfo info, CharSequence actual, CharSequence expected) { String actualNormalized = actual.toString().replace("\r\n", "\n"); String expectedNormalized = expected.toString().replace("\r\n", "\n"); if(!actualNormalized.equals(expectedNormalized)) throw failures.failure(info, shouldBeEqual(actual, expected)); }
Source:
public SingleOp(String name, Runnable op) { setName(name); this.op = op; }

Target:
public SingleOp(String name, Runnable op) { super(); setName(name); this.op = op; }
Source:
public void onSaveInstanceState(Bundle outState) { outState.putBoolean(ExtraConstants.HAS_EXISTING_INSTANCE, !mIsWaitingForPlayServices); super.onSaveInstanceState(outState); }

Target:
public void onSaveInstanceState(Bundle outState) { outState.putBoolean(ExtraConstants.HAS_EXISTING_INSTANCE, true); outState.putBoolean(IS_WAITING_FOR_PLAY_SERVICES, mIsWaitingForPlayServices); super.onSaveInstanceState(outState); }