auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>LocalJobPlanner getPlanner() { boolean isAppModeBatch = new ApplicationConfig(appDesc.getConfig()).getAppMode() == ApplicationConfig.ApplicationMode.BATCH; if (!isAppModeBatch) { return new LocalJobPlanner(appDesc, PROCESSOR_ID); } <START> CoordinationUtils coordinationUtils = null; <END> String runId = null; if (this.coordinationUtils.isPresent()) { coordinationUtils = this.coordinationUtils.get(); } if (this.runId.isPresent()) { runId = this.runId.get(); } return new LocalJobPlanner(appDesc, coordinationUtils, PROCESSOR_ID, runId); }</code><technical_language>simplified coordinationUtils = this.coordinationUtils.orElse(null); runId = this.runId.orElse(null)</technical_language>

Target:
LocalJobPlanner getPlanner() { boolean isAppModeBatch = new ApplicationConfig(appDesc.getConfig()).getAppMode() == ApplicationConfig.ApplicationMode.BATCH; if (!isAppModeBatch) { return new LocalJobPlanner(appDesc, PROCESSOR_ID); } CoordinationUtils coordinationUtils = this.coordinationUtils.orElse(null); String runId = this.runId.orElse(null); return new LocalJobPlanner(appDesc, coordinationUtils, PROCESSOR_ID, runId); }
Source:
<code>public void executePatchRequest() throws Exception { final MkContainer container = new MkGrizzlyContainer().next( new MkAnswer.Simple(HttpURLConnection.HTTP_OK, "{\"msg\":\"hi\"}") ).start(); final RtGist gist = new RtGist( new MkGithub(), new ApacheRequest(container.home()), "patch" ); gist.patch( Json.createObjectBuilder() .add("content", "hi you!") .build() ); MatcherAssert.assertThat( container.take().method(), Matchers.equalTo(Request.PATCH) ); <START> container.stop(); <END> }</code><technical_language>stop container in finally block</technical_language>

Target:
public void executePatchRequest() throws Exception { final MkContainer container = new MkGrizzlyContainer().next( new MkAnswer.Simple(HttpURLConnection.HTTP_OK, "{\"msg\":\"hi\"}") ).start(); try { final RtGist gist = new RtGist( new MkGithub(), new ApacheRequest(container.home()), "patch" ); gist.patch( Json.createObjectBuilder() .add("content", "hi you!") .build() ); MatcherAssert.assertThat( container.take().method(), Matchers.equalTo(Request.PATCH) ); } finally { container.stop(); } }
Source:
<code>protected void initConfig() { super.initConfig(); setIconId("\uF002"); <START> setTooltipText("Suche"); <END> }</code><technical_language>missing translation</technical_language>

Target:
protected void initConfig() { super.initConfig(); setIconId("\uF002"); setTooltipText("Search"); }
Source:
<code>public ArrayList<WebElement> getUnreadNotificationsForTitle(String title) { ArrayList<WebElement> notifications = new ArrayList<WebElement>(); for (int i = 0; i < this.notificationsList.size(); i++) { <START> WebElement n = this.notificationsList.get(i); <END> WebElement nTitle = n.findElement(By.cssSelector("div.msg-title")); if (n != null) { if (title.equals(nTitle.getText())) { notifications.add(n); } } } return notifications; }</code><technical_language>currently creating new object in loop execution, if WebElement n nTitle created loop</technical_language>

Target:
public ArrayList<WebElement> getUnreadNotificationsForTitle(String title) { ArrayList<WebElement> notifications = new ArrayList<WebElement>(); for (int i = 0; i < this.notificationsList.size(); i++) { WebElement n = this.notificationsList.get(i); WebElement nTitle = n.findElement(notificationTitle); if (n != null) { if (title.equals(nTitle.getText())) { notifications.add(n); } } } return notifications; }
Source:
<code>private boolean shouldRefresh() { <START> return expiry == null || getClock().currentTimeMillis() / 1000 > expiry; <END> }</code><technical_language>This incorporate standard clock skew accommodation: <LINK_0></technical_language>

Target:
private boolean shouldRefresh() { return expiryInSeconds == null || getClock().currentTimeMillis() / 1000 > expiryInSeconds - CLOCK_SKEW; }
Source:
<code>protected IScalarEvaluator createEvaluator(IHyracksTaskContext ctx, IScalarEvaluator[] args) throws AlgebricksException { return new AbstractTaggedValueArgumentScalarEvaluator(args) { @Override protected void evaluate(TaggedValuePointable[] args, IPointable result) throws SystemException { TaggedValuePointable tvp = args[0]; TaggedValuePointable tvp1 = args[1]; if (tvp1.getTag() != ValueTag.XS_STRING_TAG) { throw new SystemException(ErrorCode.FORG0006); } XMLSerializer printer = new XMLSerializer(); printer.printTaggedValuePointable(System.err, tvp1); <START> printer.printTaggedValuePointable(System.err, tvp); <END> } }; }</code><technical_language>is result</technical_language>

Target:
protected IScalarEvaluator createEvaluator(IHyracksTaskContext ctx, IScalarEvaluator[] args) throws AlgebricksException { return new AbstractTaggedValueArgumentScalarEvaluator(args) { @Override protected void evaluate(TaggedValuePointable[] args, IPointable result) throws SystemException { TaggedValuePointable tvpValue = args[0]; TaggedValuePointable tvpLabel = args[1]; if (tvpLabel.getTag() != ValueTag.XS_STRING_TAG) { throw new SystemException(ErrorCode.FORG0006); } XMLSerializer printer = new XMLSerializer(); printer.printTaggedValuePointable(System.err, tvpLabel); printer.printTaggedValuePointable(System.err, tvpValue); result.set(tvpValue); } }; }
Source:
<code><START> public HashMap<String, String> deleteFacebookTestUser(String userId) { <END> try { HttpResponse response = deleteTestUser(userId); String entity = EntityUtils.toString(response.getEntity()); return new Gson().fromJson(entity, new TypeToken<HashMap<String, String>>(){}.getType()); } catch (IOException | URISyntaxException e) { PageObjectLogging.log(URI_SYNTAX_EXCEPTION, ExceptionUtils.getStackTrace(e), false); throw new WebDriverException(ERROR_MESSAGE); } }</code><technical_language>Interface Map<String, String> more appropriate</technical_language>

Target:
public void deleteFacebookTestUser(String userId) { try { deleteTestUser(userId); } catch (IOException | URISyntaxException e) { PageObjectLogging.log(URI_SYNTAX_EXCEPTION, ExceptionUtils.getStackTrace(e), false); throw new WebDriverException(ERROR_MESSAGE); } }
Source:
<code>private Consumer<Poller<CertificateOperation>> cancelOperation(String name) { return poller -> { service.updateCertificateOperation(endpoint, name, API_VERSION, ACCEPT_LANGUAGE, <START> new CertificateOperationUpdateParameter().cancellationRequested(true), CONTENT_TYPE_HEADER_VALUE, Context.NONE); <END> }; }</code><technical_language>For async APIs, Flux Mono context instead of Context.None</technical_language>

Target:
private Consumer<Poller<CertificateOperation>> cancelOperation(String name) { return poller -> withContext(context -> cancelCertificateOperationWithResponse(name, context)); }
Source:
<code>void setSize(int size) { this.maxSize = size; if (size <= store.size()) { while (store.size() > size) { <START> store.poll(); <END> } } }</code><technical_language>This loop if user sets a negative size</technical_language>

Target:
void setSize(int size) { if (size < 0) { Logger.warn("Ignoring invalid breadcrumb capacity. Must be >= 0."); return; } this.maxSize = size; while (store.size() > size) { store.poll(); } }
Source:
<code>public void onComplete() { if (index <= count && !done) { done = true; <START> if (defaultValue != null) { <END> actual.onSuccess(defaultValue); } else { actual.onError(new NoSuchElementException()); } } }</code><technical_language>Read T v</technical_language>

Target:
public void onComplete() { if (index <= count && !done) { done = true; T v = defaultValue; if (v != null) { actual.onSuccess(v); } else { actual.onError(new NoSuchElementException()); } } }
Source:
<code>public void testConversion() throws IOException { final StreamObjectPutter putter = new StreamObjectPutter(contentBytes); final InputStream result = putter.buildInputStream("key"); assertThat(result.available(), is(contentBytes.length)); <START> for (byte contentByte : contentBytes) { <END> assertThat(result.read(), is((int) contentByte)); } }</code><technical_language>Missing final</technical_language>

Target:
public void testConversion() throws IOException { final StreamObjectPutter putter = new StreamObjectPutter(contentBytes); final InputStream result = putter.buildInputStream("key"); assertThat(result.available(), is(contentBytes.length)); for (final byte contentByte : contentBytes) { assertThat(result.read(), is((int) contentByte)); } }
Source:
<code>private void parseV2Prefix(Path remoteFilePath) { <START> assert remoteFilePath.getNameCount() >= 3; <END> baseDir = remoteFilePath.getName(0).toString(); clusterName = parseAndValidateAppNameWithHash(remoteFilePath.getName(1).toString()); token = remoteFilePath.getName(2).toString(); }</code><technical_language>do expect name count > 3 well</technical_language>

Target:
private void parseV2Prefix(Path remoteFilePath) { if (remoteFilePath.getNameCount() < 3) throw new RuntimeException( "Not enough no. of elements to parseV2Prefix : " + remoteFilePath); baseDir = remoteFilePath.getName(0).toString(); clusterName = parseAndValidateAppNameWithHash(remoteFilePath.getName(1).toString()); token = remoteFilePath.getName(2).toString(); }
Source:
<code>private void populateChangeRow(final int row, final ChangeInfo c) { ChangeCache cache = ChangeCache.get(c.getId()); cache.getChangeInfoCache().set(c); final String idstr = c.getKey().abbreviate(); table.setWidget(row, C_ARROW, null); if (Gerrit.isSignedIn()) { table.setWidget(row, C_STAR, StarredChanges.createIcon(c.getId(), c.isStarred())); } table.setWidget(row, C_ID, new TableChangeLink(idstr, c)); String s = Util.cropSubject(c.getSubject()); if (c.getStatus() != null && c.getStatus() != Change.Status.NEW) { s += " (" + c.getStatus().name() + ")"; } if (! c.isLatest() || Change.Status.ABANDONED.equals(c.getStatus())) { <START> s += " [OUTDATED]"; <END> table.getRowFormatter().addStyleName(row, Gerrit.RESOURCES.css().outdated()); } else { table.getRowFormatter().removeStyleName(row, Gerrit.RESOURCES.css().outdated()); } table.setWidget(row, C_SUBJECT, new TableChangeLink(s, c)); table.setWidget(row, C_OWNER, link(c.getOwner())); table.setWidget(row, C_PROJECT, new ProjectLink(c.getProject().getKey(), c .getStatus())); table.setWidget(row, C_BRANCH, new BranchLink(c.getProject().getKey(), c .getStatus(), c.getBranch(), c.getTopic())); table.setText(row, C_LAST_UPDATE, shortFormat(c.getLastUpdatedOn())); setRowItem(row, c); }</code><technical_language>this add [OUTDATED] end of change? Also, while this table is for changescreen now, originally ChangeList screen. Shawn started REST api stuff I copied ChangeTable renamed ChangeTable2. I suspect intent is merge again, need some signal abandoned changes highlighted. I kinda if merge 2 making inherit other prevent diverging</technical_language>

Target:
private void populateChangeRow(final int row, final ChangeInfo c) { ChangeCache cache = ChangeCache.get(c.getId()); cache.getChangeInfoCache().set(c); final String idstr = c.getKey().abbreviate(); table.setWidget(row, C_ARROW, null); if (Gerrit.isSignedIn()) { table.setWidget(row, C_STAR, StarredChanges.createIcon(c.getId(), c.isStarred())); } table.setWidget(row, C_ID, new TableChangeLink(idstr, c)); String s = Util.cropSubject(c.getSubject()); if (c.getStatus() != null && c.getStatus() != Change.Status.NEW) { s += " (" + c.getStatus().name() + ")"; } if (! c.isLatest()) { s += " [OUTDATED]"; table.getRowFormatter().addStyleName(row, Gerrit.RESOURCES.css().outdated()); } else if (Change.Status.ABANDONED.equals(c.getStatus())) { table.getRowFormatter().addStyleName(row, Gerrit.RESOURCES.css().outdated()); } else { table.getRowFormatter().removeStyleName(row, Gerrit.RESOURCES.css().outdated()); } table.setWidget(row, C_SUBJECT, new TableChangeLink(s, c)); table.setWidget(row, C_OWNER, link(c.getOwner())); table.setWidget(row, C_PROJECT, new ProjectLink(c.getProject().getKey(), c .getStatus())); table.setWidget(row, C_BRANCH, new BranchLink(c.getProject().getKey(), c .getStatus(), c.getBranch(), c.getTopic())); table.setText(row, C_LAST_UPDATE, shortFormat(c.getLastUpdatedOn())); setRowItem(row, c); }
Source:
<code>public void testIndexOnFrozenUDT() throws Throwable { String type = createType("CREATE TYPE %s (a int)"); String tableName = createTable("CREATE TABLE %s (k int PRIMARY KEY, v frozen<" + type + ">)"); Object udt1 = userType("a", 1); Object udt2 = userType("a", 2); execute("INSERT INTO %s (k, v) VALUES (?, ?)", 0, udt1); String indexName = createIndex("CREATE INDEX ON %s (v)"); <START> assertTrue(waitForIndex(keyspace(), tableName, indexName)); <END> execute("INSERT INTO %s (k, v) VALUES (?, ?)", 1, udt2); execute("INSERT INTO %s (k, v) VALUES (?, ?)", 1, udt1); assertRows(execute("SELECT * FROM %s WHERE v = ?", udt1), row(1, udt1), row(0, udt1)); assertEmpty(execute("SELECT * FROM %s WHERE v = ?", udt2)); execute("DELETE FROM %s WHERE k = 0"); assertRows(execute("SELECT * FROM %s WHERE v = ?", udt1), row(1, udt1)); dropIndex("DROP INDEX %s." + indexName); assertInvalidMessage(format("Index '%s.%s' doesn't exist", KEYSPACE, indexName), format("DROP INDEX %s.%s", KEYSPACE, indexName)); assertInvalidMessage(StatementRestrictions.REQUIRES_ALLOW_FILTERING_MESSAGE, "SELECT * FROM %s WHERE v = ?", udt1); }</code><technical_language>I this is important change of behaviour in indexes, missing writes done initialization. I this problem solved if add SIM#writableIndexes beginning of registration (before initialization), remove writableIndexes in SIM#markIndexFailed. WDYT</technical_language>

Target:
public void testIndexOnFrozenUDT() throws Throwable { String type = createType("CREATE TYPE %s (a int)"); String tableName = createTable("CREATE TABLE %s (k int PRIMARY KEY, v frozen<" + type + ">)"); Object udt1 = userType("a", 1); Object udt2 = userType("a", 2); execute("INSERT INTO %s (k, v) VALUES (?, ?)", 0, udt1); String indexName = createIndex("CREATE INDEX ON %s (v)"); execute("INSERT INTO %s (k, v) VALUES (?, ?)", 1, udt2); execute("INSERT INTO %s (k, v) VALUES (?, ?)", 1, udt1); assertTrue(waitForIndex(keyspace(), tableName, indexName)); assertRows(execute("SELECT * FROM %s WHERE v = ?", udt1), row(1, udt1), row(0, udt1)); assertEmpty(execute("SELECT * FROM %s WHERE v = ?", udt2)); execute("DELETE FROM %s WHERE k = 0"); assertRows(execute("SELECT * FROM %s WHERE v = ?", udt1), row(1, udt1)); dropIndex("DROP INDEX %s." + indexName); assertInvalidMessage(format("Index '%s.%s' doesn't exist", KEYSPACE, indexName), format("DROP INDEX %s.%s", KEYSPACE, indexName)); assertInvalidMessage(StatementRestrictions.REQUIRES_ALLOW_FILTERING_MESSAGE, "SELECT * FROM %s WHERE v = ?", udt1); }
Source:
<code>public DocIdSet getDocIdSet(LeafReaderContext context, Bits acceptDocs) throws IOException { final LeafReader atomicReader = context.reader(); DocIdSet docs = previousFilter.getDocIdSet( context, acceptDocs ); if ( ( docs == null ) || ( docs.iterator() == null ) ) { return null; } final Bits docsWithLatitude = DocValues.getDocsWithField( atomicReader, getLatitudeField() ); final Bits docsWithLongitude = DocValues.getDocsWithField( atomicReader, getLongitudeField() ); final NumericDocValues latitudeValues = DocValues.getNumeric( atomicReader, getLatitudeField() ); final NumericDocValues longitudeValues = DocValues.getNumeric( atomicReader, getLongitudeField() ); return new FilteredDocIdSet( docs ) { @Override protected boolean match(int documentIndex) { Double lat = coordinate( docsWithLatitude, latitudeValues, documentIndex ); <START> Double lon = coordinate( docsWithLongitude, longitudeValues, documentIndex ); <END> if ( center.getDistanceTo( lat, lon ) <= radius ) { return true; } else { return false; } } }; }</code><technical_language>in Collector, I need primitives for lat/lon value, do checking in advance for fields exist in Bits instance. If not, eagerly return false</technical_language>

Target:
public DocIdSet getDocIdSet(LeafReaderContext context, Bits acceptDocs) throws IOException { final LeafReader atomicReader = context.reader(); DocIdSet docs = previousFilter.getDocIdSet( context, acceptDocs ); if ( ( docs == null ) || ( docs.iterator() == null ) ) { return null; } final Bits docsWithLatitude = DocValues.getDocsWithField( atomicReader, getLatitudeField() ); final Bits docsWithLongitude = DocValues.getDocsWithField( atomicReader, getLongitudeField() ); final NumericDocValues latitudeValues = DocValues.getNumeric( atomicReader, getLatitudeField() ); final NumericDocValues longitudeValues = DocValues.getNumeric( atomicReader, getLongitudeField() ); return new FilteredDocIdSet( docs ) { @Override protected boolean match(int documentIndex) { if ( docsWithLatitude.get( documentIndex ) && docsWithLongitude.get( documentIndex ) ) { double lat = coordinate( latitudeValues, documentIndex ); double lon = coordinate( longitudeValues, documentIndex ); if ( center.getDistanceTo( lat, lon ) <= radius ) { return true; } } return false; } }; }
Source:
<code>public RegexParser( final String pattern, <START> final Optional<String> listDelimiter <END> ) { this.pattern = pattern; this.listDelimiter = listDelimiter.isPresent() ? listDelimiter.get() : Parsers.DEFAULT_LIST_DELIMITER; this.listSplitter = Splitter.on(this.listDelimiter); this.valueFunction = new Function<String, Object>() { @Override public Object apply(String input) { if (input.contains(RegexParser.this.listDelimiter)) { return Lists.newArrayList( Iterables.transform( listSplitter.split(input), ParserUtils.nullEmptyStringFunction ) ); } else { return ParserUtils.nullEmptyStringFunction.apply(input); } } }; this.compiled = Pattern.compile(pattern); }</code><technical_language>making delimiter a regex well</technical_language>

Target:
public RegexParser( final String pattern, final Optional<String> listDelimiter ) { this.pattern = pattern; this.listSplitter = Splitter.onPattern(listDelimiter.isPresent() ? listDelimiter.get() : Parsers.DEFAULT_LIST_DELIMITER); this.valueFunction = new Function<String, Object>() { @Override public Object apply(String input) { final List retVal = Lists.newArrayList( Iterables.transform( listSplitter.split(input), ParserUtils.nullEmptyStringFunction ) ); if (retVal.size() == 1) { return retVal.get(0); } else { return retVal; } } }; this.compiled = Pattern.compile(pattern); }
Source:
<code>public NettyClientRouter(@Nonnull NodeLocator node, @Nonnull EventLoopGroup eventLoopGroup, @Nonnull CorfuRuntimeParameters parameters) { this.node = node; this.parameters = parameters; ImmutableMap.Builder<CorfuMsgType, String> mapBuilder = ImmutableMap.builder(); for (CorfuMsgType type : CorfuMsgType.values()) { <START> String router = CorfuComponent.CLIENT_ROUTER.toString() + type.name().toLowerCase(); <END> mapBuilder.put(type, router); } timerNameCache = mapBuilder.build(); timeoutConnect = parameters.getConnectionTimeout().toMillis(); timeoutResponse = parameters.getRequestTimeout().toMillis(); timeoutRetry = parameters.getConnectionRetryRate().toMillis(); connectionFuture = new CompletableFuture<>(); handlerMap = new ConcurrentHashMap<>(); clientList = new ArrayList<>(); requestID = new AtomicLong(); outstandingRequests = new ConcurrentHashMap<>(); shutdown = true; if (parameters.isTlsEnabled()) { try { sslContext = SslContextConstructor.constructSslContext(false, parameters.getKeyStore(), parameters.getKsPasswordFile(), parameters.getTrustStore(), parameters.getTsPasswordFile()); } catch (SSLException e) { throw new UnrecoverableCorfuError(e); } } addClient(new BaseHandler()); shutdown = false; Bootstrap b = new Bootstrap(); b.group(eventLoopGroup); b.channel(parameters.getSocketType().getChannelClass()); parameters.getNettyChannelOptions().forEach(b::option); b.handler(getChannelInitializer()); b.option(ChannelOption.CONNECT_TIMEOUT_MILLIS, (int) timeoutConnect); connectAsync(b); }</code><technical_language>router a good name. timer</technical_language>

Target:
public NettyClientRouter(@Nonnull NodeLocator node, @Nonnull EventLoopGroup eventLoopGroup, @Nonnull CorfuRuntimeParameters parameters) { this.node = node; this.parameters = parameters; ImmutableMap.Builder<CorfuMsgType, String> timerBuilder = ImmutableMap.builder(); for (CorfuMsgType type : CorfuMsgType.values()) { String timerName = CorfuComponent.CLIENT_ROUTER.toString() + type.name().toLowerCase(); timerBuilder.put(type, timerName); } timerNameCache = timerBuilder.build(); timeoutConnect = parameters.getConnectionTimeout().toMillis(); timeoutResponse = parameters.getRequestTimeout().toMillis(); timeoutRetry = parameters.getConnectionRetryRate().toMillis(); connectionFuture = new CompletableFuture<>(); handlerMap = new ConcurrentHashMap<>(); clientList = new ArrayList<>(); requestID = new AtomicLong(); outstandingRequests = new ConcurrentHashMap<>(); shutdown = true; if (parameters.isTlsEnabled()) { try { sslContext = SslContextConstructor.constructSslContext(false, parameters.getKeyStore(), parameters.getKsPasswordFile(), parameters.getTrustStore(), parameters.getTsPasswordFile()); } catch (SSLException e) { throw new UnrecoverableCorfuError(e); } } addClient(new BaseHandler()); shutdown = false; Bootstrap b = new Bootstrap(); b.group(eventLoopGroup); b.channel(parameters.getSocketType().getChannelClass()); parameters.getNettyChannelOptions().forEach(b::option); b.handler(getChannelInitializer()); b.option(ChannelOption.CONNECT_TIMEOUT_MILLIS, (int) timeoutConnect); connectAsync(b); }
Source:
<code>public static void addSegment( Iterator<StorageLocation> cyclicIterator, int numLocations, String supervisorTaskId, String subTaskId, DataSegment segment, File segmentFile ) { for (int i = 0; i < numLocations; i++) { final StorageLocation location = cyclicIterator.next(); final File destFile = location.reserve( getPartitionFilePath( supervisorTaskId, subTaskId, segment.getInterval(), segment.getShardSpec().getPartitionNum() ), segment.getId(), segmentFile.length() ); if (destFile != null) { try { FileUtils.forceMkdirParent(destFile); final long copiedBytes = Files.asByteSource(segmentFile).copyTo(Files.asByteSink(destFile)); if (copiedBytes == 0) { throw new IOE( "0 bytes copied after copying a segment file from [%s] to [%s]", segmentFile.getAbsolutePath(), destFile.getAbsolutePath() ); } else { return; } } <START> catch (Exception e) { <END> log.warn(e, "Failed to write segmentFile at [%s]", destFile); location.removeFile(segmentFile); } } } throw new ISE("Can't find location to handle segment[%s]", segment); }</code><technical_language>catch narrower exception type</technical_language>

Target:
public static void addSegment( Iterator<StorageLocation> cyclicIterator, int numLocations, String supervisorTaskId, String subTaskId, DataSegment segment, File segmentFile ) { for (int i = 0; i < numLocations; i++) { final StorageLocation location = cyclicIterator.next(); final File destFile = location.reserve( getPartitionFilePath( supervisorTaskId, subTaskId, segment.getInterval(), segment.getShardSpec().getPartitionNum() ), segment.getId(), segmentFile.length() ); if (destFile != null) { try { FileUtils.forceMkdirParent(destFile); final long copiedBytes = Files.asByteSource(segmentFile).copyTo(Files.asByteSink(destFile)); if (copiedBytes == 0) { throw new IOE( "0 bytes copied after copying a segment file from [%s] to [%s]", segmentFile.getAbsolutePath(), destFile.getAbsolutePath() ); } else { return; } } catch (IOException e) { log.warn(e, "Failed to write segmentFile at [%s]", destFile); location.removeFile(segmentFile); } } } throw new ISE("Can't find location to handle segment[%s]", segment); }
Source:
<code>public void should_pass_if_there_is_only_one_consumer_and_can_be_satisfied() { <START> Consumer<String> consumer = s -> { assertThat(s.length()).isEqualTo(4); }; <END> iterables.assertSatisfy(info, actual, consumer); }</code><technical_language>If a consumer contains a single assertion statement, shorthand notion brackets? (Applies other unit tests well.) suggestion Consumer<String> consumer = s -> assertThat(s.length()).isEqualTo(4);</technical_language>

Target:
public void should_pass_if_there_is_only_one_consumer_and_can_be_satisfied() { Consumer<String> consumer = s -> assertThat(s).hasSize(4); iterables.assertSatisfy(info, actual, consumer); }
Source:
<code>public List<T> peek(final int max) { try { final List<T> entries = new ArrayList<T>(max); queueFile.forEach(new QueueFile.ElementVisitor() { int count; @Override public boolean read(InputStream in, int length) throws IOException { <START> final int fileLength = queueFile.fileLength - QueueFile.HEADER_LENGTH; <END> if (length > fileLength || length > queueFile.maxElementSize) { final int debugSize = Math.min(fileLength, Math.min(LARGE_ELEMENT_PREVIEW_SIZE, length)); byte[] debugBytes = new byte[debugSize]; final int readSize = in.read(debugBytes, 0, debugSize); throw new CorruptionException("Possible corruption: Trying to read a Tape element " + "claiming length: " + length + ", which is either a) larger than the current file " + "length of: " + fileLength + ", or larger than the max Tape element size of: " + queueFile.maxElementSize + ". The first " + readSize + " bytes of the element are: " + new String(debugBytes, StandardCharsets.UTF_8)); } byte[] data = new byte[length]; in.read(data, 0, length); entries.add(converter.from(data)); return ++count < max; } }); return unmodifiableList(entries); } catch (IOException e) { throw new FileException("Failed to peek.", e, file); } }</code><technical_language>Code style: local vars final. Name: fileContentLength</technical_language>

Target:
public List<T> peek(final int max) { try { final List<T> entries = new ArrayList<T>(max); queueFile.forEach(new QueueFile.ElementVisitor() { int count; @Override public boolean read(InputStream in, int length) throws IOException { byte[] data = new byte[length]; in.read(data, 0, length); entries.add(converter.from(data)); return ++count < max; } }); return unmodifiableList(entries); } catch (IOException e) { throw new FileException("Failed to peek.", e, file); } }
Source:
<code>private void fillProcMetaData(String procName, Connection con, StoredProcedureMetaData procMetaData) throws SQLException { SimpleJdbcCall call = handler.getCall(procName, handler.createCallForModification(procName)); Map<String, SqlCallParameter> paramOrder = new HashMap<String, SqlCallParameter>(); ResultSet rs2 = con.getMetaData().getProcedureColumns(null, null, call.getProcedureName().toLowerCase(), "%"); StringBuilder params = new StringBuilder(); String procNameFromDB = null; String procSchemaFromDB = null; int internalCounter = 1; try { while (rs2.next()) { ProcData procData = fillProcData(rs2, internalCounter); if (procData != null) { ++internalCounter; paramOrder.put(procData.getColName(), new SqlCallParameter( procData.getOrdinal(), procData.getColName(), procData.getDataType())); procNameFromDB = procData.getProcName(); procSchemaFromDB = procData.getSchemaName(); params.append("CAST (? AS ").append(procData.getDbTypeName()) .append("),"); } } if (params.length() > 0) { params.deleteCharAt(params.length() - 1); } } catch (SQLException e) { log.fatalFormat("Can't get procedure %s meta data", procName); log.fatal(e.getMessage(), e); <START> } finally { <END> rs2.close(); } procMetaData.setSqlCommand(handler.getDialect().createSqlCallCommand( procSchemaFromDB, procNameFromDB, params.toString())); procMetaData.setDbName(procNameFromDB); procMetaData.setParamatersMetaData(paramOrder); procMetaData.setSchemaName(procSchemaFromDB); }</code><technical_language>java 7 syntax here, close resource</technical_language>

Target:
private void fillProcMetaData(String procName, Connection con, StoredProcedureMetaData procMetaData) throws SQLException { SimpleJdbcCall call = handler.getCall(procName, handler.createCallForModification(procName)); Map<String, SqlCallParameter> paramOrder = new HashMap<>(); String procNameFromDB = null; String procSchemaFromDB = null; StringBuilder params = new StringBuilder(); try (ResultSet rs2 = con.getMetaData().getProcedureColumns(null, null, call.getProcedureName().toLowerCase(), "%")) { int internalCounter = 1; while (rs2.next()) { ProcData procData = fillProcData(rs2, internalCounter); if (procData != null) { ++internalCounter; paramOrder.put(procData.getColName(), new SqlCallParameter( procData.getOrdinal(), procData.getColName(), procData.getDataType())); procNameFromDB = procData.getProcName(); procSchemaFromDB = procData.getSchemaName(); params.append("CAST (? AS ").append(procData.getDbTypeName()) .append("),"); } } if (params.length() > 0) { params.deleteCharAt(params.length() - 1); } } catch (SQLException e) { log.fatalFormat("Can't get procedure %s meta data", procName); log.fatal(e.getMessage(), e); } procMetaData.setSqlCommand(handler.getDialect().createSqlCallCommand( procSchemaFromDB, procNameFromDB, params.toString())); procMetaData.setDbName(procNameFromDB); procMetaData.setParamatersMetaData(paramOrder); procMetaData.setSchemaName(procSchemaFromDB); }
Source:
<code>private void setRelatedIndexes(String str) { Matcher matcher = RELINDEXPATTERN.matcher(str); if(matcher.matches()) { StringTokenizer indexeToks = new StringTokenizer(matcher.group(1), ";"); while (indexeToks.hasMoreTokens()) { addRelatedIndex(indexeToks.nextToken().trim()); } } else <START> HPCCJDBCUtils.traceoutln(TraceLevel.ERROR, "Could not determine releated index for file: " + this.getFullyQualifiedName()); <END> }</code><technical_language>Egregious of creative spelling</technical_language>

Target:
private void setRelatedIndexes(String str) { Matcher matcher = RELINDEXPATTERN.matcher(str); if(matcher.matches()) { StringTokenizer indexeToks = new StringTokenizer(matcher.group(1), ";"); while (indexeToks.hasMoreTokens()) { addRelatedIndex(indexeToks.nextToken().trim()); } } else HPCCJDBCUtils.traceoutln(Level.SEVERE, "Could not determine related index for file: " + this.getFullyQualifiedName()); }
Source:
<code>public SshKeyCacheEntryIterable createEntry(Account.Username username) throws Exception { final ReviewDb db = schema.open(); try { final AccountExternalId.Key key = new AccountExternalId.Key(SCHEME_USERNAME, username.get()); final AccountExternalId user = db.accountExternalIds().get(key); if (user == null) { return NO_SUCH_USER; } final List<SshKeyCacheEntry> kl = new ArrayList<SshKeyCacheEntry>(4); for (AccountSshKey k : db.accountSshKeys().byAccount( user.getAccountId())) { if (k.isValid()) { add(db, kl, k); } } if (kl.isEmpty()) { <START> return NO_KEYS; <END> } return new SshKeyCacheEntryIterable(Collections.unmodifiableList(kl)); } finally { db.close(); } }</code><technical_language>magical values (NO_KEYS, NO_SUCH_USER) trouble. empty list stored in cache serialize out way, deserialize empty list. need add a field SshKeyCacheEntryIterable type of entry is, get rid of magical constants NO_KEYS, NO_SUCH_USER field magical type is</technical_language>

Target:
public SshKeyCacheEntryCollection createEntry(Account.Username username) throws Exception { final ReviewDb db = schema.open(); try { final AccountExternalId.Key key = new AccountExternalId.Key(SCHEME_USERNAME, username.get()); final AccountExternalId user = db.accountExternalIds().get(key); if (user == null) { return new SshKeyCacheEntryCollection( SshKeyCacheEntryCollection.Type.NO_SUCH_USER); } final List<SshKeyCacheEntry> kl = new ArrayList<SshKeyCacheEntry>(4); for (AccountSshKey k : db.accountSshKeys().byAccount( user.getAccountId())) { if (k.isValid()) { add(db, kl, k); } } if (kl.isEmpty()) { return new SshKeyCacheEntryCollection( SshKeyCacheEntryCollection.Type.NO_KEYS); } return new SshKeyCacheEntryCollection(Collections.unmodifiableList(kl)); } finally { db.close(); } }
Source:
<code>protected void reconcileOptionsWithGuards() { if (options.enables(DiagnosticGroups.CHECK_TYPES)) { options.checkTypes = true; } else if (options.disables(DiagnosticGroups.CHECK_TYPES)) { options.checkTypes = false; } else if (!options.checkTypes) { options.setWarningLevel( DiagnosticGroup.forType( RhinoErrorReporter.TYPE_PARSE_ERROR), CheckLevel.OFF); } if (options.getNewTypeInference()) { options.checkTypes = true; <START> if (!options.reportOldTypeInferenceErrorsUnderNTI) { <END> options.setWarningLevel(DiagnosticGroups.OLD_CHECK_TYPES, CheckLevel.OFF); } options.setWarningLevel( DiagnosticGroup.forType(RhinoErrorReporter.TYPE_PARSE_ERROR), CheckLevel.WARNING); } if (options.checkGlobalThisLevel.isOn() && !options.disables(DiagnosticGroups.GLOBAL_THIS)) { options.setWarningLevel( DiagnosticGroups.GLOBAL_THIS, options.checkGlobalThisLevel); } if (options.getLanguageIn().isStrict()) { options.setWarningLevel( DiagnosticGroups.ES5_STRICT, CheckLevel.ERROR); } if (!options.checkSymbols && !options.enables(DiagnosticGroups.CHECK_VARIABLES)) { options.setWarningLevel( DiagnosticGroups.CHECK_VARIABLES, CheckLevel.OFF); } }</code><technical_language>reportOtiErrorsUnderNti</technical_language>

Target:
protected void reconcileOptionsWithGuards() { if (options.enables(DiagnosticGroups.CHECK_TYPES)) { options.checkTypes = true; } else if (options.disables(DiagnosticGroups.CHECK_TYPES)) { options.checkTypes = false; } else if (!options.checkTypes) { options.setWarningLevel( DiagnosticGroup.forType( RhinoErrorReporter.TYPE_PARSE_ERROR), CheckLevel.OFF); } if (options.getNewTypeInference()) { options.checkTypes = true; if (!options.reportOTIErrorsUnderNTI) { options.setWarningLevel(DiagnosticGroups.OLD_CHECK_TYPES, CheckLevel.OFF); } options.setWarningLevel( DiagnosticGroup.forType(RhinoErrorReporter.TYPE_PARSE_ERROR), CheckLevel.WARNING); } if (options.checkGlobalThisLevel.isOn() && !options.disables(DiagnosticGroups.GLOBAL_THIS)) { options.setWarningLevel( DiagnosticGroups.GLOBAL_THIS, options.checkGlobalThisLevel); } if (options.getLanguageIn().isStrict()) { options.setWarningLevel( DiagnosticGroups.ES5_STRICT, CheckLevel.ERROR); } if (!options.checkSymbols && !options.enables(DiagnosticGroups.CHECK_VARIABLES)) { options.setWarningLevel( DiagnosticGroups.CHECK_VARIABLES, CheckLevel.OFF); } }
Source:
<code>public void onDutyCycleRatioUpdate(int dutyCycleRatio) { ThingHandlerCallback callback = getCallback(); if (callback == null) { logger.debug( "Duty Cycle ratio update is skipped for the homematic bridge '{}' because the handler is not initialized yet.", thing.getBridgeUID().getId()); return; } synchronized (dutyCycleRatioUpdateLock) { <START> final int dutyCycleRatioLimit = 99; <END> callback.stateUpdated(thing.getChannel(CHANNEL_TYPE_DUTY_CYCLE_RATIO).getUID(), new DecimalType(dutyCycleRatio)); if (!isInDutyCycle && dutyCycleRatio >= dutyCycleRatioLimit) { logger.info("Duty cycle threshold exceeded by homematic bridge {}, it will go OFFLINE.", thing.getBridgeUID().getId()); isInDutyCycle = true; this.updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.DUTY_CYCLE); } else if (isInDutyCycle && dutyCycleRatio < dutyCycleRatioLimit) { logger.info("Homematic bridge fell below duty cycle threshold and will come ONLINE again.", thing.getBridgeUID().getId()); isInDutyCycle = false; this.updateStatus(ThingStatus.ONLINE); } } }</code><technical_language>this a constant class-level</technical_language>

Target:
public void onDutyCycleRatioUpdate(int dutyCycleRatio) { ThingHandlerCallback callback = getCallback(); if (callback == null) { logger.debug( "Duty Cycle ratio update is skipped for the homematic bridge '{}' because the handler is not initialized yet.", thing.getUID()); return; } synchronized (dutyCycleRatioUpdateLock) { callback.stateUpdated(thing.getChannel(CHANNEL_TYPE_DUTY_CYCLE_RATIO).getUID(), new DecimalType(dutyCycleRatio)); if (!isInDutyCycle && dutyCycleRatio >= DUTY_CYCLE_RATIO_LIMIT) { logger.info("Duty cycle threshold exceeded by homematic bridge {}, it will go OFFLINE.", thing.getUID()); isInDutyCycle = true; this.updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.DUTY_CYCLE); } else if (isInDutyCycle && dutyCycleRatio < DUTY_CYCLE_RATIO_LIMIT) { logger.info("Homematic bridge fell below duty cycle threshold and will come ONLINE again.", thing.getUID()); isInDutyCycle = false; this.updateStatus(ThingStatus.ONLINE); } } }
Source:
<code><START> public List<PatchLineComment> comments(Provider<ReviewDb> db) <END> throws OrmException { if (comments == null) { comments = db.get().patchComments().byChange(legacyId).toList(); } return comments; }</code><technical_language>Wrong place. :) unordered retrieval. Try line 216</technical_language>

Target:
public Collection<PatchLineComment> comments(Provider<ReviewDb> db) throws OrmException { if (comments == null) { comments = db.get().patchComments().byChange(legacyId).toList(); } return comments; }
Source:
<code>private static List<String> unTgz(File tarFile, File directory) throws IOException { List<String> result = new ArrayList<>(); try (TarArchiveInputStream in = new TarArchiveInputStream( new GzipCompressorInputStream(new FileInputStream(tarFile)))) { TarArchiveEntry entry = in.getNextTarEntry(); while (entry != null) { if (entry.isDirectory()) { entry = in.getNextTarEntry(); continue; } File curfile = new File(directory, entry.getName()); File parent = curfile.getParentFile(); if (!parent.exists()) { parent.mkdirs(); } OutputStream out = new FileOutputStream(curfile); IOUtils.copy(in, out); <START> out.close(); <END> result.add(entry.getName()); entry = in.getNextTarEntry(); } } return result; }</code><technical_language>@necosta handle try-with-resource well</technical_language>

Target:
private static List<String> unTgz(File tarFile, File directory) throws IOException { List<String> result = new ArrayList<>(); try (TarArchiveInputStream in = new TarArchiveInputStream( new GzipCompressorInputStream(new FileInputStream(tarFile)))) { TarArchiveEntry entry = in.getNextTarEntry(); while (entry != null) { if (entry.isDirectory()) { entry = in.getNextTarEntry(); continue; } File curfile = new File(directory, entry.getName()); File parent = curfile.getParentFile(); if (!parent.exists()) { parent.mkdirs(); } try (OutputStream out = new FileOutputStream(curfile)) { IOUtils.copy(in, out); } result.add(entry.getName()); entry = in.getNextTarEntry(); } } return result; }
Source:
<code>private void check() throws Exception { startGrids(NODES_COUNT); grid(0).cluster().active(true); grid(0).createCache(DEFAULT_CACHE_NAME); runSql("CREATE TABLE PUBLIC.FOO (A INT, B INT, C INT PRIMARY KEY) WITH \"CACHE_NAME=FOO\""); List<String> createIndexQueries = Arrays.asList( "CREATE INDEX ON PUBLIC.FOO (a)", "CREATE INDEX ON PUBLIC.FOO (b)", "CREATE INDEX ON PUBLIC.FOO (c)", "CREATE INDEX \"idx\" ON PUBLIC.FOO (a)", "CREATE INDEX \"IDX\" ON PUBLIC.FOO (a)", "CREATE INDEX \"iDx\" ON PUBLIC.FOO (a)", "CREATE INDEX \"\" ON PUBLIC.FOO (a)", "CREATE INDEX \" \" ON PUBLIC.FOO (a)" ); for (String sql : createIndexQueries) runSql(sql); List<String> expIndexNames = Arrays.asList( "foo_a_asc_idx", "foo_b_asc_idx", "foo_c_asc_idx", "idx", "IDX", "iDx", "", " " ); Collections.sort(expIndexNames); checkIndexes(expIndexNames); for (String sql : createIndexQueries) { GridTestUtils.assertThrows( log, () -> { runSql(sql); return null; }, useJdbc ? SQLException.class : IgniteSQLException.class, <START> "Index already exists" <END> ); } checkIndexes(expIndexNames); stopAllGrids(); startGrids(NODES_COUNT); checkIndexes(expIndexNames); }</code><technical_language>add error code check here? E.g. IgniteQueryErrorCode.INDEX_ALREADY_EXISTS</technical_language>

Target:
private void check() throws Exception { startGrids(NODES_COUNT); grid(0).cluster().active(true); grid(0).createCache(DEFAULT_CACHE_NAME); runSql("CREATE TABLE PUBLIC.FOO (A INT, B INT, C INT PRIMARY KEY) WITH \"CACHE_NAME=FOO\""); List<String> createIndexQueries = Arrays.asList( "CREATE INDEX ON PUBLIC.FOO (a)", "CREATE INDEX ON PUBLIC.FOO (b)", "CREATE INDEX ON PUBLIC.FOO (c)", "CREATE INDEX \"idx\" ON PUBLIC.FOO (a)", "CREATE INDEX \"IDX\" ON PUBLIC.FOO (a)", "CREATE INDEX \"iDx\" ON PUBLIC.FOO (a)", "CREATE INDEX \"\" ON PUBLIC.FOO (a)", "CREATE INDEX \" \" ON PUBLIC.FOO (a)" ); for (String sql : createIndexQueries) runSql(sql); List<String> expIndexNames = Arrays.asList( "foo_a_asc_idx", "foo_b_asc_idx", "foo_c_asc_idx", "idx", "IDX", "iDx", "", " " ); Collections.sort(expIndexNames); checkIndexes(expIndexNames); for (String sql : createIndexQueries) { Throwable e = GridTestUtils.assertThrows( log, () -> { runSql(sql); return null; }, useJdbc ? SQLException.class : IgniteSQLException.class, "Index already exists" ); int errorCode = useJdbc ? ((SQLException)e).getErrorCode() : ((IgniteSQLException)e).statusCode(); assertEquals(IgniteQueryErrorCode.INDEX_ALREADY_EXISTS, errorCode); } checkIndexes(expIndexNames); stopAllGrids(); startGrids(NODES_COUNT); checkIndexes(expIndexNames); }
Source:
<code>private PsiDirectory getViewsDirectory(Project project, PsiFile psiFile) { String basePath = project.getBasePath(); PsiDirectory directory = psiFile.getContainingDirectory(); while(directory != null && !directory.getVirtualFile().getPath().equals(basePath)) { <START> if(directory.getName().equals("views") || directory.getName().equals("templates")) { <END> return directory; } if(directory.getParentDirectory() != null) { directory = directory.getParentDirectory(); } else { break; } } for(TemplatePath templatePath : ViewCollector.getPaths(project)) { final VirtualFile templateDir = VfsUtil.findRelativeFile(templatePath.getPath(), project.getBaseDir()); if(templateDir != null) { return PsiManager.getInstance(psiFile.getProject()).findDirectory(templateDir); } } return directory; }</code><technical_language>iterate ViewCollector.getPaths try check if directory is this path. support custom project structures do views template structure</technical_language>

Target:
private TargetViewFolder getViewsDirectory(Project project, PsiFile psiFile) { PsiDirectory firstExistingTemplatePath = null; String firstExistingTemplatePathNamespace = null; for(TemplatePath templatePath : ViewCollector.getPaths(project)) { final VirtualFile templateDir = templatePath.getRelativePath(project); if(templateDir != null) { PsiDirectory psiDirectory = PsiManager.getInstance(project).findDirectory(templateDir); if(psiFile.getVirtualFile().getPath().startsWith(templateDir.getPath() + "/")) { return new TargetViewFolder(psiDirectory, templatePath.getNamespace()); } if(firstExistingTemplatePath == null) { firstExistingTemplatePath = psiDirectory; firstExistingTemplatePathNamespace = templatePath.getNamespace(); } } } if(firstExistingTemplatePath != null) { return new TargetViewFolder(firstExistingTemplatePath, firstExistingTemplatePathNamespace); } return new TargetViewFolder(PsiManager.getInstance(project).findDirectory(project.getBaseDir()), null); }
Source:
<code>public Collection<String> entityInitials() { return <START> ImmutableList.of("Q", "P"); <END> }</code><technical_language>This a constant</technical_language>

Target:
public Collection<String> entityInitials() { return WIKIBASE_INITIALS; }
Source:
<code>private void sortAgenciesWithNoReportsToAgency(List<RassXmlAgencyEntry> agencies, AgenciesSortHelper agencySortHelper) { for (RassXmlAgencyEntry entry : agencies) { if (StringUtils.isBlank(entry.getReportsToAgencyNumber())) { agencySortHelper.agencyNumberInSortedList.add(entry.getNumber()); agencySortHelper.sortedAgencies.add(entry); } else { <START> agencySortHelper.leftOverAgencies.add(entry); <END> } } LOG.debug("sortAgenciesWithNoReportsToAgency, number of angencies without reports to agencies: " + agencySortHelper.sortedAgencies.size()); }</code><technical_language>left agencies in fact unsorted ones? I wondering if is a name for in this list</technical_language>

Target:
private void sortAgenciesWithNoReportsToAgency(List<RassXmlAgencyEntry> agencies, AgenciesSortHelper agencySortHelper) { for (RassXmlAgencyEntry entry : agencies) { if (StringUtils.isBlank(entry.getReportsToAgencyNumber())) { agencySortHelper.agencyNumberInSortedList.add(entry.getNumber()); agencySortHelper.sortedAgencies.add(entry); } else { agencySortHelper.unsortedAgencies.add(entry); } } LOG.debug("sortAgenciesWithNoReportsToAgency, number of angencies without reports to agencies: " + agencySortHelper.sortedAgencies.size()); }
Source:
<code>public HeaderField(String caption) { super(caption); <START> label = new Header(""); <END> }</code><technical_language>setLabel set label instead</technical_language>

Target:
public HeaderField(String caption) { super(caption); super.setLabel(new Header("")); }
Source:
<code>public final void run() { if (running) { return; } if (!Bukkit.isPrimaryThread()) { return; } <START> if (!SlimefunPlugin.isEnabled()) { <END> return; } final ArrayBlockingQueue<Runnable> syncTasks = new ArrayBlockingQueue<>(32); Bukkit.getScheduler().runTaskAsynchronously( SlimefunPlugin.instance(), () -> this.tick(syncTasks) ); processSyncTasks(syncTasks); }</code><technical_language>suggestion if (!SlimefunPlugin.instance().isEnabled()) {</technical_language>

Target:
public final void run() { if (running) { processSyncTasks(); return; } if (!Bukkit.isPrimaryThread()) { return; } new Thread(() -> this.tick(), "Slimefun Async Ticker Thread").start(); processSyncTasks(); }
Source:
<code>public void restoreSnapshot(TeamSnapshot s) { synchronized (coreLock) { if (s.getId() != getId()) { return; } <START> boolean ended = s.getFieldingAdvancePending(); <END> set(Value.FIELDING_ADVANCE_PENDING, ended); updateTeamJams(); if (scoreBoard.isInJam()) { set(Value.CALLOFF, false); set(Value.INJURY, false); } } }</code><technical_language>this once, need for a variable</technical_language>

Target:
public void restoreSnapshot(TeamSnapshot s) { synchronized (coreLock) { if (s.getId() != getId()) { return; } set(Value.FIELDING_ADVANCE_PENDING, s.getFieldingAdvancePending()); updateTeamJams(); if (scoreBoard.isInJam()) { set(Value.CALLOFF, false); set(Value.INJURY, false); } } }
Source:
<code>private void updatePrimaryButtonEnabledStatus() { <START> View view = getView(); if (view != null) { <END> String currentPassword = mPasswordInput.getEditText().getText().toString(); getPrimaryButton().setEnabled(!currentPassword.trim().isEmpty()); } }</code><technical_language>do need check this here</technical_language>

Target:
private void updatePrimaryButtonEnabledStatus() { String currentPassword = mPasswordInput.getEditText().getText().toString(); getPrimaryButton().setEnabled(!currentPassword.trim().isEmpty()); }
Source:
<code>private static boolean isAddressValid(InetAddress addr) { ServerSocket ss; try { ss = new ServerSocket(); ss.setSoTimeout(250); } catch (IOException e) { throw Exceptions.propagate(e); } try { ss.bind(new InetSocketAddress(addr, 0)); return true; } catch (IOException e) { Exceptions.propagateIfFatal(e); if (log.isTraceEnabled()) log.trace("Binding on failed, interface could be down, being reconfigured, file handle exhaustion, port exhaustion, etc.", addr); return false; } finally { try { ss.close(); } catch (IOException e) { <START> Exceptions.propagateIfFatal(e); <END> } } }</code><technical_language>a closeQuietly method</technical_language>

Target:
private static boolean isAddressValid(InetAddress addr) { ServerSocket ss; try { ss = new ServerSocket(); ss.setSoTimeout(250); } catch (IOException e) { throw Exceptions.propagate(e); } try { ss.bind(new InetSocketAddress(addr, 0)); return true; } catch (IOException e) { if (log.isTraceEnabled()) log.trace("Binding on failed, interface could be down, being reconfigured, file handle exhaustion, port exhaustion, etc.", addr); return false; } finally { closeQuietly(ss); } }
Source:
<code>public EventTypeSchema getSchemaVersion(final String name, final String version) throws NoSuchSchemaException, InternalNakadiException { final String sql = "SELECT ets_schema_object FROM zn_data.event_type_schema " + "WHERE ets_event_type_name = ? AND ets_schema_object ->> 'version' = ?"; try { return jdbcTemplate.queryForObject(sql, new Object[]{name, version}, new SchemaRowMapper()); } catch (EmptyResultDataAccessException e) { throw new NoSuchSchemaException("EventType \"" + name <START> + "\" has no schema with version \"" + version + "\"", e); <END> } }</code><technical_language>do need InternalNakadiException line <LINK_0></technical_language>

Target:
public EventTypeSchema getSchemaVersion(final String name, final String version) throws NoSuchSchemaException { final String sql = "SELECT ets_schema_object FROM zn_data.event_type_schema " + "WHERE ets_event_type_name = ? AND ets_schema_object ->> 'version' = ?"; try { return jdbcTemplate.queryForObject(sql, new Object[]{name, version}, new SchemaRowMapper()); } catch (EmptyResultDataAccessException e) { throw new NoSuchSchemaException("EventType \"" + name + "\" has no schema with version \"" + version + "\"", e); } }