auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void run() { reader = new BufferedReader(new InputStreamReader(in)); String line; String responseText = ""; while (!interrupted) { try { line = reader.readLine(); if (line == null) { throw new EOFException("lost connection"); } else { Matcher m = EVENT_PATTERN.matcher(line); logger.trace("Received message: {}", line); if (m.matches()) { String code = m.group(1); String repeatsHex = m.group(2); String button = m.group(3); String remote = m.group(4); int repeats = Integer.parseInt(repeatsHex, 16); LIRCButtonEvent buttonMessage = new LIRCButtonEvent(remote, button, repeats, code); connector.sendButtonToListeners(buttonMessage); } else { if ("BEGIN".equals(line)) { responseText = ""; } else if ("END".equals(line)) { processResponse(responseText); responseText = null; } else { responseText += line + "\n"; } } } } catch (InterruptedIOException e) { Thread.currentThread().interrupt(); logger.error("Interrupted via InterruptedIOException"); } catch (EOFException e) { logger.error("Lost connection to LIRC server", e); connector.sendErrorToListeners(e.getMessage()); this.interrupt(); } catch (IOException e) { if (!interrupted) { logger.error("Reading from socket failed", e); connector.sendErrorToListeners(e.getMessage()); } } catch (LIRCResponseException e) { logger.error("Invalid message received", e); } } IOUtils.closeQuietly(reader); }

Target:
public void run() { reader = new BufferedReader(new InputStreamReader(in)); String line; String responseText = ""; while (!interrupted) { try { line = reader.readLine(); if (line == null) { throw new EOFException("lost connection"); } else { logger.trace("Received message: {}", line); Matcher m = EVENT_PATTERN.matcher(line); if (m.matches()) { String code = m.group(1); String repeatsHex = m.group(2); String button = m.group(3); String remote = m.group(4); int repeats = Integer.parseInt(repeatsHex, 16); LIRCButtonEvent buttonMessage = new LIRCButtonEvent(remote, button, repeats, code); connector.sendButtonToListeners(buttonMessage); } else { if ("BEGIN".equals(line)) { responseText = ""; } else if ("END".equals(line)) { processResponse(responseText); responseText = null; } else { responseText += line + "\n"; } } } } catch (InterruptedIOException e) { Thread.currentThread().interrupt(); logger.error("Interrupted via InterruptedIOException"); } catch (EOFException e) { logger.error("Lost connection to LIRC server", e); connector.sendErrorToListeners(e.getMessage()); this.interrupt(); } catch (IOException e) { if (!interrupted) { logger.error("Reading from socket failed", e); connector.sendErrorToListeners(e.getMessage()); } } catch (LIRCResponseException e) { logger.error("Invalid message received", e); } } IOUtils.closeQuietly(reader); }
Source:
private void addTestResultException(XMLStringBuffer xmlBuffer, ITestResult testResult) { Throwable exception = testResult.getThrowable(); if (exception != null) { Properties exceptionAttrs = new Properties(); exceptionAttrs.setProperty(XMLReporterConfig.ATTR_CLASS, exception.getClass().getName()); xmlBuffer.push(XMLReporterConfig.TAG_EXCEPTION, exceptionAttrs); if (!Utils.isStringEmpty(exception.getMessage())) { xmlBuffer.push(XMLReporterConfig.TAG_MESSAGE); xmlBuffer.addCDATA(exception.getMessage()); xmlBuffer.pop(); } String[] stackTraces = Utils.stackTrace(exception, false); int level = calculateStackTraceLevels(testResult); switch (level) { case XMLReporterConfig.STACKTRACE_SHORT: xmlBuffer.push(XMLReporterConfig.TAG_SHORT_STACKTRACE); xmlBuffer.addCDATA(stackTraces[0]); xmlBuffer.pop(); break; case XMLReporterConfig.STACKTRACE_FULL: xmlBuffer.push(XMLReporterConfig.TAG_FULL_STACKTRACE); xmlBuffer.addCDATA(stackTraces[1]); xmlBuffer.pop(); break; default: } xmlBuffer.pop(); } }

Target:
private void addTestResultException(XMLStringBuffer xmlBuffer, ITestResult testResult) { Throwable exception = testResult.getThrowable(); if (exception != null) { Properties exceptionAttrs = new Properties(); exceptionAttrs.setProperty(XMLReporterConfig.ATTR_CLASS, exception.getClass().getName()); xmlBuffer.push(XMLReporterConfig.TAG_EXCEPTION, exceptionAttrs); if (!Utils.isStringEmpty(exception.getMessage())) { xmlBuffer.push(XMLReporterConfig.TAG_MESSAGE); xmlBuffer.addCDATA(exception.getMessage()); xmlBuffer.pop(); } XMLReporterConfig.StackTraceLevels level = calculateStackTraceLevels(testResult); switch (level) { case SHORT: xmlBuffer.push(XMLReporterConfig.TAG_SHORT_STACKTRACE); xmlBuffer.addCDATA(Utils.shortStackTrace(exception, false)); xmlBuffer.pop(); break; case FULL: xmlBuffer.push(XMLReporterConfig.TAG_FULL_STACKTRACE); xmlBuffer.addCDATA(Utils.longStackTrace(exception, false)); xmlBuffer.pop(); break; default: } xmlBuffer.pop(); } }
Source:
public ButtonRs() { this( new ButtonRs.BuildInfoRetriever() { @Override public TestResponse info(final UriBuilder builder, final String stnd) { return RestTester.start( builder.path(stnd).build() ) .header( "Accept", MediaType.APPLICATION_XML_UTF_8.toString() ) .get("retrieve stand"); } } ); }

Target:
public ButtonRs() { this(ButtonRs.DEFAULT_BUILD); }
Source:
void doPrefetch(long relativeOffset, long size) throws IOException { long sizeToRead = Math.min(size, getMessageInfo().getSize() - relativeOffset); prefetchedData = ByteBuffer.allocate((int) sizeToRead); getChannel().position(offset.getOffset() + relativeOffset); getChannel().read(prefetchedData); prefetchedDataRelativeOffset = relativeOffset; }

Target:
void doPrefetch(long relativeOffset, long size) throws IOException { long sizeToRead = Math.min(size, getMessageInfo().getSize() - relativeOffset); prefetchedData = ByteBuffer.allocate((int) sizeToRead); getChannel().read(prefetchedData, offset.getOffset() + relativeOffset); prefetchedDataRelativeOffset = relativeOffset; }
Source:
public void setResponse(int status, InputStream entity, MultiValueMap<String, String> headers) throws IOException { RequestContext context = RequestContext.getCurrentContext(); context.setResponseStatusCode(status); if (entity != null) { context.setResponseDataStream(entity); } boolean isOriginResponseGzipped = false; if (headers.containsKey(CONTENT_ENCODING)) { List<String> collection = headers.get(CONTENT_ENCODING); for (String header : collection) { if (HTTPRequestUtils.getInstance().isGzipped(header)) { isOriginResponseGzipped = true; break; } } } context.setResponseGZipped(isOriginResponseGzipped); for (Entry<String, List<String>> header : headers.entrySet()) { String name = header.getKey(); for (String value : header.getValue()) { context.addOriginResponseHeader(name, value); if (name.equalsIgnoreCase(CONTENT_LENGTH)) { context.setOriginContentLength(value); } if (isIncludedHeader(name)) { context.addZuulResponseHeader(name, value); } } } }

Target:
public void setResponse(int status, InputStream entity, MultiValueMap<String, String> headers) throws IOException { RequestContext context = RequestContext.getCurrentContext(); context.setResponseStatusCode(status); if (entity != null) { context.setResponseDataStream(entity); } boolean isOriginResponseGzipped = false; for (Entry<String, List<String>> header : headers.entrySet()) { String name = header.getKey(); for (String value : header.getValue()) { if (name.equalsIgnoreCase(HttpHeaders.CONTENT_ENCODING) && HTTPRequestUtils.getInstance().isGzipped(value)) { isOriginResponseGzipped = true; } if (name.equalsIgnoreCase(HttpHeaders.CONTENT_LENGTH)) { context.setOriginContentLength(value); } if (isIncludedHeader(name)) { context.addZuulResponseHeader(name, value); } } } context.setResponseGZipped(isOriginResponseGzipped); }
Source:
public List<AuthorizationAttribute> getAll() { return Stream.of( Optional.ofNullable(readers).orElse(new ArrayList<>()), Optional.ofNullable(admins).orElse(new ArrayList<>())) .flatMap(Collection::stream).collect(Collectors.toList()); }

Target:
public List<AuthorizationAttribute> getAll() { return Stream.of(readers, admins) .flatMap(Collection::stream).collect(Collectors.toList()); }
Source:
private ArrayList<MediaOption> initOtherMediaFileOptions() { ArrayList<MediaOption> otherMediaOptions = new ArrayList<>(); Bundle arguments = getArguments(); FragmentActivity activity = getActivity(); if (activity == null || arguments == null) { AppLog.e(T.EDITOR, "Failed to initialize other media options because the activity or getArguments() is null"); return otherMediaOptions; } String packageName = activity.getApplication().getPackageName(); int stockMediaResourceId = getResources().getIdentifier("photo_picker_choose_file", "string", packageName); otherMediaOptions.add(new MediaOption(MEDIA_SOURCE_FILE, getString(stockMediaResourceId))); return otherMediaOptions; }

Target:
private ArrayList<MediaOption> initOtherMediaFileOptions() { ArrayList<MediaOption> otherMediaOptions = new ArrayList<>(); FragmentActivity activity = getActivity(); if (activity == null) { AppLog.e(T.EDITOR, "Failed to initialize other media options because the activity is null"); return otherMediaOptions; } String packageName = activity.getApplication().getPackageName(); int chooseFileResourceId = getResources().getIdentifier("photo_picker_choose_file", "string", packageName); otherMediaOptions.add(new MediaOption(MEDIA_SOURCE_FILE, getString(chooseFileResourceId))); return otherMediaOptions; }
Source:
public void waitContextMenuJavaDocText(String expectedText) { waitJavaDocPopupSrcAttributeIsNotEmpty(); loadPageDriverWait.until( new ExpectedCondition<Boolean>() { @Override public Boolean apply(WebDriver driver) { String javaDocPopupHtmlText = ""; try { javaDocPopupHtmlText = getJavaDocPopupText(); } catch (IOException e) { LOG.error("Can not get java doc HTML text from autocomplete context menu in editor"); } return verifyJavaDoc(javaDocPopupHtmlText, expectedText); } }); }

Target:
public void waitContextMenuJavaDocText(String expectedText) { waitJavaDocPopupSrcAttributeIsNotEmpty(); loadPageDriverWait.until( (ExpectedCondition<Boolean>) driver -> { String javaDocPopupHtmlText = ""; try { javaDocPopupHtmlText = getJavaDocPopupText(); } catch (IOException e) { LOG.error( "Can not get java doc HTML text from autocomplete context menu in editor"); } return verifyJavaDoc(javaDocPopupHtmlText, expectedText); }); }
Source:
public List<BakedQuad> getFaceQuads(EnumFacing side) { ArrayList<BakedQuad> ret = new ArrayList(base.getFaceQuads(side)); for (IFlexibleBakedModel bakedPart : parts) ret.addAll(bakedPart.getFaceQuads(side)); return ret; }

Target:
public List<BakedQuad> getFaceQuads(EnumFacing side) { return faces.get(side); }
Source:
public int hashCode() { int result = super.hashCode(); result = 31 * result + getLibraryId(); result = 31 * result + getReadGroup(); return result; }

Target:
public int hashCode() { int result = getLibraryId(); result = 31 * result + getReadGroup(); result = 31 * result + getTile(); result = 31 * result + getY(); result = 31 * result + getX(); return result; }
Source:
public void updateEndpointRegistry(String registryId, String registryName, String registryType, EndpointRegistryInfo endpointRegistryInfo) throws EndpointRegistryException { String tenantDomain = MultitenantUtils .getTenantDomain(APIUtil.replaceEmailDomainBack(endpointRegistryInfo.getOwner())); int tenantId; try { tenantId = ServiceReferenceHolder.getInstance().getRealmService().getTenantManager() .getTenantId(tenantDomain); if (!registryType.equals(endpointRegistryInfo.getType()) && registryDAO.isEndpointRegistryTypeExists(endpointRegistryInfo.getType(), tenantId)) { EndpointRegistryUtil.handleResourceAlreadyExistsException("Endpoint Registry of type '" + endpointRegistryInfo.getType() + "' already exists"); } else if (!registryName.equals(endpointRegistryInfo.getName()) && registryDAO.isEndpointRegistryNameExists(endpointRegistryInfo.getName(), tenantId)) { EndpointRegistryUtil.handleResourceAlreadyExistsException("Endpoint Registry with name '" + endpointRegistryInfo.getName() + "' already exists"); } registryDAO.updateEndpointRegistry(registryId, endpointRegistryInfo, username); } catch (UserStoreException e) { String msg = "Error while retrieving tenant information"; log.error(msg, e); throw new EndpointRegistryException("Error in retrieving Tenant Information while updating " + "endpoint registry with id :" + registryId, e); } }

Target:
public void updateEndpointRegistry(String registryId, String registryName, String registryType, EndpointRegistryInfo endpointRegistryInfo) throws EndpointRegistryException { String tenantDomain = MultitenantUtils .getTenantDomain(APIUtil.replaceEmailDomainBack(endpointRegistryInfo.getOwner())); int tenantId; try { tenantId = ServiceReferenceHolder.getInstance().getRealmService().getTenantManager() .getTenantId(tenantDomain); if (!registryType.equals(endpointRegistryInfo.getType()) && registryDAO.isEndpointRegistryTypeExists(endpointRegistryInfo.getType(), tenantId)) { EndpointRegistryUtil.raiseResourceAlreadyExistsException("Endpoint Registry of type '" + endpointRegistryInfo.getType() + "' already exists"); } else if (!registryName.equals(endpointRegistryInfo.getName()) && registryDAO.isEndpointRegistryNameExists(endpointRegistryInfo.getName(), tenantId)) { EndpointRegistryUtil.raiseResourceAlreadyExistsException("Endpoint Registry with name '" + endpointRegistryInfo.getName() + "' already exists"); } registryDAO.updateEndpointRegistry(registryId, endpointRegistryInfo, username); } catch (UserStoreException e) { String msg = "Error while retrieving tenant information"; log.error(msg, e); throw new EndpointRegistryException("Error in retrieving Tenant Information while updating " + "endpoint registry with id :" + registryId, e); } }
Source:
public void addTransactionHandler(Coordinator coordinator, Receiver receiver) { ProtonTransactionHandler transactionHandler = new ProtonTransactionHandler(sessionSPI); coordinator.setCapabilities(Symbol.getSymbol("[\"amqp:local-transactions\",\"amqp:multi-txns-per-ssn\",\"amqp:multi-ssns-per-txn\"]")); receiver.setContext(transactionHandler); receiver.open(); receiver.flow(100); }

Target:
public void addTransactionHandler(Coordinator coordinator, Receiver receiver) { ProtonTransactionHandler transactionHandler = new ProtonTransactionHandler(sessionSPI); coordinator.setCapabilities(Symbol.getSymbol("amqp:local-transactions"), Symbol.getSymbol("amqp:multi-txns-per-ssn"), Symbol.getSymbol("amqp:multi-ssns-per-txn")); receiver.setContext(transactionHandler); receiver.open(); receiver.flow(100); }
Source:
public void elementTextShouldNotBe(String locator, String text, String...params) { String message = robot.getParamsValue(params, 0, ""); List<WebElement> elements = elementFind(locator, true, true); Boolean ignoreCase = robot.getParamsValue(params, 1, Boolean.FALSE); String actual = elements.get(0).getText(); String textToCompare = text; if (ignoreCase) { actual = actual.toLowerCase(); textToCompare = textToCompare.toLowerCase(); } if (textToCompare.equals(actual)) { if (StringUtils.isNotBlank(message)) { message = String.format("The text of element '%s' should have been '%s', but it was '%s'.", locator, text, actual); } throw new SeleniumLibraryNonFatalException(message); } }

Target:
public void elementTextShouldNotBe(String locator, String text, String...params) { String message = robot.getParamsValue(params, 0, ""); List<WebElement> elements = elementFind(locator, true, true); Boolean ignoreCase = robot.getParamsValue(params, 1, Boolean.FALSE); String actual = elements.get(0).getText(); if (textIs(actual, text, ignoreCase)) { if (StringUtils.isEmpty(message)) { message = String.format("The text of element '%s' should have been '%s', but it was '%s'.", locator, text, actual); } throw new SeleniumLibraryNonFatalException(message); } }
Source:
public boolean acquireLockPatiently(KeyType key, int maxWaitMillis) { final long startTime = System.currentTimeMillis(); boolean acquiredLock; while (!(acquiredLock = acquireLock(key)) && System.currentTimeMillis() - startTime < maxWaitMillis) { try { TimeUnit.MILLISECONDS.sleep(250L); } catch(InterruptedException ie) { log.info("{}: interrupted acquiring lock", cacheName, ie); } } if (!acquiredLock) { log.warn("{}: failed to acquire lock within milliseconds", cacheName, maxWaitMillis); } return acquiredLock; }

Target:
public boolean acquireLockPatiently(KeyType key, int maxWaitMillis) { final long startTime = System.currentTimeMillis(); boolean acquiredLock; while (!(acquiredLock = acquireLock(key)) && System.currentTimeMillis() - startTime < maxWaitMillis) { try { TimeUnit.MILLISECONDS.sleep(250L); } catch(InterruptedException ie) { log.info("{}: interrupted acquiring lock", cacheName, ie); Thread.currentThread().interrupt(); } } if (!acquiredLock) { log.warn("{}: failed to acquire lock within milliseconds", cacheName, maxWaitMillis); } return acquiredLock; }
Source:
public void afterScenario(Scenario scenario) { if (scenario.isFailed()) { container.afterTest(new TestDescription() { @Override public String getTestId() { return scenario.getId(); } @Override public String getFilesystemFriendlyName() { return scenario.getName(); } }, Optional.of(RuntimeException.class)); } container.stop(); }

Target:
public void afterScenario(Scenario scenario) { container.afterTest(new TestDescription() { @Override public String getTestId() { return scenario.getId(); } @Override public String getFilesystemFriendlyName() { return scenario.getName(); } }, Optional.of(scenario).filter(Scenario::isFailed).map(__ -> new RuntimeException())); }
Source:
Request build() throws UnsupportedEncodingException { if (multipartBody != null && multipartBody.getPartCount() == 0) { throw new IllegalStateException("Multipart requests must contain at least one part."); } String apiUrl = this.apiUrl; StringBuilder url = new StringBuilder(apiUrl); if (apiUrl.endsWith("/")) { url.deleteCharAt(url.length() - 1); } url.append(relativeUrl); StringBuilder queryParams = this.queryParams; if (queryParams != null) { url.append(queryParams); } TypedOutput body = this.body; if (body != null) { boolean hasContentType = false; if (headers != null) { for (Header header : headers) { if ("Content-Type".equalsIgnoreCase(header.getName())) { hasContentType = true; break; } } } if (!hasContentType) { addHeader("Content-Type", body.mimeType()); } long length = body.length(); if (length != -1) { addHeader("Content-Length", String.valueOf(length)); } } return new Request(requestMethod, url.toString(), headers, body); }

Target:
Request build() throws UnsupportedEncodingException { if (multipartBody != null && multipartBody.getPartCount() == 0) { throw new IllegalStateException("Multipart requests must contain at least one part."); } String apiUrl = this.apiUrl; StringBuilder url = new StringBuilder(apiUrl); if (apiUrl.endsWith("/")) { url.deleteCharAt(url.length() - 1); } url.append(relativeUrl); StringBuilder queryParams = this.queryParams; if (queryParams != null) { url.append(queryParams); } TypedOutput body = this.body; if (body != null) { if (!hasContentTypeHeader) { addHeader("Content-Type", body.mimeType()); } long length = body.length(); if (length != -1) { addHeader("Content-Length", String.valueOf(length)); } } return new Request(requestMethod, url.toString(), headers, body); }
Source:
void processRuntimes(String rtLocations, String installLocation, String installerBase, int step) throws IOException { String jarLocation = P2DirectorStarterListener.findPathJar(Unpacker.class); String[] rtl = rtLocations.split(","); handler.nextStep("Processing Supplemental Runtimes", step + 1, 1); installLocation += java.io.File.separator + "runtimes" + java.io.File.separator; Path zipPath = null; java.util.jar.JarFile jar = new java.util.jar.JarFile(jarLocation); JarEntry runtimeEntry = null; for (int i = 0; i < rtl.length; i++) { runtimeEntry = jar.getJarEntry(rtl[i]); if (runtimeEntry != null) { handler.progress(i + 1, "Runtime " + runtimeEntry.getName()); String separator = java.io.File.separator; if (separator.equals("\\")) separator = "/"; String[] rtlComponents = rtl[i].split(separator); File entryFile = new File(installLocation, rtlComponents[0]); entryFile.setLastModified(runtimeEntry.getTime()); entryFile.getParentFile().mkdirs(); InputStream in = new BufferedInputStream(jar.getInputStream(runtimeEntry)); OutputStream out = new BufferedOutputStream(new FileOutputStream(entryFile)); byte[] buffer = new byte[BUFFER_SIZE]; for (;;) { int nBytes = in.read(buffer); if (nBytes <= 0) break; out.write(buffer, 0, nBytes); } out.flush(); out.close(); in.close(); zipPath = Paths.get(entryFile.getAbsolutePath()); inflateZip(zipPath.toString(), installLocation); Files.delete(zipPath); } } jar.close(); }

Target:
void processRuntimes(String rtLocations, String installLocation, String installerBase, int step) throws IOException { String jarLocation = P2DirectorStarterListener.findPathJar(Unpacker.class); String[] rtl = rtLocations.split(","); handler.nextStep("Processing Supplemental Runtimes", step + 1, 1); installLocation += java.io.File.separator + "runtimes" + java.io.File.separator; Path zipPath = null; java.util.jar.JarFile jar = new java.util.jar.JarFile(jarLocation); JarEntry runtimeEntry = null; for (int i = 0; i < rtl.length; i++) { runtimeEntry = jar.getJarEntry(rtl[i]); if (runtimeEntry != null) { handler.progress(i + 1, "Runtime " + runtimeEntry.getName()); String[] rtlComponents = rtl[i].split("/"); File entryFile = new File(installLocation, rtlComponents[0]); entryFile.setLastModified(runtimeEntry.getTime()); entryFile.getParentFile().mkdirs(); InputStream in = new BufferedInputStream(jar.getInputStream(runtimeEntry)); OutputStream out = new BufferedOutputStream(new FileOutputStream(entryFile)); byte[] buffer = new byte[BUFFER_SIZE]; for (;;) { int nBytes = in.read(buffer); if (nBytes <= 0) break; out.write(buffer, 0, nBytes); } out.flush(); out.close(); in.close(); zipPath = Paths.get(entryFile.getAbsolutePath()); inflateZip(zipPath.toString(), installLocation); Files.delete(zipPath); } } jar.close(); }
Source:
private String findPdpFromEmailAddress() { return parameterService.getParameterValueAsString(KFSConstants.ParameterNamespaces.PDP, KfsParameterConstants.BATCH_COMPONENT, KFSConstants.FROM_EMAIL_ADDRESS_PARM_NM); }

Target:
private String findPdpFromEmailAddress() { return parameterService.getParameterValueAsString(KFSConstants.CoreModuleNamespaces.PDP, KfsParameterConstants.BATCH_COMPONENT, KFSConstants.FROM_EMAIL_ADDRESS_PARM_NM); }
Source:
private ConsumerRecords<K, V> pollKafkaBroker(PollablePartitionsInfo pollablePartitionsInfo) { doSeekRetriableTopicPartitions(pollablePartitionsInfo.pollableEarliestRetriableOffsets); Set<TopicPartition> pausedPartitions = new HashSet<>(kafkaConsumer.assignment()); pausedPartitions.removeIf(pollablePartitionsInfo.pollablePartitions::contains); try { kafkaConsumer.pause(pausedPartitions); final ConsumerRecords<K, V> consumerRecords = kafkaConsumer.poll(kafkaSpoutConfig.getPollTimeoutMs()); ackRetriableOffsetsIfCompactedAway(pollablePartitionsInfo.pollableEarliestRetriableOffsets, consumerRecords); final int numPolledRecords = consumerRecords.count(); LOG.debug("Polled records from Kafka", numPolledRecords); if (kafkaSpoutConfig.getProcessingGuarantee() == KafkaSpoutConfig.ProcessingGuarantee.AT_MOST_ONCE) { Map<TopicPartition, OffsetAndMetadata> offsetsToCommit = createOffsetsToCommitForConsumedOffsets(kafkaConsumer.assignment()); kafkaConsumer.commitSync(offsetsToCommit); LOG.debug("Committed offsets to Kafka", offsetsToCommit); } return consumerRecords; } finally { kafkaConsumer.resume(pausedPartitions); } }

Target:
private ConsumerRecords<K, V> pollKafkaBroker(PollablePartitionsInfo pollablePartitionsInfo) { doSeekRetriableTopicPartitions(pollablePartitionsInfo.pollableEarliestRetriableOffsets); Set<TopicPartition> pausedPartitions = new HashSet<>(kafkaConsumer.assignment()); pausedPartitions.removeIf(pollablePartitionsInfo.pollablePartitions::contains); try { kafkaConsumer.pause(pausedPartitions); final ConsumerRecords<K, V> consumerRecords = kafkaConsumer.poll(kafkaSpoutConfig.getPollTimeoutMs()); ackRetriableOffsetsIfCompactedAway(pollablePartitionsInfo.pollableEarliestRetriableOffsets, consumerRecords); final int numPolledRecords = consumerRecords.count(); LOG.debug("Polled records from Kafka", numPolledRecords); if (kafkaSpoutConfig.getProcessingGuarantee() == KafkaSpoutConfig.ProcessingGuarantee.AT_MOST_ONCE) { Map<TopicPartition, OffsetAndMetadata> offsetsToCommit = createFetchedOffsetsMetadata(kafkaConsumer.assignment()); kafkaConsumer.commitSync(offsetsToCommit); LOG.debug("Committed offsets to Kafka", offsetsToCommit); } return consumerRecords; } finally { kafkaConsumer.resume(pausedPartitions); } }
Source:
public void testWhenAnyResultFirstSuccess() { runTaskTest(new Callable<Task<?>>() { @Override public Task<?> call() throws Exception { final ArrayList<Task<Void>> tasks = new ArrayList<Task<Void>>(); final Task<Void> firstToCompleteSuccess = Task.callInBackground(new Callable<Void>() { @Override public Void call() throws Exception { Thread.sleep(50); return null; } }); tasks.addAll(launchTasksWithRandomCompletions(10)); tasks.add(firstToCompleteSuccess); return Task.whenAnyResult(tasks).continueWith(new Continuation<Task<Void>, Object>() { @Override public Object then(Task<Task<Void>> task) throws Exception { assertTrue(task.isCompleted()); assertFalse(task.isFaulted()); assertFalse(task.isCancelled()); assertEquals(task.getResult(), firstToCompleteSuccess); assertTrue(task.getResult().isCompleted()); assertFalse(task.getResult().isCancelled()); assertFalse(task.getResult().isFaulted()); return null; } }); } }); }

Target:
public void testWhenAnyResultFirstSuccess() { runTaskTest(new Callable<Task<?>>() { @Override public Task<?> call() throws Exception { final ArrayList<Task<Integer>> tasks = new ArrayList<>(); final Task<Integer> firstToCompleteSuccess = Task.callInBackground(new Callable<Integer>() { @Override public Integer call() throws Exception { Thread.sleep(50); return 10; } }); tasks.addAll(launchTasksWithRandomCompletions(5)); tasks.add(firstToCompleteSuccess); tasks.addAll(launchTasksWithRandomCompletions(5)); return Task.whenAnyResult(tasks).continueWith(new Continuation<Task<Integer>, Void>() { @Override public Void then(Task<Task<Integer>> task) throws Exception { assertTrue(task.isCompleted()); assertFalse(task.isFaulted()); assertFalse(task.isCancelled()); assertEquals(firstToCompleteSuccess, task.getResult()); assertTrue(task.getResult().isCompleted()); assertFalse(task.getResult().isCancelled()); assertFalse(task.getResult().isFaulted()); assertEquals(10, (int)task.getResult().getResult()); return null; } }); } }); }
Source:
protected RouteBuilder createRouteBuilder() throws Exception { return new RouteBuilder() { @Override public void configure() throws Exception { from("netty4:udp://localhost:{{port}}?option."+ ChannelOption.RCVBUF_ALLOCATOR.name() +"=#"+ChannelOption.RCVBUF_ALLOCATOR.name()) .to("mock:result"); } }; }

Target:
protected RouteBuilder createRouteBuilder() throws Exception { return new RouteBuilder() { @Override public void configure() throws Exception { from("netty4:udp://localhost:{{port}}?receiveBufferSizePredictor=2048&sync=false") .to("mock:result"); } }; }
Source:
public void onLoad(String mixinPackage) { boolean isOptifineCoreModLoaded = true; try { Class.forName("optifine.OptiFineForgeTweaker"); } catch (ClassNotFoundException e) { isOptifineCoreModLoaded = false; } modDependencyConditions.defaultReturnValue(true); modDependencyConditions.put( "cubicchunks.asm.mixin.selectable.client.MixinRenderChunk_NoOptifine", !isOptifineCoreModLoaded); modDependencyConditions.put( "cubicchunks.asm.mixin.selectable.client.MixinRenderChunk_OptifineSpecific", isOptifineCoreModLoaded); modDependencyConditions.put( "cubicchunks.asm.mixin.selectable.client.MixinRenderGlobal_BiggerRenderChunk_NoOptifine", !isOptifineCoreModLoaded); modDependencyConditions.put( "cubicchunks.asm.mixin.selectable.client.MixinRenderGlobal_BiggerRenderChunk_OptifineSpecific", isOptifineCoreModLoaded); File folder = new File(".", "config"); folder.mkdirs(); File configFile = new File(folder, "cubicchunks_mixin_config.json"); LOGGER.info("Loading configuration file " + configFile.getAbsolutePath()); try { if (!configFile.exists()) this.writeConfigToJson(configFile); this.readConfigFromJson(configFile); } catch (IOException e) { e.printStackTrace(); } }

Target:
public void onLoad(String mixinPackage) { boolean isOptifineCoreModLoaded = true; try { Class.forName("optifine.OptiFineForgeTweaker"); } catch (ClassNotFoundException e) { isOptifineCoreModLoaded = false; } modDependencyConditions.defaultReturnValue(true); modDependencyConditions.put( "cubicchunks.asm.mixin.selectable.client.MixinRenderChunk_NoOptifine", !isOptifineCoreModLoaded); modDependencyConditions.put( "cubicchunks.asm.mixin.selectable.client.MixinRenderChunk_OptifineSpecific", isOptifineCoreModLoaded); modDependencyConditions.put( "cubicchunks.asm.mixin.selectable.client.MixinRenderGlobal_BiggerRenderChunk_OptifineSpecific", isOptifineCoreModLoaded); File folder = new File(".", "config"); folder.mkdirs(); File configFile = new File(folder, "cubicchunks_mixin_config.json"); LOGGER.info("Loading configuration file " + configFile.getAbsolutePath()); try { if (!configFile.exists()) this.writeConfigToJson(configFile); this.readConfigFromJson(configFile); } catch (IOException e) { e.printStackTrace(); } }
Source:
private StringBuffer getPathFromDirInternal(@Nonnull CachedParentVDir baseDir, @Nonnull CachedParentVDir currentDir) { if (baseDir == currentDir) { return new StringBuffer(); } CachedParentVDir currentParent = currentDir.getParent(); assert currentParent != null; return getPathFromDirInternal(baseDir, currentParent).append(currentDir.getName()).append('/'); }

Target:
private static StringBuffer getPathFromDirInternal(@Nonnull CachedParentVDir baseDir, @Nonnull CachedParentVDir currentDir) { if (baseDir == currentDir) { return new StringBuffer(); } CachedParentVDir currentParent = currentDir.getParent(); assert currentParent != null; return getPathFromDirInternal(baseDir, currentParent).append(currentDir.getName()).append('/'); }
Source:
private LoginService initLoginService() { if (authenticationControlType == null) { final String[] splittedProperty = ServerConfiguration .getSplittedProperty(ServerConfiguration.AUTHENTICATION_POLICY); authenticationControlType = ESAuthenticationControlType.valueOf(splittedProperty[0]); } final String delayString = ServerConfiguration.getProperties().getProperty( ServerConfiguration.AUTHENTICATION_LOGIN_DELAY_FAILED_REQUESTS, ServerConfiguration.AUTHENTICATION_LOGIN_DELAY_FAILED_REQUESTS_DEFAULT); int delay; try { delay = Integer.valueOf(delayString); } catch (final NumberFormatException ex) { ModelUtil.logWarning(MessageFormat.format(Messages.AccessControl_IllegalDelayValueInProperties, ServerConfiguration.AUTHENTICATION_LOGIN_DELAY_FAILED_REQUESTS), ex); delay = -1; } return new LoginService( authenticationControlType, sessions, orgUnitProvider, getOrgUnitResolverServive(), delay); }

Target:
private LoginService initLoginService() throws FatalESException { if (authenticationControlType == null) { final String[] splittedProperty = ServerConfiguration .getSplittedProperty(ServerConfiguration.AUTHENTICATION_POLICY); authenticationControlType = ESAuthenticationControlType.valueOf(splittedProperty[0]); } final String delayString = ServerConfiguration.getProperties().getProperty( ServerConfiguration.AUTHENTICATION_LOGIN_DELAY_FAILED_REQUESTS, ServerConfiguration.AUTHENTICATION_LOGIN_DELAY_FAILED_REQUESTS_DEFAULT); int delay; try { delay = Integer.valueOf(delayString); } catch (final NumberFormatException ex) { throw new FatalESException(MessageFormat.format(Messages.AccessControl_IllegalDelayValueInProperties, ServerConfiguration.AUTHENTICATION_LOGIN_DELAY_FAILED_REQUESTS), ex); } return new LoginService( authenticationControlType, sessions, orgUnitProvider, getOrgUnitResolverServive(), delay); }
Source:
public String encode(CharSequence rawPassword) { return new String(Hex.encode(SCrypt.generate(Utf8.encode(rawPassword), saltBytes, cpuCost, memoryCost, parallelization, saltBytes.length))); }

Target:
public String encode(CharSequence rawPassword) { return digest(rawPassword, saltGenerator.generateKey()); }
Source:
public void checkSwitchProjectsWhenContributeIsFalse() { openContributeTab(); setStateContributeChecboxAndCloseForm(true); projectExplorer.waitAndSelectItem(FIRST_PROJECT_NAME); pullRequestPanel.waitOpenPanel(); openContributeTab(); setStateContributeChecboxAndCloseForm(false); projectExplorer.waitAndSelectItem(FIRST_PROJECT_NAME); pullRequestPanel.waitRepoUrl(firstProjectUrl); pullRequestPanel.waitProjectName(FIRST_PROJECT_NAME); projectExplorer.waitAndSelectItem(SECOND_PROJECT_NAME); pullRequestPanel.waitRepoUrl(secondProjectUrl); pullRequestPanel.waitProjectName(SECOND_PROJECT_NAME); projectExplorer.waitAndSelectItem(THIRD_PROJECT_NAME); pullRequestPanel.waitTetxNotVcsProject(EXP_TEXT_NOT_VCS); }

Target:
public void checkSwitchProjectsWhenContributeIsFalse() { openContributeTab(); setStateContributeChecboxAndCloseForm(true); projectExplorer.waitAndSelectItem(FIRST_PROJECT_NAME); pullRequestPanel.waitOpenPanel(); openContributeTab(); setStateContributeChecboxAndCloseForm(false); projectExplorer.waitAndSelectItem(FIRST_PROJECT_NAME); pullRequestPanel.waitRepoUrl(firstProjectUrl); pullRequestPanel.waitProjectName(FIRST_PROJECT_NAME); projectExplorer.waitAndSelectItem(SECOND_PROJECT_NAME); pullRequestPanel.waitRepoUrl(secondProjectUrl); pullRequestPanel.waitProjectName(SECOND_PROJECT_NAME); projectExplorer.waitAndSelectItem(THIRD_PROJECT_NAME); pullRequestPanel.waitTextNotVcsProject(EXP_TEXT_NOT_VCS); }
Source:
public void init(Project.NameKey project, ReceivePack rp) { QuotaSection quotaSection = quotaFinder.firstMatching(project); if (quotaSection == null) { return; } Long maxRepoSize = quotaSection.getMaxRepoSize(); if (maxRepoSize == null) { return; } try { long maxPackSize = Math.max(0, maxRepoSize - getDiskUsage(project)); rp.setMaxPackSizeLimit(maxPackSize); } catch (IOException e) { log.warn("Couldn't setMaxPackSizeLimit", e); } }

Target:
public void init(Project.NameKey project, ReceivePack rp) { QuotaSection quotaSection = quotaFinder.firstMatching(project); if (quotaSection == null) { return; } Long maxRepoSize = quotaSection.getMaxRepoSize(); if (maxRepoSize == null) { return; } try { long maxPackSize = Math.max(0, maxRepoSize - getDiskUsage(project)); rp.setMaxPackSizeLimit(maxPackSize); } catch (IOException e) { log.warn("Couldn't setMaxPackSizeLimit on receive-pack for " + project.get(), e); } }
Source:
public static <T> long count( Iterable<T> iterable, Predicate<T> filter ) { try ( ResourceIterator<T> iterator = Iterators.asResourceIterator( iterable.iterator() ) ) { return Iterators.count( iterator, filter ); } }

Target:
public static <T> long count( Iterable<T> iterable, Predicate<T> filter ) { Iterator<T> iterator = iterable.iterator(); try { return Iterators.count( iterator, filter ); } finally { if ( iterator instanceof ResourceIterator ) { ((ResourceIterator) iterator).close(); } } }
Source:
public void validate(PasswordChangeDTO passwordChangeDTO) throws PasswordOldMatchValidationException { Assert.notNull(passwordChangeDTO); Assert.notNull(passwordChangeDTO.getOldPassword()); UserDetails userDetails = null; try { userDetails = authenticationService.getCurrentUserDetails(); } catch (UserNotLoggedInException e) { e.printStackTrace(); throw new PasswordOldMatchValidationException(); } if (!(bCryptPasswordEncoder.matches(passwordChangeDTO.getOldPassword(), userDetails.getPassword()))) { throw new PasswordOldMatchValidationException(); } }

Target:
public void validate(PasswordChangeDTO passwordChangeDTO) throws PasswordOldMatchValidationException { Assert.notNull(passwordChangeDTO); Assert.notNull(passwordChangeDTO.getOldPassword()); UserDetails userDetails; try { userDetails = authenticationService.getCurrentUserDetails(); } catch (UserNotLoggedInException e) { log.error("User is not logged in: ", e); throw new PasswordOldMatchValidationException(); } if (!(bCryptPasswordEncoder.matches(passwordChangeDTO.getOldPassword(), userDetails.getPassword()))) { throw new PasswordOldMatchValidationException(); } }
Source:
public void startServer() throws RemotingException { port = NetUtils.getAvailablePort(); ReplierDispatcher dispatcher = new ReplierDispatcher(); dispatcher.addReplier(RpcMessage.class, new RpcMessageHandler()); dispatcher.addReplier(Data.class, (channel, msg) -> { for (int i = 0; i < 10000; i++) { System.currentTimeMillis(); } return new StringMessage("hello world"); }); exchangeServer = Exchangers.bind(URL.valueOf("dubbo://localhost:" + port), dispatcher); }

Target:
public void startServer() throws RemotingException { port = NetUtils.getAvailablePort(); ReplierDispatcher dispatcher = new ReplierDispatcher(); dispatcher.addReplier(RpcMessage.class, new RpcMessageHandler()); dispatcher.addReplier(Data.class, (channel, msg) -> new StringMessage("hello world")); exchangeServer = Exchangers.bind(URL.valueOf("dubbo://localhost:" + port), dispatcher); }
Source:
public MessagePanel(final ChangeMessage msg) { SafeHtml message = new SafeHtmlBuilder().append(msg.getMessage().trim()); message.setFindReplaceList(Gerrit.getConfig().getCommentLinks()); final Widget l = message.wikify().runFindReplaceList().toBlockWidget(); l.setStyleName("gerrit-ChangeMessage-Message"); initWidget(l); }

Target:
public MessagePanel(final ChangeMessage msg) { final Widget l = new SafeHtmlBuilder().append(msg.getMessage().trim()).wikify() .replaceAll(Gerrit.getConfig().getCommentLinks()).toBlockWidget(); l.setStyleName("gerrit-ChangeMessage-Message"); initWidget(l); }
Source:
private void executeCommand(String command) { ServiceReference ref = hostBundle.getServiceReference( SHELL_SERVICE_REFERENCE); if (ref == null) { LOGGER.error(I18N.tr("No shell service is available.")); return; } ShellService shell = (ShellService) hostBundle.getService(ref); try { try { outputField.getDocument().insertString(outputField.getDocument().getLength(), "-> "+command+"\n", null); } catch(BadLocationException ex) { LOGGER.debug(ex.getLocalizedMessage(), ex); } try { shell.executeCommand(command, new PrintStream(info), new PrintStream(error)); } catch (Exception ex) { LOGGER.error(ex.getLocalizedMessage(),ex); } finally { try { info.flush(); error.flush(); outputField.setCaretPosition(outputField.getDocument().getLength()); } catch(IOException ex) { LOGGER.error(ex.getLocalizedMessage(),ex); } } } finally { hostBundle.ungetService(ref); } }

Target:
private void executeCommand(String command) { ServiceReference ref = hostBundle.getServiceReference( SHELL_SERVICE_REFERENCE); if (ref == null) { LOGGER.error(I18N.tr("No shell service is available.")); return; } ShellService shell = (ShellService) hostBundle.getService(ref); try { try { outputField.getDocument().insertString(outputField.getDocument().getLength(), "osgi> "+command+"\n", null); } catch(BadLocationException ex) { LOGGER.debug(ex.getLocalizedMessage(), ex); } try { shell.executeCommand(command, new PrintStream(info), new PrintStream(error)); } catch (Exception ex) { LOGGER.error(ex.getLocalizedMessage(),ex); } finally { try { info.flush(); error.flush(); outputField.setCaretPosition(outputField.getDocument().getLength()); } catch(IOException ex) { LOGGER.error(ex.getLocalizedMessage(),ex); } } } finally { hostBundle.ungetService(ref); } }
Source:
private RexNode simplifyIs2(SqlKind kind, RexNode a, RexUnknownAs unknownAs) { final RexNode simplified; switch (kind) { case IS_NULL: simplified = simplifyIsNull(a); if (simplified != null) { return simplified; } break; case IS_NOT_NULL: simplified = simplifyIsNotNull(a); if (simplified != null) { return simplified; } break; case IS_TRUE: case IS_NOT_FALSE: if (!a.getType().isNullable()) { return simplify(a, unknownAs); } else { RexNode newSub = simplify(a, kind == SqlKind.IS_TRUE ? RexUnknownAs.FALSE : TRUE); if (newSub == a) { return null; } return rexBuilder.makeCall(RexUtil.op(kind), ImmutableList.of(newSub)); } case IS_FALSE: case IS_NOT_TRUE: if (!a.getType().isNullable()) { return simplify(rexBuilder.makeCall(SqlStdOperatorTable.NOT, a), unknownAs); } break; } switch (a.getKind()) { case NOT: final SqlOperator notKind = RexUtil.op(kind.negateNullSafe()); final RexNode arg = ((RexCall) a).operands.get(0); return simplify(rexBuilder.makeCall(notKind, arg), UNKNOWN); } final RexNode a2 = simplify(a, UNKNOWN); if (a != a2) { return rexBuilder.makeCall(RexUtil.op(kind), ImmutableList.of(a2)); } return null; }

Target:
private RexNode simplifyIs2(SqlKind kind, RexNode a, RexUnknownAs unknownAs) { final RexNode simplified; switch (kind) { case IS_NULL: simplified = simplifyIsNull(a); if (simplified != null) { return simplified; } break; case IS_NOT_NULL: simplified = simplifyIsNotNull(a); if (simplified != null) { return simplified; } break; case IS_TRUE: case IS_NOT_FALSE: if (!a.getType().isNullable()) { return simplify(a, unknownAs); } else { RexNode newSub = simplify(a, kind == SqlKind.IS_TRUE ? RexUnknownAs.FALSE : RexUnknownAs.TRUE); if (newSub == a) { return null; } return rexBuilder.makeCall(RexUtil.op(kind), ImmutableList.of(newSub)); } case IS_FALSE: case IS_NOT_TRUE: if (!a.getType().isNullable()) { return simplify(rexBuilder.makeCall(SqlStdOperatorTable.NOT, a), unknownAs); } break; } switch (a.getKind()) { case NOT: final SqlOperator notKind = RexUtil.op(kind.negateNullSafe()); final RexNode arg = ((RexCall) a).operands.get(0); return simplify(rexBuilder.makeCall(notKind, arg), UNKNOWN); } final RexNode a2 = simplify(a, UNKNOWN); if (a != a2) { return rexBuilder.makeCall(RexUtil.op(kind), ImmutableList.of(a2)); } return null; }
Source:
public Mono<CosmosDatabaseResponse> createDatabaseIfNotExists(String id, ThroughputProperties throughputProperties) { return this.getDatabase(id).read().onErrorResume(exception -> { final Throwable unwrappedException = Exceptions.unwrap(exception); if (unwrappedException instanceof CosmosException) { final CosmosException cosmosException = (CosmosException) unwrappedException; if (cosmosException.getStatusCode() == HttpConstants.StatusCodes.NOTFOUND) { CosmosDatabaseRequestOptions options = new CosmosDatabaseRequestOptions(); ModelBridgeInternal.setThroughputProperties(options, throughputProperties); return createDatabase(new CosmosDatabaseProperties(id), options); } } return Mono.error(unwrappedException); }); }

Target:
public Mono<CosmosDatabaseResponse> createDatabaseIfNotExists(String id, ThroughputProperties throughputProperties) { return withContext(context -> createDatabaseIfNotExistsInternal(getDatabase(id), throughputProperties, context)); }
Source:
public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); String searchQueryExtra = null; String searchUrl = null; if (savedInstanceState != null) { searchUrl = savedInstanceState.getString(INSTANCE_CURRENT_DISCOVER_URL, null); } if (searchUrl == null && getArguments() != null) { searchQueryExtra = getArguments().getString(Router.EXTRA_SEARCH_QUERY); } if (searchQueryExtra != null) { initSearch(searchQueryExtra); } else { loadUrl(searchUrl == null ? getInitialUrl() : searchUrl); } if (shouldShowSubjectDiscovery()) { initSubjects(); } if (!EventBus.getDefault().isRegistered(this)) { EventBus.getDefault().register(this); } setWebViewActionListener(); }

Target:
public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); String searchQueryExtra = null; String searchUrl = null; if (savedInstanceState != null) { searchUrl = savedInstanceState.getString(INSTANCE_CURRENT_DISCOVER_URL, null); } if (searchUrl == null && getArguments() != null) { searchQueryExtra = getArguments().getString(Router.EXTRA_SEARCH_QUERY); } if (searchQueryExtra != null) { initSearch(searchQueryExtra); } else { loadUrl(searchUrl == null ? getInitialUrl() : searchUrl); } if (!EventBus.getDefault().isRegistered(this)) { EventBus.getDefault().register(this); } setWebViewActionListener(); }
Source:
public int read(long position, byte[] buffer, int offset, int length) throws IOException { int bytesRead = inputStream.positionedRead(position, buffer, offset, length); if (cacheValidationEnabled) { byte[] validationBuffer = new byte[bytesRead]; originInputStream.read(position, validationBuffer, 0, bytesRead); for (int i = 0; i < bytesRead; i++) { verify(buffer[offset + i] == validationBuffer[i], "corrupted buffer at position " + i); } } return bytesRead; }

Target:
public int read(long position, byte[] buffer, int offset, int length) throws IOException { int bytes = inputStream.positionedRead(position, buffer, offset, length); if (cacheValidationEnabled) { byte[] validationBuffer = new byte[bytes]; dataTierInputStream.get().read(position, validationBuffer, 0, bytes); for (int i = 0; i < bytes; i++) { verify(buffer[offset + i] == validationBuffer[i], "corrupted buffer at position " + i); } } return bytes; }
Source:
public void test() throws Exception { String rawInput = getResource(TEST_DOC); String input; String expected = getResource(CONVERTED_HTML); input = NormalizeHtml.convertToNormalizedHTML(rawInput); input = bodyOnly(input); expected = bodyOnly(expected); input = input.replaceAll("\r", ""); expected = expected.replaceAll("\r", ""); Assert.assertEquals("Converted HTML does not equal expected", expected, input); input = rawInput.replaceAll("BODY", "body"); input = bodyOnly(input); input = NormalizeHtml.wrapAndNormalizeHTML(input, false, false, false); input = bodyOnly(input); input = input.replaceAll("\r", ""); Assert.assertEquals("Converted body only HTML does not equal expected", expected, input); }

Target:
public void test() throws Exception { String rawInput = getResource(TEST_DOC); String expected = getResource(CONVERTED_HTML); String input = NormalizeHtml.convertToNormalizedHTML(rawInput); input = bodyOnly(input); expected = bodyOnly(expected); input = input.replaceAll("\r", ""); expected = expected.replaceAll("\r", ""); Assert.assertEquals("Converted HTML does not equal expected", expected, input); input = rawInput.replaceAll("BODY", "body"); input = bodyOnly(input); input = NormalizeHtml.wrapAndNormalizeHTML(input, false, false, false); input = bodyOnly(input); input = input.replaceAll("\r", ""); Assert.assertEquals("Converted body only HTML does not equal expected", expected, input); }
Source:
public void onRefresh() { mSyncSavingsAccountTransactionPresenter.loadDatabaseSavingsAccountTransactions(); mSyncSavingsAccountTransactionPresenter.loadPaymentTypeOption(); if (swipeRefreshLayout.isRefreshing()) swipeRefreshLayout.setRefreshing(false); }

Target:
public void onRefresh() { mSyncSavingsAccountTransactionPresenter.loadDatabaseSavingsAccountTransactions(); mSyncSavingsAccountTransactionPresenter.loadPaymentTypeOption(); if (swipeRefreshLayout.isRefreshing()) { swipeRefreshLayout.setRefreshing(false); } }
Source:
public AsyncReportStatusListener( final String path, final UUID uuid, final String mimeType, final List<? extends ReportProgressListener> callbackListeners ) { this.path = path; this.uuid = uuid; this.mimeType = mimeType; this.callbackListeners = callbackListeners; final ExtendedConfiguration config = ClassicEngineBoot.getInstance().getExtendedConfig(); firstPageMode = config.getBoolProperty( "org.pentaho.reporting.platform.plugin.output.FirstPageMode" ); }

Target:
public AsyncReportStatusListener( final String path, final UUID uuid, final String mimeType, final List<? extends ReportProgressListener> callbackListeners ) { ArgumentNullException.validate( "callbackListeners", callbackListeners ); this.path = path; this.uuid = uuid; this.mimeType = mimeType; this.callbackListeners = Collections.unmodifiableList( callbackListeners ); final ExtendedConfiguration config = ClassicEngineBoot.getInstance().getExtendedConfig(); firstPageMode = config.getBoolProperty( "org.pentaho.reporting.platform.plugin.output.FirstPageMode" ); }
Source:
public boolean hasAllFinishedReading() throws IOException { if (m_closed) throw new IOException("Segment closed"); if (m_readCursors.size() == 0) return false; for (String cid : m_readCursors.keySet()) { SegmentReader reader = m_readCursors.get(cid); if (reader.m_objectReadIndex < m_numOfEntries) { return false; } } return true; }

Target:
public boolean hasAllFinishedReading() throws IOException { if (m_closed) throw new IOException("Segment closed"); if (m_readCursors.size() == 0) return false; for (SegmentReader reader : m_readCursors.values()) { if (reader.m_objectReadIndex < m_numOfEntries) { return false; } } return true; }