auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public String showPage(Model model) { PublicSiteUser user = currentUserService.getCurrentUser(); Set<DiseaseGroup> diseaseInterests = new HashSet<>(); Map<String, Integer> reviewCountPerDiseaseGroup = new HashMap<>(); Map<String, Integer> occurrenceCountPerDiseaseGroup = new HashMap<>(); boolean userLoggedIn = (user != null); if (userLoggedIn) { diseaseInterests = expertService.getDiseaseInterests(user.getId()); reviewCountPerDiseaseGroup = expertService.getDiseaseOccurrenceReviewCountPerDiseaseGroup(user.getId(), diseaseInterests); occurrenceCountPerDiseaseGroup = expertService.getDiseaseOccurrenceCountPerDiseaseGroup(user.getId(), diseaseInterests); } else { DiseaseGroup defaultDiseaseGroup = diseaseService.getDiseaseGroupByName(DEFAULT_DISEASE_NAME); diseaseInterests.add(defaultDiseaseGroup); reviewCountPerDiseaseGroup.put(defaultDiseaseGroup.getDisplayName(), 0); occurrenceCountPerDiseaseGroup.put(defaultDiseaseGroup.getDisplayName(), DEFAULT_DISEASE_OCCURRENCE_COUNT); } Integer diseaseOccurrenceReviewCount = sum(reviewCountPerDiseaseGroup.values()); model.addAttribute("reviewCount", diseaseOccurrenceReviewCount); model.addAttribute("diseaseInterests", convertSetToAlphabeticalList(diseaseInterests)); model.addAttribute("userLoggedIn", userLoggedIn); model.addAttribute("reviewCountPerDiseaseGroup", reviewCountPerDiseaseGroup); model.addAttribute("occurrenceCountPerDiseaseGroup", occurrenceCountPerDiseaseGroup); return "datavalidation"; }

Target:
public String showPage(Model model) { PublicSiteUser user = currentUserService.getCurrentUser(); Set<DiseaseGroup> diseaseInterests = new HashSet<>(); Map<String, Integer> reviewCountPerDiseaseGroup = new HashMap<>(); Map<String, Integer> occurrenceCountPerDiseaseGroup = new HashMap<>(); boolean userLoggedIn = (user != null); if (userLoggedIn) { diseaseInterests = expertService.getDiseaseInterests(user.getId()); reviewCountPerDiseaseGroup = expertService.getDiseaseOccurrenceReviewCountPerDiseaseGroup(user.getId(), diseaseInterests); occurrenceCountPerDiseaseGroup = expertService.getDiseaseOccurrenceCountPerDiseaseGroup(user.getId(), diseaseInterests); } else { DiseaseGroup defaultDiseaseGroup = diseaseService.getDiseaseGroupByName(DEFAULT_DISEASE_NAME); diseaseInterests.add(defaultDiseaseGroup); reviewCountPerDiseaseGroup.put(defaultDiseaseGroup.getDisplayName(), 0); occurrenceCountPerDiseaseGroup.put(defaultDiseaseGroup.getDisplayName(), DEFAULT_DISEASE_OCCURRENCE_COUNT); } Integer diseaseOccurrenceReviewCount = sum(reviewCountPerDiseaseGroup.values()).intValue(); model.addAttribute("reviewCount", diseaseOccurrenceReviewCount); model.addAttribute("diseaseInterests", sortByDisplayName(diseaseInterests)); model.addAttribute("userLoggedIn", userLoggedIn); model.addAttribute("reviewCountPerDiseaseGroup", reviewCountPerDiseaseGroup); model.addAttribute("occurrenceCountPerDiseaseGroup", occurrenceCountPerDiseaseGroup); return "datavalidation"; }
Source:
public void setUp() throws IOException { log.debug("Setting up OozieClient at {}", getOozieServiceLoc()); oozieClient = new OozieClient(getOozieServiceLoc()); String s = "<?xml-stylesheet type=\"text/xsl\" href=\"configuration.xsl\"?>" + "<configuration>" + "<property><name>fs.defaultFS</name><value>" + getNameNode() + "</value></property>" + "</configuration>"; Configuration hdfsConf = new Configuration(false); hdfsConf.addResource(new ReaderInputStream(new StringReader(s))); hadoopFilesystem = FileSystem.get(hdfsConf); tempDir = Files.createTempDir(); }

Target:
public void setUp() throws IOException { log.debug("Setting up OozieClient at {}", getOozieServiceLoc()); oozieClient = new OozieClient(getOozieServiceLoc()); Configuration hdfsConf = new Configuration(false); hdfsConf.set("fs.defaultFS", getNameNode()); hadoopFilesystem = FileSystem.get(hdfsConf); oozieJobPropertiesFetcher = new OozieJobPropertiesFetcher(oozieClient); hdfsTestHelper = new HdfsTestHelper(hadoopFilesystem); tempDir = Files.createTempDir(); }
Source:
private JsonResult getJoinStatusResult(boolean hasJoined) { Map<String, String> result = new HashMap<>(); result.put("hasJoined", String.valueOf(hasJoined)); if (!hasJoined) { result.put("userId", userInfo.id); } return new JsonResult(result); }

Target:
private JsonResult getJoinStatusResult(boolean hasJoined) { Map<String, Object> result = new HashMap<>(); result.put("hasJoined", hasJoined); if (!hasJoined) { result.put("userId", userInfo.id); } return new JsonResult(result); }
Source:
public NotificationPopupHandle show(NotificationEvent event, Command hideCommand) { if (container == null) { throw new IllegalStateException("The setContainer() method hasn't been called!"); } final NotificationPopupView view = new NotificationPopupView(); final PopupHandle popupHandle = new PopupHandle(view, event); activeNotifications.add(popupHandle); int size = activeNotifications.size(); int topMargin = (size == 1) ? initialSpacing : (size * SPACING) - (SPACING - initialSpacing); view.setPopupPosition(getLeftPosition(container.asWidget()) + getMargin(), getTopPosition(container.asWidget()) + topMargin); view.setNotification(event.getNotification()); view.setType(event.getType()); view.setNotificationWidth(getWidth() + "px"); if (event.hasNavigation()) { ResourceRef resourceRef = new ResourceRef( event.getNavigationPath(), ActivityResourceType.PERSPECTIVE); boolean authorized = authorizationManager.authorize( resourceRef, user); if (authorized) { view.addNavigation(event.getNavigationText(), () -> { hideCommand.execute(); placeManager.goTo(event.getNavigationPath()); }); } } view.show(hideCommand, event.autoHide()); return popupHandle; }

Target:
public NotificationPopupHandle show(NotificationEvent event, Command hideCommand) { if (container == null) { throw new IllegalStateException("The setContainer() method hasn't been called!"); } final NotificationPopupView view = new NotificationPopupView(); final PopupHandle popupHandle = new PopupHandle(view, event); activeNotifications.add(popupHandle); int size = activeNotifications.size(); int topMargin = (size == 1) ? initialSpacing : (size * SPACING) - (SPACING - initialSpacing); view.setPopupPosition(getLeftPosition(container.asWidget()) + getMargin(), getTopPosition(container.asWidget()) + topMargin); view.setNotification(event.getNotification()); view.setType(event.getType()); view.setNotificationWidth(getWidth() + "px"); if (event.hasNavigation()) { final String identifier = event.getNavigationPlace().getIdentifier(); final SyncBeanDef<Activity> syncBeanDefActivity = activityBeansCache.getActivity(identifier); final ResourceRef resourceRef = new ResourceRef(identifier, syncBeanDefActivity.getInstance().getResourceType()); final Boolean isAuthorized = authorizationManager.authorize(resourceRef, user); if (isAuthorized) { view.addNavigation( event.getNavigationText(), () -> { hideCommand.execute(); placeManager.goTo(event.getNavigationPlace()); }); } } view.show(hideCommand, event.autoHide()); return popupHandle; }
Source:
List<BookieSocketAddress> replaceBookiesInEnsemble(LedgerMetadata metadata, List<BookieSocketAddress> oldEnsemble, Map<Integer, BookieSocketAddress> failedBookies) throws BKException.BKNotEnoughBookiesException { List<BookieSocketAddress> newEnsemble = new ArrayList<BookieSocketAddress>(oldEnsemble); int ensembleSize = metadata.getEnsembleSize(); int writeQ = metadata.getWriteQuorumSize(); int ackQ = metadata.getAckQuorumSize(); Map<String, byte[]> customMetadata = metadata.getCustomMetadata(); Set<BookieSocketAddress> exclude = new HashSet<BookieSocketAddress>(failedBookies.values()); int replaced = 0; for (Map.Entry<Integer, BookieSocketAddress> entry : failedBookies.entrySet()) { int idx = entry.getKey(); BookieSocketAddress addr = entry.getValue(); LOG.debug("[EnsembleChange-L{}] replacing bookie: index: {}", getId(), addr, idx); if (!newEnsemble.get(idx).equals(addr)) { LOG.debug("[EnsembleChange-L{}] Not changing failed bookie at index {}, already changed to {}", getId(), addr, idx, newEnsemble.get(idx)); continue; } try { BookieSocketAddress newBookie = clientCtx.getBookieWatcher().replaceBookie( ensembleSize, writeQ, ackQ, customMetadata, newEnsemble, idx, exclude); newEnsemble.set(idx, newBookie); replaced++; } catch (BKException.BKNotEnoughBookiesException e) { if (replaced <= 0) { throw e; } else { break; } } } return newEnsemble; }

Target:
List<BookieSocketAddress> replaceBookiesInEnsemble(LedgerMetadata metadata, List<BookieSocketAddress> oldEnsemble, Map<Integer, BookieSocketAddress> failedBookies) throws BKException.BKNotEnoughBookiesException { List<BookieSocketAddress> newEnsemble = new ArrayList<>(oldEnsemble); int ensembleSize = metadata.getEnsembleSize(); int writeQ = metadata.getWriteQuorumSize(); int ackQ = metadata.getAckQuorumSize(); Map<String, byte[]> customMetadata = metadata.getCustomMetadata(); Set<BookieSocketAddress> exclude = new HashSet<>(failedBookies.values()); int replaced = 0; for (Map.Entry<Integer, BookieSocketAddress> entry : failedBookies.entrySet()) { int idx = entry.getKey(); BookieSocketAddress addr = entry.getValue(); if (LOG.isDebugEnabled()) { LOG.debug("[EnsembleChange-L{}] replacing bookie: index: {}", getId(), addr, idx); } if (!newEnsemble.get(idx).equals(addr)) { if (LOG.isDebugEnabled()) { LOG.debug("[EnsembleChange-L{}] Not changing failed bookie at index {}, already changed to {}", getId(), addr, idx, newEnsemble.get(idx)); } continue; } try { BookieSocketAddress newBookie = clientCtx.getBookieWatcher().replaceBookie( ensembleSize, writeQ, ackQ, customMetadata, newEnsemble, idx, exclude); newEnsemble.set(idx, newBookie); replaced++; } catch (BKException.BKNotEnoughBookiesException e) { if (replaced <= 0) { throw e; } else { break; } } } return newEnsemble; }
Source:
private static void writeBlocks(Cube cube, NBTTagCompound cubeNbt) { ExtendedBlockStorage ebs = cube.getStorage(); if(ebs == null){ return; } byte[] abyte = new byte[4096]; NibbleArray data = new NibbleArray(); NibbleArray add = ebs.getData().getDataForNBT(abyte, data); cubeNbt.setByteArray("Blocks", abyte); cubeNbt.setByteArray("Data", data.getData()); if (add != null) { cubeNbt.setByteArray("Add", add.getData()); } cubeNbt.setByteArray("BlockLight", ebs.getBlocklightArray().getData()); if (!cube.getCubicWorld().getProvider().getHasNoSky()) { cubeNbt.setByteArray("SkyLight", ebs.getSkylightArray().getData()); } }

Target:
private static void writeBlocks(Cube cube, NBTTagCompound cubeNbt) { ExtendedBlockStorage ebs = cube.getStorage(); if(ebs == null) { return; } byte[] abyte = new byte[Cube.SIZE*Cube.SIZE*Cube.SIZE]; NibbleArray data = new NibbleArray(); NibbleArray add = ebs.getData().getDataForNBT(abyte, data); cubeNbt.setByteArray("Blocks", abyte); cubeNbt.setByteArray("Data", data.getData()); if (add != null) { cubeNbt.setByteArray("Add", add.getData()); } cubeNbt.setByteArray("BlockLight", ebs.getBlocklightArray().getData()); if (!cube.getWorld().getProvider().getHasNoSky()) { cubeNbt.setByteArray("SkyLight", ebs.getSkylightArray().getData()); } }
Source:
@Override public void toJson(JsonWriter writer, @Nullable Object value) throws IOException { if (value == null) { value = defaultIfNull; } delegate.toJson(writer, value); }

Target:
@Override public void toJson(JsonWriter writer, @Nullable Object value) throws IOException { if (defaultIfNull().equals(value)) { delegate.toJson(writer, null); } else { delegate.toJson(writer, value); } }
Source:
private void serverAboutToStart( FMLServerAboutToStartEvent evt ) { WorldData.instance().onWorldStart(); }

Target:
private void serverAboutToStart( FMLServerAboutToStartEvent evt ) { WorldData.onServerAboutToStart(); }
Source:
public void onPicturePathReceived(String picturePath) { if (getListener() != null) { getListener().onImageUploadStarted(); } getViewModel().imageUploadStart(picturePath); performUserAction(UPLOAD_IMAGE, picturePath); }

Target:
public void onPicturePathReceived(String picturePath) { Class activityUploadDetail = null; if (getListener() != null) { activityUploadDetail = getListener().provideImageUploadDetailActivity(); } startUploadDetailActivity(activityUploadDetail, picturePath); }
Source:
public void verifyDoesNotRunOutOfMemory() { final List<Rule> rules = Lists.newArrayList(); for (int i=0; i<100; i++) { final Rule rule = new RuleBuilder().withName("rule1").withPosition(i+1).withProtocol("UDP").withDstAddress("192.168.0." + i).build(); rules.add(rule); } final DefaultClassificationEngine engine = new DefaultClassificationEngine(() -> rules, FilterService.NOOP); System.gc(); }

Target:
public void verifyDoesNotRunOutOfMemory() { final List<Rule> rules = Lists.newArrayList(); for (int i=0; i<100; i++) { final Rule rule = new RuleBuilder().withName("rule1").withPosition(i+1).withProtocol("UDP").withDstAddress("192.168.0." + i).build(); rules.add(rule); } final DefaultClassificationEngine engine = new DefaultClassificationEngine(() -> rules, FilterService.NOOP); engine.classify(new ClassificationRequest("localhost", 1234, "127.0.0.1", 80, "192.168.0.1", Protocols.getProtocol("UDP"))); }
Source:
public void testSessionlessConnectionsExpired() throws Exception { ServerCnxnFactory factory = new NIOServerCnxnFactory(); factory.configure(new InetSocketAddress(PortAssignment.unique()), 1000); factory.start(); int timeout = Integer.getInteger( ZOOKEEPER_NIO_SESSIONLESS_CNXN_TIMEOUT, 10000); ServerMetrics.resetAll(); ((NIOServerCnxnFactory) factory).touchCnxn(createMockNIOCnxn()); ((NIOServerCnxnFactory) factory).touchCnxn(createMockNIOCnxn()); Thread.sleep(2*timeout); Map<String, Object> values = ServerMetrics.getAllValues(); Assert.assertEquals(2L, values.get("sessionless_connections_expired")); factory.shutdown(); }

Target:
public void testSessionlessConnectionsExpired() throws Exception { ServerCnxnFactory factory = new NIOServerCnxnFactory(); factory.configure(new InetSocketAddress(PortAssignment.unique()), 1000); factory.start(); int timeout = Integer.getInteger( ZOOKEEPER_NIO_SESSIONLESS_CNXN_TIMEOUT, 10000); ServerMetrics.getMetrics().resetAll(); ((NIOServerCnxnFactory) factory).touchCnxn(createMockNIOCnxn()); ((NIOServerCnxnFactory) factory).touchCnxn(createMockNIOCnxn()); Map<String, Object> values = MetricsUtils.currentServerMetrics(); int sleptTime = 0; while (values.get("sessionless_connections_expired") == null || sleptTime < 2*timeout){ Thread.sleep(100); sleptTime += 100; values = MetricsUtils.currentServerMetrics(); } Assert.assertEquals(2L, values.get("sessionless_connections_expired")); factory.shutdown(); }
Source:
public void onDeselectAllItemsEvent(@Observes DeselectAllItemsEvent event) { if (getListView().getListGrid() != null) { getListView().getListGrid().deselectAllItems(); } refreshGrid(); }

Target:
public void onDeselectAllItemsEvent(@Observes DeselectAllItemsEvent event) { deselectAllItems(); }
Source:
static void interactive(Parameters params, CoreInterface core) throws Exception { log.info("Setting up interactive shell..."); Exception e = null; try { runInteractiveShell(core); } catch (final Exception inner) { log.error("Error when running shell", e); e = inner; } log.info("Closing core bridge..."); try { core.shutdown(); } catch (final Exception inner) { log.error("Failed to close core bridge", e); if (e != null) { inner.addSuppressed(e); } e = inner; } if (e != null) { throw e; } }

Target:
static void interactive(Parameters params, CoreInterface core) throws Exception { log.info("Setting up interactive shell..."); Exception e = null; try { runInteractiveShell(core); } catch (final Exception inner) { e = inner; } log.info("Closing core bridge..."); try { core.shutdown(); } catch (final Exception inner) { if (e != null) { inner.addSuppressed(e); } e = inner; } if (e != null) { throw e; } }
Source:
public CreateServiceUserMenu(@PluginName String pluginName, Provider<CurrentUser> userProvider) { this.pluginName = pluginName; this.userProvider = userProvider; menuEntries = Lists.newArrayList(); if (canCreateServiceUser()) { menuEntries.add(new MenuEntry("People", Collections .singletonList(new MenuItem("Create Service User", "#/x/" + pluginName + "/create-service-user", "")))); } }

Target:
public CreateServiceUserMenu(@PluginName String pluginName, Provider<CurrentUser> userProvider) { this.pluginName = pluginName; this.userProvider = userProvider; menuEntries = Lists.newArrayList(); if (canCreateServiceUser()) { menuEntries.add(new MenuEntry("People", Collections .singletonList(new MenuItem("Create Service User", "#/x/" + pluginName + "/create", "")))); } }
Source:
public void internalExtractResult(long startTs, ColumnSelection selection, byte[] row, byte[] col, byte[] val, long ts) { if (ts < startTs && selection.contains(col)) { Cell cell = Cell.create(row, col); if (!collector.containsKey(cell)) { collector.put(cell, Value.create(val, ts)); } } else { getPostFilteredCellsMeter(ValueExtractor.class).mark(); } }

Target:
public void internalExtractResult(long startTs, ColumnSelection selection, byte[] row, byte[] col, byte[] val, long ts) { if (ts < startTs && selection.contains(col)) { Cell cell = Cell.create(row, col); if (!collector.containsKey(cell)) { collector.put(cell, Value.create(val, ts)); } else { notLatestVisibleValueCellFilterMeter.mark(); } } else { notLatestVisibleValueCellFilterMeter.mark(); } }
Source:
public final synchronized void setId(@CheckForNull String id) { if (this.id == null) { this.id = id; } else { System.out.println("Go away"); } }

Target:
public final synchronized void setId(@CheckForNull String id) { if (this.id == null) { this.id = id; } else if (!this.id.equals(id)) { throw new IllegalStateException("The ID cannot be changed after it has been set."); } }
Source:
public void removeDBPropertyToPreventRenameWhenBootstrapDumpOfTableFails() throws Exception { List<String> tableList = Arrays.asList("a1", "a2"); String dbRandomKey = "akeytoberandom"; mockStatic(Utils.class); when(Utils.matchesDb(same(hive), eq("default"))) .thenReturn(Collections.singletonList("default")); when(Utils.getAllTables(same(hive), eq("default"))).thenReturn(tableList); when(Utils.setDbBootstrapDumpState(same(hive), eq("default"))).thenReturn(dbRandomKey); when(Utils.matchesTbl(same(hive), eq("default"), anyString())).thenReturn(tableList); when(hive.getAllFunctions()).thenReturn(Collections.emptyList()); when(queryState.getConf()).thenReturn(conf); when(conf.getLong("hive.repl.last.repl.id", -1L)).thenReturn(1L); ReplDumpTask task = new StubReplDumpTask() { private int tableDumpCount = 0; @Override void dumpTable(String dbName, String tblName, String validTxnList, Path dbRoot, long lastReplId, Hive hiveDb) throws Exception { tableDumpCount++; if (tableDumpCount > 1) { throw new TestException(); } } }; task.initialize(queryState, null, null, null); task.setWork( new ReplDumpWork("default", "", Long.MAX_VALUE, Long.MAX_VALUE, "", Integer.MAX_VALUE, "") ); try { task.bootStrapDump(mock(Path.class), null, mock(Path.class), Hive.get()); } finally { verifyStatic(); Utils.resetDbBootstrapDumpState(same(hive), eq("default"), eq(dbRandomKey)); } }

Target:
public void removeDBPropertyToPreventRenameWhenBootstrapDumpOfTableFails() throws Exception { List<String> tableList = Arrays.asList("a1", "a2"); String dbRandomKey = "akeytoberandom"; mockStatic(Utils.class); when(Utils.matchesDb(same(hive), eq("default"))) .thenReturn(Collections.singletonList("default")); when(Utils.getAllTables(same(hive), eq("default"))).thenReturn(tableList); when(Utils.setDbBootstrapDumpState(same(hive), eq("default"))).thenReturn(dbRandomKey); when(Utils.matchesTbl(same(hive), eq("default"), anyString())).thenReturn(tableList); when(hive.getAllFunctions()).thenReturn(Collections.emptyList()); when(queryState.getConf()).thenReturn(conf); when(conf.getLong("hive.repl.last.repl.id", -1L)).thenReturn(1L); ReplDumpTask task = new StubReplDumpTask() { private int tableDumpCount = 0; @Override void dumpTable(String dbName, String tblName, String validTxnList, Path dbRoot, long lastReplId, Hive hiveDb) throws Exception { tableDumpCount++; if (tableDumpCount > 1) { throw new TestException(); } } }; task.initialize(queryState, null, null, null); task.setWork( new ReplDumpWork("default", "", Long.MAX_VALUE, Long.MAX_VALUE, "", Integer.MAX_VALUE, "") ); try { task.bootStrapDump(mock(Path.class), null, mock(Path.class), hive); } finally { verifyStatic(); Utils.resetDbBootstrapDumpState(same(hive), eq("default"), eq(dbRandomKey)); } }
Source:
private Set<String> parseSet(String str) { if (str == null) { return null; } String[] parts = str.split("" + RECORD_SEPERATOR); Set<String> results = new HashSet<>(); Collections.addAll(results, parts); return results; }

Target:
private Set<String> parseSet(String str) { if (str == null) { return null; } String[] parts = RECORD_SEPARATOR_PATTERN.split(str); Set<String> results = new HashSet<>(); Collections.addAll(results, parts); return results; }
Source:
public IAnalysisModule instantiateAnalysis() { ITmfProjectModelElement parent = getParent(); if (parent instanceof TmfTraceElement) { ITmfTrace trace = ((TmfTraceElement) parent).openTrace(); try { fModule.setTrace(trace); return fModule; } catch (TmfAnalysisException e) { e.printStackTrace(); } } return null; }

Target:
public IAnalysisModule instantiateAnalysis() { ITmfProjectModelElement parent = getParent(); if (parent instanceof TmfTraceElement) { final ITmfTrace trace = ((TmfTraceElement) parent).getTrace(); try { fModule.setTrace(trace); return fModule; } catch (TmfAnalysisException e) { TraceUtils.displayErrorMsg(Messages.TmfAnalysisElement_InstantiateAnalysis, e.getMessage()); } } return null; }
Source:
private boolean isDoubleClick() { if (mClearOnDoubleClick) { if (mFirstClick != 0 && System.currentTimeMillis() - mFirstClick > 200) { mCountClick = 0; } mCountClick++; if (mCountClick == 1) { mFirstClick = System.currentTimeMillis(); } else if (mCountClick == 2) { long lastClick = System.currentTimeMillis(); if (lastClick - mFirstClick < 200) { this.clear(); return true; } } } return false; }

Target:
private boolean isDoubleClick() { if (mClearOnDoubleClick) { if (mFirstClick != 0 && System.currentTimeMillis() - mFirstClick > DOUBLE_CLICK_DELAY_MS) { mCountClick = 0; } mCountClick++; if (mCountClick == 1) { mFirstClick = System.currentTimeMillis(); } else if (mCountClick == 2) { long lastClick = System.currentTimeMillis(); if (lastClick - mFirstClick < DOUBLE_CLICK_DELAY_MS) { this.clear(); return true; } } } return false; }
Source:
public Optional<String> extractBranch(String uri) { final Pattern pattern = Pattern.compile("^[A-Za-z]+://([^@]+)@.*"); final Matcher matcher = pattern.matcher(uri); if (matcher.matches()) { return Optional.of(matcher.group(1)); } else { return Optional.empty(); } }

Target:
public Optional<String> extractBranch(String uri) { final Matcher matcher = branchNameExtractor.matcher(uri); if (matcher.matches()) { return Optional.of(matcher.group(1)); } else { return Optional.empty(); } }
Source:
public void getContents() throws IOException, SignatureException, URISyntaxException, XmlProcessingException { final String bucketName = "test_get_contents"; try { client.putBucket(new PutBucketRequest(bucketName)); loadBookTestData(client, bucketName); final Ds3ClientHelpers helpers = Ds3ClientHelpers.wrap(client); final Ds3ClientHelpers.Job job = helpers.startReadAllJob(bucketName); final UUID jobId = job.getJobId(); job.transfer(new Ds3ClientHelpers.ObjectChannelBuilder() { @Override public SeekableByteChannel buildChannel(final String key) throws IOException { final Path filePath = Files.createTempFile("ds3", key); return Files.newByteChannel(filePath, StandardOpenOption.DELETE_ON_CLOSE, StandardOpenOption.WRITE); } }); JobStatus getJobResponseStatus = JobStatus.IN_PROGRESS; for (int retry = 0; retry < 3; retry++) { final GetJobResponse jobResponse = client.getJob(new GetJobRequest(jobId)); getJobResponseStatus = jobResponse.getMasterObjectList().getStatus(); if (getJobResponseStatus == JobStatus.COMPLETED) break; try { TimeUnit.MILLISECONDS.sleep(500); } catch (InterruptedException e) { LOG.warn("Caught interrupt", e); } } assertThat(getJobResponseStatus, is(JobStatus.COMPLETED)); } finally { deleteAllContents(client, bucketName); } }

Target:
public void getContents() throws IOException, SignatureException, URISyntaxException, XmlProcessingException { final String bucketName = "test_get_contents"; try { client.putBucket(new PutBucketRequest(bucketName)); loadBookTestData(client, bucketName); final Ds3ClientHelpers helpers = Ds3ClientHelpers.wrap(client); final Ds3ClientHelpers.Job job = helpers.startReadAllJob(bucketName); final UUID jobId = job.getJobId(); job.transfer(new Ds3ClientHelpers.ObjectChannelBuilder() { @Override public SeekableByteChannel buildChannel(final String key) throws IOException { final Path filePath = Files.createTempFile("ds3", key); return Files.newByteChannel(filePath, StandardOpenOption.DELETE_ON_CLOSE, StandardOpenOption.WRITE); } }); JobStatus getJobResponseStatus = JobStatus.IN_PROGRESS; for (int retry = 0; retry < 3; retry++) { final GetJobResponse jobResponse = client.getJob(new GetJobRequest(jobId)); getJobResponseStatus = jobResponse.getMasterObjectList().getStatus(); if (getJobResponseStatus == JobStatus.COMPLETED) break; try { TimeUnit.MILLISECONDS.sleep(500); } catch (final InterruptedException e) { LOG.warn("Caught interrupt", e); } } assertThat(getJobResponseStatus, is(JobStatus.COMPLETED)); } finally { deleteAllContents(client, bucketName); } }
Source:
public Future<byte[]> assignAsync(RegionInfo regionInfo, ServerName sn) throws IOException { RegionStateNode regionNode = regionStates.getOrCreateRegionStateNode(regionInfo); TransitRegionStateProcedure proc; regionNode.lock(); try { preTransitCheck(regionNode, STATES_EXPECTED_ON_ASSIGN); proc = TransitRegionStateProcedure.assign(getProcedureEnvironment(), regionInfo, sn); regionNode.setProcedure(proc); } finally { regionNode.unlock(); } return ProcedureSyncWait.submitProcedure(master.getMasterProcedureExecutor(), proc); }

Target:
public Future<byte[]> assignAsync(RegionInfo regionInfo, ServerName sn) throws IOException { TransitRegionStateProcedure proc = createAssignProcedure(regionInfo, sn); return ProcedureSyncWait.submitProcedure(master.getMasterProcedureExecutor(), proc); }
Source:
public void test() { ClientMessage message = ClientMessage.createForEncode(); message.add(new ClientMessage.Frame(new byte[100], UNFRAGMENTED_MESSAGE | FINAL)); message.setMessageType((short) MapPutCodec.REQUEST_MESSAGE_TYPE); AtomicReference<ClientMessage> reference = new AtomicReference<>(message); ClientMessageEncoder encoder = new ClientMessageEncoder(); encoder.src(() -> reference.getAndSet(null)); ByteBuffer buffer = ByteBuffer.allocate(1000); buffer.flip(); encoder.dst(buffer); HandlerStatus result = encoder.onWrite(); assertEquals(CLEAN, result); AtomicReference<ClientMessage> resultingMessage = new AtomicReference<>(); ClientMessageDecoder decoder = new ClientMessageDecoder(null, resultingMessage::set); decoder.setNormalPacketsRead(SwCounter.newSwCounter()); buffer.position(buffer.limit()); decoder.src(buffer); decoder.onRead(); assertEquals(message.getMessageType(), resultingMessage.get().getMessageType()); }

Target:
public void test() { ClientMessage message = ClientMessage.createForEncode(); message.add(new ClientMessage.Frame(new byte[100], UNFRAGMENTED_MESSAGE | IS_FINAL_FLAG)); message.setMessageType((short) MapPutCodec.REQUEST_MESSAGE_TYPE); AtomicReference<ClientMessage> reference = new AtomicReference<>(message); ClientMessageEncoder encoder = new ClientMessageEncoder(); encoder.src(() -> reference.getAndSet(null)); ByteBuffer buffer = ByteBuffer.allocate(1000); buffer.flip(); encoder.dst(buffer); HandlerStatus result = encoder.onWrite(); assertEquals(CLEAN, result); AtomicReference<ClientMessage> resultingMessage = new AtomicReference<>(); ClientMessageDecoder decoder = new ClientMessageDecoder(null, resultingMessage::set); decoder.setNormalPacketsRead(SwCounter.newSwCounter()); buffer.position(buffer.limit()); decoder.src(buffer); decoder.onRead(); assertEquals(message.getMessageType(), resultingMessage.get().getMessageType()); assertEquals(message.getFrameLength(), resultingMessage.get().getFrameLength()); assertEquals(message.getHeaderFlags(), resultingMessage.get().getHeaderFlags()); assertEquals(message.getPartitionId(), resultingMessage.get().getPartitionId()); }
Source:
private Single<Optional<Optional<java.io.File>>> downloadFileForReceipt(@NonNull final PartialReceipt partialReceipt, @NonNull final java.io.File inDirectory) { final java.io.File receiptFile = new java.io.File(new java.io.File(inDirectory, partialReceipt.parentTripName), partialReceipt.fileName); return mDriveStreamsManager.download(partialReceipt.driveId.getId(), receiptFile) .map(Optional::of) .doOnError(throwable -> Logger.error(DriveRestoreDataManager.this, "Failed to download in with id {}.", partialReceipt.fileName, partialReceipt.parentTripName, partialReceipt.driveId)); }

Target:
private Single<Optional<java.io.File>> downloadFileForReceipt(@NonNull final PartialReceipt partialReceipt, @NonNull final java.io.File inDirectory) { final java.io.File receiptFile = new java.io.File(new java.io.File(inDirectory, partialReceipt.parentTripName), partialReceipt.fileName); return mDriveStreamsManager.download(partialReceipt.driveId.getId(), receiptFile) .doOnError(throwable -> Logger.error(DriveRestoreDataManager.this, "Failed to download in with id {}.", partialReceipt.fileName, partialReceipt.parentTripName, partialReceipt.driveId)); }
Source:
public void setup() { settingsService = mock(SettingsService.class); commitService = mock(CommitService.class); jenkins = mock(Jenkins.class); settings = mock(Settings.class); refChange = mock(RefChange.class); minimalRef = mock(MinimalRef.class); repository = mock(Repository.class); project = mock(Project.class); user = mock(ApplicationUser.class); when(refChange.getRef()).thenReturn(minimalRef); when(refChange.getToHash()).thenReturn(COMMIT); when(settingsService.getSettings(any())).thenReturn(settings); when(repository.getProject()).thenReturn(project); when(project.getKey()).thenReturn(PROJECT_KEY); when(jenkins.getJenkinsServer(project.getKey())).thenReturn(projectServer); when(refChange.getType()).thenReturn(RefChangeType.UPDATE); when(minimalRef.getId()).thenReturn(BRANCH_REF); jobBuilder = new Job.JobBuilder(1).jobName("").buildParameters("").branchRegex("") .pathRegex("").ignoreCommitMsg("").ignoreComitters(""); jobs = new ArrayList<>(); when(settingsService.getJobs(any())).thenReturn(jobs); }

Target:
public void setup() { settingsService = mock(SettingsService.class); commitService = mock(CommitService.class); Commit commit = mock(Commit.class); jenkins = mock(Jenkins.class); Person person = mock(Person.class); settings = mock(Settings.class); refChange = mock(RefChange.class); minimalRef = mock(MinimalRef.class); repository = mock(Repository.class); project = mock(Project.class); user = mock(ApplicationUser.class); when(refChange.getRef()).thenReturn(minimalRef); when(refChange.getToHash()).thenReturn(COMMIT); when(settingsService.getSettings(any())).thenReturn(settings); when(repository.getProject()).thenReturn(project); when(project.getKey()).thenReturn(PROJECT_KEY); when(jenkins.getJenkinsServer(project.getKey())).thenReturn(projectServer); when(refChange.getType()).thenReturn(RefChangeType.UPDATE); when(minimalRef.getId()).thenReturn(BRANCH_REF); jobBuilder = new Job.JobBuilder(1).jobName("").buildParameters("").branchRegex("") .pathRegex("").ignoreCommitMsg("").ignoreComitters(""); jobs = new ArrayList<>(); when(settingsService.getJobs(any())).thenReturn(jobs); when(commitService.getCommit(any())).thenReturn(commit); when(commit.getMessage()).thenReturn(commitMsg); when(commit.getAuthor()).thenReturn(person); when(person.getName()).thenReturn(committer); }
Source:
public AbstractListDataView<T> addItemsBefore(Collection<T> items, T before) { if (items == null || items.isEmpty()) { return this; } final ListDataProvider<T> dataProvider = getDataProvider(); final Collection<T> backendItems = dataProvider.getItems(); final int beforeItemIndex = getItemIndex(before); if (beforeItemIndex == -1) { throw new IllegalArgumentException( "Item to insert before is not available in the data"); } if (backendItems instanceof List) { final List<T> itemList = (List<T>) backendItems; final List<T> itemsToAdd = items.stream() .filter(item -> !contains(item, dataProvider)) .collect(Collectors.toList()); itemList.addAll(beforeItemIndex, itemsToAdd); dataProvider.refreshAll(); return this; } throw new IllegalArgumentException( String.format(COLLECTION_TYPE_ERROR_MESSAGE_PATTERN, backendItems.getClass().getSimpleName())); }

Target:
public AbstractListDataView<T> addItemsBefore(Collection<T> items, T before) { addItemCollectionOnTarget(items, before, "Item to insert before is not available in the data", (index, containsTarget) -> index); return this; }
Source:
private void checkPackagePermission(EntityType newEntityType, AbstractRowLevelSecurityRepositoryDecorator.Action action) { Package pack = newEntityType.getPackage(); if (pack != null) { boolean checkPackage = isPackageUpdated(action, newEntityType); if (checkPackage && !userPermissionEvaluator.hasPermission(new PackageIdentity(pack.getId()), PackagePermission.WRITEMETA)) { throw new MolgenisDataException( String.format("No [%s] permission on package '%s'", toMessagePermission(action), pack.getLabel())); } } else { if (!currentUserIsSuOrSystem() && isPackageUpdated(action, newEntityType)) { throw new MolgenisDataException("Only superusers are allowed to create EntityTypes without a package."); } } }

Target:
private void checkPackagePermission(EntityType newEntityType, AbstractRowLevelSecurityRepositoryDecorator.Action action) { Package pack = newEntityType.getPackage(); if (pack != null) { boolean checkPackage = isPackageUpdated(action, newEntityType); if (checkPackage && !userPermissionEvaluator.hasPermission(new PackageIdentity(pack.getId()), PackagePermission.WRITEMETA)) { throw new PackagePermissionException(PackagePermission.WRITEMETA, pack); } } else { if (!currentUserIsSuOrSystem() && isPackageUpdated(action, newEntityType)) { throw new NullPackageNotSuException(); } } }
Source:
public Iterator<IColumn> columnsIterator() { return (Iterator<IColumn>) (Object) id2ChunkMap.values().iterator(); }

Target:
Iterator<IColumn> columnsIterator() { return (Iterator<IColumn>) (Object) id2ChunkMap.values().iterator(); }
Source:
protected int sizeOfSize() { return 1; }

Target:
protected final int sizeOfSize() { return 1; }
Source:
public GlusterVolumeSnapshotListModel() { setTitle(ConstantsManager.getInstance().getConstants().snapshotsTitle()); setHelpTag(HelpTag.volume_snapshots); setHashName("volume_snapshots"); setRestoreSnapshotCommand(new UICommand("Restore", this)); setDeleteSnapshotCommand(new UICommand("Delete", this)); setDeleteAllSnapshotsCommand(new UICommand("DeleteAll", this)); setActivateSnapshotCommand(new UICommand("Activate", this)); setDeactivateSnapshotCommand(new UICommand("Deactivate", this)); }

Target:
public GlusterVolumeSnapshotListModel() { setTitle(ConstantsManager.getInstance().getConstants().snapshotsTitle()); setHelpTag(HelpTag.volume_snapshots); setHashName("volume_snapshots"); setRestoreSnapshotCommand(new UICommand("restore", this)); setDeleteSnapshotCommand(new UICommand("delete", this)); setDeleteAllSnapshotsCommand(new UICommand("deleteAll", this)); setActivateSnapshotCommand(new UICommand("activate", this)); setDeactivateSnapshotCommand(new UICommand("deactivate", this)); }
Source:
private void setupNonStickDevices(Dictionary<String, ?> config) { Set<String> deviceNames = getDeviceNamesFromConfig(config); for (String deviceName : deviceNames) { if ("stick".equals(deviceName)) { continue; } if (stick.getDeviceByName(deviceName) != null) { continue; } String MAC = (String) config.get(deviceName + ".mac"); if (MAC == null || MAC.equals("")) { logger.error("Plugwise can not add device with name without a MAC address", deviceName); } else if (stick.getDeviceByMAC(MAC) != null) { logger.error( "Plugwise can not add device with name: and MAC address: {}, " + "the same MAC address is already used by device with name: {}", deviceName, MAC, stick.getDeviceByMAC(MAC).name); } else { String deviceType = (String) config.get(deviceName + ".type"); PlugwiseDevice device = createPlugwiseDevice(deviceType, MAC, deviceName); if (device != null) { stick.plugwiseDeviceCache.add(device); } } } }

Target:
private void setupNonStickDevices(Dictionary<String, ?> config) { Set<String> deviceNames = getDeviceNamesFromConfig(config); for (String deviceName : deviceNames) { if ("stick".equals(deviceName)) { continue; } if (stick.getDeviceByName(deviceName) != null) { continue; } String MAC = (String) config.get(deviceName + ".mac"); if (MAC == null || MAC.equals("")) { logger.warn("Plugwise can not add device with name without a MAC address", deviceName); } else if (stick.getDeviceByMAC(MAC) != null) { logger.warn( "Plugwise can not add device with name: and MAC address: {}, " + "the same MAC address is already used by device with name: {}", deviceName, MAC, stick.getDeviceByMAC(MAC).name); } else { String deviceType = (String) config.get(deviceName + ".type"); PlugwiseDevice device = createPlugwiseDevice(deviceType, MAC, deviceName); if (device != null) { stick.plugwiseDeviceCache.add(device); } } } }
Source:
protected LoginPackage preLogin() throws BankException, IOException { urlopen = new Urllib(context, CertificateReader.getCertificates(context, R.raw.cert_ostgotatrafiken_login, R.raw.cert_ostgotatrafiken_overview)); List<NameValuePair> postData = new ArrayList<NameValuePair>(); postData.add(new BasicNameValuePair("", "{\"authSource\":10,\"keepMeLimitedLoggedIn\":true," + "\"userName\":\"" + getUsername() + "\"," + "\"password\":\"" + getPassword() + "\"," + "\"impersonateUserName\":\"\"}")); return new LoginPackage(urlopen, postData, response, "<LINK_0>"); }

Target:
protected LoginPackage preLogin() throws BankException, IOException { urlopen = new Urllib(context, CertificateReader.getCertificates(context, R.raw.cert_ostgotatrafiken_login, R.raw.cert_ostgotatrafiken_overview)); List<NameValuePair> postData = new ArrayList<NameValuePair>(); postData.add(new BasicNameValuePair("", "{\"authSource\":10," + "\"keepMeLimitedLoggedIn\":true," + "\"userName\":\"" + getUsername() + "\"," + "\"password\":\"" + getPassword() + "\"," + "\"impersonateUserName\":\"\"}")); return new LoginPackage(urlopen, postData, response, "<LINK_0>"); }
Source:
Object read(BinaryReaderExImpl reader) throws BinaryObjectException { try { assert reader != null; assert mode != BinaryWriteMode.OPTIMIZED : "OptimizedMarshaller should not be used here: " + cls.getName(); assert !CompressionUtils.isCompressionType(mode); Object res; switch (mode) { case BINARY: res = newInstance(); reader.setHandle(res); if (serializer != null) serializer.readBinary(res, reader); else ((Binarylizable)res).readBinary(reader); break; case OBJECT: res = newInstance(); reader.setHandle(res); for (BinaryFieldAccessor info : fields) info.read(res, reader); break; default: assert false : "Invalid mode: " + mode; return null; } if (readResolveMtd != null) { try { res = readResolveMtd.invoke(res); reader.setHandle(res); } catch (IllegalAccessException e) { throw new RuntimeException(e); } catch (InvocationTargetException e) { if (e.getTargetException() instanceof BinaryObjectException) throw (BinaryObjectException)e.getTargetException(); throw new BinaryObjectException("Failed to execute readResolve() method on " + res, e); } } return res; } catch (Exception e) { if (S.INCLUDE_SENSITIVE && !F.isEmpty(typeName)) throw new BinaryObjectException("Failed to deserialize object [typeName=" + typeName + ']', e); else throw new BinaryObjectException("Failed to deserialize object [typeId=" + typeId + ']', e); } }

Target:
Object read(BinaryReaderExImpl reader) throws BinaryObjectException { try { assert reader != null; assert mode != BinaryWriteMode.OPTIMIZED : "OptimizedMarshaller should not be used here: " + cls.getName(); assert mode != BinaryWriteMode.COMPRESSED : "Compressed type isn't allowed here: " + mode; Object res; switch (mode) { case BINARY: res = newInstance(); reader.setHandle(res); if (serializer != null) serializer.readBinary(res, reader); else ((Binarylizable)res).readBinary(reader); break; case OBJECT: res = newInstance(); reader.setHandle(res); for (BinaryFieldAccessor info : fields) info.read(res, reader); break; default: assert false : "Invalid mode: " + mode; return null; } if (readResolveMtd != null) { try { res = readResolveMtd.invoke(res); reader.setHandle(res); } catch (IllegalAccessException e) { throw new RuntimeException(e); } catch (InvocationTargetException e) { if (e.getTargetException() instanceof BinaryObjectException) throw (BinaryObjectException)e.getTargetException(); throw new BinaryObjectException("Failed to execute readResolve() method on " + res, e); } } return res; } catch (Exception e) { if (S.INCLUDE_SENSITIVE && !F.isEmpty(typeName)) throw new BinaryObjectException("Failed to deserialize object [typeName=" + typeName + ']', e); else throw new BinaryObjectException("Failed to deserialize object [typeId=" + typeId + ']', e); } }
Source:
public SSLContext get() { try { return SSLContext.getDefault(); } catch (NoSuchAlgorithmException e) { return null; } }

Target:
public SSLContext get() { try { return SSLContext.getDefault(); } catch (NoSuchAlgorithmException e) { throw new RuntimeException(e); } }
Source:
private void initializeFromOldBits(CircularBitSet oldBitSet) { if (oldBitSet.occupiedBits <= size) { for (int i = 0; i < oldBitSet.occupiedBits; i++) setNext(oldBitSet.bitSet.get(i)); } else { int startIndex = oldBitSet.currentIndex - size; for (int i = 0; i < size; i++) { int index = startIndex + i; index = index < 0 ? index + oldBitSet.size : index; setNext(oldBitSet.bitSet.get(index)); } } }

Target:
private void initializeFromOldBits(CircularBitSet oldBitSet) { int startIndex = oldBitSet.occupiedBits <= size ? 0 : oldBitSet.occupiedBits - size; for (int i = startIndex; i < oldBitSet.occupiedBits; i++) { setNext(oldBitSet.bitSet.get(i)); } }
Source:
public boolean moveCellsUp() { boolean dirty = false; if (moveCellsUpLoop()) dirty = true; for (int i = 0; i < GRID_WIDTH; i++) { for (int j = 0; j < (GRID_WIDTH - 1); j++) { int nextJ = j + 1; dirty = combineCells(i, nextJ, i, j, dirty); } } if (moveCellsUpLoop()) dirty = true; return dirty; }

Target:
public boolean moveCellsUp() { boolean dirty = false; if (moveCellsUpLoop()) { dirty = true; } for (int i = 0; i < GRID_WIDTH; i++) { for (int j = 0; j < (GRID_WIDTH - 1); j++) { int nextJ = j + 1; dirty = combineCells(i, nextJ, i, j, dirty); } } if (moveCellsUpLoop()) { dirty = true; } return dirty; }
Source:
public static Slice stConvexHull(@SqlType(GEOMETRY_TYPE_NAME) Slice input) { OGCGeometry geometry = deserialize(input); if (geometry.isEmpty()) { return input; } if (GeometryType.getForEsriGeometryType(geometry.geometryType()) == POINT) { return input; } OGCGeometry convexHull = geometry.convexHull(); return serialize(convexHull); }

Target:
public static Slice stConvexHull(@SqlType(GEOMETRY_TYPE_NAME) Slice input) { OGCGeometry geometry = deserialize(input); if (geometry.isEmpty()) { return input; } if (GeometryType.getForEsriGeometryType(geometry.geometryType()) == POINT) { return input; } return serialize(geometry.convexHull()); }
Source:
public int hashCode() { int h = 0; if (oldId != null) { h = h * 31 + oldId.hashCode(); } h = h * 31 + newId.hashCode(); h = h * 31 + whitespace.name().hashCode(); h = h * 31 + isRebaseTransparent.hashCode(); return h; }

Target:
public int hashCode() { int h = 0; if (oldId != null) { h = h * 31 + oldId.hashCode(); } h = h * 31 + newId.hashCode(); h = h * 31 + whitespace.name().hashCode(); h = h * 31 + (isRebaseTransparent ? 1 : 0); return h; }
Source:
public void rebaseEdit() throws Exception { assertEquals(RefUpdate.Result.NEW, modifier.createEdit( change, ps)); assertEquals(RefUpdate.Result.FORCED, modifier.modifyFile( editUtil.byChange(change).get(), FILE_NAME, CONTENT_NEW)); Optional<ChangeEditData> data = editUtil.dataByChange(change); PatchSet current = getCurrentPatchSet(changeId); assertEquals(current.getPatchSetId(), data.get().getBasePatchSet().getPatchSetId() + 1); modifier.rebaseEdit(data.get(), current); data = editUtil.dataByChange(change); assertEquals(current.getPatchSetId(), data.get().getBasePatchSet().getPatchSetId()); }

Target:
public void rebaseEdit() throws Exception { assertEquals(RefUpdate.Result.NEW, modifier.createEdit( change, ps)); assertEquals(RefUpdate.Result.FORCED, modifier.modifyFile( editUtil.byChange(change).get(), FILE_NAME, CONTENT_NEW)); ChangeEdit edit = editUtil.byChange(change).get(); PatchSet current = getCurrentPatchSet(changeId); assertEquals(current.getPatchSetId() - 1, edit.getBasePatchSet().getPatchSetId()); Date beforeRebase = edit.getEditCommit().getCommitterIdent().getWhen(); Thread.sleep(1000L); modifier.rebaseEdit(edit, current); edit = editUtil.byChange(change).get(); assertArrayEquals(CONTENT_NEW, toBytes(fileUtil.getContent(edit.getChange().getProject(), edit.getRevision().get(), FILE_NAME))); assertArrayEquals(CONTENT_NEW2, toBytes(fileUtil.getContent(edit.getChange().getProject(), edit.getRevision().get(), FILE_NAME2))); assertEquals(current.getPatchSetId(), edit.getBasePatchSet().getPatchSetId()); Date afterRebase = edit.getEditCommit().getCommitterIdent().getWhen(); assertFalse(beforeRebase.equals(afterRebase)); }
Source:
public static void beforeClass() { cluster = PassthroughTestHelpers.createActiveOnly("stripe", server -> { server.registerClientEntityService(new LeaseAcquirerClientService()); server.registerServerEntityService(new LeaseAcquirerServerService()); server.registerOverrideServiceProvider(new LeaseServiceProvider(), new LeaseConfigurationImpl(500L)); }); cluster.startAllServers(); }

Target:
public static void beforeClass() { cluster = PassthroughTestHelpers.createActiveOnly("stripe", server -> { server.registerClientEntityService(new LeaseAcquirerClientService()); server.registerServerEntityService(new LeaseAcquirerServerService()); server.registerOverrideServiceProvider(new LeaseServiceProvider(), new LeaseConfiguration(500L)); }); cluster.startAllServers(); }
Source:
protected static void validateCommandLineParameters(CommandLineArgs args) { String testClasses = args.testClass; List<String> testNgXml = args.suiteFiles; String testJar = args.testJar; String slave = args.slave; List<String> methods = args.commandLineMethods; if (testClasses == null && slave == null && testJar == null && (testNgXml == null || testNgXml.isEmpty()) && (methods == null || methods.isEmpty())) { throw new ParameterException("You need to specify at least one testng.xml, one class" + " or one method"); } String groups = args.groups; String excludedGroups = args.excludedGroups; if (testJar == null && (null != groups || null != excludedGroups) && testClasses == null && (testNgXml == null || testNgXml.isEmpty())) { throw new ParameterException("Groups option should be used with testclass option"); } if (args.slave != null && args.master != null) { throw new ParameterException(CommandLineArgs.SLAVE + " can't be combined with " + CommandLineArgs.MASTER); } Boolean junit = args.junit; Boolean mixed = args.mixed; if (junit && mixed) { throw new ParameterException(CommandLineArgs.MIXED + " can't be combined with " + CommandLineArgs.JUNIT); } }

Target:
protected static void validateCommandLineParameters(CommandLineArgs args) { String testClasses = args.testClass; List<String> testNgXml = args.suiteFiles; String testJar = args.testJar; List<String> methods = args.commandLineMethods; if (testClasses == null && testJar == null && (testNgXml == null || testNgXml.isEmpty()) && (methods == null || methods.isEmpty())) { throw new ParameterException("You need to specify at least one testng.xml, one class" + " or one method"); } String groups = args.groups; String excludedGroups = args.excludedGroups; if (testJar == null && (null != groups || null != excludedGroups) && testClasses == null && (testNgXml == null || testNgXml.isEmpty())) { throw new ParameterException("Groups option should be used with testclass option"); } Boolean junit = args.junit; Boolean mixed = args.mixed; if (junit && mixed) { throw new ParameterException(CommandLineArgs.MIXED + " can't be combined with " + CommandLineArgs.JUNIT); } }