auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void serialize(CloudBlobMetadata value, JsonGenerator gen, SerializerProvider provider) throws IOException { gen.writeStartObject(); gen.writeStringField(FIELD_ID, value.id); gen.writeStringField(FIELD_PARTITION_ID, value.partitionId); gen.writeNumberField(FIELD_ACCOUNT_ID, value.accountId); gen.writeNumberField(FIELD_CONTAINER_ID, value.containerId); gen.writeNumberField(FIELD_SIZE, value.size); if (value.creationTime > 0) { gen.writeNumberField(FIELD_CREATION_TIME, value.creationTime); } if (value.uploadTime > 0) { gen.writeNumberField(FIELD_UPLOAD_TIME, value.uploadTime); } if (value.deletionTime > 0) { gen.writeNumberField(FIELD_DELETION_TIME, value.deletionTime); } if (value.expirationTime > 0) { gen.writeNumberField(FIELD_EXPIRATION_TIME, value.expirationTime); } if (value.namingScheme > 0) { gen.writeNumberField(FIELD_NAMING_SCHEME, value.namingScheme); } if (value.encryptionOrigin == EncryptionOrigin.VCR) { <START> gen.writeStringField(FIELD_ENCRYPTION_ORIGIN, value.encryptionOrigin.toString()); <END> gen.writeStringField(FIELD_VCR_KMS_CONTEXT, value.vcrKmsContext); gen.writeStringField(FIELD_CRYPTO_AGENT_FACTORY, value.cryptoAgentFactory); gen.writeNumberField(FIELD_ENCRYPTED_SIZE, value.encryptedSize); } gen.writeEndObject(); }</code><technical_language>I if is reason set FIELD_ENCRYPTION_ORIGIN if is EncryptionOrigin.ROUTER? I of need other able write analytics queries count # of encrypted blobs</technical_language>

Target:
public void serialize(CloudBlobMetadata value, JsonGenerator gen, SerializerProvider provider) throws IOException { gen.writeStartObject(); gen.writeStringField(FIELD_ID, value.id); gen.writeStringField(FIELD_PARTITION_ID, value.partitionId); gen.writeNumberField(FIELD_ACCOUNT_ID, value.accountId); gen.writeNumberField(FIELD_CONTAINER_ID, value.containerId); gen.writeNumberField(FIELD_SIZE, value.size); if (value.creationTime > 0) { gen.writeNumberField(FIELD_CREATION_TIME, value.creationTime); } if (value.uploadTime > 0) { gen.writeNumberField(FIELD_UPLOAD_TIME, value.uploadTime); } if (value.deletionTime > 0) { gen.writeNumberField(FIELD_DELETION_TIME, value.deletionTime); } if (value.expirationTime > 0) { gen.writeNumberField(FIELD_EXPIRATION_TIME, value.expirationTime); } if (value.nameSchemeVersion > 0) { gen.writeNumberField(FIELD_NAME_SCHEME_VERSION, value.nameSchemeVersion); } if (value.encryptionOrigin != EncryptionOrigin.NONE) { gen.writeStringField(FIELD_ENCRYPTION_ORIGIN, value.encryptionOrigin.toString()); if (value.encryptionOrigin == EncryptionOrigin.VCR) { gen.writeStringField(FIELD_ENCRYPTION_ORIGIN, value.encryptionOrigin.toString()); gen.writeStringField(FIELD_VCR_KMS_CONTEXT, value.vcrKmsContext); gen.writeStringField(FIELD_CRYPTO_AGENT_FACTORY, value.cryptoAgentFactory); gen.writeNumberField(FIELD_ENCRYPTED_SIZE, value.encryptedSize); } } gen.writeEndObject(); }
Source:
<code><START> private okhttp3.Request createRequest(Request request, int networkPolicy) { <END> CacheControl cacheControl = null; if (networkPolicy != 0) { if (NetworkPolicy.isOfflineOnly(networkPolicy)) { cacheControl = CacheControl.FORCE_CACHE; } else { CacheControl.Builder builder = new CacheControl.Builder(); if (!NetworkPolicy.shouldReadFromDiskCache(networkPolicy)) { builder.noCache(); } if (!NetworkPolicy.shouldWriteToDiskCache(networkPolicy)) { builder.noStore(); } cacheControl = builder.build(); } } okhttp3.Request.Builder builder = new okhttp3.Request.Builder().url(request.uri.toString()); if (cacheControl != null) { builder.cacheControl(cacheControl); } return builder.build(); }</code><technical_language>static</technical_language>

Target:
private static okhttp3.Request createRequest(Request request, int networkPolicy) { CacheControl cacheControl = null; if (networkPolicy != 0) { if (NetworkPolicy.isOfflineOnly(networkPolicy)) { cacheControl = CacheControl.FORCE_CACHE; } else { CacheControl.Builder builder = new CacheControl.Builder(); if (!NetworkPolicy.shouldReadFromDiskCache(networkPolicy)) { builder.noCache(); } if (!NetworkPolicy.shouldWriteToDiskCache(networkPolicy)) { builder.noStore(); } cacheControl = builder.build(); } } okhttp3.Request.Builder builder = new okhttp3.Request.Builder().url(request.uri.toString()); if (cacheControl != null) { builder.cacheControl(cacheControl); } return builder.build(); }
Source:
<code>private final int[] decodeInts(final String string) { final int nValues = ParsingUtils.split(string, INT_DECODE_VECTOR, ','); final int[] values = new int[nValues]; try { for ( int i = 0; i < nValues; i++ ) <START> values[i] = Integer.valueOf(INT_DECODE_VECTOR.elementAt(i)); <END> } catch (final NumberFormatException e) { return null; } return values; }</code><technical_language>of _values_ incorrect initial size of INT_DECODE_VECTOR is _blank_ (zero)</technical_language>

Target:
private final int[] decodeInts(final String string) { final int nValues = ParsingUtils.split(string, INT_DECODE_LIST, ','); final int[] values = new int[nValues]; try { for ( int i = 0; i < nValues; i++ ) values[i] = Integer.valueOf(INT_DECODE_LIST.get(i)); } catch (final NumberFormatException e) { return null; } return values; }
Source:
<code>public List<Optional<TransactionAndImmutableTsLock>> setupRunTaskWithConditionThrowOnConflictBatch( List<PreCommitCondition> conditions) { List<Optional<StartIdentifiedAtlasDbTransactionResponse>> transactionResponses = timelockService.startIdentifiedAtlasDbTransactionBatch(conditions.size()); if (transactionResponses.stream().allMatch(response -> !response.isPresent())) { <START> throw new RuntimeException("entire batch failed"); <END> } List<Optional<TransactionAndImmutableTsLock>> result = Streams.zip(transactionResponses.stream(), conditions.stream(), (response, condition) -> { if (!response.isPresent()) { return Optional.<TransactionAndImmutableTsLock>empty(); } try { return Optional.of(wrap(condition, response.get())); } catch (RuntimeException e) { return Optional.<TransactionAndImmutableTsLock>empty(); } }).collect(Collectors.toList()); return result; }</code><technical_language>pointless this in API level if throw</technical_language>

Target:
public List<TransactionAndImmutableTsLock> setupRunTaskWithConditionThrowOnConflictBatch( List<PreCommitCondition> conditions) { List<StartIdentifiedAtlasDbTransactionResponse> transactionResponses = timelockService.startIdentifiedAtlasDbTransactionBatch(conditions.size()); List<TransactionAndImmutableTsLock> result = new ArrayList<>(); try { Streams.zip(transactionResponses.stream(), conditions.stream(), (response, condition) -> { result.add(wrap(condition, response)); return null; }); } catch (RuntimeException e) { result.forEach(txnAndLock -> timelockService.tryUnlock(ImmutableSet.of(txnAndLock.immutableTsLock()))); throw new TransactionFailedRetriableException("failed to start batch of txns"); } return result; }
Source:
<code>public HttpLookupFailure(DomainBareJid host, Exception exception) { <START> super("Http lookup exception for " + host.toString(), exception); <END> this.host = host; }</code><technical_language>toString() is unnecessary</technical_language>

Target:
public HttpLookupFailure(DomainBareJid host, Exception exception) { super("Http lookup exception for " + host, exception); this.host = host; }
Source:
<code><START> protected boolean uniqueInterfaceName(List<VmNetworkInterface> interfaces) { <END> if (!VmHandler.IsNotDuplicateInterfaceName(interfaces, getInterfaceName(), getReturnValue().getCanDoActionMessages())) { return false; } else { return true; } }</code><technical_language>simplified a single return statement protected boolean uniqueInterfaceName(List<VmNetworkInterface> interfaces) { return VmHandler.IsNotDuplicateInterfaceName(interfaces, getInterfaceName(), getReturnValue().getCanDoActionMessages()); }</technical_language>

Target:
protected boolean uniqueInterfaceName(List<VmNetworkInterface> interfaces) { return VmHandler.IsNotDuplicateInterfaceName(interfaces, getInterfaceName(), getReturnValue().getCanDoActionMessages()); }
Source:
<code><START> private static List<ExpressionTree> findLiterals(List<ExpressionTree> expressions) { <END> return expressions.stream() .filter(BooleanOrNullLiteralInAssertionsCheck::isBoolOrNullLiteral) .collect(Collectors.toCollection(ArrayList::new)); }</code><technical_language>confusing find**Literals** returns a list of ExpressionTree LiteralTree. Similarly line 157 checkEqualityAssertWithOneLiteral argument named ExpressionTree literal, while else a literal (a typecast). working LiteralTree instead (extracting literal cast)? (it enable avoid a call isNullLiteral line 159)</technical_language>

Target:
private static List<LiteralTree> findLiterals(List<ExpressionTree> expressions) { List<LiteralTree> result = new ArrayList<>(); for (ExpressionTree expression : expressions) { getBoolOrNullLiteral(expression).ifPresent(result::add); } return result; }
Source:
<code>public List<FeedbackSessionAttributes> getFeedbackSessionsForUserInCourse( String courseId, String userEmail) throws EntityDoesNotExistException { if (!coursesLogic.isCoursePresent(courseId)) { throw new EntityDoesNotExistException( <START> ERROR_GET_NON_EXISTENT_SESSION_COURSE); <END> } return getFeedbackSessionsForUserInCourseSkipCheck(courseId, userEmail); }</code><technical_language>This combined line :)</technical_language>

Target:
public List<FeedbackSessionAttributes> getFeedbackSessionsForUserInCourse( String courseId, String userEmail) throws EntityDoesNotExistException { if (!coursesLogic.isCoursePresent(courseId)) { throw new EntityDoesNotExistException(ERROR_NON_EXISTENT_COURSE); } return getFeedbackSessionsForUserInCourseSkipCheck(courseId, userEmail); }
Source:
<code>public void setNewBranchName(String newBranchName) { this.newBranchName = newBranchName; <START> if (myPage != null) <END> myPage.setBranchName(newBranchName); }</code><technical_language>Missing braces</technical_language>

Target:
public void setNewBranchName(String newBranchName) { this.newBranchName = newBranchName; if (myPage != null) { myPage.setBranchName(newBranchName); } }
Source:
<code>public IFileRevision[] getContributors(final IFileRevision ifr) { String path = null; RevCommit commit = null; if (ifr instanceof CommitFileRevision) { final CommitFileRevision rev = (CommitFileRevision) ifr; path = rev.getGitPath(); commit = rev.getRevCommit(); <START> } else if (ifr instanceof IAdaptable) { <END> final IResourceVariant variant = (IResourceVariant) ((IAdaptable) ifr) .getAdapter(IResourceVariant.class); if (variant instanceof GitRemoteResource) { final GitRemoteResource gitVariant = (GitRemoteResource) variant; path = gitVariant.getPath(); try { commit = walk.parseCommit(gitVariant.getCommitId()); } catch (IOException e) { } } } if (path != null && commit != null) { final IFileRevision[] r = new IFileRevision[commit.getParentCount()]; for (int i = 0; i < r.length; i++) r[i] = new CommitFileRevision(db, commit.getParent(i), path); return r; } return NO_REVISIONS; }</code><technical_language>this execution branch covered test</technical_language>

Target:
public IFileRevision[] getContributors(final IFileRevision ifr) { String path = getGitPath(ifr); RevCommit commit = getRevCommit(ifr); if (path != null && commit != null) { final IFileRevision[] r = new IFileRevision[commit.getParentCount()]; for (int i = 0; i < r.length; i++) r[i] = new CommitFileRevision(db, commit.getParent(i), path); return r; } return NO_REVISIONS; }
Source:
<code>public Set<String> getCacheNames() { OperationsFactory operationsFactory = new OperationsFactory(channelFactory, codec, configuration); String names = await(operationsFactory.newAdminOperation("@@cache@names", Collections.emptyMap()).execute()); Set<String> cacheNames = new HashSet<>(); <START> Pattern pattern = Pattern.compile("(?:\")([^\"]*)(?:\",?)"); <END> Matcher matcher = pattern.matcher(names); while (matcher.find()) { cacheNames.add(matcher.group(1)); } return cacheNames; }</code><technical_language>This extracted a constant</technical_language>

Target:
public Set<String> getCacheNames() { OperationsFactory operationsFactory = new OperationsFactory(channelFactory, codec, configuration); String names = await(operationsFactory.newAdminOperation("@@cache@names", Collections.emptyMap()).execute()); Set<String> cacheNames = new HashSet<>(); Pattern pattern = Pattern.compile(JSON_STRING_ARRAY_ELEMENT_REGEX); Matcher matcher = pattern.matcher(names); while (matcher.find()) { cacheNames.add(matcher.group(1)); } return cacheNames; }
Source:
<code>public void openContextMenuByPathSelectedItem(String path) { <START> for (int i = 1; ; i++) { <END> waitAndSelectItem(path); actionsFactory.createAction(seleniumWebDriver).contextClick().perform(); waitContextMenu(); try { waitItemIsSelected(path, REDRAW_UI_ELEMENTS_TIMEOUT_SEC); return; } catch (WebDriverException e) { seleniumWebDriverHelper.hideContextMenu(); waitContextMenuPopUpClosed(); if (i == 2) { throw e; } } } }</code><technical_language>explain problem current code fixes it</technical_language>

Target:
public void openContextMenuByPathSelectedItem(String path) { for (int i = 1; ; i++) { waitAndSelectItem(path); actionsFactory.createAction(seleniumWebDriver).contextClick().perform(); waitContextMenu(); try { waitItemIsSelected(path, REDRAW_UI_ELEMENTS_TIMEOUT_SEC); return; } catch (TimeoutException e) { seleniumWebDriverHelper.hideContextMenu(); waitContextMenuPopUpClosed(); if (i == 2) { throw e; } } } }
Source:
<code>@Test public void testCastInStringOperandOfComparison() { final String query = "select \"employee_id\" " + "from \"foodmart\".\"employee\" " + "where 10 = cast('10' as int) and \"birth_date\" = cast('1914-02-02' as date) or " + "\"hire_date\" = cast('1996-01-01 '||'00:00:00' as timestamp)"; final String expected = "SELECT \"employee_id\"\n" + "FROM \"foodmart\".\"employee\"\n" + "WHERE 10 = '10' AND \"birth_date\" = '1914-02-02' OR \"hire_date\" = '1996-01-01 ' || " + "'00:00:00'"; final String expectedBiqquery = "SELECT employee_id\n" + "FROM foodmart.employee\n" + "WHERE 10 = CAST('10' AS INTEGER) AND birth_date = '1914-02-02' OR hire_date = " <START> + "CAST('1996-01-01 ' || '00:00:00' AS TIMESTAMP(0))"; <END> sql(query) .ok(expected) .withBigQuery() .ok(expectedBiqquery); }</code><technical_language>Honestly, I TIMESTAMP(0) in BigQuery</technical_language>

Target:
@Test public void testCastInStringOperandOfComparison() { final String query = "select \"employee_id\" " + "from \"foodmart\".\"employee\" " + "where 10 = cast('10' as int) and \"birth_date\" = cast('1914-02-02' as date) or " + "\"hire_date\" = cast('1996-01-01 '||'00:00:00' as timestamp)"; final String expected = "SELECT \"employee_id\"\n" + "FROM \"foodmart\".\"employee\"\n" + "WHERE 10 = '10' AND \"birth_date\" = '1914-02-02' OR \"hire_date\" = '1996-01-01 ' || " + "'00:00:00'"; final String expectedBiqquery = "SELECT employee_id\n" + "FROM foodmart.employee\n" + "WHERE 10 = CAST('10' AS INTEGER) AND birth_date = '1914-02-02' OR hire_date = " + "CAST('1996-01-01 ' || '00:00:00' AS TIMESTAMP)"; sql(query) .ok(expected) .withBigQuery() .ok(expectedBiqquery); }
Source:
<code>public void testEarliestAggregators() throws Exception { <START> skipVectorize(); <END> testQuery( "SELECT " + "EARLIEST(cnt), EARLIEST(m1), EARLIEST(dim1, 10), " + "EARLIEST(cnt + 1), EARLIEST(m1 + 1), EARLIEST(dim1 || CAST(cnt AS VARCHAR), 10) " + "FROM druid.foo", ImmutableList.of( Druids.newTimeseriesQueryBuilder() .dataSource(CalciteTests.DATASOURCE1) .intervals(querySegmentSpec(Filtration.eternity())) .granularity(Granularities.ALL) .virtualColumns( expressionVirtualColumn("v0", "(\"cnt\" + 1)", ValueType.LONG), expressionVirtualColumn("v1", "(\"m1\" + 1)", ValueType.FLOAT), expressionVirtualColumn("v2", "concat(\"dim1\",CAST(\"cnt\", 'STRING'))", ValueType.STRING) ) .aggregators( aggregators( new LongFirstAggregatorFactory("a0", "cnt"), new FloatFirstAggregatorFactory("a1", "m1"), new StringFirstAggregatorFactory("a2", "dim1", 10), new LongFirstAggregatorFactory("a3", "v0"), new FloatFirstAggregatorFactory("a4", "v1"), new StringFirstAggregatorFactory("a5", "v2", 10) ) ) .context(TIMESERIES_CONTEXT_DEFAULT) .build() ), ImmutableList.of( new Object[]{1L, 1.0f, "", 2L, 2.0f, "1"} ) ); }</code><technical_language>this need reset end of test? other tests run this run vectorize disabled? is handled some rule in this delta</technical_language>

Target:
public void testEarliestAggregators() throws Exception { skipVectorize(); testQuery( "SELECT " + "EARLIEST(cnt), EARLIEST(m1), EARLIEST(dim1, 10), " + "EARLIEST(cnt + 1), EARLIEST(m1 + 1), EARLIEST(dim1 || CAST(cnt AS VARCHAR), 10) " + "FROM druid.foo", ImmutableList.of( Druids.newTimeseriesQueryBuilder() .dataSource(CalciteTests.DATASOURCE1) .intervals(querySegmentSpec(Filtration.eternity())) .granularity(Granularities.ALL) .virtualColumns( expressionVirtualColumn("v0", "(\"cnt\" + 1)", ValueType.LONG), expressionVirtualColumn("v1", "(\"m1\" + 1)", ValueType.FLOAT), expressionVirtualColumn("v2", "concat(\"dim1\",CAST(\"cnt\", 'STRING'))", ValueType.STRING) ) .aggregators( aggregators( new LongFirstAggregatorFactory("a0", "cnt"), new FloatFirstAggregatorFactory("a1", "m1"), new StringFirstAggregatorFactory("a2", "dim1", 10), new LongFirstAggregatorFactory("a3", "v0"), new FloatFirstAggregatorFactory("a4", "v1"), new StringFirstAggregatorFactory("a5", "v2", 10) ) ) .context(TIMESERIES_CONTEXT_DEFAULT) .build() ), ImmutableList.of( new Object[]{1L, 1.0f, NullHandling.sqlCompatible() ? "" : "10.1", 2L, 2.0f, "1"} ) ); }
Source:
<code>public final String extendedGuideUrl() { <START> return formatString(DynamicMessageKey.EXTENDED_GUIDE_URL, LocaleInfo.getCurrentLocale().getLocaleName()); <END> }</code><technical_language>do "LocaleInfo.getCurrentLocale().getLocaleName()" in DynamicMessages, please consider adding a method this: protected LocaleInfo getCurrentLocale() { return LocaleInfo.getCurrentLocale(); } DynamicMessages this method in places, i.e. DynamicMessages.guideUrl + ApplicationDynamicMessages.extendedGuideUrl</technical_language>

Target:
public final String extendedGuideUrl() { return formatString(DynamicMessageKey.EXTENDED_GUIDE_URL, getCurrentLocaleAsString()); }
Source:
<code>public RegexProvider getRegexpProvider() { return new RegexProvider() { @Override public Map<String, String> getLanguageRegexes() { <START> return ImmutableMap.of("maven", ".*pom\\.xml"); <END> } @Override public Set<String> getFileWatchPatterns() { return ImmutableSet.of(); } }; }</code><technical_language>Again, this matches "foopom.xml"</technical_language>

Target:
public RegexProvider getRegexpProvider() { return new RegexProvider() { @Override public Map<String, String> getLanguageRegexes() { return ImmutableMap.of("maven", ".*[/\\\\]?pom\\.xml$"); } @Override public Set<String> getFileWatchPatterns() { return ImmutableSet.of(); } }; }
Source:
<code>public Multimap<CallStackDepth, ISegment> queryCallStacks(Collection<CallStackDepth> callstacks, Collection<Long> times) { Map<Integer, <START> CallStackDepth> quarks = new HashMap<>(); for (CallStackDepth csDepth : callstacks) { quarks.put(csDepth.getQuark(), csDepth); } <END> Multimap<CallStackDepth, ISegment> map = Objects.requireNonNull(ArrayListMultimap.create()); Collection<Long> queryTimes = getTimes(fStateSystem, times); try { Iterable<ITmfStateInterval> query2d = fStateSystem.query2D(quarks.keySet(), queryTimes); for (ITmfStateInterval callInterval : query2d) { CallStackDepth callStackDepth = Objects.requireNonNull(quarks.get(callInterval.getAttribute())); if (!callInterval.getStateValue().isNull()) { map.put(callStackDepth, callStackDepth.getCallStack().getFunctionFromInterval(callInterval)); } else { map.put(callStackDepth, new NullFunction(callInterval)); } } } catch (IndexOutOfBoundsException | TimeRangeException | StateSystemDisposedException e) { e.printStackTrace(); } return map; }</code><technical_language>Maps.uniqueIndex</technical_language>

Target:
public Multimap<CallStackDepth, ISegment> queryCallStacks(Collection<CallStackDepth> callstacks, Collection<Long> times) { Map<Integer, CallStackDepth> quarks = Maps.uniqueIndex(callstacks, cs -> cs.getQuark()); Multimap<CallStackDepth, ISegment> map = Objects.requireNonNull(ArrayListMultimap.create()); Collection<Long> queryTimes = getTimes(fStateSystem, times); try { Iterable<ITmfStateInterval> query2d = fStateSystem.query2D(quarks.keySet(), queryTimes); for (ITmfStateInterval callInterval : query2d) { CallStackDepth callStackDepth = Objects.requireNonNull(quarks.get(callInterval.getAttribute())); if (callInterval.getValue() != null) { map.put(callStackDepth, callStackDepth.getCallStack().getFunctionFromInterval(callInterval)); } else { map.put(callStackDepth, new BasicSegment(callInterval.getStartTime(), callInterval.getEndTime() + 1)); } } } catch (IndexOutOfBoundsException | TimeRangeException | StateSystemDisposedException e) { e.printStackTrace(); } return map; }
Source:
<code>private ImpersonatedCredentials(Builder builder) { this.sourceCredentials = builder.getSourceCredentials(); this.targetPrincipal = builder.getTargetPrincipal(); this.delegates = builder.getDelegates(); this.scopes = builder.getScopes(); this.lifetime = builder.getLifetime(); this.transportFactory = firstNonNull( builder.getHttpTransportFactory(), getFromServiceLoader(HttpTransportFactory.class, OAuth2Utils.HTTP_TRANSPORT_FACTORY)); this.transportFactoryClassName = this.transportFactory.getClass().getName(); if (this.delegates == null) { this.delegates = new ArrayList<String>(); } if (this.scopes == null) { throw new IllegalStateException(SCOPE_EMPTY_ERROR); } if (this.lifetime > TWELVE_HOURS_IN_SECONDS) { throw new IllegalStateException(LIFETIME_EXCEEDED_ERROR); } if (this.lifetime == 0) { <START> this.lifetime = DEFAULT_LIFETIME_IN_SECONDS; <END> } }</code><technical_language>If this client side, default this in builder</technical_language>

Target:
private ImpersonatedCredentials(Builder builder) { this.sourceCredentials = builder.getSourceCredentials(); this.targetPrincipal = builder.getTargetPrincipal(); this.delegates = builder.getDelegates(); this.scopes = builder.getScopes(); this.lifetime = builder.getLifetime(); this.transportFactory = firstNonNull( builder.getHttpTransportFactory(), getFromServiceLoader(HttpTransportFactory.class, OAuth2Utils.HTTP_TRANSPORT_FACTORY)); this.transportFactoryClassName = this.transportFactory.getClass().getName(); if (this.delegates == null) { this.delegates = new ArrayList<String>(); } if (this.scopes == null) { throw new IllegalStateException("Scopes cannot be null"); } if (this.lifetime > TWELVE_HOURS_IN_SECONDS) { throw new IllegalStateException("lifetime must be less than or equal to 43200"); } }
Source:
<code>public void createPayment_success() throws JsonProcessingException { final Account account = new Account(GATEWAY_ACCOUNT_ID, TokenPaymentType.DIRECT_DEBIT); final String status = "created"; final boolean finished = false; DirectDebitConnectorCreatePaymentResponse connectorResponse = aDirectDebitConnectorCreatePaymentResponse() .withPaymentExternalId(PAYMENT_ID) .withAmount(500L) .withPaymentProvider(PAYMENT_PROVIDER) .withCreatedDate(CREATED_DATE) .withDescription(DESCRIPTION) .withState(new PaymentState(status, finished)) .withReference(REFERENCE) .build(); connectorDDMockClient.respondWithPaymentCreated(connectorResponse, account.getAccountId()); <START> String request = new GsonBuilder().create().toJson(Map.of( <END> "amount", 500, "description", DESCRIPTION, "reference", REFERENCE, "mandate_id", MANDATE_ID)); postPaymentResponse(request) .statusCode(201) .body("payment_id", is(PAYMENT_ID)) .body("amount", is(500)) .body("payment_provider", is(PAYMENT_PROVIDER)) .body("created_date", is(CREATED_DATE)) .body("description", is(DESCRIPTION)) .body("reference", is(REFERENCE)) .body("state.status", is(status)) .body("state.finished", is(finished)) .body("_links.events.href", is(paymentEventsLocationFor(PAYMENT_ID))) .body("_links.events.method", is("GET")) .body("_links.self.href", is(paymentLocationFor(PAYMENT_ID))) .body("_links.self.method", is("GET")); }</code><technical_language>this collapsed new Gson().toJson(Map.of..</technical_language>

Target:
public void createPayment_success() throws JsonProcessingException { final Account account = new Account(GATEWAY_ACCOUNT_ID, TokenPaymentType.DIRECT_DEBIT); final String status = "created"; final boolean finished = false; DirectDebitConnectorCreatePaymentResponse connectorResponse = aDirectDebitConnectorCreatePaymentResponse() .withPaymentExternalId(PAYMENT_ID) .withAmount(500L) .withPaymentProvider(PAYMENT_PROVIDER) .withCreatedDate(CREATED_DATE) .withDescription(DESCRIPTION) .withState(new PaymentState(status, finished)) .withReference(REFERENCE) .build(); connectorDDMockClient.respondWithPaymentCreated(connectorResponse, account.getAccountId()); String request = new Gson().toJson(Map.of( "amount", 500, "description", DESCRIPTION, "reference", REFERENCE, "mandate_id", MANDATE_ID)); postPaymentResponse(request) .statusCode(201) .body("payment_id", is(PAYMENT_ID)) .body("amount", is(500)) .body("payment_provider", is(PAYMENT_PROVIDER)) .body("created_date", is(CREATED_DATE)) .body("description", is(DESCRIPTION)) .body("reference", is(REFERENCE)) .body("state.status", is(status)) .body("state.finished", is(finished)) .body("_links.events.href", is(paymentEventsLocationFor(PAYMENT_ID))) .body("_links.events.method", is("GET")) .body("_links.self.href", is(paymentLocationFor(PAYMENT_ID))) .body("_links.self.method", is("GET")); }
Source:
<code>private Map<String, byte[]> getPropagatedVariables(SchedulerDBManager dbManager, EligibleTaskDescriptor eligibleTaskDescriptor, InternalJob job, InternalTask task) throws UnknownTaskException { Map<String, byte[]> variables = new HashMap<>(); if (job.getType() == JobType.TASKSFLOW && eligibleTaskDescriptor != null) { <START> TaskResultImpl taskResult = (TaskResultImpl) dbManager.loadLastTaskResult(task.getId()); <END> if (taskResult != null){ variables.putAll(taskResult.getPropagatedVariables()); }else{ int numberOfParentTasks = eligibleTaskDescriptor.getParents().size(); if ((numberOfParentTasks > 0) && task.handleResultsArguments()) { variables = extractTaskResultsAndMergeIntoMap(dbManager, eligibleTaskDescriptor, job); } else { variables = extractJobVariables(job); } } } return variables; }</code><technical_language>logic is clear check taskResult. occur DatabaseManagerException exception, is thrown loadTasksResults() method. is needed catch exception</technical_language>

Target:
private Map<String, byte[]> getPropagatedVariables(SchedulerDBManager dbManager, EligibleTaskDescriptor eligibleTaskDescriptor, InternalJob job, InternalTask task) throws UnknownTaskException { Map<String, byte[]> variables = new HashMap<>(); if (job.getType() == JobType.TASKSFLOW && eligibleTaskDescriptor != null) { TaskResultImpl taskResult = null; try{ taskResult = (TaskResultImpl) dbManager.loadLastTaskResult(task.getId()); }catch(DatabaseManagerException exception){ tlogger.error(task.getId(), exception.getMessage(), exception); } if (taskResult != null){ variables.putAll(taskResult.getPropagatedVariables()); }else{ int numberOfParentTasks = eligibleTaskDescriptor.getParents().size(); if ((numberOfParentTasks > 0) && task.handleResultsArguments()) { variables = extractTaskResultsAndMergeIntoMap(dbManager, eligibleTaskDescriptor, job); } else { variables = extractJobVariables(job); } } } return variables; }
Source:
<code>public static JavaArchive deployment() { final JavaArchive jar = ShrinkWrap.create(JavaArchive.class, "pdp-service-bean.jar"); jar.addAsManifestResource(EmptyAsset.INSTANCE, ArchivePaths.create("beans.xml")); XACMLTestUtils.addCommonClassesToArchive(jar); XACMLTestUtils.addJBossDeploymentStructureToArchive(jar); XACMLTestUtils.addXACMLPoliciesToArchive(jar); for (int i = 1; i <= 7; i++) { jar.addAsResources(JBossPDPServletInitializationTestCase.class.getPackage(), XACMLTestUtils.TESTOBJECTS_REQUESTS + "/scenario2-testcase" + i + "-request.xml"); } jar.addAsResource(JBossPDPServletInitializationTestCase.class.getPackage(), XACMLTestUtils.TESTOBJECTS_REQUESTS + "/med-example-request.xml"); final String tempDir = System.getProperty("java.io.tmpdir"); final String testObjectsPolicies = AssetUtil.getClassLoaderResourceName(JBossPDPInteroperabilityTestCase.class.getPackage(), XACMLTestUtils.TESTOBJECTS_POLICIES); jar.addAsResource(createPermissionsXmlAsset( new FilePermission(testObjectsPolicies + "/-", "read"), new FilePermission(tempDir + "/-", "read,write,delete"), new PropertyPermission("java.io.tmpdir", "read"), new ReflectPermission("suppressAccessChecks"), new RuntimePermission("getClassLoader"), <START> new RuntimePermission("accessDeclaredMembers") <END> ),"META-INF/permissions.xml"); return jar; }</code><technical_language>**suppressAccessChecks** **accessDeclaredMembers** needed latest XACML - removed</technical_language>

Target:
public static JavaArchive deployment() { final JavaArchive jar = ShrinkWrap.create(JavaArchive.class, "pdp-service-bean.jar"); jar.addAsManifestResource(EmptyAsset.INSTANCE, ArchivePaths.create("beans.xml")); XACMLTestUtils.addCommonClassesToArchive(jar); XACMLTestUtils.addJBossDeploymentStructureToArchive(jar); XACMLTestUtils.addXACMLPoliciesToArchive(jar); for (int i = 1; i <= 7; i++) { jar.addAsResources(JBossPDPServletInitializationTestCase.class.getPackage(), XACMLTestUtils.TESTOBJECTS_REQUESTS + "/scenario2-testcase" + i + "-request.xml"); } jar.addAsResource(JBossPDPServletInitializationTestCase.class.getPackage(), XACMLTestUtils.TESTOBJECTS_REQUESTS + "/med-example-request.xml"); final String tempDir = System.getProperty("java.io.tmpdir"); final String testObjectsPolicies = AssetUtil.getClassLoaderResourceName(JBossPDPInteroperabilityTestCase.class.getPackage(), XACMLTestUtils.TESTOBJECTS_POLICIES); jar.addAsResource(createPermissionsXmlAsset( new FilePermission(testObjectsPolicies + "/-", "read"), new FilePermission(tempDir + "/-", "read,write,delete") ),"META-INF/permissions.xml"); return jar; }
Source:
<code><START> protected void fetchClusterWideStatsIfNeeded() { <END> if (launchNewDistTask()) { List<Future<Map<String, Number>>> responseList = Collections.emptyList(); try { responseList = des.submitEverywhere(new DistributedCacheStatsCallable()); updateFieldsFromResponseMap(responseList); } catch (Exception e) { log.warn("Could not execute cluster wide cache stats operation ", e); } finally { statsUpdateTimestamp = ts.time(); } } }</code><technical_language>if this method is invoked more 1 thread more 1 cluster stats collection happening time. synchronize this? This care of issue variables read volatile partial updates due memory model reordering operations</technical_language>

Target:
protected synchronized void fetchClusterWideStatsIfNeeded() { if (launchNewDistTask()) { List<Future<Map<String, Number>>> responseList = Collections.emptyList(); try { responseList = des.submitEverywhere(new DistributedCacheStatsCallable()); updateFieldsFromResponseMap(responseList); } catch (Exception e) { log.warn("Could not execute cluster wide cache stats operation ", e); } finally { statsUpdateTimestamp = ts.time(); } } }
Source:
<code>private void logTrace(String string) { System.out.println("SaveableCompareEditorInput " + <START> hashCode() <END> + ": " + string); }</code><technical_language>hashCode -> System.identityHashCode</technical_language>

Target:
private void logTrace(String string) { System.out.println("SaveableCompareEditorInput " + System.identityHashCode(this) + ": " + string); }
Source:
<code>private File[] retrieveSortedBenchmarkReportDirectories(File benchmarkDirectory) { File[] benchmarkReportDirectories = benchmarkDirectory.listFiles((FileFilter) DirectoryFileFilter.INSTANCE); if (benchmarkReportDirectories == null) { <START> return new File[] {}; <END> } else { Arrays.sort(benchmarkReportDirectories); return benchmarkReportDirectories; } }</code><technical_language>Unconventional space</technical_language>

Target:
private File[] retrieveSortedBenchmarkReportDirectories(File benchmarkDirectory) { File[] benchmarkReportDirectories = benchmarkDirectory.listFiles((FileFilter) DirectoryFileFilter.INSTANCE); if (benchmarkReportDirectories == null) { throw new IllegalStateException("Unable to list subdirectories in a directory (" + benchmarkDirectory.getAbsolutePath() + ")."); } else { Arrays.sort(benchmarkReportDirectories); return benchmarkReportDirectories; } }
Source:
<code>private Department getDepartment(HttpServletRequest request, List<Department> departments) { Department department = getDomainObject(request, "departmentID"); <START> return department != null ? department : departments.stream().findAny().orElse(null); <END> }</code><technical_language>Creating a Stream for sole purpose of retrieving a single element a List is a bit excessive. I suggest this instead: return department != null ? department : departments.isEmpty() ? null : departments.get(0);</technical_language>

Target:
private Department getDepartment(HttpServletRequest request, List<Department> departments) { Department department = getDomainObject(request, "departmentID"); return department != null ? department : departments.isEmpty() ? null : departments.get(0); }
Source:
<code>protected ServerErrorCode validateRequest(PartitionId partition, RequestOrResponseType requestType, boolean skipPartitionAndDiskAvailableCheck) { if (partition == null) { metrics.badRequestError.inc(); return ServerErrorCode.Bad_Request; } if (!skipPartitionAndDiskAvailableCheck) { ReplicaId localReplica = localPartitionToReplicaMap.get(partition); if (localReplica != null && localReplica.getDiskId().getState() == HardwareState.UNAVAILABLE) { metrics.diskUnavailableError.inc(); return ServerErrorCode.Disk_Unavailable; } <START> ServerErrorCode errorCode = storeManager.isPartitionAvailable(partition, localReplica); <END> switch (errorCode) { case Disk_Unavailable: metrics.diskUnavailableError.inc(); localReplica.markDiskDown(); return errorCode; case Replica_Unavailable: metrics.replicaUnavailableError.inc(); return errorCode; case Partition_Unknown: metrics.partitionUnknownError.inc(); return errorCode; } } if (requestType.equals(RequestOrResponseType.PutRequest) && partition.getPartitionState() == PartitionState.READ_ONLY) { metrics.partitionReadOnlyError.inc(); return ServerErrorCode.Partition_ReadOnly; } if (!isRequestEnabled(requestType, partition)) { metrics.temporarilyDisabledError.inc(); return ServerErrorCode.Temporarily_Disabled; } return ServerErrorCode.No_Error; }</code><technical_language>If need error code, call method checkLocalPartitionStatus</technical_language>

Target:
protected ServerErrorCode validateRequest(PartitionId partition, RequestOrResponseType requestType, boolean skipPartitionAndDiskAvailableCheck) { if (partition == null) { metrics.badRequestError.inc(); return ServerErrorCode.Bad_Request; } if (!skipPartitionAndDiskAvailableCheck) { ReplicaId localReplica = localPartitionToReplicaMap.get(partition); if (localReplica != null && localReplica.getDiskId().getState() == HardwareState.UNAVAILABLE) { metrics.diskUnavailableError.inc(); return ServerErrorCode.Disk_Unavailable; } ServerErrorCode errorCode = storeManager.checkLocalPartitionStatus(partition, localReplica); switch (errorCode) { case Disk_Unavailable: metrics.diskUnavailableError.inc(); localReplica.markDiskDown(); return errorCode; case Replica_Unavailable: metrics.replicaUnavailableError.inc(); return errorCode; case Partition_Unknown: metrics.partitionUnknownError.inc(); return errorCode; } } if (requestType.equals(RequestOrResponseType.PutRequest) && partition.getPartitionState() == PartitionState.READ_ONLY) { metrics.partitionReadOnlyError.inc(); return ServerErrorCode.Partition_ReadOnly; } if (!isRequestEnabled(requestType, partition)) { metrics.temporarilyDisabledError.inc(); return ServerErrorCode.Temporarily_Disabled; } return ServerErrorCode.No_Error; }
Source:
<code>public View onCreateView(LayoutInflater inflater, ViewGroup viewGroup, Bundle bundle) { View view = super.onCreateView(inflater, viewGroup, bundle); <START> mCallback.onMapReady(); <END> return view; }</code><technical_language>Add check null</technical_language>

Target:
public View onCreateView(LayoutInflater inflater, ViewGroup viewGroup, Bundle bundle) { View view = super.onCreateView(inflater, viewGroup, bundle); if (mOnMapReadyListener != null){ mOnMapReadyListener.onMapReady(); } return view; }
Source:
<code>protected DocumentModelList searchUsers() { if (StringUtils.isBlank(prefix)) { return new DocumentModelListImpl(); } String trimmedPrefix = prefix.trim(); if (Framework.getService(ConfigurationService.class).isBooleanPropertyFalse(FULLNAME_SEARCH_PROPERTY)) { return userManager.searchUsers(trimmedPrefix); } String[] searchTerms = trimmedPrefix.split("\\s", 2); DocumentModelList firstTermResults = userManager.searchUsers(searchTerms[0]); if (firstTermResults.isEmpty()) { return new DocumentModelListImpl(); } if (searchTerms.length <= 1) { return firstTermResults; } DocumentModelList secondTermResults = userManager.searchUsers(searchTerms[1].trim()); DocumentModelList results = firstTermResults.stream().filter(secondTermResults::contains).collect( <START> Collectors.toCollection(DocumentModelListImpl::new)); <END> if (results.isEmpty()) { return userManager.searchUsers(trimmedPrefix); } else { return results; } }</code><technical_language>Collection.retainAll</technical_language>

Target:
protected DocumentModelList searchUsers() { if (StringUtils.isBlank(prefix)) { return new DocumentModelListImpl(); } String trimmedPrefix = prefix.trim(); if (Framework.getService(ConfigurationService.class).isBooleanPropertyFalse(FULLNAME_SEARCH_PROPERTY)) { return userManager.searchUsers(trimmedPrefix); } String[] searchTerms = trimmedPrefix.split("\\s", 2); return Stream.of(searchTerms) .map(userManager::searchUsers) .reduce((a, b) -> { a.retainAll(b); return a; }) .filter(result -> !result.isEmpty()) .orElseGet(() -> userManager.searchUsers(trimmedPrefix)); }
Source:
<code>public ValueMatcher makeMatcher(ValueMatcherFactory factory) { if (extractionFn == null) { return factory.makeValueMatcher(dimension, value); } else { return factory.makeValueMatcher( dimension, new Predicate<String>() { @Override public boolean apply(String input) { <START> return value.equals(Strings.nullToEmpty(extractionFn.apply(Strings.emptyToNull(input)))); <END> } } ); } }</code><technical_language>This feels a lot of hoops jump through. ExtractionFn contract needs clarified in. a spot cases is obvious JavaScript extraction fn handles null inputs in a proper way. output is null empty (by method contract) able eliminate nullToEmpty... if ability for ExtractionFn.apply accept null xor empty in method contract, clarify need for emptyToNull. Some ExtractionFuncions handle null input explicitly, others do do so, a waiting bug unneeded check. Anyways, a change scope of this PR approach is fine for now, please a null check reaches here</technical_language>

Target:
public ValueMatcher makeMatcher(ValueMatcherFactory factory) { if (extractionFn == null) { return factory.makeValueMatcher(dimension, value); } else { return factory.makeValueMatcher( dimension, new Predicate<String>() { @Override public boolean apply(String input) { return value.equals(Strings.nullToEmpty(extractionFn.apply(input))); } } ); } }
Source:
<code>public Chronology getChronology() { <START> return chronology; <END> }</code><technical_language>return AccountingChronology Chronology</technical_language>

Target:
public AccountingChronology getChronology() { return chronology; }
Source:
<code>public final LogEventRequestType transformRequestToAuditMsg(T request, AssertionType assertion, NhinTargetSystemType target, String direction, String _interface, boolean isRequesting, Properties webContextProperties, String serviceName) { setRequest(request); setTarget(target); setAssertion(assertion); AuditMessageType auditMsg = createBaseAuditMessage(assertion, target, isRequesting, webContextProperties, serviceName); auditMsg = getParticipantObjectIdentificationForRequest(request, assertion, auditMsg); return buildLogEventRequestType(auditMsg, direction, getMessageCommunityId(assertion, target, isRequesting), serviceName, assertion, auditMsg.getEventIdentification().getEventID().getDisplayName(), auditMsg.getEventIdentification().getEventOutcomeIndicator(), <START> auditMsg.getEventIdentification().getEventDateTime(), getRequestorUserId(auditMsg,assertion)); <END> }</code><technical_language>Is a reason passing auditMsg object? need auditMessageType.getActiveParticipant() in this method</technical_language>

Target:
public final LogEventRequestType transformRequestToAuditMsg(T request, AssertionType assertion, NhinTargetSystemType target, String direction, String _interface, boolean isRequesting, Properties webContextProperties, String serviceName) { setRequest(request); setTarget(target); setAssertion(assertion); AuditMessageType auditMsg = createBaseAuditMessage(assertion, target, isRequesting, webContextProperties, serviceName); auditMsg = getParticipantObjectIdentificationForRequest(request, assertion, auditMsg); return buildLogEventRequestType(auditMsg, direction, getMessageCommunityId(assertion, target, isRequesting), serviceName, assertion, auditMsg.getEventIdentification().getEventID().getDisplayName(), auditMsg .getEventIdentification().getEventOutcomeIndicator(), auditMsg.getEventIdentification() .getEventDateTime(), getRequestorUserId(auditMsg.getActiveParticipant(), assertion)); }
Source:
<code>public static @Nullable KernelMemoryUsageDataProvider create(ITmfTrace trace) { TmfStateSystemAnalysisModule module = TmfTraceUtils.getAnalysisModuleOfClass(trace, <START> TmfStateSystemAnalysisModule.class, <END> KernelMemoryAnalysisModule.ID); if (module != null) { module.schedule(); return new KernelMemoryUsageDataProvider(trace, module); } return null; }</code><technical_language>KernelMemoryAnalysisModule</technical_language>

Target:
public static @Nullable KernelMemoryUsageDataProvider create(ITmfTrace trace) { KernelMemoryAnalysisModule module = TmfTraceUtils.getAnalysisModuleOfClass(trace, KernelMemoryAnalysisModule.class, KernelMemoryAnalysisModule.ID); if (module != null) { module.schedule(); return new KernelMemoryUsageDataProvider(trace, module); } return null; }
Source:
<code>public void shouldSearchAndReturnAListOfLogEntriesGeneratedByUser() throws Exception { MockHttpServletRequest req = request(RequestMethod.GET, getURI()); req.addParameter("generatedBy", "1010d442-e134-11de-babe-001e378eb67e"); SimpleObject result = deserialize(handle(req)); <START> Assert.assertEquals(5, Util.getResultsSize(result)); <END> }</code><technical_language>getAllCount() instead of 5</technical_language>

Target:
public void shouldSearchAndReturnAListOfLogEntriesGeneratedByUser() throws Exception { MockHttpServletRequest req = request(RequestMethod.GET, getURI()); req.addParameter("generatedBy", USER_UUID); SimpleObject result = deserialize(handle(req)); Assert.assertEquals(2, Util.getResultsSize(result)); }
Source:
<code>public void handleVolumeCommand(Command command, ChannelUID channelUID) throws IOException { if (command instanceof RefreshType) { <START> updateState(channelUID, new DecimalType(connection.getVolume() / 100.0)); <END> } if (command instanceof DecimalType) { connection.setVolume(((DecimalType) command).intValue()); } }</code><technical_language>PercentType instead of DecimalType do need divide 100</technical_language>

Target:
public void handleVolumeCommand(Command command, ChannelUID channelUID) throws IOException { handleVolumeCommand(command, channelUID, 0); }
Source:
<code>public TexBibEntriesResolverResult resolve(TexParserResult texParserResult) { TexBibEntriesResolverResult resolverResult = new TexBibEntriesResolverResult(texParserResult); Map<Path, BibDatabase> bibDatabases = resolverResult.getBibFiles().values().stream().distinct().collect(Collectors.toMap( Function.identity(), path -> OpenDatabase.loadDatabase(path.toString(), importFormatPreferences, fileMonitor).getDatabase())); <START> texParserResult.getCitations().entries().forEach(mapEntry -> <END> texParserResult.getBibFiles().get(mapEntry.getValue().getPath()).forEach(bibFile -> bibDatabases.get(bibFile).getEntriesByKey(mapEntry.getKey()).forEach(entry -> { Optional<BibEntry> databaseEntry = masterDatabase.getEntryByKey(entry.getCiteKeyOptional().orElse("")); if (!databaseEntry.isPresent() || !databaseEntry.get().equals(entry)) { bibDatabases.get(bibFile).getReferencedEntry(entry).ifPresent(refEntry -> refEntry.getFields().forEach(field -> entry.getFieldMap().putIfAbsent(field, refEntry.getFieldOrAlias(field).orElse("")))); resolverResult.addEntry(entry); } }))); return resolverResult; }</code><technical_language>a flatmap</technical_language>

Target:
public TexBibEntriesResolverResult resolve(TexParserResult texParserResult) { TexBibEntriesResolverResult resolverResult = new TexBibEntriesResolverResult(texParserResult); Map<Path, BibDatabase> bibDatabases = resolverResult.getBibFiles().values().stream().distinct().collect(Collectors.toMap( Function.identity(), path -> OpenDatabase.loadDatabase(path.toString(), importFormatPreferences, fileMonitor).getDatabase())); Stream<Map.Entry<String, Citation>> citationsStream = texParserResult.getCitations().entries().stream().distinct(); Set<BibEntry> newEntries = citationsStream.flatMap(mapEntry -> apply(mapEntry, texParserResult, bibDatabases)).collect(Collectors.toSet()); resolverResult.getNewEntries().addAll(newEntries); return resolverResult; }
Source:
<code>public String toString() { <START> return "ControllerBasedStartupStrategy - deploays kie containers given by controller ignoring locally defined"; <END> }</code><technical_language>A typo: "deploays" -> "deploys"</technical_language>

Target:
public String toString() { return "ControllerBasedStartupStrategy - deploys kie containers given by controller ignoring locally defined"; }
Source:
<code>public int onStartCommand(Intent intent, int flags, int startId) { <START> self = this; <END> NotificationManagerCompat.from(this).cancelAll(); final String machine = (String) intent.getExtras().get("machine"); int timeLeft = (int) intent.getExtras().get("time"); notifcationIds.put(machine, id); CountDownTimer timer = new CountDownTimer(timeLeft, 1000) { public void onTick(long millisUntilFinished) { updateTimeNotification(machine, NotificationCreator.this, millisUntilFinished); } public void onFinish() { updateTimeNotification(machine, NotificationCreator.this, 0); stopTimer(id, machine); } }.start(); timers.put(id, timer); id++; return START_REDELIVER_INTENT; }</code><technical_language>this fix it? I services enough know</technical_language>

Target:
public int onStartCommand(Intent intent, int flags, int startId) { self = new WeakReference<>(this); NotificationManagerCompat.from(this).cancelAll(); final String machine = (String) intent.getExtras().get("machine"); int timeLeft = (int) intent.getExtras().get("time"); notifcationIds.put(machine, id); CountDownTimer timer = new CountDownTimer(timeLeft, 1000) { public void onTick(long millisUntilFinished) { updateTimeNotification(machine, NotificationCreator.this, millisUntilFinished); } public void onFinish() { updateTimeNotification(machine, NotificationCreator.this, 0); stopTimer(id, machine); } }.start(); timers.put(id, timer); id++; return START_REDELIVER_INTENT; }
Source:
<code>public static int ascii(String s) { <START> return s.length() == 0 <END> ? 0 : s.substring(0, 1).getBytes(StandardCharsets.UTF_8)[0]; }</code><technical_language>Is prefers string.isEmpty() string.length() > 0</technical_language>

Target:
public static int ascii(String s) { return s.isEmpty() ? 0 : s.codePointAt(0); }
Source:
<code><START> default Collection<Container> addContainers(String accountName, Collection<Container> containers) { <END> throw new UnsupportedOperationException("This method is not supported"); }</code><technical_language>I methods throw exceptions (might need create one). return false, impl throw IllegalStateException failure feel right</technical_language>

Target:
default Collection<Container> addContainers(String accountName, Collection<Container> containers) throws AccountServiceException { throw new UnsupportedOperationException("This method is not supported"); }