auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private static void setupLogging() { Logging logging = Logging.initialize(); logging.setLevel("org.apache.parquet.hadoop", WARN); logging.setLevel("parquet.hadoop", WARN); <START> logging.setLevel("org.glassfish.jersey.internal.inject.Providers", ERROR); <END> logging.setLevel("com.facebook.presto.server.PluginManager", WARN); logging.setLevel("io.airlift.bootstrap.LifeCycleManager", WARN); logging.setLevel("com.facebook.presto.security.AccessControlManager", WARN); logging.setLevel("org.eclipse.jetty.server.handler.ContextHandler", WARN); logging.setLevel("org.eclipse.jetty.server.AbstractConnector", WARN); }</code><technical_language>perhaps, arrange lines in alphabetical order: logging.setLevel("com.facebook.presto.security.AccessControlManager", WARN); logging.setLevel("com.facebook.presto.server.PluginManager", WARN); logging.setLevel("io.airlift.bootstrap.LifeCycleManager", WARN); logging.setLevel("org.apache.parquet.hadoop", WARN); logging.setLevel("org.eclipse.jetty.server.handler.ContextHandler", WARN); logging.setLevel("org.eclipse.jetty.server.AbstractConnector", WARN); logging.setLevel("org.glassfish.jersey.internal.inject.Providers", ERROR); logging.setLevel("parquet.hadoop", WARN); logging.setLevel("parquet.hadoop", WARN);</technical_language>

Target:
private static void setupLogging() { Logging logging = Logging.initialize(); logging.setLevel("com.facebook.presto.security.AccessControlManager", WARN); logging.setLevel("com.facebook.presto.server.PluginManager", WARN); logging.setLevel("io.airlift.bootstrap.LifeCycleManager", WARN); logging.setLevel("org.apache.parquet.hadoop", WARN); logging.setLevel("org.eclipse.jetty.server.handler.ContextHandler", WARN); logging.setLevel("org.eclipse.jetty.server.AbstractConnector", WARN); logging.setLevel("org.glassfish.jersey.internal.inject.Providers", ERROR); logging.setLevel("parquet.hadoop", WARN); }
Source:
<code><START> public Integer getNumExecutors() { <END> return numExecutors; }</code><technical_language>I null is acceptable here, primitives</technical_language>

Target:
public int getNumExecutors() { return numExecutors; }
Source:
<code>public static TableRow row(String table) throws SQLException { <START> return new TableRow(canonicalize(table), getColumnNames(null, table)); <END> }</code><technical_language>create a getColumnNames(table) method in this class. This change is unnecessary, other method</technical_language>

Target:
public static TableRow row(String table) throws SQLException { return new TableRow(canonicalize(table), getColumnNames(table)); }
Source:
<code>public void onLASTeamChange(OnChangedComponent event, EntityRef characterEntity, LASTeamComponent lasTeamComponent) { if (characterEntity.hasComponent(VisualCharacterComponent.class)) { VisualCharacterComponent visualCharacterComponent = characterEntity.getComponent(VisualCharacterComponent.class); EntityRef visualCharacter = visualCharacterComponent.visualCharacter; if (visualCharacter != EntityRef.NULL && visualCharacter.hasComponent(SkeletalMeshComponent.class)) { SkeletalMeshComponent skeletalMeshComponent = visualCharacter.getComponent(SkeletalMeshComponent.class); <START> if (lasTeamComponent.team.equals(LASUtils.BLACK_TEAM)) { <END> skeletalMeshComponent.material = Assets.getMaterial(LASUtils.BLACK_PAWN_SKIN).get(); } else if (lasTeamComponent.team.equals(LASUtils.RED_TEAM)) { skeletalMeshComponent.material = Assets.getMaterial(LASUtils.RED_PAWN_SKIN).get(); } visualCharacter.saveComponent(skeletalMeshComponent); } } }</code><technical_language>Instead of logic for team check skeletal mesh update, do similar done in case of Health HUD? i.e. create a method in LASUtils give respective Pawn skin checking team, in- <LINK_0></technical_language>

Target:
public void onLASTeamChange(OnChangedComponent event, EntityRef characterEntity, LASTeamComponent lasTeamComponent) { if (characterEntity.hasComponent(VisualCharacterComponent.class)) { VisualCharacterComponent visualCharacterComponent = characterEntity.getComponent(VisualCharacterComponent.class); EntityRef visualCharacter = visualCharacterComponent.visualCharacter; if (visualCharacter != EntityRef.NULL && visualCharacter.hasComponent(SkeletalMeshComponent.class)) { SkeletalMeshComponent skeletalMeshComponent = visualCharacter.getComponent(SkeletalMeshComponent.class); skeletalMeshComponent.material = Assets.getMaterial(LASUtils.getPlayerSkin(lasTeamComponent.team)).get(); visualCharacter.saveComponent(skeletalMeshComponent); } } }
Source:
<code>public int readInteger() { <START> final byte[] intbuff = new byte[4]; <END> try { mCompressedStream.read(intbuff, 0, 4); } catch (IOException ioe) { throw(new RuntimeIOException("Read error in CSI compressed stream: " + ioe)); } return((intbuff[0] & 0xFF) | ((intbuff[1] & 0xFF) << 8) | ((intbuff[2] & 0xFF) << 16) | ((intbuff[3] & 0xFF) << 24)); }</code><technical_language>Allocating a new byte[] for integer read is super inefficient. sense reuse buffer. This method suffers problem read guaranteeing a definite number of bytes</technical_language>

Target:
public int readInteger() { return binaryCodec.readInt(); }
Source:
<code>protected List<PermissionNode> createPermissions() { List<PermissionNode> permissions = new ArrayList<>(); PermissionLeafNode node1 = createPermissionLeafNode(RepositoryFeatures.CONFIGURE_REPOSITORY, i18n.ConfigureRepositories(), i18n.ConfigureRepositoriesHelp()); PermissionLeafNode node2 = createPermissionLeafNode(EDIT_SOURCES, i18n.DataModelerEditSources(), i18n.DataModelerEditSourcesHelp()); PermissionLeafNode node3 = createPermissionLeafNode(PLANNER_AVAILABLE, i18n.ResourcePlanner(), i18n.ResourcePlannerHelp()); PermissionLeafNode node4 = createPermissionLeafNode(JAR_DOWNLOAD, i18n.MavenRepositoryPagedJarTableDownloadJar(), i18n.MavenRepositoryPagedJarTableDownloadJarHelp()); PermissionLeafNode node5 = createPermissionLeafNode(EDIT_GLOBAL_PREFERENCES, i18n.EditGlobalPreferences(), i18n.EditGlobalPreferencesHelp()); PermissionLeafNode node6 = createPermissionLeafNode(EDIT_GUIDED_DECISION_TABLE, <START> i18n.EditGuidedDecisionTable(), <END> i18n.EditGuidedDecisionTableHelp()); permissions.add(node1); permissions.add(node2); permissions.add(node3); permissions.add(node4); permissions.add(node5); permissions.add(node6); return permissions; }</code><technical_language>i18n's refer more explicitly **columns** too</technical_language>

Target:
protected List<PermissionNode> createPermissions() { List<PermissionNode> permissions = new ArrayList<>(); PermissionLeafNode node1 = createPermissionLeafNode(RepositoryFeatures.CONFIGURE_REPOSITORY, i18n.ConfigureRepositories(), i18n.ConfigureRepositoriesHelp()); PermissionLeafNode node2 = createPermissionLeafNode(EDIT_SOURCES, i18n.DataModelerEditSources(), i18n.DataModelerEditSourcesHelp()); PermissionLeafNode node3 = createPermissionLeafNode(PLANNER_AVAILABLE, i18n.ResourcePlanner(), i18n.ResourcePlannerHelp()); PermissionLeafNode node4 = createPermissionLeafNode(JAR_DOWNLOAD, i18n.MavenRepositoryPagedJarTableDownloadJar(), i18n.MavenRepositoryPagedJarTableDownloadJarHelp()); PermissionLeafNode node5 = createPermissionLeafNode(EDIT_GLOBAL_PREFERENCES, i18n.EditGlobalPreferences(), i18n.EditGlobalPreferencesHelp()); PermissionLeafNode node6 = createPermissionLeafNode(GUIDED_DECISION_TABLE_EDIT_COLUMNS, i18n.GuidedDecisionTableEditColumns(), i18n.GuidedDecisionTableEditColumnsHelp()); permissions.add(node1); permissions.add(node2); permissions.add(node3); permissions.add(node4); permissions.add(node5); permissions.add(node6); return permissions; }
Source:
<code>public void onClickedAd(String zoneId) { if(_isVideo()) { this.mediationRewardedVideoAdListener.onAdClicked(rewardedAdapter); this.mediationRewardedVideoAdListener.onAdLeftApplication(rewardedAdapter); } else if (_isInterstitial()) { <START> this.mediationInterstitialListener.onAdClicked(interstitialAdapter); <END> } }</code><technical_language>Please add onAdLeftApplication callback for Interstitial Ads</technical_language>

Target:
public void onClickedAd(String zoneId) { if(_isVideo()) { this.mediationRewardedVideoAdListener.onAdClicked(rewardedAdapter); this.mediationRewardedVideoAdListener.onAdLeftApplication(rewardedAdapter); } else if (_isInterstitial()) { this.mediationInterstitialListener.onAdClicked(interstitialAdapter); this.mediationInterstitialListener.onAdLeftApplication(interstitialAdapter); } }
Source:
<code>private void importCertificate() { Frontend.getInstance().runAction(VdcActionType.ImportProviderCertificate, <START> importCertificatesParams(), <END> new IFrontendActionAsyncCallback() { @Override public void executed(FrontendActionAsyncResult result) { testProviderConnectivity(); } }, null, false); sourceListModel.setConfirmWindow(null); }</code><technical_language>importCertificatesParams -> importCertificateParams</technical_language>

Target:
private void importCertificate() { Frontend.getInstance().runAction(VdcActionType.ImportProviderCertificate, importCertificateParams(), new IFrontendActionAsyncCallback() { @Override public void executed(FrontendActionAsyncResult result) { testProviderConnectivity(); } }, null, false); sourceListModel.setConfirmWindow(null); }
Source:
<code>private long verifyIndexTable(String tableName, String indexName, Connection conn) throws Exception { IndexToolIT.runIndexTool(true, false, "", tableName, indexName, null, 0, IndexTool.IndexVerifyType.ONLY); long actualRowCount = IndexScrutiny.scrutinizeIndex(conn, tableName, indexName); IndexToolIT.runIndexTool(true, false, "", tableName, indexName, null, 0, IndexTool.IndexVerifyType.ONLY); IndexToolIT.runIndexTool(true, false, "", tableName, indexName, null, 0, IndexTool.IndexVerifyType.AFTER); PTable pIndexTable = PhoenixRuntime.getTable(conn, indexName); TableName physicalTableName = <START> org.apache.hadoop.hbase.TableName.valueOf(pIndexTable.getPhysicalName().getBytes()); <END> PhoenixConnection pConn = conn.unwrap(PhoenixConnection.class); try (Admin admin = pConn.getQueryServices().getAdmin()) { admin.disableTable(physicalTableName); admin.truncateTable(physicalTableName, true); } IndexToolIT.runIndexTool(true, false, "", tableName, indexName, null, 0, IndexTool.IndexVerifyType.AFTER); long actualRowCountAfterCompaction = IndexScrutiny.scrutinizeIndex(conn, tableName, indexName); assertEquals(actualRowCount, actualRowCountAfterCompaction); return actualRowCount; }</code><technical_language>nit: fully qualify TableName imported</technical_language>

Target:
private long verifyIndexTable(String tableName, String indexName, Connection conn) throws Exception { IndexToolIT.runIndexTool(true, false, "", tableName, indexName, null, 0, IndexTool.IndexVerifyType.ONLY); long actualRowCount = IndexScrutiny.scrutinizeIndex(conn, tableName, indexName); IndexToolIT.runIndexTool(true, false, "", tableName, indexName, null, 0, IndexTool.IndexVerifyType.ONLY); IndexToolIT.runIndexTool(true, false, "", tableName, indexName, null, 0, IndexTool.IndexVerifyType.AFTER); PTable pIndexTable = PhoenixRuntime.getTable(conn, indexName); TableName physicalTableName = TableName.valueOf(pIndexTable.getPhysicalName().getBytes()); PhoenixConnection pConn = conn.unwrap(PhoenixConnection.class); try (Admin admin = pConn.getQueryServices().getAdmin()) { admin.disableTable(physicalTableName); admin.truncateTable(physicalTableName, true); } IndexToolIT.runIndexTool(true, false, "", tableName, indexName, null, 0, IndexTool.IndexVerifyType.AFTER); long actualRowCountAfterCompaction = IndexScrutiny.scrutinizeIndex(conn, tableName, indexName); assertEquals(actualRowCount, actualRowCountAfterCompaction); return actualRowCount; }
Source:
<code>TypeArgumentConstraintLocation(ConstraintLocation delegate, TypeVariable<?> typeParameter, Type typeOfAnnotatedElement) { this.delegate = delegate; this.typeParameter = typeParameter; this.typeForValidatorResolution = ReflectionHelper.boxedType( typeOfAnnotatedElement ); this.containerType = delegate.getTypeForValidatorResolution(); <START> ConstraintLocation outterDelegate = delegate; <END> while ( outterDelegate instanceof TypeArgumentConstraintLocation ) { outterDelegate = ( (TypeArgumentConstraintLocation) outterDelegate ).delegate; } this.outterDelegate = outterDelegate; }</code><technical_language>outter=outer</technical_language>

Target:
TypeArgumentConstraintLocation(ConstraintLocation delegate, TypeVariable<?> typeParameter, Type typeOfAnnotatedElement) { this.delegate = delegate; this.typeParameter = typeParameter; this.typeForValidatorResolution = ReflectionHelper.boxedType( typeOfAnnotatedElement ); this.containerType = delegate.getTypeForValidatorResolution(); ConstraintLocation outerDelegate = delegate; while ( outerDelegate instanceof TypeArgumentConstraintLocation ) { outerDelegate = ( (TypeArgumentConstraintLocation) outerDelegate ).delegate; } this.outerDelegate = outerDelegate; }
Source:
<code>void performCustomMigrationForMultiple() { ProjectId id1 = createId(1); ProjectId id2 = createId(2); ProjectId id3 = createId(3); TestProjectionRepository repository = repository(); TestProjection projection1 = new TestProjection(id1); TestProjection projection2 = new TestProjection(id2); TestProjection projection3 = new TestProjection(id3); repository.store(projection1); repository.store(projection2); repository.store(projection3); TargetFilters filters = targetFilters(Project.Column.name(), SetTestProjectionName.NEW_NAME); Iterator<TestProjection> found = repository.find(filters, ResponseFormat.getDefaultInstance()); assertThat(found.hasNext()).isFalse(); repository.applyMigration(ImmutableSet.of(id1, id2), new SetTestProjectionName()); Iterator<TestProjection> foundAfterMigration = repository.find(filters, ResponseFormat.getDefaultInstance()); ImmutableList<TestProjection> results = ImmutableList.copyOf(foundAfterMigration); assertThat(results).hasSize(2); <START> assertThat(results) .comparingElementsUsing(idCorrespondence()) .containsExactly(id1, id2); <END> }</code><technical_language>test states well</technical_language>

Target:
void performCustomMigrationForMultiple() { ProjectId id1 = createId(1); ProjectId id2 = createId(2); ProjectId id3 = createId(3); TestProjectionRepository repository = repository(); TestProjection projection1 = new TestProjection(id1); TestProjection projection2 = new TestProjection(id2); TestProjection projection3 = new TestProjection(id3); repository.store(projection1); repository.store(projection2); repository.store(projection3); TargetFilters filters = targetFilters(Project.Column.name(), SetTestProjectionName.NEW_NAME); Iterator<TestProjection> found = repository.find(filters, ResponseFormat.getDefaultInstance()); assertThat(found.hasNext()).isFalse(); repository.applyMigration(ImmutableSet.of(id1, id2), new SetTestProjectionName()); Iterator<TestProjection> foundAfterMigration = repository.find(filters, ResponseFormat.getDefaultInstance()); ImmutableList<TestProjection> results = ImmutableList.copyOf(foundAfterMigration); Project expectedState1 = projection1 .state() .toBuilder() .setName(SetTestProjectionName.NEW_NAME) .setIdString(projection1.getIdString()) .build(); Project expectedState2 = projection2 .state() .toBuilder() .setName(SetTestProjectionName.NEW_NAME) .setIdString(projection2.getIdString()) .build(); assertThat(results).hasSize(2); assertThat(results) .comparingElementsUsing(entityState()) .containsExactly(expectedState1, expectedState2); }
Source:
<code>private void checkCondition(ExpressionTree tree) { SymbolicValue result = evaluator.evaluate(new ExecutionState(), tree); if (result.equals(SymbolicValue.BOOLEAN_FALSE)) { context.addIssue(tree, this, "Change this condition so that it does not always evaluate to \"false\""); } else if (result.equals(SymbolicValue.BOOLEAN_TRUE)) { context.addIssue(tree, this, "Change this condition so that it does not always evaluate to \"true\""); <START> } <END> }</code><technical_language>small factorization here</technical_language>

Target:
private void checkCondition(ExpressionTree tree) { SymbolicBooleanConstraint result = evaluator.evaluate(new ExecutionState(), tree); if (result == SymbolicBooleanConstraint.FALSE) { raiseIssue(tree, "false"); } else if (result == SymbolicBooleanConstraint.TRUE) { raiseIssue(tree, "true"); } }
Source:
<code>public double getMeanJobSubmittingPeriod() { return executeReadOnlyTransaction(session -> { Query query = session.getNamedQuery("getMeanJobSubmittingPeriod"); Object[] result = (Object[]) query.uniqueResult(); Long count = (Long) result[0]; Long minSubmittedTime = (Long) result[1]; Long maxSubmittedTime = (Long) result[2]; <START> if (count < 2) { <END> return 0d; } else { return (maxSubmittedTime - minSubmittedTime) / (double) (count - 1); } }); }</code><technical_language>Ideally return EMPTY JobData object, caller need handle null</technical_language>

Target:
public double getMeanJobSubmittingPeriod() { return executeReadOnlyTransaction(session -> { Query query = session.getNamedQuery("getMeanJobSubmittingPeriod"); Object[] result = (Object[]) query.uniqueResult(); Long count = (Long) result[0]; Long minSubmittedTime = (Long) result[1]; Long maxSubmittedTime = (Long) result[2]; if (count < 2) { return 0.0d; } else { return (maxSubmittedTime - minSubmittedTime) / (double) (count - 1); } }); }
Source:
<code>protected boolean isClaimExists(Connection dbConnection, String uri) throws UserStoreException { int claimId = getClaimId(dbConnection, uri); if (claimId != -1) { return true; } else { return false; <START> } <END> }</code><technical_language>simplified "return claimId != -1;"</technical_language>

Target:
protected boolean isClaimExists(Connection dbConnection, String uri) throws UserStoreException { int claimId = getClaimId(dbConnection, uri); return claimId != -1; }
Source:
<code>public Void visit(Attribute entry, Void _) { if (Constants.GENERATED_LOCATION.equals(entry.getLocation())) return null; if (context.isParsingTag(entry.getKey())) return null; if (entry.getKey().equals(Attribute.keyOf("latex"))) return null; <START> if (entry.getKey().equals(Attribute.keyOf("html"))) { <END> return null; } if (firstAttribute) { result.append(" [ <span class =\"attribute\"> "); firstAttribute = false; } else { result.append(", "); } result.append(makeGreek(Attribute.toString(entry.getKey()))); String value = makeGreek(entry.getValue().toString()); if (!value.isEmpty()) result.append("(" + value + ")"); return null; }</code><technical_language>ifs merged || also, this return null. I guess null encodes not-visited, ugly. get AST refactoring</technical_language>

Target:
public Void visit(Attribute entry, Void _) { if (Constants.GENERATED_LOCATION.equals(entry.getLocation())) return null; if (context.isParsingTag(entry.getKey())) return null; if (entry.getKey().equals(Attribute.keyOf("latex")) || entry.getKey().equals(Attribute.keyOf("html"))) { return null; } if (firstAttribute) { result.append(" [ <span class =\"attribute\"> "); firstAttribute = false; } else { result.append(", "); } result.append(makeGreek(entry.getKey().toString())); String value = makeGreek(entry.getValue().toString()); if (!value.isEmpty()) result.append("(" + value + ")"); return null; }
Source:
<code>public Page getNextPage() { try { batchId++; int batchSize = recordReader.nextBatch(); if (batchSize <= 0) { close(); return null; } Block[] blocks = new Block[hiveColumnIndexes.length]; for (int fieldId = 0; fieldId < blocks.length; fieldId++) { Type type = types.get(fieldId); if (constantBlocks[fieldId] != null) { blocks[fieldId] = constantBlocks[fieldId].getRegion(0, batchSize); } else { blocks[fieldId] = new LazyBlock(batchSize, new OrcBlockLoader(hiveColumnIndexes[fieldId], type)); } } return new Page(batchSize, blocks); } catch (PrestoException e) { closeWithSuppression(e); throw e; } catch (IOException | RuntimeException e) { closeWithSuppression(e); <START> if (e instanceof OrcCorruptionException) { <END> throw new PrestoException(HIVE_BAD_DATA, e); } throw new PrestoException(HIVE_CURSOR_ERROR, e); } }</code><technical_language>java catch (PrestoException e) { closeWithSuppression(e); throw e; } catch (OrcCorruptionException e) { closeWithSuppression(e); throw new PrestoException(HIVE_BAD_DATA, e); } catch (IOException | RuntimeException e) { closeWithSuppression(e); throw new PrestoException(HIVE_CURSOR_ERROR, e); }</technical_language>

Target:
public Page getNextPage() { try { batchId++; int batchSize = recordReader.nextBatch(); if (batchSize <= 0) { close(); return null; } Block[] blocks = new Block[hiveColumnIndexes.length]; for (int fieldId = 0; fieldId < blocks.length; fieldId++) { Type type = types.get(fieldId); if (constantBlocks[fieldId] != null) { blocks[fieldId] = constantBlocks[fieldId].getRegion(0, batchSize); } else { blocks[fieldId] = new LazyBlock(batchSize, new OrcBlockLoader(hiveColumnIndexes[fieldId], type)); } } return new Page(batchSize, blocks); } catch (PrestoException e) { closeWithSuppression(e); throw e; } catch (OrcCorruptionException e) { closeWithSuppression(e); throw new PrestoException(HIVE_BAD_DATA, e); } catch (IOException | RuntimeException e) { closeWithSuppression(e); throw new PrestoException(HIVE_CURSOR_ERROR, e); } }
Source:
<code>public ScenarioForceTemplate(int forceAlignment, int generationMethod, double forceMultiplier, List<Integer> deploymentZones, int destinationZone, int retreatThreshold, int allowedUnitType) { this.forceAlignment = forceAlignment; this.generationMethod = generationMethod; this.forceMultiplier = forceMultiplier; this.deploymentZones = new ArrayList<>(); this.destinationZone = destinationZone; this.retreatThreshold = retreatThreshold; this.allowedUnitType = allowedUnitType; <START> deploymentZones = new ArrayList<>(); <END> Collections.copy(this.deploymentZones, deploymentZones); }</code><technical_language>not: this.deploymentZones = new ArrayList<>(deploymentZones);</technical_language>

Target:
public ScenarioForceTemplate(int forceAlignment, int generationMethod, double forceMultiplier, List<Integer> deploymentZones, int destinationZone, int retreatThreshold, int allowedUnitType) { this.forceAlignment = forceAlignment; this.generationMethod = generationMethod; this.forceMultiplier = forceMultiplier; this.deploymentZones = new ArrayList<>(); this.destinationZone = destinationZone; this.retreatThreshold = retreatThreshold; this.allowedUnitType = allowedUnitType; this.deploymentZones = deploymentZones == null ? new ArrayList<>() : new ArrayList<>(deploymentZones); }
Source:
<code>public void registerCatalogFunction( UnresolvedIdentifier unresolvedIdentifier, Class<? extends UserDefinedFunction> functionClass, boolean ignoreIfExists) { try { UserDefinedFunctionHelper.validateClass(functionClass); } catch (Throwable t) { throw new ValidationException( String.format( "Could not register catalog function '%s' due to implementation errors.", catalogManager.qualifyIdentifier(unresolvedIdentifier).asSummaryString()), t); } <START> final CatalogFunction catalogFunction = new CatalogFunctionImpl( <END> functionClass.getName(), FunctionLanguage.JAVA); registerCatalogFunction(unresolvedIdentifier, catalogFunction, ignoreIfExists); }</code><technical_language>explain aim of this change? is difference changed logic original logic</technical_language>

Target:
public void registerCatalogFunction( UnresolvedIdentifier unresolvedIdentifier, Class<? extends UserDefinedFunction> functionClass, boolean ignoreIfExists) { final ObjectIdentifier identifier = catalogManager.qualifyIdentifier(unresolvedIdentifier); final ObjectIdentifier normalizedIdentifier = FunctionIdentifier.normalizeObjectIdentifier(identifier); try { UserDefinedFunctionHelper.validateClass(functionClass); } catch (Throwable t) { throw new ValidationException( String.format( "Could not register catalog function '%s' due to implementation errors.", identifier.asSummaryString()), t); } final Catalog catalog = catalogManager.getCatalog(normalizedIdentifier.getCatalogName()) .orElseThrow(IllegalStateException::new); final ObjectPath path = identifier.toObjectPath(); if (tempCatalogFunctions.containsKey(normalizedIdentifier)) { if (ignoreIfExists) { return; } throw new ValidationException( String.format( "Could not register catalog function. A temporary function '%s' does already exist. " + "Please drop the temporary function first.", identifier.asSummaryString())); } if (catalog.functionExists(path)) { if (ignoreIfExists) { return; } throw new ValidationException( String.format( "Could not register catalog function. A function '%s' does already exist.", identifier.asSummaryString())); } final CatalogFunction catalogFunction = new CatalogFunctionImpl( functionClass.getName(), FunctionLanguage.JAVA); try { catalog.createFunction(path, catalogFunction, ignoreIfExists); } catch (Throwable t) { throw new TableException( String.format( "Could not register catalog function '%s'.", identifier.asSummaryString()), t); } }
Source:
<code>public void sanitizeForSaving() { <START> this.courseId = Sanitizer.sanitizeTitle(courseId); <END> this.feedbackQuestionId = Sanitizer.sanitizeTitle(feedbackQuestionId); this.giverEmail = Sanitizer.sanitizeEmail(giverEmail); this.giverSection = Sanitizer.sanitizeTitle(giverSection); this.recipientEmail = Sanitizer.sanitizeEmail(recipientEmail); this.recipientSection = Sanitizer.sanitizeTitle(recipientSection); }</code><technical_language>So, is policy here? Sanitize new attributes? In case, is Id sanitized</technical_language>

Target:
public void sanitizeForSaving() { }
Source:
<code>ImmutableMap<TypeName, FieldSpec> createFields(List<Property> properties) { ImmutableMap.Builder<TypeName, FieldSpec> fields = ImmutableMap.builder(); ClassName jsonAdapter = ClassName.get(TypeAdapter.class); Set<TypeName> seenTypes = Sets.newHashSet(); NameAllocator nameAllocator = new NameAllocator(); for (Property property : properties) { <START> if (property.shouldNotDeserialize() && !property.shouldNotSerialize()) { <END> continue; } TypeName type = property.type.isPrimitive() ? property.type.box() : property.type; ParameterizedTypeName adp = ParameterizedTypeName.get(jsonAdapter, type); if (!seenTypes.contains(property.type)) { fields.put(property.type, FieldSpec.builder(adp, nameAllocator.newName(simpleName(property.type)) + "_adapter", PRIVATE, VOLATILE) .build()); seenTypes.add(property.type); } } return fields.build(); }</code><technical_language>this property.shouldNotSerialize() (drop !)</technical_language>

Target:
ImmutableMap<TypeName, FieldSpec> createFields(List<Property> properties) { ImmutableMap.Builder<TypeName, FieldSpec> fields = ImmutableMap.builder(); ClassName jsonAdapter = ClassName.get(TypeAdapter.class); Set<TypeName> seenTypes = Sets.newHashSet(); NameAllocator nameAllocator = new NameAllocator(); for (Property property : properties) { if (property.shouldNotDeserialize() && property.shouldNotSerialize()) { continue; } TypeName type = property.type.isPrimitive() ? property.type.box() : property.type; ParameterizedTypeName adp = ParameterizedTypeName.get(jsonAdapter, type); if (!seenTypes.contains(property.type)) { fields.put(property.type, FieldSpec.builder(adp, nameAllocator.newName(simpleName(property.type)) + "_adapter", PRIVATE, VOLATILE) .build()); seenTypes.add(property.type); } } return fields.build(); }
Source:
<code>public boolean equals(Object obj) { if (this == obj) { return true; } if(obj == null) { return false; } if(this.getClass() != obj.getClass()) { return false; } try { StringLiteral other = (StringLiteral) obj; <START> return this.equals(other); <END> } catch(ClassCastException e) { return false; } }</code><technical_language>Instead of this, check if String values equal</technical_language>

Target:
public boolean equals(Object obj) { if (this == obj) { return true; } if(obj == null) { return false; } if(this.getClass() != obj.getClass()) { return false; } try { StringLiteral other = (StringLiteral) obj; return this.getValue().equals(other.getValue()); } catch(ClassCastException e) { return false; } }
Source:
<code>private void collectConfigurationParameters(boolean isUse) { addContextParams(EHadoopParamName.DataBricksEndpoint, isUse); <START> addContextParams(EHadoopParamName.DataBricksCloudProvider, isUse); <END> addContextParams(EHadoopParamName.DataBricksClusterId, isUse); addContextParams(EHadoopParamName.DataBricksToken, isUse); addContextParams(EHadoopParamName.DataBricksDBFSDepFolder, isUse); }</code><technical_language>If I remember well, add context support for combo parameters</technical_language>

Target:
private void collectConfigurationParameters(boolean isUse) { addContextParams(EHadoopParamName.DataBricksEndpoint, isUse); addContextParams(EHadoopParamName.DataBricksClusterId, isUse); addContextParams(EHadoopParamName.DataBricksToken, isUse); addContextParams(EHadoopParamName.DataBricksDBFSDepFolder, isUse); }
Source:
<code>private void postEvents(List<Event> events) { CloseableHttpResponse response = null; Gson gson = new Gson(); String json = gson.toJson(events); HttpPost request = config.postRequest("/api/events/bulk"); StringEntity entity = new StringEntity(json, "UTF-8"); entity.setContentType("application/json"); request.setEntity(entity); try { response = client.execute(request); int status = response.getStatusLine().getStatusCode(); if (status != HttpStatus.SC_OK) { if (status == HttpStatus.SC_UNAUTHORIZED) { <START> logger.info("Invalid API key"); <END> } else { logger.error("Unexpected status code: " + status); } } } catch (IOException e) { logger.error("Unhandled exception in LaunchDarkly client", e); } finally { try { if (response != null) response.close(); } catch (IOException e) { logger.error("Unhandled exception in LaunchDarkly client", e); } } }</code><technical_language>this a WARN level</technical_language>

Target:
private void postEvents(List<Event> events) { CloseableHttpResponse response = null; Gson gson = new Gson(); String json = gson.toJson(events); HttpPost request = config.postRequest("/api/events/bulk"); StringEntity entity = new StringEntity(json, "UTF-8"); entity.setContentType("application/json"); request.setEntity(entity); try { response = client.execute(request); int status = response.getStatusLine().getStatusCode(); if (status != HttpStatus.SC_OK) { if (status == HttpStatus.SC_UNAUTHORIZED) { logger.error("Invalid API key"); } else { logger.error("Unexpected status code: " + status); } } } catch (IOException e) { logger.error("Unhandled exception in LaunchDarkly client", e); } finally { try { if (response != null) response.close(); } catch (IOException e) { logger.error("Unhandled exception in LaunchDarkly client", e); } } }
Source:
<code>public TtlTimeProvider(Configuration conf) { <START> this.authoritativeDirTtl = conf.getLong(METADATASTORE_METADATA_TTL, <END> DEFAULT_METADATASTORE_METADATA_TTL); }</code><technical_language>getTimeDuration()</technical_language>

Target:
public TtlTimeProvider(Configuration conf) { this.authoritativeDirTtl = conf.getTimeDuration(METADATASTORE_METADATA_TTL, DEFAULT_METADATASTORE_METADATA_TTL, TimeUnit.SECONDS); }
Source:
<code>private ProjectConfig getProject(String workspaceId, String projectName) throws Exception { return requestFactory .fromUrl(workspaceAgentApiEndpointUrlProvider.get(workspaceId) + "project/" + projectName) .useGetMethod() <START> .setAuthorizationHeader(machineServiceClient.getMachineApiToken(workspaceId)) <END> .request() .asDto(ProjectConfigDto.class); }</code><technical_language>added prefix BEARER_TOKEN_PREFIX + well</technical_language>

Target:
private ProjectConfig getProject(String workspaceId, String projectName) throws Exception { return requestFactory .fromUrl(workspaceAgentApiEndpointUrlProvider.get(workspaceId) + "project/" + projectName) .useGetMethod() .setAuthorizationHeader( BEARER_TOKEN_PREFIX + machineServiceClient.getMachineApiToken(workspaceId)) .request() .asDto(ProjectConfigDto.class); }
Source:
<code>public void testGetOptionTypeWithoutResults() { prepareAndInitSession(); prepareAndInitSession(); List<String> checkedVariables = Arrays.asList("not-existing1", "not-existing2", "not-existing3", "and_so_on"); String type; <START> for (int i = 0; i < checkedVariables.size(); i++) { <END> type = searchService.getOptionType(checkedVariables.get(i)); assertNotEquals(mockedVariableTypes, type); } }</code><technical_language>replaced foreach loop</technical_language>

Target:
public void testGetOptionTypeWithoutResults() { prepareAndInitSession(); prepareAndInitSession(); List<String> checkedVariables = Arrays.asList("not-existing1", "not-existing2", "not-existing3", "and_so_on"); checkedVariables.forEach(checkedVariable -> { String type = searchService.getOptionType(checkedVariable); assertNotEquals(mockedVariableTypes, type); }); }
Source:
<code>public void waitForAllLifespanCommitted() { ListenableFuture<?> future = whenAllSucceed(commitFutures).call(() -> null, directExecutor()); try { <START> getFutureValue(future, PrestoException.class); <END> } catch (RuntimeException e) { future.cancel(true); throw e; } }</code><technical_language>Thanks for addressing ;-)</technical_language>

Target:
public void waitForAllLifespanCommitted() { ListenableFuture<Void> future = whenAllSucceed(commitFutures).call(() -> null, directExecutor()); try { future.get(); } catch (InterruptedException e) { future.cancel(true); currentThread().interrupt(); throw new RuntimeException(e); } catch (ExecutionException e) { future.cancel(true); propagateIfPossible(e.getCause(), PrestoException.class); throw new RuntimeException(e.getCause()); } }
Source:
<code>public List<ByteString> parseNextBlock(boolean skipIfStartingOnBoundary) throws IOException { LOG.debug("BlockReader: none left to read, skipping to sync point"); long skipped = skipToNextSyncPoint(); if (skipped <= -1) { LOG.debug("BlockReader: SYNC point eof"); return null; } int blockSize = readInt(); LOG.debug("BlockReader: found sync point, next block has size " + blockSize); if (blockSize < 0) { LOG.debug("ProtobufReader: reading size after sync point eof"); return null; } byte[] byteArray = new byte[blockSize]; IOUtils.readFully(in_, byteArray, 0, blockSize); <START> if (skipIfStartingOnBoundary && skipped == Protobufs.KNOWN_GOOD_POSITION_MARKER.length) { <END> return parseNextBlock(false); } SerializedBlock block = SerializedBlock.parseFrom(byteArray); curBlobs_ = block.getProtoBlobs(); numLeftToReadThisBlock_ = curBlobs_.size(); LOG.debug("ProtobufReader: number in next block is " + numLeftToReadThisBlock_); return curBlobs_; }</code><technical_language>do this? put readFully below</technical_language>

Target:
public List<ByteString> parseNextBlock(boolean skipIfStartingOnBoundary) throws IOException { LOG.debug("BlockReader: none left to read, skipping to sync point"); long skipped = skipToNextSyncPoint(); if (skipped <= -1) { LOG.debug("BlockReader: SYNC point eof"); return null; } int blockSize = readInt(); LOG.debug("BlockReader: found sync point, next block has size " + blockSize); if (blockSize < 0) { LOG.debug("ProtobufReader: reading size after sync point eof"); return null; } if (skipIfStartingOnBoundary && skipped == Protobufs.KNOWN_GOOD_POSITION_MARKER.length) { in_.skip(blockSize); return parseNextBlock(false); } SerializedBlock block = SerializedBlock.parseFrom( new BoundedInputStream(in_, blockSize), blockSize); curBlobs_ = block.getProtoBlobs(); numLeftToReadThisBlock_ = curBlobs_.size(); LOG.debug("ProtobufReader: number in next block is " + numLeftToReadThisBlock_); return curBlobs_; }
Source:
<code>public void execute(final WorkflowExecutor executor, final Context context) { pullRequestWorkflowService.getSettings() .then((Map<String, String> settings) -> { <START> if (!Boolean.parseBoolean(settings.getOrDefault(CHE_PULLREQUEST_GENERATE__REVIEW__FACTORY, "true"))) { <END> executor.done(GenerateReviewFactoryStep.this, context); return; } generateReviewFactory(executor, context); }); }</code><technical_language>I need a map there, inject a property name "che.pullrequest.generate_review_factory"</technical_language>

Target:
public void execute(final WorkflowExecutor executor, final Context context) { pullRequestWorkflowService.shouldGenerateReviewUrl() .then((Boolean shouldGenerateReviewUrl) -> { if (!shouldGenerateReviewUrl) { executor.done(GenerateReviewFactoryStep.this, context); return; } generateReviewFactory(executor, context); }); }
Source:
<code>protected final List<ResultDocument> getSearchResults(ExecutionContext ctx) { <START> return null; <END> }</code><technical_language>return empty list instead</technical_language>

Target:
protected final List<ResultDocument> getSearchResults(ExecutionContext ctx) { throw new IllegalStateException(); }
Source:
<code>private long getHeaderIndex(Predicate<WebElement> headerPredicate) { return Streams.mapWithIndex( getHeadings(), (we, i) -> headerPredicate.test(we) ? i : null) .filter(Objects::nonNull) .findFirst() .orElseThrow(() -> new NoSuchElementException( <START> "No header matches " + headerPredicate)); <END> }</code><technical_language>I realized headerPredicate returns a Java Object representation a String representation of lambda function. Googling suggests is direct stringify error message helpful I thought in current form, I of</technical_language>

Target:
private long getHeaderIndex(Predicate<WebElement> headerPredicate) { return Streams.mapWithIndex( getHeadings(), (webElement, i) -> headerPredicate.test(webElement) ? i : null) .filter(Objects::nonNull) .findFirst() .orElseThrow(() -> new NoSuchElementException("No header found.")); }
Source:
<code>private Schema applyTruncateRule(Schema inputSchema, TruncateRule rule) { Schema.Builder builder = Schema.builder(); for (Column column : inputSchema.getColumns()) { <START> builder.add(column.getName().substring(0, rule.getMaxLength()), column.getType()); <END> } return builder.build(); }</code><technical_language>IndexOutOfBoundsException ignored. substring throws exception if length is max_length</technical_language>

Target:
private Schema applyTruncateRule(Schema inputSchema, TruncateRule rule) { Schema.Builder builder = Schema.builder(); for (Column column : inputSchema.getColumns()) { if (column.getName().length() <= rule.getMaxLength()) { builder.add(column.getName(), column.getType()); } else { try { builder.add(column.getName().substring(0, rule.getMaxLength()), column.getType()); } catch (IndexOutOfBoundsException ex) { logger.error("FATAL unexpected error in \"truncate\" rule: substring failed."); throw new AssertionError("FATAL unexpected error in \"truncate\" rule: substring failed.", ex); } } } return builder.build(); }
Source:
<code>public void setPanelInfo(List<PanelInfo> panelInfo) { this.openPanels = new ArrayList<PanelInfo>(panelInfo); <START> } <END></code><technical_language>need parameterise ArrayList</technical_language>

Target:
public void setPanelInfo(List<PanelInfo> panelInfo) { this.lastSessionPanels = new ArrayList<>(panelInfo); }
Source:
<code>public static String placeholderAPIFormat(final Player player, String input) { if (input == null) { return null; } input = input.replaceAll(" <START> <END> if (papiEnabled) { return PlaceholderAPI.setPlaceholders(player, input); } return input; }</code><technical_language>This needs here, in case PAPI loads EssentialsX - in instance, Essentials receive PAPI's PluginEnableEvent</technical_language>

Target:
public static String placeholderAPIFormat(final Player player, String input) { if (input == null) { return null; } input = input.replaceAll("\\{|\\}", "%"); if(papiEnabled == null){ papiEnabled = Bukkit.getPluginManager().isPluginEnabled("PlaceholderAPI"); } if (papiEnabled) { return PlaceholderAPI.setPlaceholders(player, input); } return input; }
Source:
<code>@Test public void testPushDistinctAggregateIntoJoin() throws Exception { final HepProgram preProgram = new HepProgramBuilder() .addRuleInstance(AggregateProjectMergeRule.INSTANCE) <START> .build(); <END> final HepProgram program = new HepProgramBuilder() .addRuleInstance(AggregateJoinTransposeRule.EXTENDED) .build(); final String sql = "select count(distinct sal) from sales.emp join sales.dept on job = name"; checkPlanUnchanged(new HepPlanner(program), sql); }</code><technical_language>preProgram is used, remove it</technical_language>

Target:
@Test public void testPushDistinctAggregateIntoJoin() { final HepProgram program = new HepProgramBuilder() .addRuleInstance(AggregateJoinTransposeRule.EXTENDED) .build(); final String sql = "select count(distinct sal) from sales.emp join sales.dept on job = name"; checkPlanUnchanged(new HepPlanner(program), sql); }
Source:
<code>public void addAccounts(Collection<Account> accounts, int batchSize) throws SQLException { try { long startTimeMs = System.currentTimeMillis(); PreparedStatement insertStatement = dataAccessor.getPreparedStatement(insertSql, true); int count = 0; for (Account account : accounts) { insertStatement.setString(1, AccountCollectionSerde.accountToJsonNoContainers(account).toString()); insertStatement.setInt(2, account.getSnapshotVersion()); insertStatement.addBatch(); if (++count % batchSize == 0) { insertStatement.executeBatch(); } } insertStatement.executeBatch(); dataAccessor.onSuccess(Write, System.currentTimeMillis() - startTimeMs); } catch (SQLException e) { <START> dataAccessor.onException(e, Write); <END> throw e; } }</code><technical_language>I happen if batch execution succeeds batch fails</technical_language>

Target:
public void addAccounts(Collection<Account> accounts, int batchSize) throws SQLException { try { long startTimeMs = System.currentTimeMillis(); PreparedStatement insertStatement = dataAccessor.getPreparedStatement(insertSql, true); int count = 0; for (Account account : accounts) { insertStatement.setString(1, AccountCollectionSerde.accountToJsonNoContainers(account).toString()); insertStatement.setInt(2, account.getSnapshotVersion()); insertStatement.addBatch(); if (++count % batchSize == 0) { insertStatement.executeBatch(); } } if (accounts.size() % batchSize != 0) { insertStatement.executeBatch(); } dataAccessor.onSuccess(Write, System.currentTimeMillis() - startTimeMs); } catch (SQLException e) { dataAccessor.onException(e, Write); throw e; } }
Source:
<code>public void testMulticastTopicToAnycastQueueBothAddress() throws Exception { String address = "testBoth"; File file = createMessageFile(); int noMessages = 10; Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); connection.start(); createBothTypeAddress(address); <START> Thread export = new Thread(() -> { <END> try { exportMessages("topic://" + address, noMessages, file); } catch (Exception e) { e.printStackTrace(); } }); export.start(); List<Message> messages = new ArrayList<>(noMessages); for (int i = 0; i < noMessages; i++) { messages.add(session.createTextMessage(RandomUtil.randomString())); } TimeUnit.SECONDS.sleep(3); sendMessages(session, getTopicDestination(address), messages); export.join(); importMessages(address, file); List<Message> received = consumeMessages(session, address, noMessages, false); for (int i = 0; i < noMessages; i++) { assertEquals(((TextMessage) messages.get(i)).getText(), ((TextMessage) received.get(i)).getText()); } }</code><technical_language>need do export a new thread></technical_language>

Target:
public void testMulticastTopicToAnycastQueueBothAddress() throws Exception { String address = "testBoth"; String clientId = "test-client-id"; File file = createMessageFile(); Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); createBothTypeAddress(address); exportMessages("topic://" + address, 0, true, clientId, file); connection.start(); List<Message> messages = generateTextMessages(session, getTopicDestination(address)); exportMessages("topic://" + address, TEST_MESSAGE_COUNT, true, clientId, file); importMessages(address, file); checkSentMessages(session, messages, address); }
Source:
<code>public static Optional<SweepProgress> hydrateProgress(Map<SweepProgressTable.SweepProgressRow, byte[]> result) { if (result.isEmpty()) { log.info("No persisted SweepProgress information found. Sweep will choose a new table to sweep."); return Optional.empty(); } try { return Optional.of(OBJECT_MAPPER.readValue(result.get(ROW), ImmutableSweepProgress.class)); } catch (Exception e) { <START> log.warn("Error deserializing SweepProgress object while attempting to load intermittent result."); <END> return Optional.empty(); } }</code><technical_language>mention Sweep choose a new table sweep</technical_language>

Target:
public static Optional<SweepProgress> hydrateProgress(Map<SweepProgressTable.SweepProgressRow, byte[]> result) { if (result.isEmpty()) { log.info("No persisted SweepProgress information found. Sweep will choose a new table to sweep."); return Optional.empty(); } try { return Optional.of(OBJECT_MAPPER.readValue(result.get(ROW), ImmutableSweepProgress.class)); } catch (Exception e) { log.warn("Error deserializing SweepProgress object while attempting to load intermittent result. Sweep " + "will choose a new table to sweep."); return Optional.empty(); } }
Source:
<code>public void testDensification() throws Exception { CoordinateReferenceSystem utm32n = CRS.decode("EPSG:32632", true); ReferencedEnvelope wgs84Envelope = new ReferencedEnvelope(-190, 60, -90, 45, WGS84); ProjectionHandler handler = ProjectionHandlerFinder.getHandler(wgs84Envelope, WGS84, true); Geometry line = gf.createLineString( new Coordinate[] {new Coordinate(40, 45), new Coordinate(40, 88)}); LineString notDensified = (LineString) handler.preProcess(line); <START> assertTrue(notDensified.getCoordinates().length == 2); <END> Map params = new HashMap(); params.put("advancedProjectionDensify", 1.0); handler = ProjectionHandlerFinder.getHandler(wgs84Envelope, WGS84, true, params); LineString densified = (LineString) handler.preProcess(line); assertFalse(densified.getCoordinates().length == 2); }</code><technical_language>assertEquals please :-)</technical_language>

Target:
public void testDensification() throws Exception { CoordinateReferenceSystem utm32n = CRS.decode("EPSG:32632", true); ReferencedEnvelope wgs84Envelope = new ReferencedEnvelope(-190, 60, -90, 45, WGS84); ProjectionHandler handler = ProjectionHandlerFinder.getHandler(wgs84Envelope, WGS84, true); Geometry line = gf.createLineString( new Coordinate[] {new Coordinate(40, 45), new Coordinate(40, 88)}); LineString notDensified = (LineString) handler.preProcess(line); assertEquals(2, notDensified.getCoordinates().length); Map params = new HashMap(); params.put(ProjectionHandler.ADVANCED_PROJECTION_DENSIFY, 1.0); handler = ProjectionHandlerFinder.getHandler(wgs84Envelope, WGS84, true, params); LineString densified = (LineString) handler.preProcess(line); assertEquals(45, densified.getCoordinates().length); }
Source:
<code>private void pauseBeforeRetry(int retries, HttpResponse httpResponse, long timeElapsed) throws RestException { long delay = -1; long timeElapsedLeft = maxElapsedMillis - timeElapsed; if (backoffStrategy != null) { delay = Math.min(this.backoffStrategy.getDelayMillis(retries), timeElapsedLeft); } else if (httpResponse != null && httpResponse.getStatusLine().getStatusCode() == 429) { delay = get429DelayMillis(httpResponse); if (!shouldRetry(retries, timeElapsed + delay)) { <START> throw new RestException("HTTP 429: Too Many Requests. Exceeded request rate limit in the allotted amount of time."); <END> } log.debug("429 detected, will retry in {}ms, attempt number: {}", delay, retries); } if (delay < 0) { delay = Math.min(getDefaultDelayMillis(retries), timeElapsedLeft); } log.debug("Retryable condition detected, will retry in {}ms, attempt number: {}", delay, retries); try { Thread.sleep(delay); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new RestException(e.getMessage(), e); } }</code><technical_language>Do need add this error text? pass get response</technical_language>

Target:
private void pauseBeforeRetry(int retries, HttpResponse httpResponse, long timeElapsed) throws RestException { long delay = -1; long timeElapsedLeft = maxElapsedMillis - timeElapsed; if (backoffStrategy != null) { delay = Math.min(this.backoffStrategy.getDelayMillis(retries), timeElapsedLeft); } else if (httpResponse != null && httpResponse.getStatusLine().getStatusCode() == 429) { delay = get429DelayMillis(httpResponse); if (!shouldRetry(retries, timeElapsed + delay)) { throw new RestException("Cannot retry request, next request will exceed retry configuration."); } log.debug("429 detected, will retry in {}ms, attempt number: {}", delay, retries); } if (delay < 0) { delay = Math.min(getDefaultDelayMillis(retries), timeElapsedLeft); } log.debug("Retryable condition detected, will retry in {}ms, attempt number: {}", delay, retries); try { Thread.sleep(delay); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new RestException(e.getMessage(), e); } }