auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static <T, S> Stream<S> map( List<T> values, Function<T, S> mapper, Executor executor, int concurrency) { int size = values.size(); if (size <= 1 || concurrency == 1) { return values.stream().map(mapper); } List<StreamElement<T, S>> elements = values.stream() .map((Function<T, StreamElement<T, S>>) StreamElement::new) .collect(Collectors.toList()); Queue<StreamElement<T, S>> queue = new ConcurrentLinkedQueue<>(elements); if (size < concurrency) { concurrency = size; } for (int i = 0; i < concurrency; i++) { executor.execute(() -> runOperationsAndUpdateFutures(queue, mapper)); } return streamAllUnchecked(elements); }

Target:
public static <T, S> Stream<S> map( List<T> values, Function<T, S> mapper, Executor executor, int concurrency) { int size = values.size(); if (size <= 1 || concurrency == 1) { return values.stream().map(mapper); } List<StreamElement<T, S>> elements = values.stream() .map(value -> StreamElement.of(value, new CompletableFuture<S>())) .collect(Collectors.toList()); Queue<StreamElement<T, S>> queue = new ConcurrentLinkedQueue<>(elements); int numThreads = size < concurrency ? size : concurrency; for (int i = 0; i < numThreads; i++) { executor.execute(() -> runOperationsAndUpdateFutures(queue, mapper)); } return streamAllUnchecked(elements); }
Source:
public void testModerateResponsesButton() { resultsPage = loginToInstructorFeedbackResultsPage("CFResultsUiT.instr", "Open Session"); resultsPage.displayByQuestion(); ThreadHelper.waitFor(2000); ______TS("Typical case: test moderate responses button for individual response (including no response)"); verifyModerateResponsesButton(2, "CFResultsUiT.alice.b@gmail.tmt", "CFResultsUiT.benny.c@gmail.tmt", "CFResultsUiT.charlie.d@gmail.tmt", "CFResultsUiT.danny.e@gmail.tmt", "drop.out@gmail.tmt", "extra.guy@gmail.tmt", "CFResultsUiT.emily.f@gmail.tmt"); ______TS("Typical case: test moderate responses button for team response"); verifyModerateResponsesButton(4, "Team 1</td></div>'\""); resultsPage = loginToInstructorFeedbackResultsPage("CFResultsUiT.instr", "Session with Instructors as Givers"); resultsPage.displayByQuestion(); ThreadHelper.waitFor(2000); ______TS("Typical case: test moderate responses button for instructors as givers"); verifyModerateResponsesButton(1, "CFResultsUiT.instr@gmail.tmt", "CFResultsUiT.instr@gmail.tmt", "CFResultsUiT.instr@gmail.tmt"); }

Target:
public void testModerateResponsesButton() { resultsPage = loginToInstructorFeedbackResultsPage("CFResultsUiT.instr", "Open Session"); resultsPage.displayByQuestion(); ______TS("Typical case: test moderate responses button for individual response (including no response)"); verifyModerateResponsesButton(2, "CFResultsUiT.alice.b@gmail.tmt", "CFResultsUiT.benny.c@gmail.tmt", "CFResultsUiT.charlie.d@gmail.tmt", "CFResultsUiT.danny.e@gmail.tmt", "drop.out@gmail.tmt", "extra.guy@gmail.tmt", "CFResultsUiT.emily.f@gmail.tmt"); ______TS("Typical case: test moderate responses button for team response"); verifyModerateResponsesButton(4, "Team 1</td></div>'\""); resultsPage = loginToInstructorFeedbackResultsPage("CFResultsUiT.instr", "Session with Instructors as Givers"); resultsPage.displayByQuestion(); resultsPage.waitForPageToLoad(); ______TS("Typical case: test moderate responses button for instructors as givers"); verifyModerateResponsesButton(1, "CFResultsUiT.instr@gmail.tmt", "CFResultsUiT.instr@gmail.tmt", "CFResultsUiT.instr@gmail.tmt"); }
Source:
private void checkManagedConfiguration() { Log.d(TAG, "Checking managed configuration"); if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) { RestrictionsManager restrictionsManager = (RestrictionsManager) getSystemService(Context.RESTRICTIONS_SERVICE); Bundle appRestrictions = restrictionsManager.getApplicationRestrictions(); if (appRestrictions.containsKey("profileUrl")) { Toast.makeText(this, "Found managed configuration install URL " + appRestrictions.getString("profileUrl"), Toast.LENGTH_LONG).show(); Log.d(TAG, "Found managed configuration install URL " + appRestrictions.getString("profileUrl")); incomingRef = appRestrictions.getString("profileUrl"); uiState = UiState.READY_TO_INSTALL; uiStateScreenTransition(); startResourceInstall(); } } }

Target:
private void checkManagedConfiguration() { Log.d(TAG, "Checking managed configuration"); if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) { RestrictionsManager restrictionsManager = (RestrictionsManager) getSystemService(Context.RESTRICTIONS_SERVICE); Bundle appRestrictions = restrictionsManager.getApplicationRestrictions(); if (appRestrictions.containsKey("profileUrl")) { Log.d(TAG, "Found managed configuration install URL " + appRestrictions.getString("profileUrl")); incomingRef = appRestrictions.getString("profileUrl"); lastInstallMode = INSTALL_MODE_MANAGED_CONFIGURATION; uiState = UiState.READY_TO_INSTALL; uiStateScreenTransition(); startResourceInstall(); } } }
Source:
public void testNeverPolicy() throws IOException, NamingException, WorkException { log.info("Running testAlwaysPolicy()"); int doWorkAccepted = server1Proxy.getDoWorkAccepted(); for (int i = 0; i < 10; i++) { server1Proxy.doWork(new ShortWork().setName("testNeverPolicy-work" + (i + 1))); } logWorkStats(); Assert.assertTrue("Expected doWorkAccepted = " + (doWorkAccepted + 10) + ", actual: " + server1Proxy.getDoWorkAccepted(), server1Proxy.getDoWorkAccepted() == doWorkAccepted + 10); }

Target:
public void testNeverPolicy() throws IOException, NamingException, WorkException { int doWorkAccepted = server1Proxy.getDoWorkAccepted(); for (int i = 0; i < 10; i++) { server1Proxy.doWork(new ShortWork()); } Assert.assertTrue("Expected doWorkAccepted = " + (doWorkAccepted + 10) + ", actual: " + server1Proxy.getDoWorkAccepted(), server1Proxy.getDoWorkAccepted() == doWorkAccepted + 10); }
Source:
private boolean tagResource(String resourceId, String tagName) { if(! Utils.isEmptyOrWhitespaces(tagName)) { Tag tag = new Tag( "Name", tagName ); CreateTagsRequest ctr = new CreateTagsRequest(Collections.singletonList(resourceId), Arrays.asList( tag )); try { this.ec2Api.createTags( ctr ); } catch(Exception e) { logger.info("Error tagging resource " + resourceId + " with name=" + tagName + ": " + e); } return true; } return false; }

Target:
private boolean tagResource(String resourceId, String tagName) { boolean result = false; if(! Utils.isEmptyOrWhitespaces(tagName)) { Tag tag = new Tag( "Name", tagName ); CreateTagsRequest ctr = new CreateTagsRequest(Collections.singletonList(resourceId), Arrays.asList( tag )); try { this.ec2Api.createTags( ctr ); } catch(Exception e) { logger.warning("Error tagging resource " + resourceId + " with name=" + tagName + ": " + e); } result = true; } return result; }
Source:
private static int computeSizeOnDisk(ITmfStateValue sv) { int size = Long.BYTES + Long.BYTES + Integer.BYTES + Integer.BYTES; size += sv.serialize().length; return size; }

Target:
private static int computeSizeOnDisk(ITmfStateValue sv) { int size = Long.BYTES + Long.BYTES + Integer.BYTES + Short.BYTES; size += sv.serialize().length; return size; }
Source:
public int hashCode() { return 31 * this.readName.hashCode() + this.pairStatus.hashCode(); }

Target:
public int hashCode() { return Objects.hash(readName, pairStatus); }
Source:
public WebDriverWrapper(@Nonnull Config config, @Nonnull WebDriver webDriver, @Nullable SelenideProxyServer selenideProxy) { if (config == null) throw new IllegalArgumentException("config must not be null"); if (webDriver == null) throw new IllegalArgumentException("webDriver must not be null"); this.config = config; this.webDriver = webDriver; this.selenideProxy = selenideProxy; }

Target:
public WebDriverWrapper(@Nonnull Config config, @Nonnull WebDriver webDriver, @Nullable SelenideProxyServer selenideProxy) { this(config, webDriver, selenideProxy, new BrowserHealthChecker()); }
Source:
public static void startH2O() { if (!H2OServerStarted) { H2OApp.main(new String[0]); H2O.waitForCloudSize(1, 10 * 1000 ); H2OServerStarted = true; } else { log.info("H2O Server is already Running"); } }

Target:
public static void startH2O() { if (!isH2OServerStarted) { H2OApp.main(new String[0]); H2O.waitForCloudSize(1, 10 * 1000 ); isH2OServerStarted = true; log.info("H2o Server has started."); } else { log.warn("H2O Server is already Running."); } }
Source:
private <T extends Closeable> OutputStream writeArchive(Format<T> fmt) { final String pfx = prefix == null ? "" : prefix; final TreeWalk walk = new TreeWalk(repo); try { final T outa = fmt.createArchiveOutputStream(out); try { final MutableObjectId idBuf = new MutableObjectId(); final ObjectReader reader = walk.getObjectReader(); final RevWalk rw = new RevWalk(walk.getObjectReader()); walk.reset(rw.parseTree(tree)); if (paths.size() != 0) { walk.setFilter(PathFilterGroup.createFromStrings(paths)); } while (walk.next()) { final String name = pfx + walk.getPathString(); FileMode mode = walk.getFileMode(0); if (walk.isSubtree()) walk.enterSubtree(); if (mode == FileMode.GITLINK) mode = FileMode.TREE; if (mode == FileMode.TREE) { fmt.putEntry(outa, name + "/", mode, null); continue; } walk.getObjectId(idBuf, 0); fmt.putEntry(outa, name, mode, reader.open(idBuf)); } outa.close(); } finally { out.close(); } return out; } catch (IOException e) { throw new JGitInternalException( JGitText.get().exceptionCaughtDuringExecutionOfArchiveCommand, e); } finally { walk.release(); } }

Target:
private <T extends Closeable> OutputStream writeArchive(Format<T> fmt) { final String pfx = prefix == null ? "" : prefix; final TreeWalk walk = new TreeWalk(repo); try { final T outa = fmt.createArchiveOutputStream(out); try { final MutableObjectId idBuf = new MutableObjectId(); final ObjectReader reader = walk.getObjectReader(); final RevWalk rw = new RevWalk(walk.getObjectReader()); walk.reset(rw.parseTree(tree)); if (!paths.isEmpty()) walk.setFilter(PathFilterGroup.createFromStrings(paths)); while (walk.next()) { final String name = pfx + walk.getPathString(); FileMode mode = walk.getFileMode(0); if (walk.isSubtree()) walk.enterSubtree(); if (mode == FileMode.GITLINK) mode = FileMode.TREE; if (mode == FileMode.TREE) { fmt.putEntry(outa, name + "/", mode, null); continue; } walk.getObjectId(idBuf, 0); fmt.putEntry(outa, name, mode, reader.open(idBuf)); } outa.close(); } finally { out.close(); } return out; } catch (IOException e) { throw new JGitInternalException( JGitText.get().exceptionCaughtDuringExecutionOfArchiveCommand, e); } finally { walk.release(); } }
Source:
public void testNormalFrame() { EmbeddedChannel decoderChannel = new EmbeddedChannel(new PerMessageDeflateDecoder(false, NEVER_SKIP)); byte[] payload = new byte[300]; random.nextBytes(payload); BinaryWebSocketFrame frame = new BinaryWebSocketFrame(true, WebSocketExtension.RSV3, Unpooled.wrappedBuffer(payload)); decoderChannel.writeInbound(frame); BinaryWebSocketFrame newFrame = decoderChannel.readInbound(); assertNotNull(newFrame); assertNotNull(newFrame.content()); assertEquals(WebSocketExtension.RSV3, newFrame.rsv()); assertEquals(300, newFrame.content().readableBytes()); byte[] finalPayload = new byte[300]; newFrame.content().readBytes(finalPayload); assertArrayEquals(finalPayload, payload); newFrame.release(); }

Target:
public void testNormalFrame() { EmbeddedChannel decoderChannel = new EmbeddedChannel(new PerMessageDeflateDecoder(false)); byte[] payload = new byte[300]; random.nextBytes(payload); BinaryWebSocketFrame frame = new BinaryWebSocketFrame(true, WebSocketExtension.RSV3, Unpooled.wrappedBuffer(payload)); assertTrue(decoderChannel.writeInbound(frame)); BinaryWebSocketFrame newFrame = decoderChannel.readInbound(); assertNotNull(newFrame); assertNotNull(newFrame.content()); assertEquals(WebSocketExtension.RSV3, newFrame.rsv()); assertEquals(300, newFrame.content().readableBytes()); byte[] finalPayload = new byte[300]; newFrame.content().readBytes(finalPayload); assertArrayEquals(finalPayload, payload); newFrame.release(); }
Source:
public Coordinator(CoordinatorConfig config) throws DatastreamException { _config = config; _eventQueue = new CoordinatorEventBlockingQueue(); _eventThread = new CoordinatorEventProcessor(); _eventThread.setDaemon(true); _adapter = new ZkAdapter(_config.getZkAddress(), _config.getCluster(), _config.getZkSessionTimeout(), _config.getZkConnectionTimeout(), this); _adapter.setListener(this); _eventCollectorFactory = new DatastreamEventCollectorFactory(config.getConfigProperties()); String transportFactory = config.getTransportProviderFactory(); TransportProviderFactory factory = ReflectionUtils.createInstance(transportFactory); if (factory == null) { throw new DatastreamException("invalid transport provider factory: " + transportFactory); } _transportProvider = factory.createTransportProvider(_config.getConfigProperties()); if (_transportProvider == null) { throw new DatastreamException("failed to create transport provider, factory=" + transportFactory); } _destinationManager = new DestinationManager(_transportProvider); }

Target:
public Coordinator(CoordinatorConfig config) throws DatastreamException { _config = config; _eventQueue = new CoordinatorEventBlockingQueue(); _eventThread = new CoordinatorEventProcessor(); _eventThread.setDaemon(true); _adapter = new ZkAdapter(_config.getZkAddress(), _config.getCluster(), _config.getZkSessionTimeout(), _config.getZkConnectionTimeout(), this); _adapter.setListener(this); _eventCollectorFactory = new DatastreamEventCollectorFactory(config.getConfigProperties()); String transportFactory = config.getTransportProviderFactory(); TransportProviderFactory factory = ReflectionUtils.createInstance(transportFactory); if (factory == null) { throw new DatastreamException("invalid transport provider factory: " + transportFactory); } _transportProvider = factory.createTransportProvider(_config.getConfigProperties()); if (_transportProvider == null) { throw new DatastreamException("failed to create transport provider, factory: " + transportFactory); } _destinationManager = new DestinationManager(_transportProvider); }
Source:
public void run() { log.info("Starting"); if (setState(State.STARTING) == null) { log.info("StreamThread already shutdown. Not running"); return; } boolean cleanRun = false; try { runLoop(); cleanRun = true; } catch (final TimeoutException e) { throw new TimeoutException("The thread-consumer : " + threadMetadata.consumerClientId() + " and restore-consumer : " + threadMetadata.restoreConsumerClientId() + "has happened TimeoutExceptio" + " Try tuning 'default.api.timeout.ms' option", e); } catch (final KafkaException e) { log.error("Encountered the following unexpected Kafka exception during processing, " + "this usually indicate Streams internal errors:", e); throw e; } catch (final Exception e) { log.error("Encountered the following error during processing:", e); throw e; } finally { completeShutdown(cleanRun); } }

Target:
public void run() { log.info("Starting"); if (setState(State.STARTING) == null) { log.info("StreamThread already shutdown. Not running"); return; } boolean cleanRun = false; try { runLoop(); cleanRun = true; } catch (final TimeoutException e) { throw new TimeoutException("The thread-consumer : " + threadMetadata.consumerClientId() + " and restore-consumer : " + threadMetadata.restoreConsumerClientId() + "has happened TimeoutException" + " Try increasing 'default.api.timeout.ms' option", e); } catch (final KafkaException e) { log.error("Encountered the following unexpected Kafka exception during processing, " + "this usually indicate Streams internal errors:", e); throw e; } catch (final Exception e) { log.error("Encountered the following error during processing:", e); throw e; } finally { completeShutdown(cleanRun); } }
Source:
public void setFact(String name, String value) { if (this.facts == null) { this.facts = new HashMap<>(); } HashMap<String, String> fact = new HashMap<String, String>() {{ put(name, value); }}; if (this.checkForCloudProfileFacts(this, fact)) { this.setRHCloudProfileModified(new Date()); } this.facts.put(name, value); }

Target:
public void setFact(String name, String value) { if (this.facts == null) { this.facts = new HashMap<>(); } HashMap<String, String> fact = new HashMap<>(); fact.put(name, value); if (this.checkForCloudProfileFacts(fact)) { this.updateRHCloudProfileModified(); } this.facts.put(name, value); }
Source:
public void expandPathInProjectExplorer(String path) { List<String> itemsPaths = splitPathOnSubitems(path); ListIterator<String> iterator = itemsPaths.listIterator(); while (iterator.hasNext()) { String currentItem = iterator.next(); if (!iterator.hasNext()) { waitItem(currentItem); openItemByPath(currentItem); break; } By nextItemLocator = By.xpath(format(PROJECT_EXPORER_ITEM_TEMPLATE, itemsPaths.get(iterator.nextIndex()))); if (!seleniumWebDriverHelper.isVisible(nextItemLocator)) { waitItem(currentItem); openItemByPath(currentItem); } } }

Target:
public void expandPathInProjectExplorer(String path) { List<String> itemsPaths = splitJavaProjectPath(path); for (int i = 0; i < itemsPaths.size(); i++) { String currentItem = itemsPaths.get(i); int nextItemIndex = i + 1; if (nextItemIndex < itemsPaths.size() && isItemVisible(itemsPaths.get(nextItemIndex))) { continue; } waitItem(currentItem); openItemByPath(currentItem); } }
Source:
protected void executeOperation(Channel channel) { retry = false; scheduleRead(channel); ByteBuf buf = channel.alloc().buffer(estimateSize()); codec.writeHeader(buf, header); writeXid(buf, xid); buf.writeByte(onePhaseCommit ? 1 : 0); writeVInt(buf, modifications.size()); modifications.forEach(m -> m.writeTo(buf, codec)); channel.writeAndFlush(buf); }

Target:
protected void executeOperation(Channel channel) { retry = false; scheduleRead(channel); ByteBuf buf = channel.alloc().buffer(estimateSize()); codec.writeHeader(buf, header); writeXid(buf, xid); buf.writeByte(onePhaseCommit ? 1 : 0); writeVInt(buf, modifications.size()); for (Modification m : modifications) { m.writeTo(buf, codec); } channel.writeAndFlush(buf); }
Source:
private void prepareContractsGrantsInvoiceDocument(KualiDecimal totalAmountBilledToDate) { PowerMockito.suppress(PowerMockito.constructor(DocumentBase.class)); contractsGrantsInvoiceDocument = PowerMockito.spy(new ContractsGrantsInvoiceDocument()); CuAward award = PowerMockito.spy(new CuAward()); award.setAwardIndirectCostAmount(new KualiDecimal(50)); award.setAwardDirectCostAmount(new KualiDecimal(50)); AwardExtendedAttribute attribute = new AwardExtendedAttribute(); attribute.setBudgetTotalAmount(new KualiDecimal(50)); award.setExtension(attribute); InvoiceGeneralDetail invoiceGeneralDetail = Mockito.mock(InvoiceGeneralDetail.class); Mockito.when(invoiceGeneralDetail.getTotalAmountBilledToDate()).thenReturn(totalAmountBilledToDate); Mockito.when(invoiceGeneralDetail.getAward()).thenReturn(award); contractsGrantsInvoiceDocument.setInvoiceGeneralDetail(invoiceGeneralDetail); }

Target:
private void prepareContractsGrantsInvoiceDocument(KualiDecimal totalAmountBilledToDate) { PowerMockito.suppress(PowerMockito.constructor(DocumentBase.class)); contractsGrantsInvoiceDocument = PowerMockito.spy(new ContractsGrantsInvoiceDocument()); CuAward award = new CuAward(); award.setAwardIndirectCostAmount(new KualiDecimal(50)); award.setAwardDirectCostAmount(new KualiDecimal(50)); AwardExtendedAttribute attribute = new AwardExtendedAttribute(); attribute.setBudgetTotalAmount(new KualiDecimal(50)); award.setExtension(attribute); InvoiceGeneralDetail invoiceGeneralDetail = Mockito.mock(InvoiceGeneralDetail.class); Mockito.when(invoiceGeneralDetail.getTotalAmountBilledToDate()).thenReturn(totalAmountBilledToDate); Mockito.when(invoiceGeneralDetail.getAward()).thenReturn(award); contractsGrantsInvoiceDocument.setInvoiceGeneralDetail(invoiceGeneralDetail); }
Source:
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { boolean doFilter = true; try { HttpServletRequest req = (HttpServletRequest) request; if (!FiltersHelper.isAuthenticated(req)) { LoginUserParameters params = null; String profileName = (String) request.getAttribute(FiltersHelper.Constants.REQUEST_PROFILE_KEY); ExtMap authRecord = (ExtMap) request.getAttribute(FiltersHelper.Constants.REQUEST_AUTH_RECORD_KEY); if (authRecord != null) { String engineSessionId = UUID.randomUUID().toString(); params = new LoginUserParameters(profileName, authRecord, engineSessionId); params.setActionType(loginAsAdmin ? VdcActionType.LoginAdminUser : VdcActionType.LoginUser); InitialContext context = new InitialContext(); try { VdcReturnValueBase returnValue = FiltersHelper.getBackend(context).login(params); if (returnValue.getSucceeded()) { HttpSession session = req.getSession(true); session.setAttribute( FiltersHelper.Constants.HTTP_SESSION_ENGINE_SESSION_ID_KEY, engineSessionId ); req.setAttribute(FiltersHelper.Constants.REQUEST_USER_KEY, returnValue.getActionReturnValue()); } } finally { context.close(); } } } } catch (Exception ex) { doFilter = false; log.error(String.format("Error in login to engine. Message is: %1$s", ex.getMessage())); ((HttpServletResponse) response).sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); } if (doFilter) { chain.doFilter(request, response); } }

Target:
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { boolean doFilter = false; try { HttpServletRequest req = (HttpServletRequest) request; if (!FiltersHelper.isAuthenticated(req)) { String profileName = (String) request.getAttribute(FiltersHelper.Constants.REQUEST_PROFILE_KEY); ExtMap authRecord = (ExtMap) request.getAttribute(FiltersHelper.Constants.REQUEST_AUTH_RECORD_KEY); if (authRecord != null) { String engineSessionId = UUID.randomUUID().toString(); InitialContext context = new InitialContext(); try { VdcReturnValueBase returnValue = FiltersHelper.getBackend(context).login(new LoginUserParameters( profileName, authRecord, engineSessionId, loginAsAdmin ? VdcActionType.LoginAdminUser : VdcActionType.LoginUser) ); if (returnValue.getSucceeded()) { HttpSession session = req.getSession(true); session.setAttribute( FiltersHelper.Constants.HTTP_SESSION_ENGINE_SESSION_ID_KEY, engineSessionId ); } } finally { context.close(); } } } doFilter = true; } catch (Exception ex) { log.error(String.format("Error in login to engine. Message is: %1$s", ex.getMessage())); ((HttpServletResponse) response).sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); } if (doFilter) { chain.doFilter(request, response); } }
Source:
public CellScanner(Context appCtx) { mAppContext = appCtx; if ((Prefs.getInstance() != null) && Prefs.getInstance().isSimulateStumble()) { mSimpleCellScanner = new MockSimpleCellScanner(mAppContext); } else { mSimpleCellScanner = new SimpleCellScannerImplementation(mAppContext); } }

Target:
public CellScanner(Context appCtx) { mAppContext = appCtx; if (AppGlobals.isDebug && Prefs.getInstance().isSimulateStumble()) { mSimpleCellScanner = new MockSimpleCellScanner(mAppContext); } else { mSimpleCellScanner = new SimpleCellScannerImplementation(mAppContext); } }
Source:
public void filePage002_tabsLoggedIn() { CommonFunctions.logOut(driver); CommonFunctions.logInCookie(Properties.userName, Properties.password); FilePagePageObject filePage = new FilePagePageObject(driver); filePage.openFilePage(URLsContent.fileName); filePage.refreshAndVerifyTabs(0); filePage.refreshAndVerifyTabs(1); filePage.refreshAndVerifyTabs(2); }

Target:
public void filePage002_tabsLoggedIn() { CommonFunctions.logOut(driver); CommonFunctions.logInCookie(Properties.userName, Properties.password); FilePagePageObject filePage = new FilePagePageObject(driver); filePage.openFilePage(URLsContent.fileName001); filePage.refreshAndVerifyTabs(0); filePage.refreshAndVerifyTabs(1); filePage.refreshAndVerifyTabs(2); }
Source:
private void onEvent(NativeEvent event) { EventData eventData = EventData.create(event); queue_.unshift(eventData); queue_.setLength(QUEUE_LENGTH); }

Target:
private void onEvent(NativeEvent event) { EventData eventData = EventData.create(event); queue_.add(eventData); if (queue_.size() > QUEUE_LENGTH) queue_.remove(); }
Source:
public OMRequest preExecute(OzoneManager ozoneManager) throws IOException { S3CreateBucketRequest s3CreateBucketRequest = getOmRequest().getCreateS3BucketRequest(); Preconditions.checkNotNull(s3CreateBucketRequest); S3CreateBucketRequest.Builder newS3CreateBucketRequest = s3CreateBucketRequest.toBuilder().setS3CreateVolumeInfo( S3CreateVolumeInfo.newBuilder().setCreationTime(Time.now())); int bucketLength = s3CreateBucketRequest.getS3Bucketname().length(); if (bucketLength < 3 || bucketLength >= 64) { throw new OMException("S3BucketName must be at least 3 and not more " + "than 63 characters long", OMException.ResultCodes.S3_BUCKET_INVALID_LENGTH); } return getOmRequest().toBuilder() .setCreateS3BucketRequest(newS3CreateBucketRequest) .setUserInfo(getUserInfo()).build(); }

Target:
public OMRequest preExecute(OzoneManager ozoneManager) throws IOException { S3CreateBucketRequest s3CreateBucketRequest = getOmRequest().getCreateS3BucketRequest(); Preconditions.checkNotNull(s3CreateBucketRequest); S3CreateBucketRequest.Builder newS3CreateBucketRequest = s3CreateBucketRequest.toBuilder().setS3CreateVolumeInfo( S3CreateVolumeInfo.newBuilder().setCreationTime(Time.now())); int bucketLength = s3CreateBucketRequest.getS3Bucketname().length(); if (bucketLength < S3_BUCKET_MIN_LENGTH || bucketLength >= S3_BUCKET_MAX_LENGTH) { throw new OMException("S3BucketName must be at least 3 and not more " + "than 63 characters long", OMException.ResultCodes.S3_BUCKET_INVALID_LENGTH); } return getOmRequest().toBuilder() .setCreateS3BucketRequest(newS3CreateBucketRequest) .setUserInfo(getUserInfo()).build(); }
Source:
public void setUp() throws Exception { Script startScript = BrickTestUtils.createProjectAndGetStartScript("newDataDialogTest"); variableBrickPosition = 1; listBrickPosition = 2; startScript.addBrick(variableBrickPosition - 1, new SetVariableBrick()); startScript.addBrick(listBrickPosition - 1, new AddItemToUserListBrick()); baseActivityTestRule.launchActivity(); }

Target:
public void setUp() throws Exception { Script startScript = BrickTestUtils.createProjectAndGetStartScript("newDataDialogTest"); variableBrickPosition = 1; listBrickPosition = 2; startScript.addBrick(new SetVariableBrick()); startScript.addBrick(new AddItemToUserListBrick()); baseActivityTestRule.launchActivity(); }
Source:
public TerminalSession terminalWithHandle(String handle) { int total = getTerminalCount(); for (int i = 0; i < total; i++) { TerminalSession t = getTerminalAtIndex(i); if (t.getHandle().equals(handle)) { return t; } } return null; }

Target:
public TerminalSession terminalWithHandle(String handle) { int total = getTerminalCount(); for (int i = 0; i < total; i++) { TerminalSession t = getTerminalAtIndex(i); if (t != null && t.getHandle().equals(handle)) { return t; } } return null; }
Source:
public List<SdxCluster> listSdxByEnvCrn(String envCrn) { LOGGER.info("Listing SDX clusters by environment crn {}", envCrn); String accountIdFromCrn = getAccountIdFromCrn(envCrn); return sdxClusterRepository.findByAccountIdAndEnvCrnAndDeletedIsNull(accountIdFromCrn, envCrn); }

Target:
public List<SdxCluster> listSdxByEnvCrn(String envCrn) { LOGGER.debug("Listing SDX clusters by environment crn {}", envCrn); String accountIdFromCrn = getAccountIdFromCrn(envCrn); return sdxClusterRepository.findByAccountIdAndEnvCrnAndDeletedIsNull(accountIdFromCrn, envCrn); }
Source:
public LookupExtractor get(String lookupName) throws ISE { assertStarted(); return lookupMap.get(lookupName); }

Target:
public LookupExtractorFactory get(String lookupName) { final LookupExtractorFactory lookupExtractorFactory = lookupMap.get(lookupName); assertStarted(); return lookupExtractorFactory; }
Source:
static RuleSet getCalciteLogicalRules() { final List<RelOptRule> ruleList = new ArrayList<>(); ruleList.add(CalcMergeRule.INSTANCE); ruleList.add(FilterCalcMergeRule.INSTANCE); ruleList.add(FilterToCalcRule.INSTANCE); ruleList.add(ProjectCalcMergeRule.INSTANCE); ruleList.add(ProjectToCalcRule.INSTANCE); ruleList.add(ProjectMergeRule.INSTANCE); ruleList.add(FilterProjectTransposeRule.INSTANCE); return RuleSets.ofList(ImmutableSet.copyOf(ruleList)); }

Target:
static RuleSet getCalciteLogicalRules() { final List<RelOptRule> ruleList = new ArrayList<>(); ruleList.add(CalcMergeRule.INSTANCE); ruleList.add(FilterCalcMergeRule.INSTANCE); ruleList.add(FilterToCalcRule.INSTANCE); ruleList.add(ProjectCalcMergeRule.INSTANCE); ruleList.add(ProjectToCalcRule.INSTANCE); ruleList.add(ProjectMergeRule.INSTANCE); ruleList.add(FilterProjectTransposeRule.INSTANCE); return RuleSets.ofList(ruleList); }
Source:
public void testContentsOfContext() throws Exception { Cache<Key, String> c = cacheManager.getCache(); ContextExtractingInterceptor cex = new ContextExtractingInterceptor(); assert c.getAdvancedCache().addInterceptorAfter(cex, InvocationContextInterceptor.class); c.put(new Key("k"), "v"); assert "v".equals(c.get(new Key("k"))); TransactionManager tm = c.getAdvancedCache().getTransactionManager(); tm.begin(); c.getAdvancedCache().lock(new Key("k")); LockManager lockManager = TestingUtil.extractComponent(c, LockManager.class); assert cex.ctx instanceof LocalTxInvocationContext; assert cex.ctx.getLookedUpEntries().size() == 0 : "Looked up key should not be in transactional invocation context " + "as we don't perform any changes"; assertEquals(lockManager.getNumberOfLocksHeld(), 1, "Only one lock should be held"); c.put(new Key("k"), "v2"); assert cex.ctx.getLookedUpEntries().size() == 1 : "Still should only be one entry in the context"; assert lockManager.getNumberOfLocksHeld() == 1 : "Only one lock should be held"; tm.commit(); assert lockManager.getNumberOfLocksHeld() == 0 : "No locks should be held anymore"; assert "v2".equals(c.get(new Key("k"))); }

Target:
public void testContentsOfContext() throws Exception { Cache<Key, String> c = cacheManager.getCache(); ContextExtractingInterceptor cex = new ContextExtractingInterceptor(); assertTrue(c.getAdvancedCache().addInterceptorAfter(cex, InvocationContextInterceptor.class)); c.put(new Key("k"), "v"); assertEquals("v", c.get(new Key("k"))); TransactionManager tm = c.getAdvancedCache().getTransactionManager(); tm.begin(); c.getAdvancedCache().lock(new Key("k")); LockManager lockManager = TestingUtil.extractComponent(c, LockManager.class); assertTrue(cex.ctx instanceof LocalTxInvocationContext); assertEquals("Looked up key should not be in transactional invocation context " + "as we don't perform any changes", 0, cex.ctx.getLookedUpEntries().size()); assertEquals("Only one lock should be held", 1, lockManager.getNumberOfLocksHeld()); c.put(new Key("k"), "v2"); assertEquals("Still should only be one entry in the context", 1, cex.ctx.getLookedUpEntries().size()); assertEquals("Only one lock should be held", 1, lockManager.getNumberOfLocksHeld()); tm.commit(); assertEquals("No locks should be held anymore", 0, lockManager.getNumberOfLocksHeld()); assertEquals("v2", c.get(new Key("k"))); }
Source:
private void handleDeleteRequest(Request request) { try { DeleteRequest deleteRequest = DeleteRequest.readFrom(new DataInputStream(request.getInputStream())); MessageFormatInputStream stream = new MessageFormatInputStream(new BlobId(deleteRequest.getBlobId()), true); MessageInfo info = new MessageInfo(new BlobId(deleteRequest.getBlobId()), stream.getSize(), 0); ArrayList<MessageInfo> infoList = new ArrayList<MessageInfo>(); infoList.add(info); MessageFormatWriteSet writeset = new MessageFormatWriteSet(stream, infoList); blobStore.delete(writeset); DeleteResponse response = new DeleteResponse(deleteRequest.getCorrelationId(), deleteRequest.getClientId(), (short)0); requestResponseChannel.sendResponse(response, request); } catch (Exception e) { } }

Target:
private void handleDeleteRequest(Request request) { try { DeleteRequest deleteRequest = DeleteRequest.readFrom(new DataInputStream(request.getInputStream())); MessageFormatInputStream stream = new DeleteMessageFormatInputStream(deleteRequest.getBlobId()); MessageInfo info = new MessageInfo(deleteRequest.getBlobId(), stream.getSize()); ArrayList<MessageInfo> infoList = new ArrayList<MessageInfo>(); infoList.add(info); MessageFormatWriteSet writeset = new MessageFormatWriteSet(stream, infoList); blobStore.delete(writeset); DeleteResponse response = new DeleteResponse(deleteRequest.getCorrelationId(), deleteRequest.getClientId(), (short)0); requestResponseChannel.sendResponse(response, request); } catch (Exception e) { } }
Source:
private AssertionError assertionFailedError(String message) { try { Object o = constructorInvoker.newInstance("org.opentest4j.AssertionFailedError", MSG_ARG_TYPES_FOR_ASSERTION_FAILED_ERROR, message, actual, expected); if (o instanceof AssertionError) { AssertionError assertionError = (AssertionError) o; Failures.instance().removeAssertJRelatedElementsFromStackTraceIfNeeded(assertionError); return assertionError; } return null; } catch (Throwable e) { return null; } }

Target:
private AssertionError assertionFailedError(String message) { try { Object o = constructorInvoker.newInstance("org.opentest4j.AssertionFailedError", MSG_ARG_TYPES_FOR_ASSERTION_FAILED_ERROR, message, expected, actual); if (o instanceof AssertionError) { AssertionError assertionError = (AssertionError) o; Failures.instance().removeAssertJRelatedElementsFromStackTraceIfNeeded(assertionError); return assertionError; } return null; } catch (Throwable e) { return null; } }
Source:
public List<SurveyAssignment> listAllContainingDevice(Long devId) { List<SurveyAssignment> all = list(Constants.ALL_RESULTS); List<SurveyAssignment> selected = new ArrayList<>(); for (SurveyAssignment ass : all) { List<Long> devs = ass.getDeviceIds(); if (devs.contains(devId)) { selected.add(ass); } } return selected; }

Target:
public List<SurveyAssignment> listAllContainingDevice(Long devId) { List<SurveyAssignment> selected = listByProperty("deviceIds", devId, "Long"); return selected; }
Source:
public TmfModelResponse<Map<String, String>> fetchTooltip(Map<String, Object> fetchParameters, @Nullable IProgressMonitor monitor) { Map<Long, Pair<ITmfStateSystem, Integer>> entries = getSelectedEntries(fetchParameters); if (entries.size() != 1) { return new TmfModelResponse<>(null, Status.COMPLETED, CommonStatusMessage.COMPLETED); } Entry<@NonNull Long, @NonNull Pair<ITmfStateSystem, Integer>> entry = entries.entrySet().iterator().next(); Map<String, String> tooltip = new HashMap<>(); Integer quark = Objects.requireNonNull(entry.getValue()).getSecond(); ITmfStateSystem ss = Objects.requireNonNull(entry.getValue()).getFirst(); tooltip.put(String.valueOf(Messages.QuarkColumnLabel), Integer.toString(quark)); tooltip.put(String.valueOf(Messages.AttributePathColumnLabel), ss.getFullAttributePath(quark)); return new TmfModelResponse<>(tooltip, Status.COMPLETED, CommonStatusMessage.COMPLETED); }

Target:
public TmfModelResponse<Map<String, String>> fetchTooltip(Map<String, Object> fetchParameters, @Nullable IProgressMonitor monitor) { Map<Long, Pair<ITmfStateSystem, Integer>> entries = getSelectedEntries(fetchParameters); if (entries.size() != 1) { return new TmfModelResponse<>(null, Status.COMPLETED, CommonStatusMessage.COMPLETED); } Entry<@NonNull Long, @NonNull Pair<ITmfStateSystem, Integer>> entry = entries.entrySet().iterator().next(); Map<String, String> tooltip = new HashMap<>(); Integer quark = Objects.requireNonNull(entry.getValue()).getSecond(); ITmfStateSystem ss = Objects.requireNonNull(entry.getValue()).getFirst(); tooltip.put(String.valueOf(Messages.QuarkColumnLabel), Integer.toString(quark)); tooltip.put(String.valueOf(Messages.AttributePathColumnLabel), ss.getFullAttributePath(quark)); tooltip.put(String.valueOf(Messages.ValueColumnLabel), getQuarkValue(fetchParameters, ss, quark)); return new TmfModelResponse<>(tooltip, Status.COMPLETED, CommonStatusMessage.COMPLETED); }
Source:
public void setValues(String key, String[] values) { md.put(key, values); }

Target:
public void setValues(String key, String[] values) { if (values == null || values.length == 0) return; md.put(key, values); }
Source:
public IStatus validate(Object value) { if(value != null && !(value instanceof String)) return ValidationStatus.cancel("Display name is not an instance of a string"); String param = (String) value; if(StringUtils.isNotEmpty(param)) { if(param.indexOf(SWT.TAB) >= 0 || param.indexOf(SWT.LF) >= 0) { return ValidationStatus.error("Display name may not contain tabs or new lines"); } if (param.length() > DISPLAY_NAME_LENGTH_LIMIT) { return ValidationStatus.error("Display name may not be longer than " + DISPLAY_NAME_LENGTH_LIMIT + " characters"); } } return ValidationStatus.ok(); }

Target:
public IStatus validate(Object value) { if(!(value instanceof String)) { return ValidationStatus.cancel("Display name is not an instance of a string"); } String param = (String) value; if(StringUtils.isNotEmpty(param)) { if(param.indexOf(SWT.TAB) >= 0 || param.indexOf(SWT.LF) >= 0) { return ValidationStatus.error("Display name may not contain tabs or new lines"); } if (param.length() > DISPLAY_NAME_LENGTH_LIMIT) { return ValidationStatus.error("Display name may not be longer than " + DISPLAY_NAME_LENGTH_LIMIT + " characters"); } } return ValidationStatus.ok(); }
Source:
public void addInstance(Object instance) throws Exception { State currentState = state.get(); if ((currentState == State.STOPPING) || (currentState == State.STOPPED)) { throw new IllegalStateException(); } else { startInstance(instance); if (methodsMap.get(instance.getClass()).hasFor(PreDestroy.class)) { if (!managedInstances.contains(instance)) { managedInstances.add(instance); } } } }

Target:
public void addInstance(Object instance) throws Exception { State currentState = state.get(); if ((currentState == State.STOPPING) || (currentState == State.STOPPED)) { throw new IllegalStateException(); } else { startInstance(instance); if (methodsMap.get(instance.getClass()).hasFor(PreDestroy.class)) { managedInstances.add(instance); } } }
Source:
private void recipeElectricalDrill() { addRecipe(findItemStack("Cheap Electrical Drill"), "CMC", " T ", " P ", 'T', findItemStack("Mining Pipe"), 'C', dictCheapChip, 'M', findItemStack("Electrical Motor"), 'P', new ItemStack(Items.iron_pickaxe)); addRecipe(findItemStack("Average Electrical Drill"), "RCR", " D ", " d ", 'R', Items.redstone, 'C', dictCheapChip, 'D', findItemStack("Cheap Electrical Drill"), 'd', new ItemStack(Items.diamond)); addRecipe(findItemStack("Fast Electrical Drill"), "MCM", " T ", " P ", 'T', findItemStack("Mining Pipe"), 'C', dictAdvancedChip, 'M', findItemStack("Advanced Electrical Motor"), 'P', new ItemStack(Items.diamond_pickaxe)); addRecipe(findItemStack("Turbo Electrical Drill"), "RCR", " F ", " D ", 'F', findItemStack("Fast Electrical Drill"), 'C', dictAdvancedChip, 'R', findItemStack("Graphite Rod"), 'D', findItemStack("Synthetic Diamond")); addRecipe(findItemStack("Irresponsible Electrical Drill"), "DDD", "DFD", "DDD", 'F', findItemStack("Turbo Electrical Drill"), 'D', findItemStack("Synthetic Diamond")); }

Target:
private void recipeElectricalDrill() { addRecipe(findItemStack("Cheap Electrical Drill"), "CMC", " T ", " P ", 'T', findItemStack("Mining Pipe"), 'C', dictCheapChip, 'M', findItemStack("Electrical Motor"), 'P', new ItemStack(Items.iron_pickaxe)); addRecipe(findItemStack("Average Electrical Drill"), "RCR", " D ", " d ", 'R', Items.redstone, 'C', dictCheapChip, 'D', findItemStack("Cheap Electrical Drill"), 'd', new ItemStack(Items.diamond)); addRecipe(findItemStack("Fast Electrical Drill"), "MCM", " T ", " P ", 'T', findItemStack("Mining Pipe"), 'C', dictAdvancedChip, 'M', findItemStack("Advanced Electrical Motor"), 'P', new ItemStack(Items.diamond_pickaxe)); }
Source:
public File asFile() { return null; }

Target:
public File asFile() { try { return asPath().toFile(); } catch (UnsupportedOperationException e) { return null; } }
Source:
private String getHtmlText(AbstractFile abstractFile) { try { int fileSize = (int) abstractFile.getSize(); byte[] buffer = new byte[fileSize]; abstractFile.read(buffer, 0, fileSize); String encoding = determineEncoding(buffer); if (encoding != null) { return new String(buffer, encoding); } else { return new String(buffer); } } catch (TskCoreException | UnsupportedEncodingException ex) { logger.log(Level.SEVERE, String.format("Unable to read from file '%s' (id=%d).", abstractFile.getName(), abstractFile.getId()), ex); return String.format("<p>%s</p>", Bundle.HtmlViewer_file_error()); } }

Target:
private String getHtmlText(AbstractFile abstractFile) { try { int fileSize = (int) abstractFile.getSize(); byte[] buffer = new byte[fileSize]; abstractFile.read(buffer, 0, fileSize); CharsetMatch match = new CharsetDetector().setText(buffer).detect(); if (match != null) { return new String(buffer, match.getName()); } else { return new String(buffer); } } catch (TskCoreException ex) { logger.log(Level.SEVERE, String.format("Unable to read from file '%s' (id=%d).", abstractFile.getName(), abstractFile.getId()), ex); return String.format("<p>%s</p>", Bundle.HtmlViewer_file_error()); } catch (UnsupportedEncodingException ex) { logger.log(Level.SEVERE, String.format("Unsupported encoding for file '%s' (id=%d).", abstractFile.getName(), abstractFile.getId()), ex); return String.format("<p>%s</p>", Bundle.HtmlViewer_encoding_error()); } }
Source:
public void testArithmetic() { assertUpdate("CREATE TABLE tpch.test_pushdown(col1 bigint, col2 bigint)"); assertUpdate("INSERT INTO tpch.test_pushdown VALUES(5, 4)", "VALUES(1)"); assertUpdate("INSERT INTO tpch.test_pushdown VALUES(2, 4)", "VALUES(1)"); assertUpdate("INSERT INTO tpch.test_pushdown VALUES(4, 4)", "VALUES(1)"); assertQuery("SELECT * FROM tpch.test_pushdown WHERE NOT(col1 + col2 - 6 = 0)", "VALUES (5, 4), (4, 4)"); assertUpdate("DROP TABLE tpch.test_pushdown"); }

Target:
public void testArithmetic() { assertUpdate("CREATE TABLE test_arithmetic(col1 bigint, col2 bigint)"); assertUpdate("INSERT INTO test_arithmetic VALUES (5, 4), (2, 4), (4, 4)", "VALUES(3)"); assertQuery("SELECT * FROM test_arithmetic WHERE NOT(col1 + col2 - 6 = 0)", "VALUES (5, 4), (4, 4)"); }
Source:
public void findAllTest() throws Exception { getClient().perform(get("/api/config/submissioncclicenses")) .andExpect(status().isOk()) .andExpect(content().contentType(contentType)) .andExpect(jsonPath("$._embedded.submissioncclicenses", Matchers.containsInAnyOrder( SubmissionCCLicenseMatcher.matchLicenseEntry(1, new int[]{3, 2, 3}), SubmissionCCLicenseMatcher.matchLicenseEntry(2, new int[]{2}), SubmissionCCLicenseMatcher.matchLicenseEntry(3, new int[]{}) ))); }

Target:
public void findAllTest() throws Exception { String epersonToken = getAuthToken(eperson.getEmail(), password); getClient(epersonToken).perform(get("/api/config/submissioncclicenses")) .andExpect(status().isOk()) .andExpect(content().contentType(contentType)) .andExpect(jsonPath("$._embedded.submissioncclicenses", Matchers.containsInAnyOrder( SubmissionCCLicenseMatcher.matchLicenseEntry(1, new int[]{3, 2, 3}), SubmissionCCLicenseMatcher.matchLicenseEntry(2, new int[]{2}), SubmissionCCLicenseMatcher.matchLicenseEntry(3, new int[]{}) ))); }
Source:
public Object replace( Object original, Object target, SharedSessionContractImplementor session, Object owner, Map copyCache, ForeignKeyDirection foreignKeyDirection) throws HibernateException { boolean include; if ( isAssociationType()) { AssociationType atype = (AssociationType) this; if ( atype instanceof OneToOneType && atype.useLHSPrimaryKey()) { include = ForeignKeyDirection.FROM_PARENT ==foreignKeyDirection; } else { include = atype.getForeignKeyDirection()==foreignKeyDirection; } } else { include = ForeignKeyDirection.FROM_PARENT ==foreignKeyDirection; } return include ? replace(original, target, session, owner, copyCache) : target; }

Target:
public Object replace( Object original, Object target, SharedSessionContractImplementor session, Object owner, Map copyCache, ForeignKeyDirection foreignKeyDirection) throws HibernateException { boolean include; if ( isAssociationType() ) { AssociationType atype = (AssociationType) this; include = atype.getForeignKeyDirection()==foreignKeyDirection; } else { include = ForeignKeyDirection.FROM_PARENT ==foreignKeyDirection; } return include ? replace(original, target, session, owner, copyCache) : target; }
Source:
public JSONPathParser(List<FieldSpec> fieldSpecs, boolean useFieldDiscovery, ObjectMapper mapper) { this.fieldSpecs = fieldSpecs; this.fieldPathMap = generateFieldPaths(fieldSpecs); this.useFieldDiscovery = useFieldDiscovery; this.mapper = mapper == null ? new ObjectMapper() : mapper; this.reader = this.mapper.reader().withType(Object.class); }

Target:
public JSONPathParser(List<FieldSpec> fieldSpecs, boolean useFieldDiscovery, ObjectMapper mapper) { this.fieldSpecs = fieldSpecs; this.fieldPathMap = generateFieldPaths(fieldSpecs); this.useFieldDiscovery = useFieldDiscovery; this.mapper = mapper == null ? new ObjectMapper() : mapper; this.jsonPathConfig = Configuration.defaultConfiguration().addOptions(Option.SUPPRESS_EXCEPTIONS); }
Source:
private boolean shouldCapture(AnnotatedTypeMirror type, TypeMirror typeMirror) { if (type.getKind() != TypeKind.DECLARED && typeMirror.getKind() != TypeKind.DECLARED) { return false; } DeclaredType capturedTypeMirror = (DeclaredType) typeMirror; AnnotatedDeclaredType typeToCapture = (AnnotatedDeclaredType) type; if (typeToCapture.getTypeArguments().isEmpty() || typeToCapture.wasRaw() || typeToCapture.containsUninferredTypeArguments() || (capturedTypeMirror != null && capturedTypeMirror.getTypeArguments().size() != typeToCapture.getTypeArguments().size())) { return false; } for (int i = 0; i < capturedTypeMirror.getTypeArguments().size(); i++) { if (TypesUtils.isCaptured(capturedTypeMirror.getTypeArguments().get(i)) && typeToCapture.getTypeArguments().get(i).getKind() == TypeKind.WILDCARD) { return true; } } return false; }

Target:
private boolean shouldCapture(AnnotatedTypeMirror type, TypeMirror typeMirror) { if (type.getKind() != TypeKind.DECLARED) { return false; } if (typeMirror.getKind() != TypeKind.DECLARED) { throw new BugInCF("Expected declared type mirror: %s, type: %s", typeMirror, type); } DeclaredType capturedTypeMirror = (DeclaredType) typeMirror; AnnotatedDeclaredType uncapturedType = (AnnotatedDeclaredType) type; if (capturedTypeMirror.getTypeArguments().isEmpty()) { return false; } if (uncapturedType.wasRaw() || uncapturedType.containsUninferredTypeArguments()) { return false; } if (capturedTypeMirror.getTypeArguments().size() != uncapturedType.getTypeArguments().size()) { throw new BugInCF( "Not the same number of type arguments: capturedTypeMirror: %s uncapturedType: %s", capturedTypeMirror, uncapturedType); } for (int i = 0; i < capturedTypeMirror.getTypeArguments().size(); i++) { TypeMirror capturedTypeArgTM = capturedTypeMirror.getTypeArguments().get(i); AnnotatedTypeMirror uncapturedTypeArg = uncapturedType.getTypeArguments().get(i); if (uncapturedTypeArg.getKind() != TypeKind.WILDCARD) { continue; } if (TypesUtils.isCaptured(capturedTypeArgTM) || capturedTypeArgTM.getKind() != TypeKind.WILDCARD) { return true; } } return false; }
Source:
static OverlapDetector<Chain> loadChains(final File chainFile) { return loadChains(new BufferedLineReader(openFileForReading(chainFile)), chainFile.toString()); }

Target:
static OverlapDetector<Chain> loadChains(final File chainFile) { IOUtil.assertFileIsReadable(chainFile); try(final BufferedLineReader reader = new BufferedLineReader(IOUtil.openFileForReading(chainFile))){ return loadChains(reader, chainFile.toString()); } }
Source:
private Mono<CosmosAsyncUserDefinedFunctionResponse> readInternal(Context context) { String spanName = "readUDF." + container.getId(); Mono<CosmosAsyncUserDefinedFunctionResponse> responseMono = readInternal(); return this.container.getDatabase().getClient().getTracerProvider().traceEnabledCosmosResponsePublisher(responseMono, context, spanName, container.getDatabase().getId(), container.getDatabase().getClient().getServiceEndpoint()); }

Target:
private Mono<CosmosUserDefinedFunctionResponse> readInternal(Context context) { String spanName = "readUDF." + container.getId(); Mono<CosmosUserDefinedFunctionResponse> responseMono = readInternal(); return this.container.getDatabase().getClient().getTracerProvider().traceEnabledCosmosResponsePublisher(responseMono, context, spanName, container.getDatabase().getId(), container.getDatabase().getClient().getServiceEndpoint()); }