auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code><START> private DomainTranslator.ExtractionResult intersectExtractionResult(DomainTranslator.ExtractionResult left, DomainTranslator.ExtractionResult right) <END> { RowExpression newRemainingExpression; if (right.getRemainingExpression().equals(TRUE_CONSTANT)) { newRemainingExpression = left.getRemainingExpression(); } else if (left.getRemainingExpression().equals(TRUE_CONSTANT)) { newRemainingExpression = right.getRemainingExpression(); } else { newRemainingExpression = and(left.getRemainingExpression(), right.getRemainingExpression()); } return new DomainTranslator.ExtractionResult(left.getTupleDomain().intersect(right.getTupleDomain()), newRemainingExpression); }</code><technical_language>static</technical_language>

Target:
private static DomainTranslator.ExtractionResult intersectExtractionResult(DomainTranslator.ExtractionResult left, DomainTranslator.ExtractionResult right) { RowExpression newRemainingExpression; if (right.getRemainingExpression().equals(TRUE_CONSTANT)) { newRemainingExpression = left.getRemainingExpression(); } else if (left.getRemainingExpression().equals(TRUE_CONSTANT)) { newRemainingExpression = right.getRemainingExpression(); } else { newRemainingExpression = and(left.getRemainingExpression(), right.getRemainingExpression()); } return new DomainTranslator.ExtractionResult(left.getTupleDomain().intersect(right.getTupleDomain()), newRemainingExpression); }
Source:
<code><START> public CheckedBiFunction<Object, Throwable, Duration> getDelayFunction() { <END> return delayFunction; }</code><technical_language>considered give this function interface? E.g. java @FunctionalInterface public interface DelayFunction { @Nullable Duration calculateDelay(@Nullable Object result, @Nullable Throwable exception); }</technical_language>

Target:
public DelayFunction<?, ? extends Throwable> getDelayFunction() { return delayFunction; }
Source:
<code>public void validate() { Attribute<Long> reaperWakeUpInterval = attributes.attribute(REAPER_WAKE_UP_INTERVAL); Attribute<Long> completedTxTimeout = attributes.attribute(COMPLETED_TX_TIMEOUT); if (reaperWakeUpInterval.get()< 0) throw log.invalidReaperWakeUpInterval(reaperWakeUpInterval.get()); if (completedTxTimeout.get() < 0) throw log.invalidCompletedTxTimeout(completedTxTimeout.get()); CacheMode cacheMode = clustering().cacheMode(); if(attributes.attribute(TRANSACTION_PROTOCOL).get() == TransactionProtocol.TOTAL_ORDER) { if(transactionMode() != TransactionMode.TRANSACTIONAL) { throw log.invalidTxModeForTotalOrder(transactionMode()); } if(!cacheMode.isReplicated() && !cacheMode.isDistributed()) { throw log.invalidCacheModeForTotalOrder(clustering().cacheMode().friendlyCacheModeString()); } if (lockingMode() != LockingMode.OPTIMISTIC) { throw log.invalidLockingModeForTotalOrder(lockingMode()); } } if (!attributes.attribute(NOTIFICATIONS).get() && !getBuilder().template()) { log.transactionNotificationsDisabled(); } if (attributes.attribute(TRANSACTION_MODE).get() == TransactionMode.TRANSACTIONAL && !cacheMode.isSynchronous()) { throw log.unsupportedAsyncCacheMode(cacheMode); } if (attributes.attribute(TRANSACTION_MODE).get() == TransactionMode.TRANSACTIONAL && attributes.attribute(LOCKING_MODE).get() == LockingMode.OPTIMISTIC && <START> !attributes.attribute(USE_EAGER_LOCKING).get() && END> getBuilder().locking().isolationLevel() == IsolationLevel.REPEATABLE_READ && cacheMode != CacheMode.INVALIDATION_SYNC && !getBuilder().invocationBatching().isEnabled()) { getBuilder().locking().writeSkewCheck(true); getBuilder().versioning().enable().scheme(VersioningScheme.SIMPLE); getBuilder().locking().validate(); getBuilder().versioning().validate(); } recovery.validate(); }</code><technical_language>Eager locking deprecated in 5.1, created <LINK_0> remove it</technical_language>

Target:
public void validate() { Attribute<Long> reaperWakeUpInterval = attributes.attribute(REAPER_WAKE_UP_INTERVAL); Attribute<Long> completedTxTimeout = attributes.attribute(COMPLETED_TX_TIMEOUT); if (reaperWakeUpInterval.get()< 0) throw log.invalidReaperWakeUpInterval(reaperWakeUpInterval.get()); if (completedTxTimeout.get() < 0) throw log.invalidCompletedTxTimeout(completedTxTimeout.get()); CacheMode cacheMode = clustering().cacheMode(); if(attributes.attribute(TRANSACTION_PROTOCOL).get() == TransactionProtocol.TOTAL_ORDER) { if(transactionMode() != TransactionMode.TRANSACTIONAL) { throw log.invalidTxModeForTotalOrder(transactionMode()); } if(!cacheMode.isReplicated() && !cacheMode.isDistributed()) { throw log.invalidCacheModeForTotalOrder(clustering().cacheMode().friendlyCacheModeString()); } if (lockingMode() != LockingMode.OPTIMISTIC) { throw log.invalidLockingModeForTotalOrder(lockingMode()); } } if (!attributes.attribute(NOTIFICATIONS).get() && !getBuilder().template()) { log.transactionNotificationsDisabled(); } if (attributes.attribute(TRANSACTION_MODE).get() == TransactionMode.TRANSACTIONAL && !cacheMode.isSynchronous()) { throw log.unsupportedAsyncCacheMode(cacheMode); } recovery.validate(); }
Source:
<code>public String toString() { <START> StringBuilder sb = new StringBuilder(); <END> sb.append("class Lifecycle {\n"); sb.append(" postStart: ").append(toIndentedString(postStart)).append("\n"); sb.append(" preStop: ").append(toIndentedString(preStop)).append("\n"); sb.append("}"); return sb.toString(); }</code><technical_language>toString() formatting</technical_language>

Target:
public String toString() { return "Lifecycle{" + "postStart=" + postStart + ", preStop=" + preStop + '}'; }
Source:
<code>public void setAcceptableValues(Collection<Object> values) { if (values == null) { return; } editors.clear(); contentPanel.clear(); for (Object value : values) { LogicalNetworkEditor networkEditor = new LogicalNetworkEditor(elementId); editors.add(networkEditor); networkEditor.setValue((NicWithLogicalNetworks) value); contentPanel.add(networkEditor); } <START> headerLabel.setText(messages.assignNicsToNetworks(values.size())); <END> }</code><technical_language>I nics vm this message shown</technical_language>

Target:
public void setAcceptableValues(Collection<Object> values) { if (values == null) { return; } editors.clear(); contentPanel.clear(); for (Object value : values) { LogicalNetworkEditor networkEditor = new LogicalNetworkEditor(); networkEditor.setElementId(elementId); editors.add(networkEditor); networkEditor.setValue((NicWithLogicalNetworks) value); contentPanel.add(networkEditor); } if (values.size() > 0) { headerLabel.setText(messages.assignNicsToNetworks(values.size())); } }
Source:
<code>protected void initializeAndStart() { SinkConnectorConfig.validate(taskConfig); if (SinkConnectorConfig.hasTopicsConfig(taskConfig)) { String[] topics = taskConfig.get(SinkTask.TOPICS_CONFIG).split(","); <START> Arrays.parallelSetAll(topics, i->topics[i].trim()); <END> consumer.subscribe(Arrays.asList(topics), new HandleRebalance()); log.debug("{} Initializing and starting task for topics {}", this, topics); } else { String topicsRegexStr = taskConfig.get(SinkTask.TOPICS_REGEX_CONFIG); Pattern pattern = Pattern.compile(topicsRegexStr); consumer.subscribe(pattern, new HandleRebalance()); log.debug("{} Initializing and starting task for topics regex {}", this, topicsRegexStr); } task.initialize(context); task.start(taskConfig); log.info("{} Sink task finished initialization and start", this); }</code><technical_language>do need process this in parallel? setAll() simple clean enough</technical_language>

Target:
protected void initializeAndStart() { SinkConnectorConfig.validate(taskConfig); if (SinkConnectorConfig.hasTopicsConfig(taskConfig)) { String[] topics = taskConfig.get(SinkTask.TOPICS_CONFIG).split(","); Arrays.setAll(topics, i -> topics[i].trim()); consumer.subscribe(Arrays.asList(topics), new HandleRebalance()); log.debug("{} Initializing and starting task for topics {}", this, topics); } else { String topicsRegexStr = taskConfig.get(SinkTask.TOPICS_REGEX_CONFIG); Pattern pattern = Pattern.compile(topicsRegexStr); consumer.subscribe(pattern, new HandleRebalance()); log.debug("{} Initializing and starting task for topics regex {}", this, topicsRegexStr); } task.initialize(context); task.start(taskConfig); log.info("{} Sink task finished initialization and start", this); }
Source:
<code>public Integer getWeight() { <START> return 100; <END> }</code><technical_language>provided constants, Weights.BUILT_IN_CONVENTION</technical_language>

Target:
private Integer getWeight() { return Weights.BUILT_IN_CONVENTION; }
Source:
<code>private void watchLogsIfDebugEnabled(Map<String, String> startOptions) throws InfrastructureException { <START> if (startOptions == null) { <END> LOG.debug( "'startOptions' is null so we won't watch the container logs for workspace '{}'", getContext().getIdentity().getWorkspaceId()); return; } boolean shouldWatchContainerStartupLogs = Boolean.parseBoolean( startOptions.getOrDefault(DEBUG_WORKSPACE_START, Boolean.FALSE.toString())); if (shouldWatchContainerStartupLogs) { Set<String> podNames = machines .getMachines(getContext().getIdentity()) .values() .stream() .filter(Objects::nonNull) .map(KubernetesMachineImpl::getPodName) .filter(Objects::nonNull) .collect(Collectors.toSet()); LOG.debug( "Watch '{}' pods in workspace '{}'", podNames, getContext().getIdentity().getWorkspaceId()); namespace .deployments() .watchLogs( new PodLogToEventPublisher(this.eventPublisher, this.getContext().getIdentity()), LogWatchTimeouts.DEFAULT, podNames); } }</code><technical_language>startOptions.isEmpty</technical_language>

Target:
private void watchLogsIfDebugEnabled(Map<String, String> startOptions) throws InfrastructureException { if (startOptions == null || startOptions.isEmpty()) { LOG.debug( "'startOptions' is null or empty so we won't watch the container logs for workspace '{}'", getContext().getIdentity().getWorkspaceId()); return; } boolean shouldWatchContainerStartupLogs = Boolean.parseBoolean( startOptions.getOrDefault(DEBUG_WORKSPACE_START, Boolean.FALSE.toString())); if (shouldWatchContainerStartupLogs) { Set<String> podNames = machines .getMachines(getContext().getIdentity()) .values() .stream() .filter(Objects::nonNull) .map(KubernetesMachineImpl::getPodName) .filter(Objects::nonNull) .collect(Collectors.toSet()); LOG.debug( "Watch '{}' pods in workspace '{}'", podNames, getContext().getIdentity().getWorkspaceId()); namespace .deployments() .watchLogs( new PodLogToEventPublisher(this.eventPublisher, this.getContext().getIdentity()), LogWatchTimeouts.DEFAULT, podNames, LogWatcher.getLogLimitBytes(startOptions)); } }
Source:
<code>public boolean isSessionLevelPrivilegeLinkClicked(int instrNum, int sectionLevelIndex, int sessionIndex, int linkNum) { <START> return this.sessionLevelTableCheckbox(instrNum, sectionLevelIndex, sessionIndex, linkNum - 1).isSelected(); <END> }</code><technical_language>linkNum - 1 in these, is linkNum reduce number in linkNum parameter in call sites</technical_language>

Target:
public boolean isSessionLevelPrivilegeLinkClicked(int instrNum, int sectionLevelIndex, int sessionIndex, int linkNum) { return getSessionLevelTableCheckbox(instrNum, sectionLevelIndex, sessionIndex, linkNum).isSelected(); }
Source:
<code>public void setContactBlocked(String number, boolean blocked) { <START> ContactInfo contact = account.getContactStore().getContact(number); <END> if (contact == null) { contact = new ContactInfo(); contact.number = number; System.err.println("Adding and " + (blocked ? "blocking" : "unblocking") + " contact " + number); } else { System.err.println((blocked ? "Blocking" : "Unblocking") + " contact " + number); } contact.blocked = blocked; account.getContactStore().updateContact(contact); account.save(); }</code><technical_language>number canonicalized retrieving contact, Utils.canonicalizeNumber(number, username)</technical_language>

Target:
public void setContactBlocked(String number, boolean blocked) throws InvalidNumberException { number = Utils.canonicalizeNumber(number, username); ContactInfo contact = account.getContactStore().getContact(number); if (contact == null) { contact = new ContactInfo(); contact.number = number; System.err.println("Adding and " + (blocked ? "blocking" : "unblocking") + " contact " + number); } else { System.err.println((blocked ? "Blocking" : "Unblocking") + " contact " + number); } contact.blocked = blocked; account.getContactStore().updateContact(contact); account.save(); }
Source:
<code>protected void postLoad(DAnalysis dAnalysis, Version loadedVersion) { if (loadedVersion.compareTo(MIGRATION_VERSION) < 0) { new DEdgeNameEditPart(null); new DEdgeBeginNameEditPart(null); new DEdgeEndNameEditPart(null); boolean isModified = false; StringBuilder sb = new StringBuilder(Messages.SnapBackDistantLabelsMigrationParticipant_title); List<Node> distantEdgeLabels = new ArrayList<Node>(); for (DView dView : dAnalysis.getOwnedViews()) { for (DDiagram dDiagram : Iterables.filter(new DViewQuery(dView).getLoadedRepresentations(), DDiagram.class)) { List<Node> currentDistantEdgeLabels = getDistantEdgeLabels(dDiagram); distantEdgeLabels.addAll(currentDistantEdgeLabels); if (currentDistantEdgeLabels.size() > 0) { isModified = true; if (currentDistantEdgeLabels.size() > 1) { sb.append(MessageFormat.format(Messages.SnapBackDistantLabelsMigrationParticipant_severalLabelsSnapBacked, currentDistantEdgeLabels.size(), dDiagram.getName())); } else { sb.append(MessageFormat.format(Messages.SnapBackDistantLabelsMigrationParticipant_oneLabelSnapBacked, dDiagram.getName())); } } } } for (Node distantEdgeLabel : distantEdgeLabels) { String <START> hint = <END> distantEdgeLabel.getType(); Point offset = LabelEditPart.getSnapBackPosition(hint); if (offset != null) { ViewUtil.setStructuralFeatureValue(distantEdgeLabel, NotationPackage.eINSTANCE.getLocation_X(), Integer.valueOf(offset.x)); ViewUtil.setStructuralFeatureValue(distantEdgeLabel, NotationPackage.eINSTANCE.getLocation_Y(), Integer.valueOf(offset.y)); } } if (isModified) { DiagramPlugin.getDefault().logInfo(sb.toString()); } } }</code><technical_language>strange variable name</technical_language>

Target:
protected void postLoad(DAnalysis dAnalysis, Version loadedVersion) { if (loadedVersion.compareTo(MIGRATION_VERSION) < 0) { initializeSnapBackPositionMap(); boolean isModified = false; StringBuilder sb = new StringBuilder(Messages.SnapBackDistantLabelsMigrationParticipant_title); List<Node> distantEdgeLabels = new ArrayList<Node>(); for (DView dView : dAnalysis.getOwnedViews()) { for (DDiagram dDiagram : Iterables.filter(new DViewQuery(dView).getLoadedRepresentations(), DDiagram.class)) { List<Node> currentDistantEdgeLabels = getDistantEdgeLabels(dDiagram); distantEdgeLabels.addAll(currentDistantEdgeLabels); if (currentDistantEdgeLabels.size() > 0) { isModified = true; if (currentDistantEdgeLabels.size() > 1) { sb.append(MessageFormat.format(Messages.SnapBackDistantLabelsMigrationParticipant_severalLabelsSnapBacked, currentDistantEdgeLabels.size(), dDiagram.getName())); } else { sb.append(MessageFormat.format(Messages.SnapBackDistantLabelsMigrationParticipant_oneLabelSnapBacked, dDiagram.getName())); } } } } for (Node distantEdgeLabel : distantEdgeLabels) { Point offset = LabelEditPart.getSnapBackPosition(distantEdgeLabel.getType()); if (offset != null) { ViewUtil.setStructuralFeatureValue(distantEdgeLabel, NotationPackage.eINSTANCE.getLocation_X(), Integer.valueOf(offset.x)); ViewUtil.setStructuralFeatureValue(distantEdgeLabel, NotationPackage.eINSTANCE.getLocation_Y(), Integer.valueOf(offset.y)); } } if (isModified) { DiagramPlugin.getDefault().logInfo(sb.toString()); } } }
Source:
<code>private SpanAnnotationResponse actionSpan(AjaxRequestTarget aTarget, IRequestParameters request, CAS aCas, VID aSelectedAnnotation) throws IOException, AnnotationException { <START> Optional<Offsets> optUserSelectedSpan = getOffsetsFromRequest(request, aCas, <END> aSelectedAnnotation); if (!optUserSelectedSpan.isPresent()) { return new SpanAnnotationResponse(); } Offsets userSelectedSpan = optUserSelectedSpan.get(); AnnotatorState state = getModelObject(); Selection selection = state.getSelection(); if (state.isSlotArmed()) { getActionHandler().actionFillSlot(aTarget, aCas, userSelectedSpan.getBegin(), userSelectedSpan.getEnd(), aSelectedAnnotation); } else { if (!aSelectedAnnotation.isSynthetic()) { selection.selectSpan(aSelectedAnnotation, aCas, userSelectedSpan.getBegin(), userSelectedSpan.getEnd()); if (selection.getAnnotation().isNotSet()) { getActionHandler().actionCreateOrUpdate(aTarget, aCas); } else { getActionHandler().actionSelect(aTarget, aCas); } } } return new SpanAnnotationResponse(); }</code><technical_language>code arrive if offsets present</technical_language>

Target:
private SpanAnnotationResponse actionSpan(AjaxRequestTarget aTarget, IRequestParameters request, CAS aCas, VID aSelectedAnnotation) throws IOException, AnnotationException { Offsets optUserSelectedSpan = getOffsetsFromRequest(request, aCas, aSelectedAnnotation); Offsets userSelectedSpan = optUserSelectedSpan; AnnotatorState state = getModelObject(); Selection selection = state.getSelection(); if (state.isSlotArmed()) { getActionHandler().actionFillSlot(aTarget, aCas, userSelectedSpan.getBegin(), userSelectedSpan.getEnd(), aSelectedAnnotation); } else { if (!aSelectedAnnotation.isSynthetic()) { selection.selectSpan(aSelectedAnnotation, aCas, userSelectedSpan.getBegin(), userSelectedSpan.getEnd()); if (selection.getAnnotation().isNotSet()) { getActionHandler().actionCreateOrUpdate(aTarget, aCas); } else { getActionHandler().actionSelect(aTarget, aCas); } } } return new SpanAnnotationResponse(); }
Source:
<code>private void emitConstructor(TypeSpec.Builder intentBuilderTypeBuilder) { MethodSpec.Builder constructorBuilder = MethodSpec.constructorBuilder() .addModifiers(Modifier.PUBLIC) .addParameter(ClassName.get("android.content", "Context"), "context"); if(usesReflection) { constructorBuilder.addStatement("try { intent = new Intent(context, Class.forName($S)); } catch(Exception ex)" <START> + " { throw new RuntimeException(ex); }", target.getFqcn()); <END> } else { constructorBuilder.addStatement("intent = new Intent(context, $L.class);", target.className); } intentBuilderTypeBuilder.addMethod(constructorBuilder.build()); }</code><technical_language>a proper error msg</technical_language>

Target:
private void emitConstructor(TypeSpec.Builder intentBuilderTypeBuilder) { MethodSpec.Builder constructorBuilder = MethodSpec.constructorBuilder() .addModifiers(Modifier.PUBLIC) .addParameter(get("android.content", "Context"), "context"); if (usesReflection) { emitGetClassDynamically(intentBuilderTypeBuilder); constructorBuilder.addStatement("intent = new Intent(context, getClassDynamically($S))", target.getFqcn()); } else { constructorBuilder.addStatement("intent = new Intent(context, $L.class)", target.className); } intentBuilderTypeBuilder.addMethod(constructorBuilder.build()); }
Source:
<code>private boolean compareCurrentToken() { <START> byte[] arr2 = currentHead.path; <END> int off2 = currentHead.pathOffset; int end2 = currentHead.pathLen; if (!hasCurrent) { throw new IllegalStateException("No current token"); } if (end - pos != end2 - off2) { return false; } int len = end - pos; for (int curPos = 0; curPos < len; curPos++) { if (bytes[pos + curPos] != arr2[off2 + curPos]) { return false; } } return true; }</code><technical_language>a name, "path"</technical_language>

Target:
private boolean compareCurrentToken() { byte[] path2 = currentHead.path; int pathOffset2 = currentHead.pathOffset; int pathLen2 = currentHead.pathLen; if (!hasCurrent) throw new IllegalStateException("No current token"); if (pathEnd - pathOffset != pathLen2 - pathOffset2) return false; int len = pathEnd - pathOffset; for (int offset = 0; offset < len; offset++) { if (path[pathOffset + offset] != path2[pathOffset2 + offset]) { return false; } } return true; }
Source:
<code>protected void update(String secretConfig) { String[] keyValues = secretConfig.split("!"); for (int i=0; i < keyValues.length; i++) { String[] keyV = keyValues[i].split(":", 2); if (keyV.length != 2) { throw new InvalidSecretFormatException("Invalid encrypted secret format"); } <START> if (i == 0){ <END> this.engineIdentifier = keyV[1]; } else { this.params.put(keyV[0], keyV[1]); } } }</code><technical_language>Missing space {</technical_language>

Target:
protected void update(String secretConfig) { String[] keyValues = secretConfig.split("!"); if (keyValues.length < 2) { throw new InvalidSecretFormatException("Invalid encrypted secret format, must have at least one parameter"); } for (int i=0; i < keyValues.length; i++) { String[] keyV = keyValues[i].split(":", 2); if (keyV.length != 2) { throw new InvalidSecretFormatException("Invalid encrypted secret format, keys and values must be delimited by ':'"); } if (i == 0) { this.engineIdentifier = keyV[1]; } else { this.params.put(keyV[0], keyV[1]); } } }
Source:
<code>protected static Work.State getState(String workId) { <START> KeyValueStore kvStore = Framework.getService(KeyValueService.class).getKeyValueStore(KV_NAME); <END> String stringState = kvStore.getString(workId + STATE_SUFFIX); return stringState == null || CANCELED.equals(stringState) ? null : Work.State.valueOf(stringState); }</code><technical_language>This extracted a getKeyValueStore() static method, 3 times in class</technical_language>

Target:
protected static Work.State getState(String workId) { String stringState = getKeyValueStore().getString(getStateKey(workId)); return stringState == null || CANCELED.equals(stringState) ? null : Work.State.valueOf(stringState); }
Source:
<code>public void testCreatePurchaseWithExternalKeyOverLimit() throws PaymentApiException, InvoiceApiException, EventBusException { final BigDecimal requestedAmount = BigDecimal.TEN; final UUID subscriptionId = UUID.randomUUID(); final UUID bundleId = UUID.randomUUID(); final LocalDate now = clock.getUTCToday(); final Invoice invoice = testHelper.createTestInvoice(account, now, Currency.USD); final String paymentExternalKey = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis,."; final String transactionExternalKey = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis,."; invoice.addInvoiceItem(new MockRecurringInvoiceItem(invoice.getId(), account.getId(), subscriptionId, bundleId, "test plan", "test phase", null, now, now.plusMonths(1), requestedAmount, new BigDecimal("1.0"), Currency.USD)); <START> <END> try { paymentApi.createPurchaseWithPaymentControl(account, account.getPaymentMethodId(), null, requestedAmount, Currency.USD, paymentExternalKey, transactionExternalKey, createPropertiesForInvoice(invoice), INVOICE_PAYMENT, callContext); } catch (final PaymentApiException e) { assertEquals(e.getCode(), ErrorCode.EXTERNAL_KEY_LIMIT_EXCEEDED.getCode()); } }</code><technical_language>Nit: do need invoice related code here? simplify</technical_language>

Target:
public void testCreatePurchaseWithExternalKeyOverLimit() throws PaymentApiException, InvoiceApiException, EventBusException { final BigDecimal requestedAmount = BigDecimal.TEN; final LocalDate now = clock.getUTCToday(); final Invoice invoice = testHelper.createTestInvoice(account, now, Currency.USD); final String paymentExternalKey = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis,."; final String transactionExternalKey = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis,."; try { paymentApi.createPurchaseWithPaymentControl(account, account.getPaymentMethodId(), null, requestedAmount, Currency.USD, paymentExternalKey, transactionExternalKey, createPropertiesForInvoice(invoice), INVOICE_PAYMENT, callContext); Assert.fail(); } catch (final PaymentApiException e) { assertEquals(e.getCode(), ErrorCode.EXTERNAL_KEY_LIMIT_EXCEEDED.getCode()); } }
Source:
<code>public void sendError() throws IOException { final HttpServletResponse sresp = new HttpServletResponseFake( new RsEmpty() ); sresp.sendError(101, "Custom error message"); MatcherAssert.assertThat( "Can't send a error in servlet response", <START> sresp.getHeaders("HTTP/1.1"), <END> Matchers.hasItem("HTTP/1.1 101 Custom error message") ); }</code><technical_language>@fanifieiev constant too</technical_language>

Target:
public void sendError() throws IOException { final HttpServletResponse sresp = new HttpServletResponseFake( new RsEmpty() ); sresp.sendError(101, "Switching Protocol"); new Assertion<>( "Can't send a error in servlet response", sresp.getHeaders(HttpServletResponseFakeTest.VERSION), new HasValues<>( HttpServletResponseFakeTest.INFO ) ).affirm(); }
Source:
<code>protected INDArray createGain(long nOut, double gainInit, INDArray gainParamView, boolean initializeParameters) { if (initializeParameters) { INDArray ret = Nd4j.valueArrayOf(new long[] {1, nOut}, gainInit); <START> gainParamView.assign(ret); <END> } return gainParamView; }</code><technical_language>create this temporary ret array. gainParamView.assign(gainInit) instead</technical_language>

Target:
protected INDArray createGain(long nOut, double gainInit, INDArray gainParamView, boolean initializeParameters) { if (initializeParameters) { gainParamView.assign(gainInit); } return gainParamView; }
Source:
<code>private void init() { <START> if (jp == null) { <END> try { if (inputStream == null) { throw new UnsupportedOperationException(); } else { jp = objectMapper.getFactory().createParser(inputStream); } objectCodec = jp.getCodec(); jp.nextToken(); } catch (IOException e) { throw new RuntimeException(e); } } }</code><technical_language>I jp is initialized lazily. Is reason jp initialized in constructor</technical_language>

Target:
private void init() { try { if (inputStream == null) { throw new UnsupportedOperationException(); } else { jp = objectMapper.getFactory().createParser(inputStream); } final JsonToken nextToken = jp.nextToken(); if (nextToken != JsonToken.START_ARRAY) { throw new IAE("First token should be START_ARRAY", jp.getCurrentToken()); } else { jp.nextToken(); objectCodec = jp.getCodec(); } } catch (IOException e) { throw new RuntimeException(e); } }
Source:
<code><START> protected Object parseSourceValue(Object value) { <END> return value.toString(); }</code><technical_language>nit: I wondering if covariance return Strings, do for other types</technical_language>

Target:
protected String parseSourceValue(Object value) { return value.toString(); }
Source:
<code><START> public static <V> ListenableFuture<V> toListenableFuture(CompletableFuture<V> completableFuture) <END> { requireNonNull(completableFuture, "completableFuture is null"); SettableFuture<V> future = SettableFuture.create(); completableFuture.whenComplete((value, exception) -> { if (exception != null) { future.setException(exception); } else { future.set(value); } }); return future; }</code><technical_language>propagate cancellation completableFuture</technical_language>

Target:
public static <V> ListenableFuture<V> toListenableFuture(CompletableFuture<V> completableFuture) { requireNonNull(completableFuture, "completableFuture is null"); SettableFuture<V> future = SettableFuture.create(); Futures.addCallback(future, new FutureCallback<V>() { @Override public void onSuccess(V result) { } @Override public void onFailure(Throwable t) { completableFuture.completeExceptionally(t); } }); completableFuture.whenComplete((value, exception) -> { if (exception != null) { future.setException(exception); } else { future.set(value); } }); return future; }
Source:
<code>default SortedSet<T> toSortedSet() throws ClassCastException { final Comparator<T> comparator; if (this instanceof TreeSet<?>) { return (TreeSet<T>) this; <START> } else if (this instanceof Ordered<?>) { <END> comparator = ((Ordered<T>) this).comparator(); } else { comparator = (Comparator<T> & Serializable) (o1, o2) -> ((Comparable<T>) o1).compareTo(o2); } return toSortedSet(comparator); }</code><technical_language>_Off-topic: <?> in instanceof checks - needed add here. Nevermind, need change occurrences in this PR._</technical_language>

Target:
default SortedSet<T> toSortedSet() throws ClassCastException { if (this instanceof TreeSet<?>) { return (TreeSet<T>) this; } else { final Comparator<T> comparator = (this instanceof Ordered<?>) ? ((Ordered<T>) this).comparator() : (Comparator<T> & Serializable) (o1, o2) -> ((Comparable<T>) o1).compareTo(o2); return toSortedSet(comparator); } }
Source:
<code>protected void addVmInterfaces() { VmInterfaceManager vmInterfaceManager = new VmInterfaceManager(); VnicProfileHelper vnicProfileHelper = new VnicProfileHelper(getVm().getVdsGroupId(), getStoragePoolId(), getVdsGroup().getcompatibility_version(), AuditLogType.IMPORTEXPORT_IMPORT_VM_INVALID_INTERFACES); List<VmNetworkInterface> nics = getVm().getInterfaces(); vmInterfaceManager.sortVmNics(nics, getVm().getStaticData().getManagedDeviceMap()); <START> List<String> macAddresses = ListUtils.EMPTY_LIST; <END> if (getParameters().isImportAsNewEntity()) { macAddresses = MacPoolManager.getInstance().allocateMacAddresses(nics.size()); } for (int i = 0; i < nics.size(); ++i) { VmNetworkInterface iface = nics.get(i); initInterface(iface); vnicProfileHelper.updateNicWithVnicProfileForUser(iface, getCurrentUser()); if (getParameters().isImportAsNewEntity()) { iface.setMacAddress(macAddresses.get(i)); } vmInterfaceManager.add(iface, getCompensationContext(), !getParameters().isImportAsNewEntity(), getVm().getOs(), getVdsGroup().getcompatibility_version()); macsAdded.add(iface.getMacAddress()); } vnicProfileHelper.auditInvalidInterfaces(getVmName()); }</code><technical_language>assign empty list if this in import new? block (which is more readable iin place spread method): if (getParameters().isImportAsNewEntity()) { List<String> macAddresses = MacPoolManager.getInstance().allocateMacAddresses(nics.size()); for (int i = 0; i < nics.size(); ++i) { iface.setMacAddress(macAddresses.get(i)); } }</technical_language>

Target:
protected void addVmInterfaces() { VmInterfaceManager vmInterfaceManager = new VmInterfaceManager(); VnicProfileHelper vnicProfileHelper = new VnicProfileHelper(getVm().getVdsGroupId(), getStoragePoolId(), getVdsGroup().getcompatibility_version(), AuditLogType.IMPORTEXPORT_IMPORT_VM_INVALID_INTERFACES); List<VmNetworkInterface> nics = getVm().getInterfaces(); vmInterfaceManager.sortVmNics(nics, getVm().getStaticData().getManagedDeviceMap()); if (getParameters().isImportAsNewEntity()) { List<String> macAddresses = MacPoolManager.getInstance().allocateMacAddresses(nics.size()); for (int i = 0; i < nics.size(); ++i) { VmNetworkInterface iface = nics.get(i); iface.setMacAddress(macAddresses.get(i)); } } for (int i = 0; i < nics.size(); ++i) { VmNetworkInterface iface = nics.get(i); initInterface(iface); vnicProfileHelper.updateNicWithVnicProfileForUser(iface, getCurrentUser()); vmInterfaceManager.add(iface, getCompensationContext(), !getParameters().isImportAsNewEntity(), getVm().getOs(), getVdsGroup().getcompatibility_version()); macsAdded.add(iface.getMacAddress()); } vnicProfileHelper.auditInvalidInterfaces(getVmName()); }
Source:
<code>public void compute1(final RectangleNeighborhood<I> input, final DoubleType output) { final IntegralCursor<I> cursor = new IntegralCursor<>(input); int dimensions = input.numDimensions(); final DoubleType sum = new DoubleType(); sum.setZero(); final Converter<I, DoubleType> conv = new RealDoubleConverter<>(); while ( cursor.hasNext() ) { int cornerInteger = cursor.getCornerRepresentation(); final I value = cursor.next().copy(); final DoubleType valueAsDoubleType = new DoubleType(); conv.convert(value, valueAsDoubleType); <START> DoubleType factor = new DoubleType(Math.pow(-1.0d, dimensions - norm(cornerInteger))); <END> valueAsDoubleType.mul(factor); sum.add(valueAsDoubleType); } output.set(sum); }</code><technical_language>reuse DoubleType</technical_language>

Target:
public void compute1(final RectangleNeighborhood<I> input, final DoubleType output) { final IntegralCursor<I> cursor = new IntegralCursor<>(input); final int dimensions = input.numDimensions(); final DoubleType sum = new DoubleType(); sum.setZero(); final Converter<I, DoubleType> conv = new RealDoubleConverter<>(); final DoubleType valueAsDoubleType = new DoubleType(); while (cursor.hasNext()) { final I value = cursor.next().copy(); conv.convert(value, valueAsDoubleType); final int cornerInteger = cursor.getCornerRepresentation(); final DoubleType factor = new DoubleType(Math.pow(-1.0d, dimensions - IntegralMean.norm(cornerInteger))); valueAsDoubleType.mul(factor); sum.add(valueAsDoubleType); } output.set(sum); }
Source:
<code>private void validate() { if (fxReset != null) { if (fxReset.getReferenceCurrency().equals(currency)) { throw new IllegalArgumentException( <START> Messages.format("Currency must not equal FxReset reference currency: {}", <END> currency, fxReset.getReferenceCurrency())); } if (!fxReset.getIndex().getCurrencyPair().contains(currency)) { throw new IllegalArgumentException( Messages.format("Currency must be one of those in the FxReset index: {}", currency, fxReset.getIndex())); } } }</code><technical_language>clear currency is in output, clearer</technical_language>

Target:
private void validate() { if (fxReset != null) { if (fxReset.getReferenceCurrency().equals(currency)) { throw new IllegalArgumentException( Messages.format("Currency must not equal FxReset reference currency {}", currency, fxReset.getReferenceCurrency())); } if (!fxReset.getIndex().getCurrencyPair().contains(currency)) { throw new IllegalArgumentException( Messages.format("Currency must be one of those in the FxReset index {}", currency, fxReset.getIndex())); } } }
Source:
<code>public void notifyChanged(final Notification notification) { super.notifyChanged(notification); <START> final Object object = notification.getNotifier(); <END> final Property property = getUMLElement(); if (object.equals(property)) { switch (notification.getFeatureID(Property.class)) { case UMLPackage.PROPERTY__LOWER_VALUE: case UMLPackage.PROPERTY__UPPER_VALUE: addAdditionalListeners(); } } }</code><technical_language>notifier instead of object</technical_language>

Target:
public void notifyChanged(final Notification notification) { super.notifyChanged(notification); final Object notifier = notification.getNotifier(); final Property property = getUMLElement(); if (notifier.equals(property)) { switch (notification.getFeatureID(Property.class)) { case UMLPackage.PROPERTY__LOWER_VALUE: case UMLPackage.PROPERTY__UPPER_VALUE: addAdditionalListeners(); } } }
Source:
<code>public StoreCopier.Message transform(StoreCopier.Message message) throws Exception { Objects.requireNonNull(message, "message must not be null"); Objects.requireNonNull(message.getMessageInfo(), "message's messageInfo must not be null"); Objects.requireNonNull(message.getStream(), "message's inputStream must not be null"); StoreKey oldStoreKey = message.getMessageInfo().getStoreKey(); StoreKey newStoreKey; if (cacheMap == null) { List<StoreKey> list = Collections.singletonList(oldStoreKey); Map<StoreKey, StoreKey> storeKeyToStoreKey = storeKeyConverter.convert(list); newStoreKey = storeKeyToStoreKey.get(oldStoreKey); } else { <START> newStoreKey = cacheMap.get(oldStoreKey); <END> } if (newStoreKey == null) { return null; } return newMessage(message.getStream(), newStoreKey); }</code><technical_language>cacheMap get populated</technical_language>

Target:
public StoreCopier.Message transform(StoreCopier.Message message) throws Exception { Objects.requireNonNull(message, "message must not be null"); Objects.requireNonNull(message.getMessageInfo(), "message's messageInfo must not be null"); Objects.requireNonNull(message.getStream(), "message's inputStream must not be null"); StoreKey oldStoreKey = message.getMessageInfo().getStoreKey(); StoreKey newStoreKey; List<StoreKey> list = Collections.singletonList(oldStoreKey); Map<StoreKey, StoreKey> storeKeyToStoreKey = storeKeyConverter.convert(list); newStoreKey = storeKeyToStoreKey.get(oldStoreKey); if (newStoreKey == null) { return null; } return newMessage(message.getStream(), newStoreKey); }
Source:
<code>protected Objects.ToStringHelper string() { return Objects.toStringHelper(this) .add("name", name).add("networkId", networkId).add("gatewayIp", gatewayIp).add("ipVersion", ipVersion) <START> .add("cidr", cidr).add("enableDhcp", enableDhcp); <END> }</code><technical_language>Is a reason allocationPools, dnsNameServers, hostRoutes missing here</technical_language>

Target:
protected Objects.ToStringHelper string() { return Objects.toStringHelper(this) .add("name", name).add("networkId", networkId).add("gatewayIp", gatewayIp).add("ipVersion", ipVersion) .add("cidr", cidr).add("enableDhcp", enableDhcp).add("allocationPools", allocationPools) .add("dnsNameServers", dnsNameServers).add("hostRoutes", hostRoutes); }
Source:
<code>public ResponseEntity<?> update( @PathVariable("name") final String name, @RequestBody @Valid final EventTypeBase eventType, final Errors errors, final NativeWebRequest request) throws TopicConfigException, InconsistentStateException, NakadiRuntimeException, ServiceTemporarilyUnavailableException, UnableProcessException { ValidationUtils.invokeValidator(eventTypeOptionsValidator, eventType.getOptions(), errors); if (errors.hasErrors()) { return Responses.create(new ValidationProblem(errors), request); } eventTypeService.update(name, eventType); final HttpHeaders headers = new HttpHeaders(); if (!nakadiSettings.getWarnAllDataAccessMessage().isEmpty()) { <START> headers.add(HttpHeaders.WARNING, nakadiSettings.getWarnAllDataAccessMessage()); <END> } return ResponseEntity.status(HttpStatus.OK).headers(headers).build(); }</code><technical_language>No, 299 code "Miscellaneous Warning | 199(Arbitrary, non-specific warning), indicating a persistent warning" standard specific <LINK_0> Warnings for other purposes, cache-related otherwise. of a warning, error status code, distinguishes responses true failures</technical_language>

Target:
public ResponseEntity<?> update( @PathVariable("name") final String name, @RequestBody @Valid final EventTypeBase eventType, final Errors errors, final NativeWebRequest request) throws TopicConfigException, InconsistentStateException, NakadiRuntimeException, ServiceTemporarilyUnavailableException, UnableProcessException { ValidationUtils.invokeValidator(eventTypeOptionsValidator, eventType.getOptions(), errors); if (errors.hasErrors()) { return Responses.create(new ValidationProblem(errors), request); } eventTypeService.update(name, eventType); return status(HttpStatus.OK).headers(generateWarningHeaders()).build(); }
Source:
<code>private void enableMenuItem(Menu menu, int rID) { <START> MenuItem item = menu.findItem(rID); <END> item.setEnabled(true); item.setVisible(true); }</code><technical_language>Add a null check, if is null add a menu item invalidate menu. Find some of adding menu item in view</technical_language>

Target:
private void enableMenuItem(Menu menu, int rID) { MenuItem item = menu.findItem(rID); if(item == null) { menu.add(rID); } item.setEnabled(true); item.setVisible(true); }
Source:
<code>static void fixConfigGroupServiceNames() { Map<Long, ConfigGroup> configGroupMap = collectConfigGroupsWithoutServiceName(); if (!MapUtils.isEmpty(configGroupMap)) { for (Map.Entry<Long, ConfigGroup> configGroupEntry : configGroupMap.entrySet()) { Long id = configGroupEntry.getKey(); ConfigGroup configGroup = configGroupEntry.getValue(); LOG.info("Setting service name of config group with id to {}", configGroup.getName(), id, configGroup.getTag()); <START> configGroup.setServiceName(configGroup.getTag()); <END> } } }</code><technical_language>this is set business object underlying method set entity persist change</technical_language>

Target:
static void fixConfigGroupServiceNames() { Map<Long, ConfigGroup> configGroupMap = collectConfigGroupsWithoutServiceName(); if (MapUtils.isEmpty(configGroupMap)) return; Clusters clusters = injector.getInstance(Clusters.class); for (Map.Entry<Long, ConfigGroup> configGroupEntry : configGroupMap.entrySet()) { ConfigGroup configGroup = configGroupEntry.getValue(); try { Cluster cluster = clusters.getCluster(configGroup.getClusterName()); Map<String, Service> serviceMap = cluster.getServices(); if (serviceMap.containsKey(configGroup.getTag())) { LOG.info("Setting service name of config group with id to {}", configGroup.getName(), configGroupEntry.getKey(), configGroup.getTag()); configGroup.setServiceName(configGroup.getTag()); } } catch (AmbariException e) { } } }
Source:
<code>protected <V> RunnableScheduledFuture<V> decorateTask( final Runnable runnable, RunnableScheduledFuture<V> r) { r = super.decorateTask(runnable, r); for (;;) { final int id = idGenerator.next(); <START> Task<V> task = null; <END> if (runnable instanceof ProjectRunnable) { task = new ProjectTask<V>((ProjectRunnable)runnable, r, this, id); } else { task = new Task<V>(runnable, r, this, id); } if (all.putIfAbsent(task.getTaskId(), task) == null) { return task; } } }</code><technical_language>Style-nit: Please assign null a variable a non-null method. Leave unassigned, compiler warn if assign a use</technical_language>

Target:
protected <V> RunnableScheduledFuture<V> decorateTask( final Runnable runnable, RunnableScheduledFuture<V> r) { r = super.decorateTask(runnable, r); for (;;) { final int id = idGenerator.next(); Task<V> task; if (runnable instanceof ProjectRunnable) { task = new ProjectTask<V>((ProjectRunnable)runnable, r, this, id); } else { task = new Task<V>(runnable, r, this, id); } if (all.putIfAbsent(task.getTaskId(), task) == null) { return task; } } }
Source:
<code>private static boolean parseError(WSTrustResponse responseValue, Document xmlDocument, XPath xPath) throws Exception { boolean errorFound = false; NodeList faultNodes = (NodeList) xPath.compile( " XPathConstants.NODESET); if (faultNodes.getLength() > 0) { responseValue.faultMessage = faultNodes.item(0).getTextContent(); <START> if (StringHelper.isBlank(responseValue.faultMessage)) { <END> responseValue.errorFound = true; } } NodeList subcodeNodes = (NodeList) xPath.compile( " .evaluate(xmlDocument, XPathConstants.NODESET); if (subcodeNodes.getLength() > 1) { throw new Exception("Found too many fault code values:" + subcodeNodes.getLength()); } if (subcodeNodes.getLength() == 1) { responseValue.errorCode = subcodeNodes.item(0).getChildNodes() .item(0).getTextContent(); responseValue.errorCode = responseValue.errorCode.split(":")[1]; errorFound = true; } return errorFound; }</code><technical_language>Is this if (!StringHelper.isBlank(responseValue.faultMessage))</technical_language>

Target:
private static boolean parseError(WSTrustResponse responseValue, Document xmlDocument, XPath xPath) throws Exception { boolean errorFound = false; NodeList faultNodes = (NodeList) xPath.compile( " XPathConstants.NODESET); if (faultNodes.getLength() > 0) { responseValue.faultMessage = faultNodes.item(0).getTextContent(); if (!StringHelper.isBlank(responseValue.faultMessage)) { responseValue.errorFound = true; } } NodeList subcodeNodes = (NodeList) xPath.compile( " .evaluate(xmlDocument, XPathConstants.NODESET); if (subcodeNodes.getLength() > 1) { throw new Exception("Found too many fault code values:" + subcodeNodes.getLength()); } if (subcodeNodes.getLength() == 1) { responseValue.errorCode = subcodeNodes.item(0).getChildNodes() .item(0).getTextContent(); responseValue.errorCode = responseValue.errorCode.split(":")[1]; errorFound = true; } return errorFound; }
Source:
<code><START> public void appendColumn( final AttributeCol52 column ) { <END> assertNotReadOnly(); try { synchronizer.appendColumn( column ); view.getLayer().draw(); model.getAuditLog().add( new InsertColumnAuditLogEntry( identity.getIdentifier(), column ) ); refreshAttributesPanelEvent.fire( new RefreshAttributesPanelEvent( this, model.getAttributeCols() ) ); } catch ( ModelSynchronizer.MoveColumnVetoException e ) { } }</code><technical_language>Some more methods (appendColumn(..) deleteColumn(..) a bit further) similar code reused</technical_language>

Target:
public void appendColumn( final AttributeCol52 column ) { doAppendColumn( column, () -> synchronizer.appendColumn( column ), () -> refreshAttributesPanelEvent.fire( new RefreshAttributesPanelEvent( this, model.getAttributeCols() ) ) ); }
Source:
<code>private String generateAndRetrieveJWTToken(String tokenSignature, JWTInfoDto jwtInfoDto) throws APISecurityException { String endUserToken; if (isGatewayTokenCacheEnabled) { Object token = getGatewayJWTTokenCache().get(tokenSignature); <START> if (token != null){ <END> endUserToken = (String) token; }else{ try { endUserToken = apiMgtGatewayJWTGenerator.generateToken(jwtInfoDto); getGatewayJWTTokenCache().put(tokenSignature,endUserToken); } catch (APIManagementException e) { throw new APISecurityException(APISecurityConstants.API_AUTH_GENERAL_ERROR, APISecurityConstants.API_AUTH_GENERAL_ERROR_MESSAGE, e); } } } else { try { endUserToken = apiMgtGatewayJWTGenerator.generateToken(jwtInfoDto); } catch (APIManagementException e) { throw new APISecurityException(APISecurityConstants.API_AUTH_GENERAL_ERROR, APISecurityConstants.API_AUTH_GENERAL_ERROR_MESSAGE, e); } } return endUserToken; }</code><technical_language>If GatewayTokenCaching is enabled, do proceed generating endUserToken checking is enabled not</technical_language>

Target:
private String generateAndRetrieveJWTToken(String tokenSignature, JWTInfoDto jwtInfoDto) throws APISecurityException { String endUserToken = null; boolean valid = false; if (isGatewayTokenCacheEnabled) { Object token = getGatewayJWTTokenCache().get(tokenSignature); if (token != null) { endUserToken = (String) token; String[] splitToken = ((String) token).split("\\."); JSONObject payload = new JSONObject(new String(Base64.getUrlDecoder().decode(splitToken[1]))); long exp = payload.getLong("exp"); long timestampSkew = OAuthServerConfiguration.getInstance().getTimeStampSkewInSeconds() * 1000; valid = (exp - System.currentTimeMillis() > timestampSkew); } if (StringUtils.isEmpty(endUserToken) || !valid) { try { endUserToken = apiMgtGatewayJWTGenerator.generateToken(jwtInfoDto); getGatewayJWTTokenCache().put(tokenSignature, endUserToken); } catch (APIManagementException e) { log.error("Error while Generating Backend JWT", e); throw new APISecurityException(APISecurityConstants.API_AUTH_GENERAL_ERROR, APISecurityConstants.API_AUTH_GENERAL_ERROR_MESSAGE, e); } } } else { try { endUserToken = apiMgtGatewayJWTGenerator.generateToken(jwtInfoDto); } catch (APIManagementException e) { log.error("Error while Generating Backend JWT", e); throw new APISecurityException(APISecurityConstants.API_AUTH_GENERAL_ERROR, APISecurityConstants.API_AUTH_GENERAL_ERROR_MESSAGE, e); } } return endUserToken; }