auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testNestedNonTerminals5() throws Exception { Grammar.NonTerminalId baseCaseId = new Grammar.NonTerminalId("BaseCase"); Grammar.StateId baseCaseEntry= new Grammar.StateId("BaseCaseEntry"); Grammar.StateId baseCaseExit = new Grammar.StateId("BaseCaseExit"); Grammar.NonTerminal baseCase = new Grammar.NonTerminal(baseCaseId, baseCaseEntry, new Grammar.State.OrderingInfo(-1), baseCaseExit, new Grammar.State.OrderingInfo(1)); Grammar.RegExState resx = new Grammar.RegExState(new Grammar.StateId("X"), baseCase, new Grammar.State.OrderingInfo(0), Pattern.compile("x")); baseCase.entryState.next.add(resx); resx.next.add(baseCase.exitState); Term expected = amb(klist(Token.kAppOf("K", "x"))); for (int i = 2; i < 10; i++) { Grammar.NonTerminal nt = new Grammar.NonTerminal(new Grammar.NonTerminalId("NT"+i), new Grammar.StateId("NT"+i+"Entry"), new Grammar.State.OrderingInfo(-i), new Grammar.StateId("NT"+i+"Exit"), new Grammar.State.OrderingInfo(2*i-1)); Grammar.NonTerminalState state = new Grammar.NonTerminalState( new Grammar.StateId("S"+i), nt, new Grammar.State.OrderingInfo(2*i-2), baseCase, false); nt.entryState.next.add(state); state.next.add(nt.exitState); baseCase = nt; expected = amb(klist(expected)); } { Term result = new Parser(new ParseState("x")).parse(baseCase, 0); expected = amb(klist(expected)); assertEquals("Single char check: ", expected, result); } assertEquals("Expected Nullable NTs", 0, NullabilityCheck.getReachableNullableNT(baseCase).size()); }

Target:
public void testNestedNonTerminals5() throws Exception { Grammar.NonTerminalId baseCaseId = new Grammar.NonTerminalId("BaseCase"); Grammar.StateId baseCaseEntry= new Grammar.StateId("BaseCaseEntry"); Grammar.StateId baseCaseExit = new Grammar.StateId("BaseCaseExit"); Grammar.NonTerminal baseCase = new Grammar.NonTerminal(baseCaseId, baseCaseEntry, new Grammar.State.OrderingInfo(-1), baseCaseExit, new Grammar.State.OrderingInfo(1)); Grammar.RegExState resx = new Grammar.RegExState(new Grammar.StateId("X"), baseCase, new Grammar.State.OrderingInfo(0), Pattern.compile("x")); baseCase.entryState.next.add(resx); resx.next.add(baseCase.exitState); Term expected = amb(klist(Token.kAppOf("K", "x"))); for (int i = 2; i < 10; i++) { Grammar.NonTerminal nt = new Grammar.NonTerminal(new Grammar.NonTerminalId("NT"+i), new Grammar.StateId("NT"+i+"Entry"), new Grammar.State.OrderingInfo(-i), new Grammar.StateId("NT"+i+"Exit"), new Grammar.State.OrderingInfo(2*i-1)); Grammar.NonTerminalState state = new Grammar.NonTerminalState( new Grammar.StateId("S"+i), nt, new Grammar.State.OrderingInfo(2*i-2), baseCase, false); nt.entryState.next.add(state); state.next.add(nt.exitState); baseCase = nt; expected = amb(klist(expected)); } { Term result = new Parser(new ParseState("x")).parse(baseCase, 0); expected = amb(klist(expected)); Assert.assertEquals("Single char check: ", expected, result); } Assert.assertEquals("Expected Nullable NTs", 0, NullabilityCheck.getReachableNullableNT(baseCase).size()); }
Source:
private void usageLabel(@Nullable IdentifierTreeImpl node) { if (node == null) { return; } labels.stream() .filter(couple -> couple.label.equals(node.name())) .map(couple -> couple.symbol) .findFirst() .ifPresent(labelSymbol -> { labelSymbol.usages.add(node); node.labelSymbol = labelSymbol; }); }

Target:
private void usageLabel(@Nullable IdentifierTreeImpl node) { if (node == null) { return; } labels.stream() .filter(symbol -> symbol.name().equals(node.name())) .findFirst() .ifPresent(labelSymbol -> { labelSymbol.usages.add(node); node.labelSymbol = labelSymbol; }); }
Source:
private void testWithoutAnyCandidateWhenDatabaseToLower() throws SQLException { deleteDb(getTestName()); final Connection conn = getJdbcConnection("DATABASE_TO_LOWER=true;DATABASE_TO_UPPER=false"); final Statement stat = conn.createStatement(); stat.execute("CREATE TABLE T2 ( ID INT IDENTITY )"); try { stat.execute("ALTER TABLE T1 DROP COLUMN ID"); fail("Table `t1` was accessible but should not have been."); } catch (SQLException e) { final String message = e.getMessage(); assertContains(message, "Table \"t1\" not found;"); } conn.close(); deleteDb(getTestName()); }

Target:
private void testWithoutAnyCandidateWhenDatabaseToLower() throws SQLException { deleteDb(getTestName()); Connection conn = getConnectionWithSettings("DATABASE_TO_LOWER=TRUE"); Statement stat = conn.createStatement(); stat.execute("CREATE TABLE T2 ( ID INT IDENTITY )"); try { stat.execute("ALTER TABLE T1 DROP COLUMN ID"); fail("Table `t1` was accessible but should not have been."); } catch (SQLException e) { String message = e.getMessage(); assertContains(message, "Table \"t1\" not found;"); } conn.close(); deleteDb(getTestName()); }
Source:
public Block copyRegion(int position, int length) { int positionCount = getPositionCount(); if (position < 0 || length < 0 || position + length > positionCount) { throw new IndexOutOfBoundsException("Invalid position " + position + " in block with " + positionCount + " positions"); } int startFieldBlockOffset = getFieldBlockOffset(position); int endFieldBlockOffset = getFieldBlockOffset(position + length); int fieldBlockLength = endFieldBlockOffset - startFieldBlockOffset; Block[] newBlocks = new Block[numFields]; for (int i = 0; i < numFields; i++) { newBlocks[i] = getFieldBlocks()[i].copyRegion(startFieldBlockOffset, fieldBlockLength); } int[] newOffsets = sliceOffsets(getFieldBlockOffsets(), position + getOffsetBase(), length); boolean[] newRowIsNull = compactBooleanArray(getRowIsNull(), position + getOffsetBase(), length); if (Arrays.equals(newBlocks, getFieldBlocks()) && newOffsets == getFieldBlockOffsets() && newRowIsNull == getRowIsNull()) { return this; } return new RowBlock(0, length, newRowIsNull, newOffsets, newBlocks); }

Target:
public Block copyRegion(int position, int length) { int positionCount = getPositionCount(); if (position < 0 || length < 0 || position + length > positionCount) { throw new IndexOutOfBoundsException("Invalid position " + position + " in block with " + positionCount + " positions"); } int startFieldBlockOffset = getFieldBlockOffset(position); int endFieldBlockOffset = getFieldBlockOffset(position + length); int fieldBlockLength = endFieldBlockOffset - startFieldBlockOffset; Block[] newBlocks = new Block[numFields]; for (int i = 0; i < numFields; i++) { newBlocks[i] = getFieldBlocks()[i].copyRegion(startFieldBlockOffset, fieldBlockLength); } int[] newOffsets = compactOffsets(getFieldBlockOffsets(), position + getOffsetBase(), length); boolean[] newRowIsNull = compactArray(getRowIsNull(), position + getOffsetBase(), length); if (arraySame(newBlocks, getFieldBlocks()) && newOffsets == getFieldBlockOffsets() && newRowIsNull == getRowIsNull()) { return this; } return new RowBlock(0, length, newRowIsNull, newOffsets, newBlocks); }
Source:
void onSave(@SuppressWarnings("unused") ClickEvent e) { if (cm.isClean(generation)) { upToChange(); return; } ChangeFileApi.putContentOrMessage(revision, path, cm.getValue(), new GerritCallback<VoidResult>() { @Override public void onSuccess(VoidResult result) { upToChange(); } }); }

Target:
void onSave(@SuppressWarnings("unused") ClickEvent e) { save().run(); }
Source:
public Trader(String name, double cashInHand) { super(); this.name = name; this.cashInHand = cashInHand; this.position = new ArrayList<Holding>(); this.ordersPlaced = new ArrayList<Order>(); }

Target:
public Trader(String name, double cashInHand) { this.name = name; this.cashInHand = cashInHand; this.position = new ArrayList<Holding>(); this.ordersPlaced = new ArrayList<Order>(); }
Source:
public void onDamage(EntityDamageByEntityEvent e) { if (e.getDamager() instanceof Bee) { if (e.getEntity() instanceof Player) { Player p = (Player) e.getEntity(); if (!SlimefunUtils.isItemSimilar(SlimefunItems.SCUBA_HELMET, p.getInventory().getHelmet(), true) && !SlimefunUtils.isItemSimilar(SlimefunItems.HAZMAT_CHESTPLATE, p.getInventory().getChestplate(), true) && !SlimefunUtils.isItemSimilar(SlimefunItems.HAZMAT_LEGGINGS, p.getInventory().getLeggings(), true) && !SlimefunUtils.isItemSimilar(SlimefunItems.RUBBER_BOOTS, p.getInventory().getBoots(), true)) { e.setDamage(0D); for (ItemStack armor : p.getInventory().getArmorContents()) { ItemUtils.damageItem(armor, 1, false); } } } } }

Target:
public void onDamage(EntityDamageByEntityEvent e) { if (e.getDamager() instanceof Bee && e.getEntity() instanceof Player) { Player p = (Player) e.getEntity(); Optional<PlayerProfile> optional = PlayerProfile.find(p); if (!optional.isPresent()) { PlayerProfile.request(p); return; } PlayerProfile profile = optional.get(); if (profile.isProtected(ProtectionType.BEES)) { for (ItemStack armor : p.getInventory().getArmorContents()) { ItemUtils.damageItem(armor, 1, false); } e.setDamage(0D); } } }
Source:
public String toString() { StringBuilder sb = new StringBuilder(getClass().getName()); sb.append(":"); if (messageId != -1) sb.append("Request for messageId=").append(messageId).append("]"); if (errorStatusCode != -1) sb.append(" returned ").append(toErrorMsg(errorStatusCode)); String message = getLocalizedMessage(); if (message != null) sb.append(": ").append(message); return sb.toString(); }

Target:
public String toString() { StringBuilder sb = new StringBuilder(getClass().getName()); sb.append(":"); if (messageId != -1) sb.append("Request for messageId=").append(messageId); if (errorStatusCode != -1) sb.append(" returned ").append(toErrorMsg(errorStatusCode)); String message = getLocalizedMessage(); if (message != null) sb.append(": ").append(message); return sb.toString(); }
Source:
public void shutdown() { if (initLocker.get() && shutdownLocker.compareAndSet(false, true)) { log.info("Shutting down transport..."); transport.sendMessage(new ShutdownRequestMessage()); } }

Target:
public void shutdown() { if (initLocker.get() && shutdownLocker.compareAndSet(false, true)) { log.info("Shutting down transport..."); transport.sendMessage(new ShutdownRequestMessage()); executor.shutdown(); } }
Source:
private RevWalk(final Repository repo, final ObjectReader or) { repository = repo; reader = or; idBuffer = new MutableObjectId(); objects = new ObjectIdOwnerMap<RevObject>(); roots = new ArrayList<RevCommit>(); queue = new DateRevQueue(); pending = new StartGenerator(this); sorting = EnumSet.of(RevSort.NONE); filter = RevFilter.ALL; treeFilter = TreeFilter.ALL; retainBody = true; streamFileThreshold = (int) Math .min(CoreConfig.KEY.parse(repo.getConfig()) .getStreamFileThreshold(), Integer.MAX_VALUE); }

Target:
private RevWalk(final Repository repo, final ObjectReader or) { repository = repo; reader = or; idBuffer = new MutableObjectId(); objects = new ObjectIdOwnerMap<RevObject>(); roots = new ArrayList<RevCommit>(); queue = new DateRevQueue(); pending = new StartGenerator(this); sorting = EnumSet.of(RevSort.NONE); filter = RevFilter.ALL; treeFilter = TreeFilter.ALL; retainBody = true; }
Source:
public void parsePropertyFiles_EmptyProperties() { initWithProperties(EMPTY_PROPERTIES); ReportParser reportParser = new ReportParser(configuration); reportParser.parsePropertiesFiles(propertyReports); assertThat(configuration.getClassifications()).hasSize(0); }

Target:
public void parsePropertyFiles_EmptyProperties() { initWithProperties(EMPTY_PROPERTIES); ReportParser reportParser = new ReportParser(configuration); reportParser.parseClassificationsFiles(classificationFiles); assertThat(configuration.getClassifications()).isEmpty(); }
Source:
protected void service(final HttpServletRequest req, final HttpServletResponse resp) throws IOException { try { super.service(req, resp); } finally { try { audit(); } catch (Throwable ignoreExceptionWhileLogging) { } finally { currentCall.set(null); } } }

Target:
protected void service(final HttpServletRequest req, final HttpServletResponse resp) throws IOException { try { super.service(req, resp); } finally { try { audit(); } catch (Throwable ignoreExceptionWhileLogging) { log.warn("Error occurred during audit event dispatch", ignoreExceptionWhileLogging); } finally { currentCall.set(null); } } }
Source:
public List<LoggerSource> getRelatedLoggers(boolean verbose) { List<LoggerSource> loggers = new ArrayList<>(); loggers.add( new LoggerSource(Type.SCM, KeyManagerImpl.class, defaultLevel(verbose))); return loggers; }

Target:
public List<LoggerSource> getRelatedLoggers(boolean verbose) { List<LoggerSource> loggers = new ArrayList<>(); loggers.add( new LoggerSource(Type.OM, KeyManagerImpl.class, defaultLevel(verbose))); return loggers; }
Source:
private float byteArrayToFloat(final byte[] bytes) { ByteBuffer buffer = ByteBuffer.wrap(bytes).order(ByteOrder.LITTLE_ENDIAN); return buffer.getFloat(); }

Target:
private float byteArrayToFloat(final byte[] bytes) { final ByteBuffer buffer = ByteBuffer.wrap(bytes).order(ByteOrder.LITTLE_ENDIAN); return buffer.getFloat(); }
Source:
public void init() { final StatusTransitioner.Transition st = statusTransitioner.init(); try { store.init(); store.enableStoreEventNotifications(storeListener); } catch (RuntimeException e) { st.failed(); throw new StateTransitionException(e); } st.succeeded(); }

Target:
public void init() { final StatusTransitioner.Transition st = statusTransitioner.init(); try { store.init(); } catch (RuntimeException e) { st.failed(); throw new StateTransitionException(e); } st.succeeded(); }
Source:
public void testCommitSingleTask() throws Exception { CountDownLatch task0ProcessedMessagesLatch = new CountDownLatch(1); CountDownLatch task1ProcessedMessagesLatch = new CountDownLatch(1); TestTask task0 = new TestTask(true, true, false, task0ProcessedMessagesLatch); task0.setCommitRequest(TaskCoordinator.RequestScope.CURRENT_TASK); TestTask task1 = new TestTask(true, false, true, task1ProcessedMessagesLatch); task1.setCommitRequest(TaskCoordinator.RequestScope.CURRENT_TASK); TaskInstance t0 = createTaskInstance(task0, taskName0, ssp0); TaskInstance t1 = createTaskInstance(task1, taskName1, ssp1); Map<TaskName, TaskInstance> tasks = new HashMap<>(); tasks.put(taskName0, t0); tasks.put(taskName1, t1); int maxMessagesInFlight = 1; AsyncRunLoop runLoop = new AsyncRunLoop(tasks, executor, consumerMultiplexer, maxMessagesInFlight, windowMs, commitMs, callbackTimeoutMs, maxThrottlingDelayMs, containerMetrics, () -> 0L, false); when(consumerMultiplexer.choose(false)).thenReturn(envelope0).thenReturn(null).thenReturn(envelope1).thenReturn(null); runLoop.run(); task0ProcessedMessagesLatch.await(); task1ProcessedMessagesLatch.await(); verify(offsetManager).createCheckpoint(taskName0); verify(offsetManager).writeCheckpoint(taskName0, any()); verify(offsetManager, never()).createCheckpoint(taskName1); verify(offsetManager, never()).writeCheckpoint(taskName1, any()); }

Target:
public void testCommitSingleTask() throws Exception { CountDownLatch task0ProcessedMessagesLatch = new CountDownLatch(1); CountDownLatch task1ProcessedMessagesLatch = new CountDownLatch(1); TestTask task0 = new TestTask(true, true, false, task0ProcessedMessagesLatch); task0.setCommitRequest(TaskCoordinator.RequestScope.CURRENT_TASK); TestTask task1 = new TestTask(true, false, true, task1ProcessedMessagesLatch); task1.setCommitRequest(TaskCoordinator.RequestScope.CURRENT_TASK); TaskInstance t0 = createTaskInstance(task0, taskName0, ssp0); TaskInstance t1 = createTaskInstance(task1, taskName1, ssp1); Map<TaskName, TaskInstance> tasks = new HashMap<>(); tasks.put(taskName0, t0); tasks.put(taskName1, t1); int maxMessagesInFlight = 1; AsyncRunLoop runLoop = new AsyncRunLoop(tasks, executor, consumerMultiplexer, maxMessagesInFlight, windowMs, commitMs, callbackTimeoutMs, maxThrottlingDelayMs, containerMetrics, () -> 0L, false); when(consumerMultiplexer.choose(false)).thenReturn(envelope0).thenReturn(null).thenReturn(envelope1).thenReturn(null); runLoop.run(); task0ProcessedMessagesLatch.await(); task1ProcessedMessagesLatch.await(); verify(offsetManager).buildCheckpoint(taskName0); verify(offsetManager).writeCheckpoint(taskName0, any()); verify(offsetManager, never()).buildCheckpoint(taskName1); verify(offsetManager, never()).writeCheckpoint(taskName1, any()); }
Source:
private void showDialogAboutZero(final String prefsKey, String title, String message) { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(app); if (prefsKey == null || !prefs.getBoolean(prefsKey, false)) { if (prefsKey != null) { prefs.edit().putBoolean(prefsKey, true).commit(); } alert = new AlertDialog.Builder(this); alert.setTitle(title); alert.setMessage(message); if (prefsKey != null) { alert.setPositiveButton(getString(R.string.zero_learn_more_learn_more), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { Utils.visitInExternalBrowser(PageActivity.this, Uri.parse(getString(R.string.zero_webpage_url))); } }); } alert.setNegativeButton(getString(R.string.zero_learn_more_dismiss), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.dismiss(); } }); final AlertDialog ad = alert.create(); ad.setOnShowListener(new DialogInterface.OnShowListener() { @Override public void onShow(DialogInterface d) { if (prefsKey != null) { ad.getButton(DialogInterface.BUTTON_POSITIVE).setTypeface(Typeface.DEFAULT, Typeface.BOLD); } } }); ad.show(); } }

Target:
private void showDialogAboutZero(final String prefsKey, String title, String message) { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(app); if (prefsKey == null || !prefs.getBoolean(prefsKey, false)) { if (prefsKey != null) { prefs.edit().putBoolean(prefsKey, true).commit(); } alert = new AlertDialog.Builder(this); alert.setTitle(title); alert.setMessage(message); if (prefsKey != null) { alert.setPositiveButton(getString(R.string.zero_learn_more_learn_more), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { Utils.visitInExternalBrowser(PageActivity.this, Uri.parse(getString(R.string.zero_webpage_url))); } }); } alert.setNegativeButton(getString(R.string.zero_learn_more_dismiss), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.dismiss(); } }); AlertDialog ad = alert.create(); ad.show(); } }
Source:
void iterationStart(HotRodHeader header, Subject subject, byte[] segmentMask, String filterConverterFactory, List<byte[]> filterConverterParams, int batch, boolean includeMetadata) { AdvancedCache<byte[], byte[]> cache = server.cache(header, subject); executor.execute(() -> { try { IterationState iterationState = server.getIterationManager().start(cache, segmentMask != null ? BitSet.valueOf(segmentMask) : null, filterConverterFactory, filterConverterParams, header.getValueMediaType(), batch, includeMetadata); channel.closeFuture().addListener(iterationState.getReaper()); writeResponse(header, header.encoder().iterationStartResponse(header, server, channel.alloc(), iterationState.getId())); } catch (Throwable t) { writeException(header, t); } }); }

Target:
void iterationStart(HotRodHeader header, Subject subject, byte[] segmentMask, String filterConverterFactory, List<byte[]> filterConverterParams, int batch, boolean includeMetadata) { AdvancedCache<byte[], byte[]> cache = server.cache(header, subject); executor.execute(() -> { try { IterationState iterationState = server.getIterationManager().start(cache, segmentMask != null ? BitSet.valueOf(segmentMask) : null, filterConverterFactory, filterConverterParams, header.getValueMediaType(), batch, includeMetadata); iterationState.getReaper().registerChannel(channel); writeResponse(header, header.encoder().iterationStartResponse(header, server, channel.alloc(), iterationState.getId())); } catch (Throwable t) { writeException(header, t); } }); }
Source:
public QueryControlResult stop(final String queryId) { final QueryControlResult queryControlResult = new QueryControlResult(); queryControlResult.setQueryId(queryId); if (deleteQueryFromManager(queryId)) { queryControlResult.setIsSuccess(true); queryControlResult.setMsg("Success: " + queryId + " is stopped."); } else { queryControlResult.setIsSuccess(false); queryControlResult.setMsg("Fail: There is no " + queryId); } return queryControlResult; }

Target:
public QueryControlResult stop(final String queryId) { final QueryControlResult queryControlResult = new QueryControlResult(); queryControlResult.setQueryId(queryId); if (deleteQueryFromManager(queryId)) { queryControlResult.setIsSuccess(true); queryControlResult.setMsg(ResultMessage.stopSuccess(queryId)); } else { queryControlResult.setIsSuccess(false); queryControlResult.setMsg(ResultMessage.noQueryId(queryId)); } return queryControlResult; }
Source:
private void showFormatUpgradeConfirmIfRequired() { StoragePool dc = getSelectedDataCentersForAttach().get(0); StorageDomain sd = getEntity(); StorageFormatUpgradeConfirmationModel model = new StorageFormatUpgradeConfirmationModel(); boolean shouldDisplay = model.initialize( Collections.singletonList(sd), dc, "OnShowFormatUpgrade", "Cancel", this); if (shouldDisplay) { setConfirmWindow(model); } else { UICommand okCommand = UICommand.createDefaultOkUiCommand( "OnShowFormatUpgrade", this); okCommand.execute(); } }

Target:
private void showFormatUpgradeConfirmIfRequired() { StoragePool dc = getSelectedDataCentersForAttach().get(0); StorageDomain sd = getEntity(); StorageFormatUpgradeConfirmationModel model = new StorageFormatUpgradeConfirmationModel(); boolean shouldDisplay = model.initialize( Collections.singletonList(sd), dc, "OnShowFormatUpgrade", "Cancel", this); if (shouldDisplay) { setConfirmWindow(model); model.setHelpTag(HelpTag.attach_storage_domain_confirmation); model.setHashName("attach_storage_domain_confirmation"); } else { UICommand okCommand = UICommand.createDefaultOkUiCommand( "OnShowFormatUpgrade", this); okCommand.execute(); } }
Source:
public void regularFloatingMedrecIsReloadingWithRecirculationModule() { Page page = new Page("project43", "SyntheticTests/LongPage"); AdsBaseObject ads = new AdsBaseObject(driver, page.getUrl()); driver.manage().getCookies().stream().forEach(c -> System.out.println(c.getName() + " = " + c.getValue() + ", httpOnly: " + c.isHttpOnly() + ", secure: " + c.isSecure())); ads.scrollToPosition(RECIRCULATION_SELECTOR); ads.wait.forElementVisible(RECIRCULATION_SELECTOR); checkIfNextModuleWillBe(ads, FMR_SELECTOR); checkIfNextModuleWillBe(ads, RECIRCULATION_SELECTOR); checkIfNextModuleWillBe(ads, FMR_SELECTOR); checkIfNextModuleWillBe(ads, RECIRCULATION_SELECTOR); checkIfNextModuleWillBe(ads, FMR_SELECTOR); checkIfNextModuleWillBe(ads, FMR_SELECTOR); }

Target:
public void regularFloatingMedrecIsReloadingWithRecirculationModule() { Page page = new Page("project43", "SyntheticTests/LongPage"); AdsBaseObject ads = new AdsBaseObject(driver, page.getUrl()); driver.manage().getCookies().stream().forEach(c -> System.out.println("Cookie " + c.getName() + " = " + c.getValue() + ", httpOnly: " + c.isHttpOnly() + ", secure: " + c.isSecure())); ads.wait.forElementPresent(RECIRCULATION_SELECTOR); ads.scrollToPosition(RECIRCULATION_SELECTOR); checkIfNextModuleWillBe(ads, FMR_SELECTOR); checkIfNextModuleWillBe(ads, RECIRCULATION_SELECTOR); checkIfNextModuleWillBe(ads, FMR_SELECTOR); checkIfNextModuleWillBe(ads, RECIRCULATION_SELECTOR); checkIfNextModuleWillBe(ads, FMR_SELECTOR); checkIfNextModuleWillBe(ads, FMR_SELECTOR); }
Source:
public JdbcBlobUtils(LocalStorageStrategy storageStrategy, Provider<BlobBuilder> blobBuilders) { this.storageStrategy = (JdbcStorageStrategy) checkNotNull(storageStrategy, "storageStrategy"); this.blobBuilders = checkNotNull(blobBuilders, "blobBuilders"); }

Target:
JdbcBlobUtils(LocalStorageStrategy storageStrategy, Provider<BlobBuilder> blobBuilders) { this.storageStrategy = (JdbcStorageStrategy) storageStrategy; this.blobBuilders = blobBuilders; }
Source:
private void copyTimestampsFromChangelog(Library library) { Date earliest = getEarliestChangeDate(library); Date latest = getLatestChangeDate(library); library.setCreationDate(earliest); }

Target:
private void copyTimestampsFromChangelog(Library library) { Date earliest = getEarliestChangeDate(library); library.setCreationDate(earliest); }
Source:
public Grid load(String gridFileName){ InputStream s = loader.getResourceAsStream(GRID_PATH + gridFileName); Reader reader = new InputStreamReader(s); try{ return gson.fromJson(reader, Grid.class); } catch (JsonSyntaxException ex){ return null; } }

Target:
public Grid load(String gridFileName) throws CreateGridException { InputStream s = loader.getResourceAsStream(GRID_PATH + gridFileName); Reader reader = null; try { reader = new InputStreamReader(s); } catch (NullPointerException ex){ throw new CreateGridException( "Error loading grid: " + gridFileName + " does not exist" ); } try{ return gson.fromJson(reader, Grid.class); } catch (JsonSyntaxException ex){ throw new CreateGridException("Error loading grid: Invalid content."); } }
Source:
public void testGetUserWithHostname() { URI endpoint = URI.create("<LINK_0>"); UserApi api = requestsSendResponses( keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess, authenticatedGET().endpoint(endpoint).build(), HttpResponse.builder().statusCode(200).payload(payloadFromResource("/user_get_withhost.json")).build() ).getUserApiForInstanceInZone("instanceId-1234-5678","RegionOne"); User user = api.get("example.user", "192.168.64.64"); assertEquals(user.getName(), "exampleuser"); assertEquals(user.getHost(), "192.168.64.64"); assertEquals(user.getIdentifier(), "exampleuser@192.168.64.64"); assertEquals(user.getDatabases().size(), 2); assertEquals(user.getDatabases().iterator().next(), "databaseA"); }

Target:
public void testGetUserWithHostname() { URI endpoint = URI.create("<LINK_0>"); UserApi api = requestsSendResponses( keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess, authenticatedGET().endpoint(endpoint).build(), HttpResponse.builder().statusCode(200).payload(payloadFromResource("/user_get_withhost.json")).build() ).getUserApiForInstanceInZone("instanceId-1234-5678","RegionOne"); User user = api.get("example.user", "192.168.64.64"); assertEquals(user.getName(), "example.user"); assertEquals(user.getHost(), "192.168.64.64"); assertEquals(user.getIdentifier(), "example.user@192.168.64.64"); assertEquals(user.getDatabases().size(), 2); assertEquals(user.getDatabases().iterator().next(), "databaseA"); }
Source:
public Guid getQuotaId() { return quotaId != null ? quotaId.getValue() : Guid.Empty; }

Target:
public Guid getQuotaId() { return getQuotaIdRef() != null ? getQuotaIdRef().getValue() : Guid.Empty; }
Source:
public <T> T getValue(final OGlobalConfiguration iConfig) { if (config != null && config.containsKey(iConfig.getKey())) return (T) config.get(iConfig.getKey()); return iConfig.getValue(); }

Target:
public Object getValue(final OGlobalConfiguration iConfig) { if (config != null && config.containsKey(iConfig.getKey())) return config.get(iConfig.getKey()); return iConfig.getValue(); }
Source:
public void maybeFlush() { if(binder == null) { return; } setEnabledOnChangeValidations(false); try { flushNestedForms(); BindableProxy<T> proxy = (BindableProxy<T>) getModel(); T model = proxy.deepUnwrap(); T backupModel = proxy.deepUnwrap(); binder.setModel(model, StateSync.FROM_UI, true); if (!validate()) { binder.setModel(backupModel, StateSync.FROM_MODEL, true); validate(); } } finally { setEnabledOnChangeValidations(true); } }

Target:
public void maybeFlush() { if (binder == null) { return; } setEnabledOnChangeValidations(false); flushNestedForms(); BindableProxy<T> proxy = (BindableProxy<T>) getModel(); T model = proxy.deepUnwrap(); T backupModel = proxy.deepUnwrap(); binder.setModel(model, StateSync.FROM_UI, true); if (!validate()) { binder.setModel(backupModel, StateSync.FROM_MODEL, true); validate(); } setEnabledOnChangeValidations(true); }
Source:
private Block[] buildOutputBlocks(int batchSize) { Block[] outputBlocks = new Block[outputChannelCount]; int channel = 0; for (int replicateIndex = 0; replicateIndex < replicateTypes.size(); replicateIndex++) { outputBlocks[channel++] = replicatedBlockBuilders.get(replicateIndex).buildOutputBlock(maxEntries, currentPosition, batchSize, currentBatchTotalEntries); } for (int unnestIndex = 0; unnestIndex < unnesters.size(); unnestIndex++) { Unnester unnester = unnesters.get(unnestIndex); Block[] block = unnester.buildOutputBlocks(maxEntries, currentPosition, batchSize, currentBatchTotalEntries, unnesters.size()); for (int j = 0; j < unnester.getChannelCount(); j++) { outputBlocks[channel++] = block[j]; } } if (withOrdinality) { outputBlocks[channel] = buildOutputBlock(maxEntries, currentPosition, batchSize, currentBatchTotalEntries); } currentPosition += batchSize; return outputBlocks; }

Target:
private Block[] buildOutputBlocks(int batchSize) { Block[] outputBlocks = new Block[outputChannelCount]; int channel = 0; for (int replicateIndex = 0; replicateIndex < replicateTypes.size(); replicateIndex++) { outputBlocks[channel++] = replicatedBlockBuilders.get(replicateIndex).buildOutputBlock(maxLengths, currentPosition, batchSize, currentBatchTotalLength); } for (int unnestIndex = 0; unnestIndex < unnesters.size(); unnestIndex++) { Unnester unnester = unnesters.get(unnestIndex); Block[] block = unnester.buildOutputBlocks(maxLengths, currentPosition, batchSize, currentBatchTotalLength); for (int j = 0; j < unnester.getChannelCount(); j++) { outputBlocks[channel++] = block[j]; } } if (withOrdinality) { outputBlocks[channel] = buildOrdinalityOutputBlock(maxLengths, currentPosition, batchSize, currentBatchTotalLength); } currentPosition += batchSize; return outputBlocks; }
Source:
public void create(String name, int size) { ChronicleLogAppender cq = ChronicleLogAppender.create(new File(basePath.toFile(), name), size, retentionDuration); try { cq.close(); } catch (Exception e) { throw new RuntimeException("Cannot create and close " + name, e); } }

Target:
public void create(String name, int size) { ChronicleLogAppender.create(basePath.resolve(name).toFile(), size, retentionDuration).close(); }
Source:
private DoubleMatrix getMatrixByEntityTypeId(String entityId) { DoubleMatrix matrix = null; Entity entity = dataService.findOneById(MatrixMetadata.PACKAGE + "_" + MatrixMetadata.SIMPLE_NAME, entityId); if (entity != null) { return getMatrix(entityId, entity); } else { throw new MolgenisDataException("Unknown Matrix Metadata EntityID [" + entityId + "]"); } }

Target:
private DoubleMatrix getMatrixByEntityTypeId(String entityId) { Entity entity = dataService.findOneById(MatrixMetadata.PACKAGE + "_" + MatrixMetadata.SIMPLE_NAME, entityId); if (entity != null) { return getMatrix(entity); } else { throw new MolgenisDataException("Unknown Matrix Metadata EntityID [" + entityId + "]"); } }
Source:
protected void provideModelInferrerConfiguration() { EMFPatternLanguageGeneratorConfig config = new EMFPatternLanguageGeneratorConfig(); if (useEclipseGeneratorPreferences && propertiesFileLocation != null) { File f = new File(propertiesFileLocation); if (f.canRead()) { Properties vqlCompilerSettings = new Properties(); try { vqlCompilerSettings.load(new FileInputStream(f)); String matcherGenerationProp = vqlCompilerSettings.getProperty("generateMatchers", MatcherGenerationStrategy.defaultValue().toString()); try { config.setMatcherGenerationStrategy(MatcherGenerationStrategy.valueOf(matcherGenerationProp)); } catch (IllegalArgumentException e) { getLog().warn("Invalid matcher generation strategy " + matcherGenerationProp + "; using default value instead"); } String generateProcessorProp = vqlCompilerSettings.getProperty("generateMatchProcessors", "true"); config.setGenerateMatchProcessors(Boolean.valueOf(generateProcessorProp)); } catch (IOException e) { getLog().warn(e); } } else { getLog().info( "Can't find Xtend properties under " + propertiesFileLocation + ", maven defaults are used."); config.setMatcherGenerationStrategy(matcherGeneration); config.setGenerateMatchProcessors(generateMatchProcessors); } } else { config.setMatcherGenerationStrategy(matcherGeneration); config.setGenerateMatchProcessors(generateMatchProcessors); } MavenGeneratorConfigProvider.setGeneratorConfig(config); }

Target:
protected void provideModelInferrerConfiguration() { EMFPatternLanguageGeneratorConfig config = new EMFPatternLanguageGeneratorConfig(); if (useEclipseGeneratorPreferences && propertiesFileLocation != null) { File f = new File(propertiesFileLocation); if (f.canRead()) { Properties vqlCompilerSettings = new Properties(); try { vqlCompilerSettings.load(new FileInputStream(f)); String matcherGenerationProp = vqlCompilerSettings.getProperty("generateMatchers", MatcherGenerationStrategy.defaultValue().toString()); try { config.setMatcherGenerationStrategy(MatcherGenerationStrategy.valueOf(matcherGenerationProp)); } catch (IllegalArgumentException e) { getLog().warn("Invalid matcher generation strategy " + matcherGenerationProp + "; using default value instead"); } String generateProcessorProp = vqlCompilerSettings.getProperty("generateMatchProcessors", "true"); config.setGenerateMatchProcessors(Boolean.valueOf(generateProcessorProp)); } catch (IOException e) { getLog().warn(e); } } else { getLog().info( "Can't find VIATRA Generator properties under " + propertiesFileLocation + ", maven defaults are used."); config.setMatcherGenerationStrategy(matcherGeneration); config.setGenerateMatchProcessors(generateMatchProcessors); } } else { config.setMatcherGenerationStrategy(matcherGeneration); config.setGenerateMatchProcessors(generateMatchProcessors); } MavenGeneratorConfigProvider.setGeneratorConfig(config); }
Source:
private void ingestChildren(ContentContainerObject destObj, Resource parentResc) throws DepositException, IOException { NodeIterator iterator = getChildIterator(parentResc); if (iterator == null) { return; } try { ContentObject obj = null; while (iterator.hasNext()) { Resource childResc = (Resource) iterator.next(); if (childResc.hasProperty(RDF.type, Cdr.Folder)) { obj = ingestFolder(destObj, parentResc, childResc); } else if (childResc.hasProperty(RDF.type, Cdr.Work)) { obj = ingestWork(destObj, parentResc, childResc); } else if (childResc.hasProperty(RDF.type, Cdr.FileObject)) { if (destObj instanceof WorkObject) { obj = ingestFileObject(destObj, parentResc, childResc); } else { obj= ingestFileObjectAsWork(destObj, parentResc, childResc); } } if (obj != null) { addIngestionEventForChild(obj); addPremisEvents(obj); } } } finally { iterator.close(); } }

Target:
private void ingestChildren(ContentContainerObject destObj, Resource parentResc) throws DepositException, IOException { NodeIterator iterator = getChildIterator(parentResc); if (iterator == null) { return; } try { while (iterator.hasNext()) { Resource childResc = (Resource) iterator.next(); if (childResc.hasProperty(RDF.type, Cdr.Folder)) { ingestFolder(destObj, parentResc, childResc); } else if (childResc.hasProperty(RDF.type, Cdr.Work)) { ingestWork(destObj, parentResc, childResc); } else if (childResc.hasProperty(RDF.type, Cdr.FileObject)) { if (destObj instanceof WorkObject) { ingestFileObject(destObj, parentResc, childResc); } else { ingestFileObjectAsWork(destObj, parentResc, childResc); } } } } finally { iterator.close(); } }
Source:
public static IValidator locateValidator(final Class<? extends Question> questionType) { if (!Question.class.isAssignableFrom(questionType)) { return null; } if (questionType.isAnnotationPresent(ValidatesWith.class)) { log.debug("Validator for question validation found. Using : " + questionType.getAnnotation(ValidatesWith.class).value()); Injector injector = IsaacApplicationRegister.injector; return injector.getInstance(questionType.getAnnotation(ValidatesWith.class).value()); } else if (questionType.equals(Question.class)) { return null; } return locateValidator((Class<? extends Question>) questionType.getSuperclass()); }

Target:
private static IValidator locateValidator(final Class<? extends Question> questionType) { if (!Question.class.isAssignableFrom(questionType)) { return null; } if (questionType.isAnnotationPresent(ValidatesWith.class)) { log.debug("Validator for question validation found. Using : " + questionType.getAnnotation(ValidatesWith.class).value()); Injector injector = IsaacApplicationRegister.injector; return injector.getInstance(questionType.getAnnotation(ValidatesWith.class).value()); } else if (questionType.equals(Question.class)) { return null; } return locateValidator((Class<? extends Question>) questionType.getSuperclass()); }
Source:
public void postCollectionSubmittersGroupCreateSubmittersGroupUnProcessableName() throws Exception { ObjectMapper mapper = new ObjectMapper(); GroupRest groupRest = new GroupRest(); groupRest.setName("Fail"); MetadataRest metadataRest = new MetadataRest(); metadataRest.put("dc.description", new MetadataValueRest("testingDescription")); metadataRest.put("dc.subject", new MetadataValueRest("testSubject")); groupRest.setMetadata(metadataRest); String token = getAuthToken(admin.getEmail(), password); getClient(token).perform(post("/api/core/collections/" + collection.getID() + "/submittersGroup") .content(mapper.writeValueAsBytes(groupRest)) .contentType(contentType)) .andExpect(status().isUnprocessableEntity()); }

Target:
public void postCollectionSubmittersGroupCreateSubmittersGroupUnProcessableName() throws Exception { ObjectMapper mapper = new ObjectMapper(); GroupRest groupRest = new GroupRest(); groupRest.setName("Fail"); MetadataRest metadataRest = new MetadataRest(); metadataRest.put("dc.description", new MetadataValueRest("testingDescription")); metadataRest.put("dc.subject", new MetadataValueRest("testSubject")); groupRest.setMetadata(metadataRest); String token = getAuthToken(admin.getEmail(), password); getClient(token).perform(post("/api/core/collections/" + collection.getID() + "/submittersGroup") .content(mapper.writeValueAsBytes(groupRest)) .contentType(contentType)) .andExpect(status().isUnprocessableEntity()); getClient(token).perform(get("/api/core/collections/" + collection.getID() + "/submittersGroup")) .andExpect(status().isNoContent()); }
Source:
public UsageReporter() { s_instance = this; }

Target:
private UsageReporter() { s_instance = this; }
Source:
private static void googleDelete(final URL url) throws IOException { final HttpURLConnection connection = setupUrlConnection(DELETE, url, false, Collections.emptyMap()); final int responseCode = connection.getResponseCode(); if (responseCode < 200 || responseCode > 299) { final InputStream stream = connection.getErrorStream(); final String response = CharStreams.toString(new InputStreamReader(stream, URL_ENCODING)); stream.close(); logger.error("Received unexpected response from Google Cloud Storage. Response status code: {}. Response body: {}", responseCode, response); throw new IOException("Received unexpected response from Google Cloud Storage."); } else { final InputStream stream = connection.getInputStream(); while (stream.read() != -1) } }

Target:
private static void googleDelete(final URL url) throws IOException { final HttpURLConnection connection = setupUrlConnection(DELETE, url, false, Collections.emptyMap()); throwIOExceptionOnErrorResponse(connection); final InputStream stream = connection.getInputStream(); ByteStreams.exhaust(stream); }
Source:
public CompletableFuture<Void> mergeRegions(List<byte[]> nameOfRegionsToMerge, boolean forcible) { if (nameOfRegionsToMerge.size() < 2) { return failedFuture(new IllegalArgumentException( "Can not merge only " + nameOfRegionsToMerge.size() + " region")); } CompletableFuture<Void> future = new CompletableFuture<>(); byte[][] encodedNameOfRegionsToMerge = nameOfRegionsToMerge.stream().map(this::toEncodeRegionName).toArray(byte[][]::new); addListener(checkRegionsAndGetTableName(encodedNameOfRegionsToMerge), (tableName, err) -> { if (err != null) { future.completeExceptionally(err); return; } MergeTableRegionsRequest request; try { request = RequestConverter.buildMergeTableRegionsRequest(encodedNameOfRegionsToMerge, forcible, ng.getNonceGroup(), ng.newNonce()); } catch (DeserializationException e) { future.completeExceptionally(e); return; } addListener( this.<MergeTableRegionsRequest, MergeTableRegionsResponse> procedureCall(tableName, request, (s, c, req, done) -> s.mergeTableRegions(c, req, done), (resp) -> resp.getProcId(), new MergeTableRegionProcedureBiConsumer(tableName)), (ret, err2) -> { if (err2 != null) { future.completeExceptionally(err2); } else { future.complete(ret); } }); }); return future; }

Target:
public CompletableFuture<Void> mergeRegions(List<byte[]> nameOfRegionsToMerge, boolean forcible) { if (nameOfRegionsToMerge.size() < 2) { return failedFuture(new IllegalArgumentException( "Can not merge only " + nameOfRegionsToMerge.size() + " region")); } CompletableFuture<Void> future = new CompletableFuture<>(); byte[][] encodedNameOfRegionsToMerge = nameOfRegionsToMerge.stream().map(this::toEncodeRegionName).toArray(byte[][]::new); addListener(checkRegionsAndGetTableName(encodedNameOfRegionsToMerge), (tableName, err) -> { if (err != null) { future.completeExceptionally(err); return; } final MergeTableRegionsRequest request; try { request = RequestConverter.buildMergeTableRegionsRequest(encodedNameOfRegionsToMerge, forcible, ng.getNonceGroup(), ng.newNonce()); } catch (DeserializationException e) { future.completeExceptionally(e); return; } addListener( this.procedureCall(tableName, request, MasterService.Interface::mergeTableRegions, MergeTableRegionsResponse::getProcId, new MergeTableRegionProcedureBiConsumer(tableName)), (ret, err2) -> { if (err2 != null) { future.completeExceptionally(err2); } else { future.complete(ret); } }); }); return future; }
Source:
public static GCRule buildGarbageCollectionRule(HColumnDescriptor columnDescriptor) { int maxVersions = columnDescriptor.getMaxVersions(); int minVersions = columnDescriptor.getMinVersions(); int ttlSeconds = columnDescriptor.getTimeToLive(); Preconditions.checkState(minVersions < maxVersions, "HColumnDescriptor min versions must be less than max versions."); if (ttlSeconds == HColumnDescriptor.DEFAULT_TTL) { if (maxVersions == Integer.MAX_VALUE) { return null; } else { return GCRULES.maxVersions(maxVersions); } } GCRule ageRule = GCRULES.maxAge(org.threeten.bp.Duration.ofSeconds(ttlSeconds)); if (minVersions != HColumnDescriptor.DEFAULT_MIN_VERSIONS) { ageRule = GCRULES.intersection().rule(ageRule).rule(GCRULES.maxVersions(minVersions)); } if (maxVersions == Integer.MAX_VALUE) { return ageRule; } else { return GCRULES.union().rule(ageRule).rule(GCRULES.maxVersions(maxVersions)); } }

Target:
public static GCRule buildGarbageCollectionRule(HColumnDescriptor columnDescriptor) { int maxVersions = columnDescriptor.getMaxVersions(); int minVersions = columnDescriptor.getMinVersions(); int ttlSeconds = columnDescriptor.getTimeToLive(); Preconditions.checkState(minVersions < maxVersions, "HColumnDescriptor min versions must be less than max versions."); if (ttlSeconds == HColumnDescriptor.DEFAULT_TTL) { if (maxVersions == Integer.MAX_VALUE) { return null; } else { return GCRULES.maxVersions(maxVersions); } } GCRule ageRule = GCRULES.maxAge(Duration.ofSeconds(ttlSeconds)); if (minVersions != HColumnDescriptor.DEFAULT_MIN_VERSIONS) { ageRule = GCRULES.intersection().rule(ageRule).rule(GCRULES.maxVersions(minVersions)); } if (maxVersions == Integer.MAX_VALUE) { return ageRule; } else { return GCRULES.union().rule(ageRule).rule(GCRULES.maxVersions(maxVersions)); } }
Source:
private Server createAndStartServer(int port, HandlerList handlers, Audience audience) throws Exception { Server server = null; int tryPort = -1; int retry = 0; try { tryPort = (port <= 0) ? ServerHelper.getAvailablePort() : port; LOGGER.info("Trying port {}", tryPort); server = new Server(tryPort); server.setHandler(handlers); server.setStopAtShutdown(true); server.start(); jettyConfig.setPort(audience, tryPort); LOGGER.info("Jetty started on port ({})", tryPort, audience); } catch (Exception ex) { ++retry; LOGGER.info("Tried port but failed to start server", tryPort); if (retry > 5) { throw ex; } } return server; }

Target:
private Server createAndStartServer(int port, HandlerList handlers, Audience audience) throws Exception { int retryIterations = 5; Server server = null; int tryPort = (port <= 0) ? 0 : port; int retry = 0; int listeningPort = 0; while (listeningPort == 0) { try { LOGGER.info("Attempting to start Jetty on port ({})", tryPort, audience); server = new Server(tryPort); server.setHandler(handlers); server.setStopAtShutdown(true); server.start(); listeningPort = server.getConnectors()[0].getLocalPort(); jettyConfig.setPort(audience, listeningPort); LOGGER.info("Jetty started on port ({})", listeningPort, audience); } catch (Exception ex) { if (tryPort == 0) { retry = retryIterations; } ++retry; LOGGER.info("Tried port ({}) but failed to start server", tryPort, audience); if (retry > retryIterations) { throw ex; } } } return server; }
Source:
private void executeCommand(ChannelHandlerContext ctx, Command command) throws Exception { if (isAuthenticated) { if (command.isOfType(RedisCommandType.SHUTDOWN)) { this.server.shutdown(); return; } if (hasTransaction() && !command.isTransactional()) { executeWithTransaction(ctx, command); } else { executeWithoutTransaction(command); } if (logger.isDebugEnabled() && command.getResponse() != null) { ByteBuf response = command.getResponse() .copy(0, Math.min(command.getResponse().readableBytes(), 100)); logger.debug("Redis command returned: {}", getPrintableByteBuf(response)); response.release(); } if (hasTransaction() && command.isOfType(RedisCommandType.MULTI)) { writeToChannel( Coder.getSimpleStringResponse(this.byteBufAllocator, RedisConstants.COMMAND_QUEUED)); } else { if (command.getCommandType() != RedisCommandType.PUBLISH) { ByteBuf response = command.getResponse(); writeToChannel(response); } } } else if (command.isOfType(RedisCommandType.QUIT)) { command.execute(this); ByteBuf response = command.getResponse(); writeToChannel(response); channelInactive(ctx); } else if (command.isOfType(RedisCommandType.AUTH)) { command.execute(this); ByteBuf response = command.getResponse(); writeToChannel(response); } else { ByteBuf r = Coder.getNoAuthResponse(this.byteBufAllocator, RedisConstants.ERROR_NOT_AUTH); writeToChannel(r); } }

Target:
private void executeCommand(ChannelHandlerContext ctx, Command command) throws Exception { if (isAuthenticated) { if (command.isOfType(RedisCommandType.SHUTDOWN)) { this.server.shutdown(); return; } if (hasTransaction() && !command.isTransactional()) { executeWithTransaction(ctx, command); } else { executeWithoutTransaction(command); } logResponse(command); if (hasTransaction() && command.isOfType(RedisCommandType.MULTI)) { writeToChannel( Coder.getSimpleStringResponse(this.byteBufAllocator, RedisConstants.COMMAND_QUEUED)); } else { if (command.getCommandType() != RedisCommandType.PUBLISH) { ByteBuf response = command.getResponse(); writeToChannel(response); } } } else if (command.isOfType(RedisCommandType.QUIT)) { command.execute(this); ByteBuf response = command.getResponse(); writeToChannel(response); channelInactive(ctx); } else if (command.isOfType(RedisCommandType.AUTH)) { command.execute(this); ByteBuf response = command.getResponse(); writeToChannel(response); } else { ByteBuf r = Coder.getNoAuthResponse(this.byteBufAllocator, RedisConstants.ERROR_NOT_AUTH); writeToChannel(r); } }
Source:
private boolean allowedConstructor(final Constructor<?> constructor, final List<String> classNames) { final Class<?>[] parameterTypes = constructor.getParameterTypes(); if (typeNames(parameterTypes).equals(classNames)) return true; if (parameterTypes.length != classNames.size()) return false; for (int i = 0; i < parameterTypes.length; i++) { final Class<?> parameterType = parameterTypes[i]; final String className = classNames.get(i); if (parameterType.isPrimitive() && !primitiveTypes.getWrapper(parameterType).getName().equals(className)) { return false; } else if (!parameterType.isPrimitive() && !parameterType.isAssignableFrom(toClassForName(className))) { return false; } } return true; }

Target:
private boolean allowedConstructor(final Constructor<?> constructor, final List<String> classNames) { final Class<?>[] parameterTypes = constructor.getParameterTypes(); if (typeNames(parameterTypes).equals(classNames)) return true; if (parameterTypes.length != classNames.size()) return false; for (int i = 0; i < parameterTypes.length; i++) { final Class<?> parameterType = parameterTypes[i]; final Class<?> resultSetType = toClassForName(classNames.get(i)); boolean matches = parameterType.isPrimitive() ? primitiveTypes.matchesWithWrapperType(parameterType, resultSetType) : parameterType.isAssignableFrom(resultSetType); if (!matches) { return false; } } return true; }