auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public UserDevfileImpl updateUserDevfile(UserDevfile update) throws ConflictException, NotFoundException, ServerException { requireNonNull(update); UserDevfileImpl result = userDevfileDao.update(new UserDevfileImpl(update)); <START> LOG.info( <END> "UserDevfile '{}' with id '{}' update by user '{}'", result.getName(), result.getId(), EnvironmentContext.getCurrent().getSubject().getUserName()); eventService.publish(new DevfileUpdatedEvent(result)); return result; }</code><technical_language>IMHO, this debug level</technical_language>

Target:
public UserDevfile updateUserDevfile(UserDevfile update) throws ConflictException, NotFoundException, ServerException { requireNonNull(update); Optional<UserDevfile> result = userDevfileDao.update(update); UserDevfile devfile = result.orElseThrow( () -> new NotFoundException( format("Devfile with id '%s' doesn't exist", update.getId()))); LOG.debug( "UserDevfile '{}' with id '{}' update by user '{}'", devfile.getName(), devfile.getId(), EnvironmentContext.getCurrent().getSubject().getUserName()); eventService.publish(new DevfileUpdatedEvent(devfile)); return devfile; }
Source:
<code>public Builder addOptions(Map<String,String> options) { <START> options.forEach((key, value) -> addOption(key, value)); <END> return this; }</code><technical_language>a step this one: suggestion options.forEach(this::addOption);</technical_language>

Target:
public Builder addOptions(Map<String,String> options) { options.forEach(this::addOption); return this; }
Source:
<code>public Scheduler getScheduler() { <START> return SchedulerFactory.singleton().createOrGetParallelScheduler("mongo", 10); <END> }</code><technical_language>10 is hard coded, configurable</technical_language>

Target:
public Scheduler getScheduler() { LOGGER.info("maxConcurrency is {}", maxConcurrency); return SchedulerFactory.singleton().createOrGetParallelScheduler(MongoDbInterpreter.class.getName() + this.hashCode(), maxConcurrency); }
Source:
<code>public AvroParquetFileWriter(LogFilePath logFilePath, CompressionCodec codec) throws IOException { Path path = new Path(logFilePath.getLogFilePath()); LOG.debug("Creating Brand new Writer for path {}", path); CompressionCodecName codecName = CompressionCodecName .fromCompressionCodec(codec != null ? codec.getClass() : null); topic = logFilePath.getTopic(); <START> Schema schema; <END> if (!schemaOverride.isEmpty()) { schema = schemaRegistryClient.getSchema(schemaOverride); } else { try { schema = schemaRegistryClient.getSchema(topic); } catch (IllegalStateException exc) { topic += schemaSuffix; schema = schemaRegistryClient.getSchema(topic); } } writer = AvroParquetWriter.builder(path) .withSchema(schema) .withCompressionCodec(codecName) .build(); }</code><technical_language>this logic need replicated in AvroParquetFileReader</technical_language>

Target:
public AvroParquetFileWriter(LogFilePath logFilePath, CompressionCodec codec) throws IOException { Path path = new Path(logFilePath.getLogFilePath()); LOG.debug("Creating Brand new Writer for path {}", path); CompressionCodecName codecName = CompressionCodecName .fromCompressionCodec(codec != null ? codec.getClass() : null); topic = logFilePath.getTopic(); Schema schema = getSchema(topic); datumReader = new SpecificDatumReader<>(schema); writer = AvroParquetWriter.builder(path) .withSchema(schema) .withCompressionCodec(codecName) .build(); }
Source:
<code><START> public void testConstructorNotAndModifiedSince() throws SearchException, IOException, ImapAsyncClientException { <END> final ExtendedSearchSequence searchSeq = new ExtendedSearchSequence(); final ExtendedModifiedSinceTerm extendedModifiedSinceTerm = new ExtendedModifiedSinceTerm(1L); final BodyTerm bodyTerm = new BodyTerm("test"); final AndTerm andTerm = new AndTerm(bodyTerm, extendedModifiedSinceTerm); final NotTerm notTerm = new NotTerm(andTerm); final Argument args = new Argument(); args.append(searchSeq.generateSequence(notTerm)); final String searchStr = args.toString(); Assert.assertEquals(searchStr, "NOT (BODY test MODSEQ 1)", "result mismatched."); }</code><technical_language>ImapAsyncClientException thrown</technical_language>

Target:
public void testConstructorNotAndModifiedSince() throws SearchException, IOException { final ExtendedSearchSequence searchSeq = new ExtendedSearchSequence(); final ExtendedModifiedSinceTerm extendedModifiedSinceTerm = new ExtendedModifiedSinceTerm(1L); final BodyTerm bodyTerm = new BodyTerm("test"); final AndTerm andTerm = new AndTerm(bodyTerm, extendedModifiedSinceTerm); final NotTerm notTerm = new NotTerm(andTerm); final Argument args = new Argument(); args.append(searchSeq.generateSequence(notTerm)); final String searchStr = args.toString(); Assert.assertEquals(searchStr, "NOT (BODY test MODSEQ 1)", "generateSequence() mismatched."); }
Source:
<code>public boolean perform(final GridWidget gridWidget, final boolean isShiftKeyDown, final boolean isControlKeyDown) { final boolean needToRedraw = super.perform(gridWidget, isShiftKeyDown, isControlKeyDown); final GridData model = gridWidget.getModel(); <START> if (model.getSelectedCells().size() == 1) { <END> final GridData.SelectedCell selectedCell = model.getSelectedCells().get(0); final GridCellValue<?> value = model.getCell(selectedCell.getRowIndex(), ColumnIndexUtilities.findUiColumnIndex(model.getColumns(), selectedCell.getColumnIndex())).getValue(); if (value instanceof ExpressionCellValue) { final Optional<BaseExpressionGrid> grid = ((ExpressionCellValue) value).getValue(); grid.ifPresent(baseExpressionGrid -> { gridLayer.select(baseExpressionGrid); baseExpressionGrid.selectFirstCell(); }); } } return needToRedraw; }</code><technical_language>@jomarko @manstis @ederign This bad, IMHO. implicitly means more selected cell while editing one, is counter-intuitive UI point of view. Moreover, means if more cell is selected, code "if" is invoked. *If* is impossible (for reason current snippet) more selected cell editing, if *it not* possible, please explicitly block flow beginning of this method, fix implementation</technical_language>

Target:
public boolean perform(final GridWidget gridWidget, final boolean isShiftKeyDown, final boolean isControlKeyDown) { final boolean changesToBeRendered = super.perform(gridWidget, isShiftKeyDown, isControlKeyDown); final GridData model = gridWidget.getModel(); final GridData.SelectedCell selectedCell = model.getSelectedCells().get(0); final GridCellValue<?> value = model.getCell(selectedCell.getRowIndex(), ColumnIndexUtilities.findUiColumnIndex(model.getColumns(), selectedCell.getColumnIndex())).getValue(); if (value instanceof ExpressionCellValue) { final Optional<BaseExpressionGrid> grid = ((ExpressionCellValue) value).getValue(); grid.ifPresent(baseExpressionGrid -> { gridLayer.select(baseExpressionGrid); baseExpressionGrid.selectFirstCell(); }); } return changesToBeRendered; }
Source:
<code>private boolean isHtmlSpace(int ch) { <START> return ch <= 0x20 && (HTML_SPACE_CHAR_BITMASK & (1L << ch)) != 0; <END> }</code><technical_language>Hmm, is this a switch?: switch (ch) { case ' ': ... }</technical_language>

Target:
private boolean isHtmlSpace(int ch) { switch (ch) { case ' ': case '\t': case '\n': case '\u000c': case '\r': return true; default: return false; } }
Source:
<code>private void cancel() { sourceListModel.setWindow(null); <START> sourceListModel.setConfirmWindow(null); <END> sourceListModel.getSearchCommand().execute(); }</code><technical_language>If invoke this dialog setWindow(), call setConfirmWindow(null)</technical_language>

Target:
private void cancel() { sourceListModel.setWindow(null); }
Source:
<code>public TypedExpression invoke(Statement statement) { <START> logger.debug("RHS phase on:\t\t" + printConstraint(statement)); <END> Context ctx = new Context(); TypedExpression typedExpression = statement.accept(this, ctx); if (typedExpression == null) { throw new MvelCompilerException("Type check of " + printConstraint(statement) + " failed."); } logger.debug("RHS phase completed"); return typedExpression; }</code><technical_language>Logging phrase mentiones RHS instead of LHS. Please check class for this</technical_language>

Target:
public TypedExpression invoke(Statement statement) { logger.debug("LHS phase on:\t\t" + printConstraint(statement)); Context ctx = new Context(); TypedExpression typedExpression = statement.accept(this, ctx); if (typedExpression == null) { throw new MvelCompilerException("Type check of " + printConstraint(statement) + " failed."); } logger.debug("LHS phase completed"); return typedExpression; }
Source:
<code>public void stop(BundleContext context) throws Exception { try { Job.getJobManager().join(LUCENE_JOB_FAMILY, null); <START> plugin = null; <END> } finally { super.stop(context); } }</code><technical_language>in finally</technical_language>

Target:
public void stop(BundleContext context) throws Exception { try { Job.getJobManager().join(LUCENE_JOB_FAMILY, null); } finally { plugin = null; super.stop(context); } }
Source:
<code>public void testLpad() { String lpad = StringUtils.lpad("abc", 7, "de"); Assert.assertEquals("dedeabc", lpad); lpad = StringUtils.lpad("abc", 6, "de"); Assert.assertEquals("dedabc", lpad); lpad = StringUtils.lpad("abc", 2, "de"); Assert.assertEquals("ab", lpad); lpad = StringUtils.lpad("abc", 0, "de"); Assert.assertEquals("", lpad); lpad = StringUtils.lpad("abc", -1, "de"); <START> Assert.assertNull(lpad); <END> lpad = StringUtils.lpad("abc", 10, ""); Assert.assertEquals("abc", lpad); lpad = StringUtils.lpad("abc", 1, ""); Assert.assertEquals("a", lpad); }</code><technical_language>postgres returns empty string for this case (but mysql returns null)</technical_language>

Target:
public void testLpad() { String lpad = StringUtils.lpad("abc", 7, "de"); Assert.assertEquals("dedeabc", lpad); lpad = StringUtils.lpad("abc", 6, "de"); Assert.assertEquals("dedabc", lpad); lpad = StringUtils.lpad("abc", 2, "de"); Assert.assertEquals("ab", lpad); lpad = StringUtils.lpad("abc", 0, "de"); Assert.assertEquals("", lpad); lpad = StringUtils.lpad("abc", -1, "de"); Assert.assertEquals("", lpad); lpad = StringUtils.lpad("abc", 10, ""); Assert.assertEquals("abc", lpad); lpad = StringUtils.lpad("abc", 1, ""); Assert.assertEquals("a", lpad); }
Source:
<code>public SqlStatementCustomizer createForParameter(Annotation annotation, Class sqlObjectType, Method method, Object arg) { <START> throw new UnsupportedOperationException("Not Yet Implemented!"); <END> }</code><technical_language>for error message annotation is supported parameters</technical_language>

Target:
public SqlStatementCustomizer createForParameter(Annotation annotation, Class sqlObjectType, Method method, Object arg) { throw new UnsupportedOperationException("@RegisterContainerMapper is not supported on parameters"); }
Source:
<code>private static Collection<Unit> findRolledTargets( final List<Unit> availableTargets, final DiceRoll dice) { <START> final List<Die> rolls = dice.getRolls(); <END> final List<Unit> hitTargets = new ArrayList<>(); for (int i = 0; i < rolls.size(); i++) { if (rolls.get(i).getType() == DieType.HIT) { hitTargets.add(availableTargets.get(i)); } } return hitTargets; }</code><technical_language>nitpicky question is intermediate rolls variable? dice.getRolls() is descriptive a couple times below. Removing intermediate variables is a good thing, for a maintainer mental stack reading code. this point reading method, 3 variables in scope, soon a 4th one, leaves room for else</technical_language>

Target:
private static Collection<Unit> findRolledTargets( final List<Unit> availableTargets, final DiceRoll dice) { Preconditions.checkArgument( availableTargets.size() == dice.getRolls().size(), "findRolledTargets needs one roll per target"); return IntStream.range(0, dice.getRolls().size()) .filter(rollIdx -> dice.getRolls().get(rollIdx).getType() == DieType.HIT) .mapToObj(availableTargets::get) .collect(Collectors.toList()); }
Source:
<code>public void txnCanCommitIfOverwrittenAndRetry() throws Exception { CorfuRuntime rt = getNewRuntime(getRuntime().getParameters()) .parseConfigurationString(getDefaultConfigurationString()); rt.connect(); OptimisticTXBegin(); put("k1", "v1"); put("k2", "v2"); <START> AtomicInteger counter = new AtomicInteger(0); <END> addClientRule(getRuntime(), new TestRule().matches(corfuMsg -> { if (corfuMsg.getMsgType().equals(CorfuMsgType.WRITE) && counter.getAndAdd(1) == 0) { Token token = rt.getSequencerView().query().getToken(); rt.getAddressSpaceView().read(token.getSequence()); } return true; })); assertThatCode(this::TXEnd).doesNotThrowAnyException(); }</code><technical_language>A cleaner is fill a hole sequencer next token handed out writer fail retry. cleaner this type of synchronization</technical_language>

Target:
public void txnCanCommitIfOverwrittenAndRetry() throws Exception { CorfuRuntime rt = getNewRuntime(getRuntime().getParameters()) .parseConfigurationString(getDefaultConfigurationString()); rt.connect(); OptimisticTXBegin(); put("k1", "v1"); put("k2", "v2"); long currentTail = rt.getSequencerView().query().getToken().getSequence(); rt.getAddressSpaceView().read(currentTail + 1); assertThatCode(this::TXEnd).doesNotThrowAnyException(); assertThat(rt.getSequencerView().query().getToken().getSequence()).isEqualTo(currentTail + 2); assertThat(get("k1")).isEqualTo("v1"); assertThat(get("k2")).isEqualTo("v2"); }
Source:
<code>public String getUrlName() { if (getProject() != null && getProject().getLastCompletedBuild() != null && getProject().isBuildable()) { return getProject().getLastCompletedBuild().getNumber() + "/rebuild"; <START> } else { <END> return "build?delay=0sec"; } }</code><technical_language>I this else else if (getProject().isBuildable()) "else return null" shown a rebuild link user get error (lack of permissions project is disabled for example)</technical_language>

Target:
public String getUrlName() { boolean isBuildable = getProject() != null && getProject().isBuildable(); boolean hasCompletedBuild = getProject().getLastCompletedBuild() != null; if (isBuildable) { if (hasCompletedBuild) { return getProject().getLastCompletedBuild().getNumber() + "/rebuild"; } else { return "build?delay=0sec"; } } else { return null; } }
Source:
<code>public boolean validateUuidPresent(CaseInsensitiveString name, Set<String> uuids) { if (isEmpty(uuids)) { <START> return false; <END> } if (!uuids.contains(uuid)) { this.addError(UUID, format("Environment '%s' has an invalid agent uuid '%s'", name, uuid)); } return errors().isEmpty(); }</code><technical_language>do return if uuids is empty? boolean anywhere. a GoCD server agents this allow associating a invalid agent environments config repo</technical_language>

Target:
public boolean validateUuidPresent(CaseInsensitiveString name, Set<String> uuids) { if (isEmpty(uuids) || !uuids.contains(uuid)) { this.addError(UUID, format("Environment '%s' has an invalid agent uuid '%s'", name, uuid)); } return errors().isEmpty(); }
Source:
<code>public void testUpsertSelect() throws Exception { String tableName = generateUniqueName(); String idxName = "IDX_" + generateUniqueName(); try (Connection conn = DriverManager.getConnection(getUrl(), testProps)) { conn.setAutoCommit(true); createTableAndIndex(conn, tableName, idxName, null, true, 2); assertMetadata(conn, ONE_CELL_PER_COLUMN, NON_ENCODED_QUALIFIERS, tableName); assertMetadata(conn, SINGLE_CELL_ARRAY_WITH_OFFSETS, TWO_BYTE_QUALIFIERS, idxName); conn.createStatement().execute("delete from " + tableName + " where pk1 = 'PK1'"); conn.commit(); String sql = <START> "UPSERT INTO " + idxName + "(\":PK1\",\":INT_PK\",\"0:V1\",\"0:V2\",\"0:V4\") SELECT PK1,INT_PK, V1, V2,V4 FROM " <END> + tableName; conn.createStatement().executeUpdate(sql); conn.commit(); String query = "SELECT \":PK1\" from " + idxName + " ORDER BY \":PK1\""; ResultSet rs = conn.createStatement().executeQuery(query); assertTrue(rs.next()); assertEquals("PK2", rs.getString(1)); assertFalse(rs.next()); } }</code><technical_language>a NO_INDEX hint in upsert clause do anything</technical_language>

Target:
public void testUpsertSelect() throws Exception { String tableName = generateUniqueName(); String idxName = "IDX_" + generateUniqueName(); try (Connection conn = DriverManager.getConnection(getUrl(), testProps)) { conn.setAutoCommit(true); createTableAndIndex(conn, tableName, idxName, null, true, 2); assertMetadata(conn, ONE_CELL_PER_COLUMN, NON_ENCODED_QUALIFIERS, tableName); assertMetadata(conn, SINGLE_CELL_ARRAY_WITH_OFFSETS, TWO_BYTE_QUALIFIERS, idxName); conn.createStatement().execute("delete from " + tableName + " where pk1 = 'PK1'"); conn.commit(); String sql = "UPSERT INTO " + idxName + "(\":PK1\",\":INT_PK\",\"0:V1\",\"0:V2\",\"0:V4\") " + " SELECT PK1,INT_PK, V1, V2,V4 FROM " + tableName; conn.createStatement().executeUpdate(sql); conn.commit(); String query = "SELECT \":PK1\" from " + idxName + " ORDER BY \":PK1\""; ResultSet rs = conn.createStatement().executeQuery(query); assertTrue(rs.next()); assertEquals("PK2", rs.getString(1)); assertFalse(rs.next()); } }
Source:
<code>private void checkVdsNetworkThreshold(VdsStatistics stat) { Integer maxUsedPercentageThreshold = Config.getValue(ConfigValues.LogMaxNetworkUsedThresholdInPercentage); for (VdsNetworkInterface iface : _vds.getInterfaces()) { Double transmitRate = iface.getStatistics().getTransmitRate(); Double receiveRate = iface.getStatistics().getReceiveRate(); if ((transmitRate != null && iface.getStatistics().getTransmitRate().intValue() > maxUsedPercentageThreshold) || (receiveRate != null && iface.getStatistics().getReceiveRate().intValue() > maxUsedPercentageThreshold)) { AuditLogableBase logable = new AuditLogableBase(_vds.getId()); <START> logable.setCustomId(iface.getName().toString()); <END> logable.addCustomValue("HostName", _vds.getName()); logable.addCustomValue("InterfaceName", iface.getName()); logable.addCustomValue("Threshold", maxUsedPercentageThreshold.toString()); logable.addCustomValue("TransmitRate", String.valueOf(transmitRate.intValue())); logable.addCustomValue("ReceiveRate", String.valueOf(receiveRate.intValue())); auditLog(logable, AuditLogType.HOST_INTERFACE_HIGH_NETWORK_USE); } } }</code><technical_language>toString() redundant ? I guess returned type of iface.getName() is string</technical_language>

Target:
private void checkVdsNetworkThreshold(VdsStatistics stat) { Integer maxUsedPercentageThreshold = Config.getValue(ConfigValues.LogMaxNetworkUsedThresholdInPercentage); for (VdsNetworkInterface iface : _vds.getInterfaces()) { Double transmitRate = iface.getStatistics().getTransmitRate(); Double receiveRate = iface.getStatistics().getReceiveRate(); if ((transmitRate != null && iface.getStatistics().getTransmitRate().intValue() > maxUsedPercentageThreshold) || (receiveRate != null && iface.getStatistics().getReceiveRate().intValue() > maxUsedPercentageThreshold)) { AuditLogableBase logable = new AuditLogableBase(_vds.getId()); logable.setCustomId(iface.getName()); logable.addCustomValue("HostName", _vds.getName()); logable.addCustomValue("InterfaceName", iface.getName()); logable.addCustomValue("Threshold", maxUsedPercentageThreshold.toString()); logable.addCustomValue("TransmitRate", String.valueOf(transmitRate.intValue())); logable.addCustomValue("ReceiveRate", String.valueOf(receiveRate.intValue())); auditLog(logable, AuditLogType.HOST_INTERFACE_HIGH_NETWORK_USE); } } }
Source:
<code><START> public void checkStorageProcessorAndHandlerNfsVersionAttributeVersionNotSet(){ <END> _resource.checkStorageProcessorAndHandlerNfsVersionAttribute(storageCmd); assertEquals(NFS_VERSION, _resource._storageNfsVersion); }</code><technical_language>@nvazquez if version is set, check if method "examineStorageSubSystemCommandNfsVersion" called</technical_language>

Target:
public void checkStorageProcessorAndHandlerNfsVersionAttributeVersionNotSet(){ _resource.checkStorageProcessorAndHandlerNfsVersionAttribute(storageCmd); verify(_resource).examineStorageSubSystemCommandNfsVersion(storageCmd); assertEquals(NFS_VERSION, _resource.storageNfsVersion); }
Source:
<code>public void test() throws InvalidConfigurationException { try { config = tryConfiguration(SOCKET_LOCATION); <START> log.info("Accessing docker with local Unix socket"); <END> } catch (Exception | UnsatisfiedLinkError e) { throw new InvalidConfigurationException("ping failed", e); } }</code><technical_language>s/local Unix socket/Named Pipe/</technical_language>

Target:
public void test() throws InvalidConfigurationException { try { config = tryConfiguration(); log.info("Accessing docker with {}", getDescription()); } catch (Exception | UnsatisfiedLinkError e) { throw new InvalidConfigurationException("ping failed", e); } }
Source:
<code>public void testCompatWarn() throws Exception { Framework.getProperties().setProperty("nuxeo.test.dummyStringProperty", "anotherDummyValue"); boolean devModeSet = Framework.isDevModeSet(); if (!devModeSet) { <START> Framework.getProperties().setProperty(Framework.NUXEO_DEV_SYSTEM_PROP, "true"); <END> } assertEquals(0, Framework.getRuntime().getMessageHandler().getWarnings().size()); hotDeployer.deploy("org.nuxeo.runtime.test.tests:configuration-test-contrib.xml"); assertEquals(0, Framework.getRuntime().getMessageHandler().getWarnings().size()); List<String> caughtEvents = logCaptureResult.getCaughtEventMessages(); assertEquals(1, caughtEvents.size()); String message = "Since version 7.4: Property 'nuxeo.test.dummyStringProperty' should now be contributed to " + "extension point 'org.nuxeo.runtime.ConfigurationService', using target 'configuration'"; assertEquals(message, caughtEvents.get(0)); Framework.getProperties().remove("nuxeo.test.dummyStringProperty"); Framework.getProperties().setProperty(Framework.NUXEO_DEV_SYSTEM_PROP, devModeSet ? "true" : "false"); }</code><technical_language>I change DeprecationLogger log WARN currently testing too. Wdyt</technical_language>

Target:
public void testCompatWarn() throws Exception { Framework.getProperties().setProperty("nuxeo.test.dummyStringProperty", "anotherDummyValue"); assertEquals(0, Framework.getRuntime().getMessageHandler().getWarnings().size()); hotDeployer.deploy("org.nuxeo.runtime.test.tests:configuration-test-contrib.xml"); assertEquals(0, Framework.getRuntime().getMessageHandler().getWarnings().size()); List<String> caughtEvents = logCaptureResult.getCaughtEventMessages(); assertEquals(1, caughtEvents.size()); String message = "Since version 7.4: Property 'nuxeo.test.dummyStringProperty' should now be contributed to " + "extension point 'org.nuxeo.runtime.ConfigurationService', using target 'configuration'"; assertEquals(message, caughtEvents.get(0)); Framework.getProperties().remove("nuxeo.test.dummyStringProperty"); }
Source:
<code>public Function1D<NormalFunctionData, Double> getPriceFunction(EuropeanVanillaOption option) { ArgChecker.notNull(option, "option"); double strike = option.getStrike(); double t = option.getTimeToExpiry(); return new Function1D<NormalFunctionData, Double>() { @SuppressWarnings("synthetic-access") @Override public Double evaluate(NormalFunctionData data) { ArgChecker.notNull(data, "data"); double forward = data.getForward(); double numeraire = data.getNumeraire(); double sigma = data.getNormalVolatility(); double sigmaRootT = sigma * Math.sqrt(t); int sign = option.isCall() ? 1 : -1; <START> if (sigmaRootT < 1e-16) { <END> double x = sign * (forward - strike); return (x > 0 ? numeraire * x : 0.0); } double arg = sign * (forward - strike) / sigmaRootT; return numeraire * (sign * (forward - strike) * NORMAL.getCDF(arg) + sigmaRootT * NORMAL.getPDF(arg)); } }; }</code><technical_language>Magic number. is it</technical_language>

Target:
public Function1D<NormalFunctionData, Double> getPriceFunction(EuropeanVanillaOption option) { ArgChecker.notNull(option, "option"); double strike = option.getStrike(); double t = option.getTimeToExpiry(); return new Function1D<NormalFunctionData, Double>() { @SuppressWarnings("synthetic-access") @Override public Double evaluate(NormalFunctionData data) { ArgChecker.notNull(data, "data"); double forward = data.getForward(); double numeraire = data.getNumeraire(); double sigma = data.getNormalVolatility(); double sigmaRootT = sigma * Math.sqrt(t); int sign = option.isCall() ? 1 : -1; if (sigmaRootT < NEAR_ZERO) { double x = sign * (forward - strike); return (x > 0 ? numeraire * x : 0.0); } double arg = sign * (forward - strike) / sigmaRootT; return numeraire * (sign * (forward - strike) * NORMAL.getCDF(arg) + sigmaRootT * NORMAL.getPDF(arg)); } }; }
Source:
<code>protected boolean connectLunDisks(Guid hostId) { if (getVm().getDiskMap().isEmpty()) { vmHandler.updateDisksFromDb(getVm()); } List<LunDisk> lunDisks = DisksFilter.filterLunDisks(getVm().getDiskMap().values()); Map<StorageType, List<StorageServerConnections>> connectionsByType = lunDisks.stream() .flatMap(d -> storageServerConnectionDao.getAllForLun(d.getLun().getLUNId()).stream()) .distinct() .collect(groupingBy(StorageServerConnections::getStorageType, toList())); return connectionsByType.entrySet().stream() <START> .map((entry) -> <END> runVdsCommand( VDSCommandType.ConnectStorageServer, new StorageServerConnectionManagementVDSParameters( hostId, getStoragePoolId(), entry.getKey(), entry.getValue()))) .noneMatch(vdsReturnValue -> !vdsReturnValue.getSucceeded()); }</code><technical_language>remove parenthesis entry</technical_language>

Target:
protected boolean connectLunDisks(Guid hostId) { if (getVm().getDiskMap().isEmpty()) { vmHandler.updateDisksFromDb(getVm()); } List<LunDisk> lunDisks = DisksFilter.filterLunDisks(getVm().getDiskMap().values()); Map<StorageType, List<StorageServerConnections>> connectionsByType = lunDisks.stream() .flatMap(d -> storageServerConnectionDao.getAllForLun(d.getLun().getLUNId()).stream()) .distinct() .collect(groupingBy(StorageServerConnections::getStorageType, toList())); return connectionsByType.entrySet().stream() .map(entry -> runVdsCommand( VDSCommandType.ConnectStorageServer, new StorageServerConnectionManagementVDSParameters( hostId, getStoragePoolId(), entry.getKey(), entry.getValue()))) .noneMatch(vdsReturnValue -> !vdsReturnValue.getSucceeded()); }
Source:
<code>public void iNavigateTo(String nameToken) { <START> if (nameToken.equals(NameTokens.LOGIN)) { <END> applicationPage.navigateToNotLoggedIn(nameToken); } else { applicationPage.navigateToWithMenu(nameToken); } }</code><technical_language>Do other around, safer do : NameTokens.LOGIN.equals(nameToken)</technical_language>

Target:
public void iNavigateTo(String nameToken) { if (NameTokens.LOGIN.equals(nameToken)) { applicationPage.navigateToNotLoggedIn(nameToken); } else { applicationPage.navigateToWithMenu(nameToken); } }
Source:
<code>public boolean test(final String rawConfig) { try { Map<String, Object> parsedConfig = MAPPER.readValue(rawConfig, new TypeReference<Map<String, Object>>() {}); for (Map<String, Object> node : (List<Map<String, Object>>) parsedConfig.get("nodesExt")) { final Map<String, Integer> nodeServices = (Map<String, Integer>) node.get("services"); for (CouchbaseService enabledService : enabledServices) { boolean found = false; for (String nodeService : nodeServices.keySet()) { if (nodeService.startsWith(enabledService.getIdentifier())) { found = true; } } if (!found) { logger().trace("Service not yet part of config, retrying.", enabledService); return false; } } } return true; } catch (IOException ex) { <START> logger().error("Unable to parse response {}", rawConfig); <END> return false; } }</code><technical_language>exception is swallowed</technical_language>

Target:
public boolean test(final String rawConfig) { try { for (JsonNode node : MAPPER.readTree(rawConfig).at("/nodesExt")) { for (CouchbaseService enabledService : enabledServices) { boolean found = false; Iterator<String> fieldNames = node.get("services").fieldNames(); while (fieldNames.hasNext()) { if (fieldNames.next().startsWith(enabledService.getIdentifier())) { found = true; } } if (!found) { logger().trace("Service not yet part of config, retrying.", enabledService); return false; } } } return true; } catch (IOException ex) { logger().error("Unable to parse response: {}", rawConfig, ex); return false; } }
Source:
<code>private void pulseSingleTickMap() { ItemTable itemTable = ItemTable.instance(); HashMap<Location, Long> pulsesToRemove = new HashMap<Location, Long>(); getSingleTickMap().entrySet().stream().filter(entry -> entry.getValue() - worldAge <= 0).forEach(entry -> { GlowBlock block = getBlockAt(entry.getKey()); BlockType notifyType = itemTable.getBlock(block.getTypeId()); if (notifyType != null) notifyType.receivePulse(block); pulsesToRemove.put(entry.getKey(), entry.getValue()); }); <START> for (Map.Entry<Location, Long> entry : pulsesToRemove.entrySet()) { <END> getSingleTickMap().remove(entry.getKey(), entry.getValue()); } }</code><technical_language>remove entries in stream</technical_language>

Target:
private void pulseSingleTickMap() { ItemTable itemTable = ItemTable.instance(); getSingleTickMap().entrySet().stream().filter(entry -> entry.getValue() - worldAge <= 0).forEach(entry -> { GlowBlock block = getBlockAt(entry.getKey()); BlockType notifyType = itemTable.getBlock(block.getTypeId()); if (notifyType != null) notifyType.receivePulse(block); getSingleTickMap().remove(entry.getKey(), entry.getValue()); }); }
Source:
<code>public void test1_check_login_saml() throws InterruptedException, NoSuchFieldException, IllegalArgumentException, IllegalAccessException { Log_OC.i(LOG_TAG, "Test Check Login SAML Start"); SystemClock.sleep(WAIT_INITIAL); onView(withId(R.id.buttonOK)).check(matches(not(isEnabled()))); onView(withId(R.id.hostUrlInput)).perform(replaceText(testServerURL)); onView(withId(R.id.thumbnail)).perform(click()); if (servertype == ServerType.NON_TRUSTED) { SystemClock.sleep(WAIT_CONNECTION); onView(withId(R.id.ok)).perform(click()); } <START> SystemClock.sleep(WAIT_CONNECTION); <END> onView(withId(R.id.server_status_text)).check(matches(withText(R.string.auth_secure_connection))); onView(withId(R.id.buttonOK)).perform(click()); SystemClock.sleep(WAIT_CONNECTION); onWebView().withElement(findElement(Locator.NAME, webViewUsernameId)).perform(webKeys(testUser)); onWebView().withElement(findElement(Locator.NAME, webViewPasswordId)).perform(webKeys(testPassword)); onWebView().withElement(findElement(Locator.XPATH, webViewSubmitXPath)).perform(webClick()); SystemClock.sleep(WAIT_LOGIN); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) assertTrue(ERROR_MESSAGE, mActivityRule.getActivity().isDestroyed()); else { Field f = Activity.class.getDeclaredField(RESULT_CODE); f.setAccessible(true); int mResultCode = f.getInt(mActivityRule.getActivity()); assertTrue(ERROR_MESSAGE, mResultCode == Activity.RESULT_OK); } Log_OC.i(LOG_TAG, "Test Check Login SAML Passed"); }</code><technical_language>curiosity, sleeps added for</technical_language>

Target:
public void test1_check_login_saml() throws InterruptedException, NoSuchFieldException, IllegalArgumentException, IllegalAccessException { Log_OC.i(LOG_TAG, "Test Check Login SAML Start"); SystemClock.sleep(WAIT_INITIAL_MS); onView(withId(R.id.buttonOK)).check(matches(not(isEnabled()))); onView(withId(R.id.hostUrlInput)).perform(replaceText(testServerURL)); onView(withId(R.id.thumbnail)).perform(click()); if (servertype == ServerType.NON_TRUSTED) { SystemClock.sleep(WAIT_CONNECTION_MS); onView(withId(R.id.ok)).perform(click()); } SystemClock.sleep(WAIT_CONNECTION_MS); onView(withId(R.id.server_status_text)).check(matches(withText(R.string.auth_secure_connection))); onView(withId(R.id.buttonOK)).perform(click()); SystemClock.sleep(WAIT_CONNECTION_MS); onWebView().withElement(findElement(Locator.NAME, webViewUsernameId)).perform(webKeys(testUser)); onWebView().withElement(findElement(Locator.NAME, webViewPasswordId)).perform(webKeys(testPassword)); onWebView().withElement(findElement(Locator.XPATH, webViewSubmitXPath)).perform(webClick()); SystemClock.sleep(WAIT_LOGIN_MS); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) assertTrue(ERROR_MESSAGE, mActivityRule.getActivity().isDestroyed()); else { Field f = Activity.class.getDeclaredField(RESULT_CODE); f.setAccessible(true); int mResultCode = f.getInt(mActivityRule.getActivity()); assertTrue(ERROR_MESSAGE, mResultCode == Activity.RESULT_OK); } Log_OC.i(LOG_TAG, "Test Check Login SAML Passed"); }
Source:
<code>public XmlStringBuilder toXML(XmlEnvironment xmlEnvironment) { XmlStringBuilder xml = new XmlStringBuilder(this).rightAngleBracket(); <START> for (ExtensionElement element : payloadElements) { <END> xml.append(element); } return xml.closeElement(this); }</code><technical_language>simply xml.append(payloadElements)</technical_language>

Target:
public XmlStringBuilder toXML(XmlEnvironment xmlEnvironment) { XmlStringBuilder xml = new XmlStringBuilder(this).rightAngleBracket(); xml.append(payloadElements); return xml.closeElement(this); }
Source:
<code>public static String createAbsolute(String path){ File curFile = new File(path); if(!curFile.isAbsolute()){ <START> path = currPath + '/' + path; <END> } return path; }</code><technical_language>File.separator</technical_language>

Target:
public static String createAbsolute(String path) { File curFile = new File(path); if (!curFile.isAbsolute()) { path = currPath + File.separator + path; } return path; }
Source:
<code>private DeleteRequest(LwM2mPath target) { super(target); if (!target.isObjectInstance()) <START> throw new InvalidRequestException("Invalid path %s : Only object instance can be delete.", target); <END> }</code><technical_language>..object instances deleted"</technical_language>

Target:
private DeleteRequest(LwM2mPath target) { super(target); if (!target.isObjectInstance()) throw new InvalidRequestException("Invalid path %s : Only object instances can be delete", target); }
Source:
<code>public void testMenuStyles() { Assert.assertEquals("Root Menu Style", "grid", mApp.getSession().getPlatform().getMenuDisplayStyle("root")); Assert.assertEquals("Common Menu Style", "list", mApp.getSession().getPlatform().getMenuDisplayStyle("m1")); Assert.assertEquals("Disperate Menu Style", null, <START> mApp.getSession().getPlatform().getMenuDisplayStyle("m2")); <END> }</code><technical_language>write a test look-up style for m0, a style</technical_language>

Target:
public void testMenuStyles() { Assert.assertEquals("Root Menu Style", "grid", mApp.getSession().getPlatform().getMenuDisplayStyle("root")); Assert.assertEquals("Common Menu Style", "list", mApp.getSession().getPlatform().getMenuDisplayStyle("m1")); Assert.assertEquals("Disperate Menu Style", null, mApp.getSession().getPlatform().getMenuDisplayStyle("m2")); Assert.assertEquals("Empty Menu", null, mApp.getSession().getPlatform().getMenuDisplayStyle("m0")); Assert.assertEquals("Specific override", "grid", mApp.getSession().getPlatform().getMenuDisplayStyle("m3")); }
Source:
<code>public void onReport() { <START> platformService.showDocument(clientProperties.getLinks().get("linksModerationReport")); <END> }</code><technical_language>constant</technical_language>

Target:
public void onReport() { platformService.showDocument(clientProperties.getWebsite().getReportUrl()); }
Source:
<code>synchronized void subscribe(final String topic) throws MqttException { <START> synchronized (subscribeLock) { <END> if (!started) { client = new MqttClient(brokerURI, clientId); client.connect(); client.setCallback(this); started = true; } client.subscribe(topic); } }</code><technical_language>subscribeLock is needed</technical_language>

Target:
void subscribe(final String topic) throws MqttException { synchronized (subscribeLock) { if (!started) { client = new MqttClient(brokerURI, clientId); client.connect(); client.setCallback(this); started = true; } client.subscribe(topic); } }
Source:
<code>public synchronized void commit() { try { switch (state) { case EMPTY: break; case SHARED_OPERATION_BUFFERED: Optional<String> doAsUser = getImpersonationUser(); if (doAsUser.isPresent()) { hdfsEnvironment.doAs(doAsUser.get(), () -> commitShared()); } else { <START> commitShared(); <END> } break; case EXCLUSIVE_OPERATION_BUFFERED: requireNonNull(bufferedExclusiveOperation, "bufferedExclusiveOperation is null"); bufferedExclusiveOperation.execute(delegate, hdfsEnvironment); break; case FINISHED: throw new IllegalStateException("Tried to commit buffered metastore operations after transaction has been committed/aborted"); default: throw new IllegalStateException("Unknown state"); } } finally { state = State.FINISHED; } }</code><technical_language>is this for commit? rollback</technical_language>

Target:
public synchronized void commit() { try { switch (state) { case EMPTY: break; case SHARED_OPERATION_BUFFERED: commitShared(); break; case EXCLUSIVE_OPERATION_BUFFERED: requireNonNull(bufferedExclusiveOperation, "bufferedExclusiveOperation is null"); bufferedExclusiveOperation.execute(delegate, hdfsEnvironment, metastoreAuthentication); break; case FINISHED: throw new IllegalStateException("Tried to commit buffered metastore operations after transaction has been committed/aborted"); default: throw new IllegalStateException("Unknown state"); } } finally { state = State.FINISHED; } }
Source:
<code>protected boolean isHandledByDirectEditor(final EObject element) { <START> return DirectEditorEditingSupport.getConfiguration(element) != null; <END> }</code><technical_language>null operande</technical_language>

Target:
protected boolean isHandledByDirectEditor(final EObject element) { return null != DirectEditorEditingSupport.getConfiguration(element); }
Source:
<code>public void removeLun(LUNs lun) { if (lun.getvolume_group_id().isEmpty()) { DbFacade.getInstance().getLunDao().remove(lun.getLUN_id()); <START> } <END> for (storage_server_connections connection : filterConnectionsUsedByOthers(lun.getLunConnections(), "", lun.getLUN_id())) { DbFacade.getInstance().getStorageServerConnectionDao().remove(connection.getid()); } }</code><technical_language>do this now</technical_language>

Target:
public void removeLun(LUNs lun) { if (lun.getvolume_group_id().isEmpty()) { DbFacade.getInstance().getLunDao().remove(lun.getLUN_id()); for (storage_server_connections connection : filterConnectionsUsedByOthers(lun.getLunConnections(), "", lun.getLUN_id())) { DbFacade.getInstance().getStorageServerConnectionDao().remove(connection.getid()); } } }
Source:
<code>static String createSerialized(boolean isFooterKey, String kmsInstanceID, String kmsInstanceURL, String masterKeyID, boolean isDoubleWrapped, String kekID, String encodedWrappedKEK, String encodedWrappedDEK, boolean isInternalStorage) { Map<String, String> keyMaterialMap = new HashMap<String, String>(10); keyMaterialMap.put(KEY_MATERIAL_TYPE_FIELD, KEY_MATERIAL_TYPE); <START> if (isInternalStorage) { <END> keyMaterialMap.put(KEY_MATERIAL_INTERNAL_STORAGE_FIELD, "true"); } keyMaterialMap.put(IS_FOOTER_KEY_FIELD, Boolean.toString(isFooterKey)); if (isFooterKey) { keyMaterialMap.put(KMS_INSTANCE_ID_FIELD, kmsInstanceID); keyMaterialMap.put(KMS_INSTANCE_URL_FIELD, kmsInstanceURL); } keyMaterialMap.put(MASTER_KEY_ID_FIELD, masterKeyID); keyMaterialMap.put(WRAPPED_DEK_FIELD, encodedWrappedDEK); keyMaterialMap.put(DOUBLE_WRAPPING_FIELD, Boolean.toString(isDoubleWrapped)); if (isDoubleWrapped) { keyMaterialMap.put(KEK_ID_FIELD, kekID); keyMaterialMap.put(WRAPPED_KEK_FIELD, encodedWrappedKEK); } try { return OBJECT_MAPPER.writeValueAsString(keyMaterialMap); } catch (IOException e) { throw new ParquetCryptoRuntimeException("Failed to serialize key material", e); } }</code><technical_language>Is correct isInternalStorage is serialized deserialized in this object</technical_language>

Target:
static String createSerialized(boolean isFooterKey, String kmsInstanceID, String kmsInstanceURL, String masterKeyID, boolean isDoubleWrapped, String kekID, String encodedWrappedKEK, String encodedWrappedDEK, boolean isInternalStorage) { Map<String, Object> keyMaterialMap = new HashMap<String, Object>(10); keyMaterialMap.put(KEY_MATERIAL_TYPE_FIELD, KEY_MATERIAL_TYPE1); if (isInternalStorage) { keyMaterialMap.put(KeyMetadata.KEY_MATERIAL_INTERNAL_STORAGE_FIELD, Boolean.TRUE); } keyMaterialMap.put(IS_FOOTER_KEY_FIELD, Boolean.valueOf(isFooterKey)); if (isFooterKey) { keyMaterialMap.put(KMS_INSTANCE_ID_FIELD, kmsInstanceID); keyMaterialMap.put(KMS_INSTANCE_URL_FIELD, kmsInstanceURL); } keyMaterialMap.put(MASTER_KEY_ID_FIELD, masterKeyID); keyMaterialMap.put(WRAPPED_DEK_FIELD, encodedWrappedDEK); keyMaterialMap.put(DOUBLE_WRAPPING_FIELD, Boolean.valueOf(isDoubleWrapped)); if (isDoubleWrapped) { keyMaterialMap.put(KEK_ID_FIELD, kekID); keyMaterialMap.put(WRAPPED_KEK_FIELD, encodedWrappedKEK); } try { return OBJECT_MAPPER.writeValueAsString(keyMaterialMap); } catch (IOException e) { throw new ParquetCryptoRuntimeException("Failed to serialize key material", e); } }
Source:
<code>public void visitNode(Tree tree) { <START> if (check.isOneSpaceBetweenKeywordAndNextToken && tree.is(CONTROL_STRUCTURES)) { <END> checkSpaceBetweenKeywordAndNextNode(new TokenVisitor(tree), tree); } if (check.isOneSpaceAfterForLoopSemicolon && tree.is(Kind.FOR_STATEMENT)) { checkSpaceForStatement(tree); } if (check.isSpaceForeachStatement && tree.is(Kind.FOREACH_STATEMENT)) { ForEachStatementTree forloop = (ForEachStatementTree) tree; checkForeachStatement(new TokenVisitor(tree), forloop, forloop.asToken(), forloop.doubleArrowToken()); } }</code><technical_language>@lindamartin check tree.is(CONTROL_STRUCTURES) here</technical_language>

Target:
public void visitNode(Tree tree) { if (check.isOneSpaceBetweenKeywordAndNextToken) { checkSpaceBetweenKeywordAndNextNode(new TokenVisitor(tree), tree); } if (check.isOneSpaceAfterForLoopSemicolon && tree.is(Kind.FOR_STATEMENT)) { checkSpaceForStatement(tree); } if (check.isSpaceForeachStatement && tree.is(Kind.FOREACH_STATEMENT)) { ForEachStatementTree foreachLoop = (ForEachStatementTree) tree; checkForeachStatement(new TokenVisitor(tree), foreachLoop, foreachLoop.asToken(), foreachLoop.doubleArrowToken()); } }
Source:
<code>private static void scanFile(JavaIssueFilter filter) { List<JavaCheck> visitors = Lists.<JavaCheck>newArrayList(filter); <START> VisitorsBridgeForTests visitorsBridge = new VisitorsBridgeForTests(visitors, Lists.<File>newLinkedList(), null); <END> JavaAstScanner.scanSingleFileForTests(new File("src/test/files/filters/AnyRuleIssueFilter.java"), visitorsBridge); }</code><technical_language>Collections.emptyList</technical_language>

Target:
private static void scanFile(JavaIssueFilter filter) { VisitorsBridgeForTests visitorsBridge = new VisitorsBridgeForTests(Collections.singletonList(filter), Collections.emptyList(), null); JavaAstScanner.scanSingleFileForTests(new File("src/test/files/filters/AnyRuleIssueFilter.java"), visitorsBridge); }
Source:
<code>public void checkConfigFile(File configFile, File serverDir) { try { ServerFeature servUtil = getServerFeatureUtil(); Set<String> features = servUtil.getServerFeatures(serverDir); if (features != null) { features.removeAll(existingFeatures); if (!features.isEmpty()) { log.info("Configuration features have been added"); Element[] featureElems = new Element[features.size() + 1]; int i = 0; for (String f : features) { featureElems[i] = element(name("feature"), f); i++; } featureElems[i] = element(name("acceptLicense"), "true"); <START> runLibertyMojoInstallFeature(element(name("features"), featureElems)); <END> this.existingFeatures.addAll(features); } } } catch (MojoExecutionException e) { log.error("Failed to install features from configuration file", e); } }</code><technical_language>Quoted #620 > liberty:install-feature is called changed server.xml is copied target, new features added server.xml is installed, Change code call install-features list of new features source server.xml is changed This root cause. server.xml (and entire server dir) is supposed copied a temp dir changes detected (see DevUtil.copyConfigFolder() calls checkConfigFile()), install features server.xml temp dir. configuration list of features need created in pom</technical_language>

Target:
public void checkConfigFile(File configFile, File serverDir) { try { ServerFeature servUtil = getServerFeatureUtil(); Set<String> features = servUtil.getServerFeatures(serverDir); if (features != null) { features.removeAll(existingFeatures); if (!features.isEmpty()) { log.info("Configuration features have been added"); Element[] featureElems = new Element[features.size() + 1]; featureElems[0] = element(name("acceptLicense"), "true"); String[] values = features.toArray(new String[features.size()]); for (int i = 0; i < features.size(); i++) { featureElems[i+1] = element(name("feature"), values[i]); } runLibertyMojoInstallFeature(element(name("features"), featureElems)); this.existingFeatures.addAll(features); } } } catch (MojoExecutionException e) { log.error("Failed to install features from configuration file", e); } }
Source:
<code>public void getNearestRail() { minX = NukkitMath.floorFloat(this.boundingBox.minX); minY = NukkitMath.floorFloat(this.boundingBox.minY); minZ = NukkitMath.floorFloat(this.boundingBox.minZ); maxX = NukkitMath.ceilFloat(this.boundingBox.maxX); maxY = NukkitMath.ceilFloat(this.boundingBox.maxY); maxZ = NukkitMath.ceilFloat(this.boundingBox.maxZ); rails = []; for (z = minZ; z <= maxZ; ++z) { for (x = minX; x <= maxX; ++x) { for (y = minY; y <= maxY; ++y) { Block block = this.level.getBlock(this.temporalVector.setComponents(x, y, z)); if (block.getId(), {Block::RAIL, Block::ACTIVATOR_RAIL, Block::DETECTOR_RAIL, Block::POWERED_RAIL}) rails[] = block; } } } <START> minDistance = PHP_INT_MAX; <END> nearestRail = null; foreach (rails as rail) { dis = this.distance(rail); if (dis < minDistance) { nearestRail = rail; minDistance = dis; } } return nearestRail; }</code><technical_language>this? code " PHP_INT_MAX " in java</technical_language>

Target:
public void getNearestRail() { minX = NukkitMath.floorFloat(this.boundingBox.minX); minY = NukkitMath.floorFloat(this.boundingBox.minY); minZ = NukkitMath.floorFloat(this.boundingBox.minZ); maxX = NukkitMath.ceilFloat(this.boundingBox.maxX); maxY = NukkitMath.ceilFloat(this.boundingBox.maxY); maxZ = NukkitMath.ceilFloat(this.boundingBox.maxZ); rails = []; for (z = minZ; z <= maxZ; ++z) { for (x = minX; x <= maxX; ++x) { for (y = minY; y <= maxY; ++y) { Block block = this.level.getBlock(this.temporalVector.setComponents(x, y, z)); if (block.getId(), {Block.RAIL, Block.ACTIVATOR_RAIL, Block.DETECTOR_RAIL, Block.POWERED_RAIL}) rails[] = block; } } } minDistance = Integer.MAX_VALUE; nearestRail = null; foreach (rails as rail) { dis = this.distance(rail); if (dis < minDistance) { nearestRail = rail; minDistance = dis; } } return nearestRail; }
Source:
<code>private void initializePattern(final String pattern) { final String[] split = pattern.split(Pattern.quote("*"), -1); final StringBuilder escapedPattern = new StringBuilder(Pattern.quote(split[0])); for (int i = 1; i < split.length; i++) { String quoted = Pattern.quote(split[i]); <START> escapedPattern.append("(.+)").append(quoted); <END> } final String regex = "^" + escapedPattern.toString() + "$"; this.patternStr = regex; this.pattern = Pattern.compile(regex); }</code><technical_language>[^.]* overmatch undermatch</technical_language>

Target:
private void initializePattern(final String pattern) { final String[] split = pattern.split(Pattern.quote("*"), -1); final StringBuilder escapedPattern = new StringBuilder(Pattern.quote(split[0])); for (int i = 1; i < split.length; i++) { String quoted = Pattern.quote(split[i]); escapedPattern.append("([^.]*)").append(quoted); } final String regex = "^" + escapedPattern.toString() + "$"; this.patternStr = regex; this.pattern = Pattern.compile(regex); }
Source:
<code>public boolean acquireReadLock(String ownerId) { try (Handle handle = rdbi.open()) { final MultiReadSingleWriteLockDAO dao = handle.attach(MultiReadSingleWriteLockDAO.class); while (true) { final int acquiredLock = dao.acquireReadLock(writeLockKey, readLockKey, ownerId, Instant.now().plus(Duration.millis(readTimeoutMillis)).getMillis()); if (acquiredLock > 0) { return true; } Thread.sleep(250); } } catch (InterruptedException e) { <START> throw new RuntimeException(e); <END> } }</code><technical_language>Same. Re-interrupt</technical_language>

Target:
public boolean acquireReadLock(String ownerId) { try (Handle handle = rdbi.open()) { final MultiReadSingleWriteLockDAO dao = handle.attach(MultiReadSingleWriteLockDAO.class); while (true) { final int acquiredLock = dao.acquireReadLock(writeLockKey, readLockKey, ownerId, Instant.now().plus(readTimeoutMillis, ChronoUnit.MILLIS).toEpochMilli()); if (acquiredLock > 0) { return true; } Thread.sleep(250); } } catch (InterruptedException e) { Thread.currentThread().interrupt(); } return false; }