auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private static boolean isSubscriptionAvailable(String apiTenant, String subscriptionAvailability, String subscriptionAllowedTenants) { String userDomain = RestApiUtil.getLoggedInUserTenantDomain(); boolean subscriptionAllowed = false; if (!userDomain.equals(apiTenant)) { if (APIConstants.SUBSCRIPTION_TO_ALL_TENANTS.equals(subscriptionAvailability)) { subscriptionAllowed = true; } else if (APIConstants.SUBSCRIPTION_TO_SPECIFIC_TENANTS.equals(subscriptionAvailability)) { String allowedTenants[] = null; if (subscriptionAllowedTenants != null) { allowedTenants = subscriptionAllowedTenants.split(","); if (allowedTenants != null) { for (String tenant : allowedTenants) { if (tenant != null && userDomain.equals(tenant.trim())) { subscriptionAllowed = true; break; } } } } } } else { subscriptionAllowed = true; } return subscriptionAllowed; }

Target:
private static boolean isSubscriptionAvailable(String apiTenant, String subscriptionAvailability, String subscriptionAllowedTenants) { String userTenant = RestApiUtil.getLoggedInUserTenantDomain(); boolean subscriptionAllowed = false; if (!userTenant.equals(apiTenant)) { if (APIConstants.SUBSCRIPTION_TO_ALL_TENANTS.equals(subscriptionAvailability)) { subscriptionAllowed = true; } else if (APIConstants.SUBSCRIPTION_TO_SPECIFIC_TENANTS.equals(subscriptionAvailability)) { String allowedTenants[] = null; if (subscriptionAllowedTenants != null) { allowedTenants = subscriptionAllowedTenants.split(","); if (allowedTenants != null) { for (String tenant : allowedTenants) { if (tenant != null && tenant.trim().equals(userTenant)) { subscriptionAllowed = true; break; } } } } } } else { subscriptionAllowed = true; } return subscriptionAllowed; }
Source:
public void markAllPushTasksScheduled() { countingLock.lock(); try { allScheduled = true; if (finishedPushCount != totalPushCount) { return; } else { if (type == ReplicationType.COMMAND) { allPushTasksFinished.countDown(); } if (totalPushCount == 0) { return; } } } finally { countingLock.unlock(); } pushProcessing.onAllNodesReplicated(); }

Target:
public void markAllPushTasksScheduled() { countingLock.lock(); try { allScheduled = true; if (finishedPushTasksCount < totalPushTasksCount) { return; } } finally { countingLock.unlock(); } doAllPushTasksCompleted(); }
Source:
public void testGetSessionServiceTokens() { prepareLooper(); boolean hasMockBrowserServiceCompat = false; boolean hasMockSessionService2 = false; boolean hasMockLibraryService2 = false; MediaSessionManager sessionManager2 = MediaSessionManager.getInstance(mContext); Set<SessionToken> serviceTokens = sessionManager2.getSessionServiceTokens(); for (SessionToken token2 : serviceTokens) { ComponentName componentName = token2.getComponentName(); if (MOCK_BROWSER_SERVICE_COMPAT_NAME.equals(componentName)) { hasMockBrowserServiceCompat = true; } else if (MOCK_MEDIA_SESSION_SERVICE.equals(componentName)) { hasMockSessionService2 = true; } else if (MOCK_MEDIA_LIBRARY_SERVICE.equals(componentName)) { hasMockLibraryService2 = true; } } assertTrue(hasMockBrowserServiceCompat); assertTrue(hasMockSessionService2); assertTrue(hasMockLibraryService2); }

Target:
public void testGetSessionServiceTokens() { prepareLooper(); boolean hasMockBrowserServiceCompat = false; boolean hasMockSessionService2 = false; boolean hasMockLibraryService2 = false; MediaSessionManager sessionManager = MediaSessionManager.getInstance(mContext); Set<SessionToken> serviceTokens = sessionManager.getSessionServiceTokens(); for (SessionToken token : serviceTokens) { ComponentName componentName = token.getComponentName(); if (MOCK_BROWSER_SERVICE_COMPAT_NAME.equals(componentName)) { hasMockBrowserServiceCompat = true; } else if (MOCK_MEDIA_SESSION_SERVICE.equals(componentName)) { hasMockSessionService2 = true; } else if (MOCK_MEDIA_LIBRARY_SERVICE.equals(componentName)) { hasMockLibraryService2 = true; } } assertTrue(hasMockBrowserServiceCompat); assertTrue(hasMockSessionService2); assertTrue(hasMockLibraryService2); }
Source:
public void onTextChanged(CharSequence s, int start, int before, int count) { int lastCharacterLocation = start + count - 1; if (s.length() > lastCharacterLocation) { if (count > 0) { if (before > 0) { mLastOperation = Operation.REPLACE; mModifiedText = s.subSequence(start, start + count); } else { mLastOperation = Operation.INSERT; mOffset = start; mModifiedText = s.subSequence(start + before, start + count); } } } }

Target:
public void onTextChanged(CharSequence s, int start, int before, int count) { if (s == null) { return; } int lastCharacterLocation = start + count - 1; if (s.length() > lastCharacterLocation) { if (count > 0) { if (before > 0) { mLastOperation = Operation.REPLACE; mModifiedText = s.subSequence(start, start + count); } else { mLastOperation = Operation.INSERT; mOffset = start; mModifiedText = s.subSequence(start + before, start + count); } } } }
Source:
public List<VersionVerifiedPlatform> getVerifiedPlatforms(@Parameter(hidden = true, name = "user")@Auth Optional<User> user, @Parameter(name = "entryId", description = "id of the entry", required = true, in = ParameterIn.PATH) @PathParam("entryId") Long entryId) { Entry<? extends Entry, ? extends Version> entry = toolDAO.getGenericEntryById(entryId); checkEntry(entry); if (!entry.getIsPublished()) { checkUser(user.get(), entry); } List<VersionVerifiedPlatform> verifiedVersions = versionDAO.findEntryVersionsWithVerifiedPlatforms(entryId); return verifiedVersions; }

Target:
public List<VersionVerifiedPlatform> getVerifiedPlatforms(@Parameter(hidden = true, name = "user")@Auth Optional<User> user, @Parameter(name = "entryId", description = "id of the entry", required = true, in = ParameterIn.PATH) @PathParam("entryId") Long entryId) { Entry<? extends Entry, ? extends Version> entry = toolDAO.getGenericEntryById(entryId); checkEntry(entry); checkEntryPermissions(user, entry); List<VersionVerifiedPlatform> verifiedVersions = versionDAO.findEntryVersionsWithVerifiedPlatforms(entryId); return verifiedVersions; }
Source:
public boolean tryExpectCompletion(long timeoutMillis) throws InterruptedException { while (timeoutMillis-- > 0) { Optional<T> value = abq.peek(); if (value != null) { if (!value.isDefined()) { abq.poll(); return true; } return false; } Thread.sleep(1); } return false; }

Target:
public boolean tryExpectCompletion(long timeoutMillis) throws InterruptedException { long end = System.currentTimeMillis() + timeoutMillis; do { Optional<T> value = abq.peek(); if (value != null) { if (!value.isDefined()) { abq.poll(); return true; } return false; } Thread.sleep(1); } while (System.currentTimeMillis() < end); return false; }
Source:
public Collection<FormElementFilter> provideFilters(final String uuid, final Object definition) { final Predicate predicate = o -> isBoundaryEvent(uuid) && isCancelActivityEnabled(uuid); final FormElementFilter isInterruptingFilter = new FormElementFilter("executionSet.cancelActivity", predicate); return Collections.singletonList(isInterruptingFilter); }

Target:
public Collection<FormElementFilter> provideFilters(final String uuid, final Object definition) { Predicate predicate = o -> isBoundaryEvent(uuid); predicate = predicate.and(o -> isCancelActivityEnabled(uuid)); final FormElementFilter isInterruptingFilter = new FormElementFilter("executionSet.cancelActivity", predicate); return Collections.singletonList(isInterruptingFilter); }
Source:
public static Location getLocation(Cluster cluster, ClusterLocationType clusterLocationType) { for (Location loc : cluster.getLocations().getLocations()) { if (loc.getName().value().equals(clusterLocationType.value())) { return loc; } } return null; }

Target:
public static Location getLocation(Cluster cluster, ClusterLocationType clusterLocationType) { for (Location loc : cluster.getLocations().getLocations()) { if (loc.getName().equals(clusterLocationType)) { return loc; } } if (clusterLocationType.equals(ClusterLocationType.WORKING)) { Location staging = getLocation(cluster, ClusterLocationType.STAGING); if (staging != null) { Location working = new Location(); working.setName(ClusterLocationType.WORKING); working.setPath(staging.getPath().charAt(staging.getPath().length() - 1) == '/' ? staging.getPath().concat(WORKINGDIR) : staging.getPath().concat("/").concat(WORKINGDIR)); return working; } } return null; }
Source:
public void verify_toString() { assertThat(Health.GREEN.toString()).isEqualTo("Health{GREEN, causes=[]}"); Health.Builder builder = newHealthCheckBuilder().setStatus(randomStatus); randomCauses.forEach(builder::addCause); String underTest = builder.build().toString(); AbstractCharSequenceAssert<?, String> a = assertThat(underTest) .describedAs("toString for status %s and causes %s", randomStatus, randomCauses); if (randomCauses.isEmpty()) { a.isEqualTo("Health{" + randomStatus + ", causes=[]}"); } else if (randomCauses.size() == 1) { a.isEqualTo("Health{" + randomStatus + ", causes=[" + randomCauses.iterator().next() + "]}"); } else { a.startsWith("Health{" + randomStatus + ", causes=[") .endsWith("]}") .contains(randomCauses); } }

Target:
public void verify_toString() { assertThat(Health.GREEN.toString()).isEqualTo("Health{GREEN, causes=[]}"); Health.Builder builder = newHealthCheckBuilder().setStatus(anyStatus); randomCauses.forEach(builder::addCause); String underTest = builder.build().toString(); AbstractCharSequenceAssert<?, String> a = assertThat(underTest) .describedAs("toString for status %s and causes %s", anyStatus, randomCauses); if (randomCauses.isEmpty()) { a.isEqualTo("Health{" + anyStatus + ", causes=[]}"); } else if (randomCauses.size() == 1) { a.isEqualTo("Health{" + anyStatus + ", causes=[" + randomCauses.iterator().next() + "]}"); } else { a.startsWith("Health{" + anyStatus + ", causes=[") .endsWith("]}") .contains(randomCauses); } }
Source:
LocalJobPlanner getPlanner() { boolean isAppModeBatch = new ApplicationConfig(appDesc.getConfig()).getAppMode() == ApplicationConfig.ApplicationMode.BATCH; if (!isAppModeBatch) { return new LocalJobPlanner(appDesc, PROCESSOR_ID); } CoordinationUtils coordinationUtils = null; 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); }

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:
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) ); container.stop(); }

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:
protected void initConfig() { super.initConfig(); setIconId("\uF002"); setTooltipText("Suche"); }

Target:
protected void initConfig() { super.initConfig(); setIconId("\uF002"); setTooltipText("Search"); }
Source:
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(By.cssSelector("div.msg-title")); if (n != null) { if (title.equals(nTitle.getText())) { notifications.add(n); } } } return notifications; }

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:
private boolean shouldRefresh() { return expiry == null || getClock().currentTimeMillis() / 1000 > expiry; }

Target:
private boolean shouldRefresh() { return expiryInSeconds == null || getClock().currentTimeMillis() / 1000 > expiryInSeconds - CLOCK_SKEW; }
Source:
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); printer.printTaggedValuePointable(System.err, tvp); } }; }

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:
public HashMap<String, String> deleteFacebookTestUser(String userId) { 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); } }

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:
private Consumer<Poller<CertificateOperation>> cancelOperation(String name) { return poller -> { service.updateCertificateOperation(endpoint, name, API_VERSION, ACCEPT_LANGUAGE, new CertificateOperationUpdateParameter().cancellationRequested(true), CONTENT_TYPE_HEADER_VALUE, Context.NONE); }; }

Target:
private Consumer<Poller<CertificateOperation>> cancelOperation(String name) { return poller -> withContext(context -> cancelCertificateOperationWithResponse(name, context)); }
Source:
void setSize(int size) { this.maxSize = size; if (size <= store.size()) { while (store.size() > size) { store.poll(); } } }

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:
public void onComplete() { if (index <= count && !done) { done = true; if (defaultValue != null) { actual.onSuccess(defaultValue); } else { actual.onError(new NoSuchElementException()); } } }

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:
public void testConversion() throws IOException { final StreamObjectPutter putter = new StreamObjectPutter(contentBytes); final InputStream result = putter.buildInputStream("key"); assertThat(result.available(), is(contentBytes.length)); for (byte contentByte : contentBytes) { assertThat(result.read(), is((int) contentByte)); } }

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:
private void parseV2Prefix(Path remoteFilePath) { assert remoteFilePath.getNameCount() >= 3; baseDir = remoteFilePath.getName(0).toString(); clusterName = parseAndValidateAppNameWithHash(remoteFilePath.getName(1).toString()); token = remoteFilePath.getName(2).toString(); }

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:
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())) { s += " [OUTDATED]"; 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); }

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:
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)"); assertTrue(waitForIndex(keyspace(), tableName, indexName)); 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); }

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:
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 ); Double lon = coordinate( docsWithLongitude, longitudeValues, documentIndex ); if ( center.getDistanceTo( lat, lon ) <= radius ) { return true; } else { return false; } } }; }

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:
public RegexParser( final String pattern, final Optional<String> listDelimiter ) { 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); }

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:
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()) { String router = CorfuComponent.CLIENT_ROUTER.toString() + type.name().toLowerCase(); 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); }

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:
public AzkabanExecutorServer(Props props) throws Exception { this.props = props; int portNumber = props.getInt("executor.port", DEFAULT_PORT_NUMBER); int maxThreads = props.getInt("executor.maxThreads", DEFAULT_THREAD_NUMBER); server = new Server(portNumber); QueuedThreadPool httpThreadPool = new QueuedThreadPool(maxThreads); server.setThreadPool(httpThreadPool); boolean isStatsOn = props.getBoolean("executor.connector.stats", Boolean.TRUE); logger.info("Setting up connector with stats on: " + isStatsOn); for (Connector connector : server.getConnectors()) { connector.setStatsOn(isStatsOn); } Context root = new Context(server, "/", Context.SESSIONS); root.setMaxFormContentSize(MAX_FORM_CONTENT_SIZE); root.addServlet(new ServletHolder(new ExecutorServlet()), "/executor"); root.addServlet(new ServletHolder(new JMXHttpServlet()), "/jmx"); root.setAttribute(AzkabanServletContextListener.AZKABAN_SERVLET_CONTEXT_KEY, this); executionLoader = createExecLoader(props); projectLoader = createProjectLoader(props); runnerManager = new FlowRunnerManager(props, executionLoader, projectLoader, this.getClass().getClassLoader()); String globalPropsPath = props.getString("executor.global.properties", null); if (globalPropsPath == null) { executorGlobalProps = new Props(); } else { executorGlobalProps = new Props(null, globalPropsPath); } runnerManager.setGlobalProps(executorGlobalProps); configureMBeanServer(); try { server.start(); } catch (Exception e) { logger.warn(e); Utils.croak(e.getMessage(), 1); } logger.info("Azkaban Executor Server started on port " + portNumber); }

Target:
public AzkabanExecutorServer(Props props) throws Exception { this.props = props; int portNumber = props.getInt("executor.port", DEFAULT_PORT_NUMBER); int maxThreads = props.getInt("executor.maxThreads", DEFAULT_THREAD_NUMBER); server = new Server(portNumber); QueuedThreadPool httpThreadPool = new QueuedThreadPool(maxThreads); server.setThreadPool(httpThreadPool); boolean isStatsOn = props.getBoolean("executor.connector.stats", true); logger.info("Setting up connector with stats on: " + isStatsOn); for (Connector connector : server.getConnectors()) { connector.setStatsOn(isStatsOn); } Context root = new Context(server, "/", Context.SESSIONS); root.setMaxFormContentSize(MAX_FORM_CONTENT_SIZE); root.addServlet(new ServletHolder(new ExecutorServlet()), "/executor"); root.addServlet(new ServletHolder(new JMXHttpServlet()), "/jmx"); root.setAttribute(AzkabanServletContextListener.AZKABAN_SERVLET_CONTEXT_KEY, this); executionLoader = createExecLoader(props); projectLoader = createProjectLoader(props); runnerManager = new FlowRunnerManager(props, executionLoader, projectLoader, this.getClass().getClassLoader()); String globalPropsPath = props.getString("executor.global.properties", null); if (globalPropsPath == null) { executorGlobalProps = new Props(); } else { executorGlobalProps = new Props(null, globalPropsPath); } runnerManager.setGlobalProps(executorGlobalProps); configureMBeanServer(); try { server.start(); } catch (Exception e) { logger.warn(e); Utils.croak(e.getMessage(), 1); } logger.info("Azkaban Executor Server started on port " + portNumber); }
Source:
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 (Exception 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); }

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:
public void should_pass_if_there_is_only_one_consumer_and_can_be_satisfied() { Consumer<String> consumer = s -> { assertThat(s.length()).isEqualTo(4); }; iterables.assertSatisfy(info, actual, consumer); }

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:
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 { final int fileLength = queueFile.fileLength - QueueFile.HEADER_LENGTH; 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); } }

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:
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); } finally { rs2.close(); } procMetaData.setSqlCommand(handler.getDialect().createSqlCallCommand( procSchemaFromDB, procNameFromDB, params.toString())); procMetaData.setDbName(procNameFromDB); procMetaData.setParamatersMetaData(paramOrder); procMetaData.setSchemaName(procSchemaFromDB); }

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:
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(TraceLevel.ERROR, "Could not determine releated index for file: " + this.getFullyQualifiedName()); }

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:
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()) { return NO_KEYS; } return new SshKeyCacheEntryIterable(Collections.unmodifiableList(kl)); } finally { db.close(); } }

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:
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.reportOldTypeInferenceErrorsUnderNTI) { 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); } }

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:
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) { final int dutyCycleRatioLimit = 99; 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); } } }

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:
public List<PatchLineComment> comments(Provider<ReviewDb> db) throws OrmException { if (comments == null) { comments = db.get().patchComments().byChange(legacyId).toList(); } return comments; }

Target:
public Collection<PatchLineComment> comments(Provider<ReviewDb> db) throws OrmException { if (comments == null) { comments = db.get().patchComments().byChange(legacyId).toList(); } return comments; }
Source:
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); out.close(); result.add(entry.getName()); entry = in.getNextTarEntry(); } } return result; }

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; }