auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void deleteIdentifier(DvObject dvObject) throws Exception { logger.log(Level.FINE,"deleteIdentifier"); String identifier = getIdentifier(dvObject); <START> Map<String, String> doiMetadata = new HashMap<>(); <END> try { doiMetadata = doiDataCiteRegisterService.getMetadata(identifier); } catch (Exception e) { logger.log(Level.WARNING, "deleteIdentifier: get matadata failed. " + e.getMessage(), e); } String idStatus = doiMetadata.get("_status"); if ( idStatus != null ) { switch ( idStatus ) { case RESERVED: case DRAFT: logger.log(Level.INFO, "Delete status is reserved.."); try { doiDataCiteRegisterService.deleteIdentifier(identifier); deleteDraftIdentifier(dvObject); } catch (Exception e) { logger.log(Level.WARNING, "delete failed: " + e.getMessage(), e); } break; case PUBLIC: case FINDABLE: Map<String, String> metadata = addDOIMetadataForDestroyedDataset(dvObject); metadata.put("_status", "registered"); metadata.put("_target", getTargetUrl(dvObject)); doiDataCiteRegisterService.deactivateIdentifier(identifier, metadata, dvObject); break; } } }</code><technical_language>@qqmyers I talked this updateIdentifierStatus method. simply unused</technical_language>

Target:
public void deleteIdentifier(DvObject dvObject) throws IOException, HttpException { logger.log(Level.FINE,"deleteIdentifier"); String identifier = getIdentifier(dvObject); String idStatus = DRAFT; if(dvObject.isReleased()) { idStatus = PUBLIC; } if ( idStatus != null ) { switch ( idStatus ) { case RESERVED: case DRAFT: logger.log(Level.INFO, "Delete status is reserved.."); doiDataCiteRegisterService.deleteIdentifier(identifier); deleteDraftIdentifier(dvObject); break; case PUBLIC: case FINDABLE: Map<String, String> metadata = addDOIMetadataForDestroyedDataset(dvObject); metadata.put("_status", "registered"); metadata.put("_target", getTargetUrl(dvObject)); doiDataCiteRegisterService.deactivateIdentifier(identifier, metadata, dvObject); break; } } }
Source:
<code>public void testCleanup() throws Exception { addDatasetInstance(NamespaceId.DEFAULT.toId(), PartitionedFileSet.class.getName(), "pfs", PartitionedFileSetProperties.builder() .setPartitioning(Partitioning.builder().addLongField("snapshot").build()) .setInputFormat(AvroKeyInputFormat.class) .setOutputFormat(AvroKeyOutputFormat.class) .build()); PartitionedFileSet partitionedFileSet = (PartitionedFileSet) getDataset("pfs").get(); <START> PartitionKey key = PartitionKey.builder().addLongField("snapshot", System.currentTimeMillis() - 1000 * 60).build(); <END> PartitionOutput partition = partitionedFileSet.getPartitionOutput(key); partition.addPartition(); SnapshotFileSet snapshotFileSet = new SnapshotFileSet(partitionedFileSet); snapshotFileSet.deleteMatchingPartitionsByTime(System.currentTimeMillis()); Assert.assertNull(partitionedFileSet.getPartition(key)); }</code><technical_language>add a partition a time, get deleted</technical_language>

Target:
public void testCleanup() throws Exception { addDatasetInstance(NamespaceId.DEFAULT.toId(), PartitionedFileSet.class.getName(), "pfs", PartitionedFileSetProperties.builder() .setPartitioning(Partitioning.builder().addLongField(SnapshotFileSet.SNAPSHOT_FIELD).build()) .setInputFormat(AvroKeyInputFormat.class) .setOutputFormat(AvroKeyOutputFormat.class) .build()); PartitionedFileSet partitionedFileSet = (PartitionedFileSet) getDataset("pfs").get(); PartitionKey deletedPartitionKey = PartitionKey.builder().addLongField(SnapshotFileSet.SNAPSHOT_FIELD, System.currentTimeMillis() - (1000 * 60)).build(); PartitionOutput partitionToDelete = partitionedFileSet.getPartitionOutput(deletedPartitionKey); partitionToDelete.addPartition(); PartitionKey persistentPartitionKey = PartitionKey.builder().addLongField(SnapshotFileSet.SNAPSHOT_FIELD, System.currentTimeMillis() - (1000 * 20)).build(); PartitionOutput partitionToKeep = partitionedFileSet.getPartitionOutput(persistentPartitionKey); partitionToKeep.addPartition(); SnapshotFileSet snapshotFileSet = new SnapshotFileSet(partitionedFileSet); snapshotFileSet.deleteMatchingPartitionsByTime(System.currentTimeMillis() - (1000 * 30)); Assert.assertNull(partitionedFileSet.getPartition(deletedPartitionKey)); Assert.assertNotNull(partitionedFileSet.getPartition(persistentPartitionKey)); }
Source:
<code>public static PlayQueue autoQueueOf(@NonNull final StreamInfo info, @NonNull final List<PlayQueueItem> existingItems) { final Set<String> urls = new HashSet<>(existingItems.size()); for (final PlayQueueItem item : existingItems) { urls.add(item.getUrl()); } final List<InfoItem> relatedItems = info.getRelatedStreams(); if (relatedItems == null) { return null; } if (relatedItems.get(0) != null && relatedItems.get(0) instanceof StreamInfoItem && !urls.contains(relatedItems.get(0).getUrl())) { return getAutoQueuedSinglePlayQueue((StreamInfoItem) relatedItems.get(0)); } final List<StreamInfoItem> autoQueueItems = new ArrayList<>(); <START> for (final InfoItem item : info.getRelatedStreams()) { <END> if (item instanceof StreamInfoItem && !urls.contains(item.getUrl())) { autoQueueItems.add((StreamInfoItem) item); } } Collections.shuffle(autoQueueItems); return autoQueueItems.isEmpty() ? null : getAutoQueuedSinglePlayQueue(autoQueueItems.get(0)); }</code><technical_language>suggestion for (final InfoItem item : relatedItems) {</technical_language>

Target:
public static PlayQueue autoQueueOf(@NonNull final StreamInfo info, @NonNull final List<PlayQueueItem> existingItems) { final Set<String> urls = new HashSet<>(existingItems.size()); for (final PlayQueueItem item : existingItems) { urls.add(item.getUrl()); } final List<InfoItem> relatedItems = info.getRelatedStreams(); if (relatedItems == null) { return null; } if (relatedItems.get(0) != null && relatedItems.get(0) instanceof StreamInfoItem && !urls.contains(relatedItems.get(0).getUrl())) { return getAutoQueuedSinglePlayQueue((StreamInfoItem) relatedItems.get(0)); } final List<StreamInfoItem> autoQueueItems = new ArrayList<>(); for (final InfoItem item : relatedItems) { if (item instanceof StreamInfoItem && !urls.contains(item.getUrl())) { autoQueueItems.add((StreamInfoItem) item); } } Collections.shuffle(autoQueueItems); return autoQueueItems.isEmpty() ? null : getAutoQueuedSinglePlayQueue(autoQueueItems.get(0)); }
Source:
<code>public MessageQueue queue() { <START> return MessageQueue.CertificationSuccess_PushMessage; <END> }</code><technical_language>essageQueue.RegisterBankAccount_PushMessage</technical_language>

Target:
public MessageQueue queue() { return MessageQueue.RegisterBankAccount_PushMessage; }
Source:
<code>public void testValidateNullGermplasmId() { this.errors = new MapBindingResult(new HashMap<String, String>(), LotDto.class.getName()); final Integer germplasmId = null; this.lotGeneratorInputDto.setGid(germplasmId); this.lotGeneratorInputDto.setLocationId(6000); this.lotGeneratorInputDto.setGenerateStock(false); <START> this.lotGeneratorInputDto.setScaleId(8264); <END> this.lotGeneratorInputDto.setStockId("ABCD"); this.lotGeneratorInputDto.setComments("Comments"); final VariableFilter variableFilter = new VariableFilter(); variableFilter.addPropertyId(TermId.INVENTORY_AMOUNT_PROPERTY.getId()); this.germplasmValidator.validateGermplasmId(this.errors, germplasmId); Assert.assertTrue(this.errors.getAllErrors().size() == 1); final ObjectError objectError = this.errors.getAllErrors().get(0); assertThat(Arrays.asList(objectError.getCodes()), CoreMatchers.hasItem("germplasm.required")); }</code><technical_language>@vmaletta replace 8264 TermId.SEED_AMOUNT_G in tests</technical_language>

Target:
public void testValidateNullGermplasmId() { this.errors = new MapBindingResult(new HashMap<String, String>(), LotDto.class.getName()); final Integer germplasmId = null; this.lotGeneratorInputDto.setGid(germplasmId); this.lotGeneratorInputDto.setLocationId(LOCATION_ID); this.lotGeneratorInputDto.setGenerateStock(false); this.lotGeneratorInputDto.setScaleId(SCALE_ID); this.lotGeneratorInputDto.setStockId(STOCK_ID); this.lotGeneratorInputDto.setComments(COMMENTS); final VariableFilter variableFilter = new VariableFilter(); variableFilter.addPropertyId(TermId.INVENTORY_AMOUNT_PROPERTY.getId()); this.germplasmValidator.validateGermplasmId(this.errors, germplasmId); Assert.assertEquals(this.errors.getAllErrors().size(), 1); final ObjectError objectError = this.errors.getAllErrors().get(0); assertThat(Arrays.asList(objectError.getCodes()), CoreMatchers.hasItem("germplasm.required")); }
Source:
<code>private static List<Class<? extends Monitor>> getMonitorsFromNames(List<String> monitorNames) { List<Class<? extends Monitor>> monitors = Lists.newArrayList(); if (monitorNames == null) { return monitors; } try { for (String monitorName : monitorNames) { <START> String effectiveMonitorName = monitorName.replace(OLD_METAMX_PACKAGE_NAME, NEW_DRUID_PACKAGE_NAME); <END> Class<? extends Monitor> monitorClass = (Class<? extends Monitor>) Class.forName(effectiveMonitorName); monitors.add(monitorClass); } return monitors; } catch (ClassNotFoundException cnfe) { throw new RuntimeException(cnfe); } }</code><technical_language>logging a warning new name instead of one</technical_language>

Target:
private static List<Class<? extends Monitor>> getMonitorsFromNames(List<String> monitorNames) { List<Class<? extends Monitor>> monitors = Lists.newArrayList(); if (monitorNames == null) { return monitors; } try { for (String monitorName : monitorNames) { String effectiveMonitorName = monitorName.replace(OLD_METAMX_PACKAGE_NAME, NEW_DRUID_PACKAGE_NAME); if (!effectiveMonitorName.equals(monitorName)) { log.warn( "Deprecated Monitor class name [%s] found, please use package %s instead of %s", monitorName, NEW_DRUID_PACKAGE_NAME, OLD_METAMX_PACKAGE_NAME ); } Class<? extends Monitor> monitorClass = (Class<? extends Monitor>) Class.forName(effectiveMonitorName); monitors.add(monitorClass); } return monitors; } catch (ClassNotFoundException cnfe) { throw new RuntimeException(cnfe); } }
Source:
<code>public ChannelSetBuilder(Type type, Optional<Integer> hashChannel, int expectedPositions, OperatorContext operatorContext, JoinCompiler joinCompiler) { List<Type> types = ImmutableList.of(type); this.hash = createGroupByHash(operatorContext.getSession(), types, HASH_CHANNELS, hashChannel, expectedPositions, joinCompiler); this.operatorContext = operatorContext; this.nullBlockPage = new Page(type.createBlockBuilder(new BlockBuilderStatus(), 1, UNKNOWN.getFixedSize()).appendNull().build()); this.localMemoryContext = operatorContext.localUserMemoryContext(); <START> } <END></code><technical_language>original implementation, appears operatorContext null (if (operatorContext != null) below). I assume this code crash NPE in a case. If turns out operatorContext is guaranteed non-null, add rquireNonNull operatorContext</technical_language>

Target:
public ChannelSetBuilder(Type type, Optional<Integer> hashChannel, int expectedPositions, OperatorContext operatorContext, JoinCompiler joinCompiler) { List<Type> types = ImmutableList.of(type); this.operatorContext = requireNonNull(operatorContext, "operatorContext is null"); this.hash = createGroupByHash(operatorContext.getSession(), types, HASH_CHANNELS, hashChannel, expectedPositions, joinCompiler); this.nullBlockPage = new Page(type.createBlockBuilder(new BlockBuilderStatus(), 1, UNKNOWN.getFixedSize()).appendNull().build()); this.localMemoryContext = operatorContext.localUserMemoryContext(); }
Source:
<code>public void testInnerSuperCallEs2015Out() { setLanguageOut(LanguageMode.ECMASCRIPT_2015); test( lines( "class A {", " m() {", " return this;", " }", "}", "class X extends A {", " async m() {", " return super.m();", " }", "}"), lines( "class A {", " m() {", " return this;", " }", "}", "class X extends A {", " m() {", " const $jscomp$async$this = this;", " const $jscomp$async$super$get$m =", <START> " () => Object.getPrototypeOf(this.constructor).prototype.m;", <END> " return $jscomp.asyncExecutePromiseGeneratorFunction(", " function* () {", " return $jscomp$async$super$get$m().call($jscomp$async$this);", " });", " }", "}")); }</code><technical_language>get prototype this? javascript () => Object.getPrototypeOf(this).m;</technical_language>

Target:
public void testInnerSuperCallEs2015Out() { setLanguageOut(LanguageMode.ECMASCRIPT_2015); test( lines( "class A {", " m() {", " return this;", " }", "}", "class X extends A {", " async m() {", " return super.m();", " }", "}"), lines( "class A {", " m() {", " return this;", " }", "}", "class X extends A {", " m() {", " const $jscomp$async$this = this;", " const $jscomp$async$super$get$m =", " () => Object.getPrototypeOf(Object.getPrototypeOf(this)).m;", " return $jscomp.asyncExecutePromiseGeneratorFunction(", " function* () {", " return $jscomp$async$super$get$m().call($jscomp$async$this);", " });", " }", "}")); }
Source:
<code>protected void handleGroupedCounterAspect(ITmfEvent event, ITmfStateSystemBuilder ss, CounterAspect aspect, int rootQuark) { int quark = rootQuark; for (Class<? extends ITmfEventAspect<?>> groupClass : aspect.getGroups()) { ITmfEventAspect<?> parentAspect = fAspectImpls.get(groupClass); if (parentAspect != null) { quark = ss.getQuarkRelativeAndAdd(quark, parentAspect.getName()); quark = ss.getQuarkRelativeAndAdd(quark, <START> String.valueOf(parentAspect.resolve(event))); <END> } } handleCounterAspect(event, ss, aspect, quark); }</code><technical_language>this "mutliAspect" ? aspects resolve null String "null", is expected behavior</technical_language>

Target:
protected void handleGroupedCounterAspect(ITmfEvent event, ITmfStateSystemBuilder ss, CounterAspect aspect, int rootQuark) { int quark = rootQuark; for (Class<? extends ITmfEventAspect<?>> groupClass : aspect.getGroups()) { ITmfEventAspect<?> parentAspect = fAspectImpls.get(groupClass); if (parentAspect != null) { Object parentAspectContent = parentAspect.resolve(event); if (parentAspectContent != null) { quark = ss.getQuarkRelativeAndAdd(quark, parentAspect.getName()); quark = ss.getQuarkRelativeAndAdd(quark, String.valueOf(parentAspectContent)); } else { return; } } } handleCounterAspect(event, ss, aspect, quark); }
Source:
<code>public static void closeAll() { LOG.debug("Closing all handles"); Iterator<String> handleIds = connectionMap.keySet().iterator(); String handleId = null; while (handleIds.hasNext()) { try { <START> handleId = handleIds.next(); <END> close(handleId); } catch (Exception err) { LOG.error("Error closing handle ID " + handleId, err); } } }</code><technical_language>I looked web pages/blogs discuss "removing element HashMap while iterating it". of suggest common method i.e. iterator. I ArrayList somewhere, a common suggestion. If keySet() return keys create ArrayList once, ideally, removing a key iterator is scanning, causing exception. end remove elements, solution is close connections iterating Map call clear() Map. This require refactor close() method suggested earlier</technical_language>

Target:
public static void closeAll() { LOG.debug("Closing all handles"); synchronized (lock) { Iterator<Map.Entry<String, List<Connection>>> itr = connectionMap.entrySet().iterator(); Map.Entry<String, List<Connection>> connHandle = null; while (itr.hasNext()) { connHandle = itr.next(); closeConnections(connHandle.getKey(), connHandle.getValue()); itr.remove(); } } }
Source:
<code>public void pause() { getLifeCycle().transition(LifeCycle.State.PAUSING); try { if (!mJournalApplier.isSuspended()) { suspend(); } } catch (IOException e) { LOG.error("State machine pause failed", e); <START> throw new IllegalStateException(e); <END> } getLifeCycle().transition(LifeCycle.State.PAUSED); }</code><technical_language>Do need throw log? this message include message above</technical_language>

Target:
public void pause() { getLifeCycle().transition(LifeCycle.State.PAUSING); try { if (!mJournalApplier.isSuspended()) { suspend(); } } catch (IOException e) { throw new IllegalStateException("State machine pause failed", e); } getLifeCycle().transition(LifeCycle.State.PAUSED); }
Source:
<code>public void registerBundleService () { if(System.getProperty(WebKeys.OSGI_ENABLED)!=null){ BundleContext context = HostActivator.instance().getBundleContext(); if (null != context) { Hashtable<String, String> props = new Hashtable<String, String>(); context.registerService(WorkflowAPIOsgiService.class.getName(), this, props); } else { <START> Logger.debug(this, "Bundle Context is null, WorkflowAPIOsgiService has been not registered"); <END> } } }</code><technical_language>@jdotcms please instead of a debug change error, if register OSGI do want noisy reason</technical_language>

Target:
public void registerBundleService () { if(System.getProperty(WebKeys.OSGI_ENABLED)!=null){ BundleContext context = HostActivator.instance().getBundleContext(); if (null != context) { Hashtable<String, String> props = new Hashtable<String, String>(); context.registerService(WorkflowAPIOsgiService.class.getName(), this, props); } else { Logger.error(this, "Bundle Context is null, WorkflowAPIOsgiService has been not registered"); } } }
Source:
<code>private void writeMetricsHeader(ch.qos.logback.classic.Logger logger, RollingFileAppender appender) { LOG.debug("Start writing header to file .."); String header = new StringBuilder("Current Date").append(",") .append("Flow Name").append(",") .append("File Name").append(",") .append("Total Events Read Per File").append(",") .append("Total Events Ingested Per File").append(",") .append("Min Event Size Per File").append(",") .append("Average Event Size Per File").append(",") .append("Max Event Size Per File").append(",") .append("Min Write Latency Per Stream").append(",") .append("Average Write Latency Per Stream").append(",") .append("Max Write Latency Per Stream").append("\n").toString(); appender.doAppend(new LoggingEvent(loggerClass, logger, null, header, null, null)); <START> LOG.debug("Successfully write header"); <END> }</code><technical_language>"Successfully wrote header"</technical_language>

Target:
private void writeMetricsHeader(ch.qos.logback.classic.Logger logger, RollingFileAppender appender) { LOG.debug("Start writing header to file .."); String header = new StringBuilder("Current Date").append(",") .append("Flow Name").append(",") .append("File Name").append(",") .append("Total Events Read Per File").append(",") .append("Total Events Ingested Per File").append(",") .append("Min Event Size Per File").append(",") .append("Average Event Size Per File").append(",") .append("Max Event Size Per File").append(",") .append("Min Write Latency Per Stream").append(",") .append("Average Write Latency Per Stream").append(",") .append("Max Write Latency Per Stream").append("\n").toString(); appender.doAppend(new LoggingEvent(loggerClass, logger, null, header, null, null)); LOG.debug("Successfully wrote header"); }
Source:
<code>public Response register(Action action) { validateParameters(action, "cluster.id|name"); validateVnicMappings(action); <START> validateClusterMappings(action); validateRoleMappings(action); validateDomainMappings(action); validateAffinityGroupMappings(action); validateAffinityLabelMappings(action); validateLunMappings(action); <END> ImportVmFromConfParameters params = new ImportVmFromConfParameters(getVnicProfileMappings(action), getReassignBadMacs(action)); ExternalRegistrationConfigurationMapper.mapFromModel(action.getRegistrationConfiguration(), params); params.setContainerId(guid); params.setStorageDomainId(parent.getStorageDomainId()); params.setClusterId(getClusterId(action)); params.setImagesExistOnTargetStorageDomain(true); if (action.isSetClone()) { params.setImportAsNewEntity(action.isClone()); if (action.isSetVm() && action.getVm().isSetName()) { params.getVm().setName(action.getVm().getName()); } } if (action.isSetAllowPartialImport()) { params.setAllowPartialImport(action.isAllowPartialImport()); } return doAction(ActionType.ImportVmFromConfiguration, params, action); }</code><technical_language>put this part in if (action.isSetRegistrationConfiguration()) block save repeating this condition in method</technical_language>

Target:
public Response register(Action action) { validateParameters(action, "cluster.id|name"); if (action.isSetRegistrationConfiguration()) { validateVnicMappings(action); validateClusterMappings(action); validateRoleMappings(action); validateDomainMappings(action); validateAffinityGroupMappings(action); validateAffinityLabelMappings(action); validateLunMappings(action); } ImportVmFromConfParameters params = new ImportVmFromConfParameters(getVnicProfileMappings(action), getReassignBadMacs(action)); ExternalRegistrationConfigurationMapper.mapFromModel(action.getRegistrationConfiguration(), params); params.setContainerId(guid); params.setStorageDomainId(parent.getStorageDomainId()); params.setClusterId(getClusterId(action)); params.setImagesExistOnTargetStorageDomain(true); if (action.isSetClone()) { params.setImportAsNewEntity(action.isClone()); if (action.isSetVm() && action.getVm().isSetName()) { params.getVm().setName(action.getVm().getName()); } } if (action.isSetAllowPartialImport()) { params.setAllowPartialImport(action.isAllowPartialImport()); } return doAction(ActionType.ImportVmFromConfiguration, params, action); }
Source:
<code>public Opt<Identity> enter(final String user, final String pwd) { <START> Opt<Identity> valid = new Opt.Empty<Identity>(); <END> if (this.users.containsKey(user) && this.users.get(user).equals(pwd)) { valid = new Opt.Single<Identity>( new Identity.Simple(PsBasic.generateIdentityUrn(user)) ); } return valid; }</code><technical_language>@lautarobock assign new Opt.Empty statement else block instead of initializing variable here. a) declare valid final, b) avoid instantiating Opt.Empty if unnecessary</technical_language>

Target:
public Opt<Identity> enter(final String user, final String pwd) { final Opt<Identity> valid; if (this.users.containsKey(user) && this.users.get(user).pass().equals(pwd)) { valid = new Opt.Single<Identity>( new Identity.Simple(this.users.get(user).urn()) ); } else { valid = new Opt.Empty<Identity>(); } return valid; }
Source:
<code>protected void onMetadataChanged(@NonNull final MediaSourceTag tag) { super.onMetadataChanged(tag); <START> boolean showKodiButton = <END> KoreUtil.isServiceSupportedByKore(tag.getMetadata().getServiceId()) && PreferenceManager.getDefaultSharedPreferences(context) .getBoolean(context.getString(R.string.show_play_with_kodi_key), false); kodiButton.setVisibility(showKodiButton ? View.VISIBLE : View.GONE); titleTextView.setText(tag.getMetadata().getName()); channelTextView.setText(tag.getMetadata().getUploaderName()); }</code><technical_language>final</technical_language>

Target:
protected void onMetadataChanged(@NonNull final MediaSourceTag tag) { super.onMetadataChanged(tag); final boolean showKodiButton = KoreUtil.isServiceSupportedByKore(tag.getMetadata().getServiceId()) && PreferenceManager.getDefaultSharedPreferences(context) .getBoolean(context.getString(R.string.show_play_with_kodi_key), false); kodiButton.setVisibility(showKodiButton ? View.VISIBLE : View.GONE); titleTextView.setText(tag.getMetadata().getName()); channelTextView.setText(tag.getMetadata().getUploaderName()); }
Source:
<code>void submitGetBlobOperation(String blobId, FutureResult<ReadableStreamChannel> futureResult, Callback<ReadableStreamChannel> callback) { try { GetBlobOperation getBlobOperation = new GetBlobOperation(routerConfig, routerMetrics, clusterMap, responseHandler, blobId, futureResult, callback, operationCompleteCallback, readyForPollCallback, blobIdFactory, time); getOperations.add(getBlobOperation); <START> readyForPollCallback.onPollReady(); <END> } catch (RouterException e) { routerMetrics.getBlobErrorCount.inc(); routerMetrics.countError(e); routerMetrics.operationDequeuingRate.mark(); operationCompleteCallback.completeOperation(futureResult, callback, null, e); } }</code><technical_language>I prefer onPollReady() operation arrival in OperationController passing in readyForPollCallback required (i.e. GetBlobOperation ChunkFiller)</technical_language>

Target:
void submitGetBlobOperation(String blobId, FutureResult<ReadableStreamChannel> futureResult, Callback<ReadableStreamChannel> callback) { try { GetBlobOperation getBlobOperation = new GetBlobOperation(routerConfig, routerMetrics, clusterMap, responseHandler, blobId, futureResult, callback, operationCompleteCallback, readyForPollCallback, blobIdFactory, time); getOperations.add(getBlobOperation); } catch (RouterException e) { routerMetrics.getBlobErrorCount.inc(); routerMetrics.countError(e); routerMetrics.operationDequeuingRate.mark(); operationCompleteCallback.completeOperation(futureResult, callback, null, e); } }
Source:
<code>public byte[] getPublicCertificate() { <START> return publicCertificate.getBytes(); <END> }</code><technical_language>This platform default character encoding. good explicit, please publicCertificate.getBytes(StandardCharsets.UTF_8) instead</technical_language>

Target:
public byte[] getPublicCertificate() { return publicCertificate.getBytes(StandardCharsets.UTF_8); }
Source:
<code>private String getDomainFromDB(String userId, int tenantId) throws UserStoreException { String domainName = null; <START> try (Connection dbConnection = getDBConnection(true); <END> PreparedStatement preparedStatement = dbConnection.prepareStatement(GET_DOMAIN)) { preparedStatement.setString(1, userId); preparedStatement.setInt(2, tenantId); try (ResultSet resultSet = preparedStatement.executeQuery()) { while (resultSet.next()) { domainName = resultSet.getString(DOMAIN_COLUMN_NAME); } } } catch (SQLException ex) { throw new UserStoreException("Error occurred while reading the domain name for user id from database.", ex); } return domainName; }</code><technical_language>do need apply transactions for SELECT statements</technical_language>

Target:
private String getDomainFromDB(String userId, int tenantId) throws UserStoreException { String domainName = null; try (Connection dbConnection = getDBConnection(); PreparedStatement preparedStatement = dbConnection.prepareStatement(GET_DOMAIN)) { preparedStatement.setString(1, userId); preparedStatement.setInt(2, tenantId); try (ResultSet resultSet = preparedStatement.executeQuery()) { while (resultSet.next()) { domainName = resultSet.getString(DOMAIN_COLUMN_NAME); } } } catch (SQLException ex) { throw new UserStoreException("Error occurred while reading the domain name for user id from database.", ex); } return domainName; }
Source:
<code>public List<MimeMessage> generateNewInstructorAccountJoinEmail(InstructorAttributes instructor,String shortName, String institute) throws AddressException,MessagingException,UnsupportedEncodingException { MimeMessage messageToUser = getEmptyEmailAddressedToEmail(instructor.email); MimeMessage messageToAdmin = getEmptyEmailAddressedToEmail(Config.SUPPORT_EMAIL); List<MimeMessage> messages = new ArrayList<MimeMessage>(); messages.add(messageToUser); messages.add(messageToAdmin); messageToUser.setSubject(String.format(SUBJECT_PREFIX_NEW_INSTRUCTOR_ACCOUNT + " " + shortName)); messageToAdmin.setSubject(String.format(SUBJECT_PREFIX_NEW_INSTRUCTOR_ACCOUNT_COPY + " " + shortName+" "+ "[" + instructor.email + "]")); for(MimeMessage message : messages){ String emailBody = EmailTemplates.NEW_INSTRCUTOR_ACCOUNT_WELCOME; emailBody = emailBody.replace("${UserName}", shortName); String joinUrl = ""; if (instructor != null) { String key; key = StringHelper.encrypt(instructor.key); joinUrl = Config.APP_URL + Const.ActionURIs.INSTRUCTOR_COURSE_JOIN; joinUrl = Url.addParamToUrl(joinUrl, Const.ParamsNames.REGKEY, key); joinUrl = Url.addParamToUrl(joinUrl, Const.ParamsNames.INSTRUCTOR_INSTITUTION, institute); } <START> emailBody = emailBody.replace("${confimationUrl}",joinUrl); <END> System.out.print("*******************************************************\n"); System.out.print(joinUrl); message.setContent(emailBody, "text/html"); } return messages; }</code><technical_language>joinUrl instead of confirmationUrl</technical_language>

Target:
public List<MimeMessage> generateNewInstructorAccountJoinEmail(InstructorAttributes instructor,String shortName, String institute) throws AddressException,MessagingException,UnsupportedEncodingException { MimeMessage messageToUser = getEmptyEmailAddressedToEmail(instructor.email); MimeMessage messageToAdmin = getEmptyEmailAddressedToEmail(Config.SUPPORT_EMAIL); List<MimeMessage> messages = new ArrayList<MimeMessage>(); messages.add(messageToUser); messages.add(messageToAdmin); messageToUser.setSubject(String.format(SUBJECT_PREFIX_NEW_INSTRUCTOR_ACCOUNT + " " + shortName)); messageToAdmin.setSubject(String.format(SUBJECT_PREFIX_NEW_INSTRUCTOR_ACCOUNT_COPY + " " + shortName+" "+ "[" + instructor.email + "]")); for(MimeMessage message : messages){ String emailBody = EmailTemplates.NEW_INSTRCUTOR_ACCOUNT_WELCOME; emailBody = emailBody.replace("${userName}", shortName); String joinUrl = ""; if (instructor != null) { String key; key = StringHelper.encrypt(instructor.key); joinUrl = Config.APP_URL + Const.ActionURIs.INSTRUCTOR_COURSE_JOIN; joinUrl = Url.addParamToUrl(joinUrl, Const.ParamsNames.REGKEY, key); joinUrl = Url.addParamToUrl(joinUrl, Const.ParamsNames.INSTRUCTOR_INSTITUTION, institute); } emailBody = emailBody.replace("${joinUrl}",joinUrl); message.setContent(emailBody, "text/html"); } return messages; }
Source:
<code>public void deregisterApplication(ApplicationStatus finalStatus, @Nullable String optionalDiagnostics) { final FinalApplicationStatus yarnStatus = getYarnStatus(finalStatus); log.info("Unregister application from the YARN Resource Manager with final status {}.", yarnStatus); final Optional<URL> historyServerURL = HistoryServerUtils.getHistoryServerURL(flinkConfig); final String appTrackingUrl = historyServerURL.map(URL::toString).orElse(""); try { resourceManagerClient.unregisterApplicationMaster(yarnStatus, optionalDiagnostics, appTrackingUrl); <START> } catch (Throwable t) { <END> log.error("Could not unregister the application master.", t); } Utils.deleteApplicationFiles(configuration.getYarnFiles()); }</code><technical_language>catch thrown exceptions Throwables here</technical_language>

Target:
public void deregisterApplication(ApplicationStatus finalStatus, @Nullable String optionalDiagnostics) { final FinalApplicationStatus yarnStatus = getYarnStatus(finalStatus); log.info("Unregister application from the YARN Resource Manager with final status {}.", yarnStatus); final Optional<URL> historyServerURL = HistoryServerUtils.getHistoryServerURL(flinkConfig); final String appTrackingUrl = historyServerURL.map(URL::toString).orElse(""); try { resourceManagerClient.unregisterApplicationMaster(yarnStatus, optionalDiagnostics, appTrackingUrl); } catch (YarnException | IOException e) { log.error("Could not unregister the application master.", e); } Utils.deleteApplicationFiles(configuration.getYarnFiles()); }
Source:
<code>public KeyValue next() throws IOException { if (mReader.next(mKey, mValue)) { MessageUnpacker unpacker = MessagePack.newDefaultUnpacker(mKey.getBytes()); int mapSize = unpacker.unpackMapHeader(); long offset = 0; <START> long timestamp = 0; <END> byte[] keyBytes = EMPTY_BYTES; for (int i = 0; i < mapSize; i++) { int key = unpacker.unpackInt(); switch (key) { case KAFKA_MESSAGE_OFFSET: offset = unpacker.unpackLong(); break; case KAFKA_MESSAGE_TIMESTAMP: timestamp = unpacker.unpackLong(); break; case KAFKA_HASH_KEY: int keySize = unpacker.unpackBinaryHeader(); keyBytes = new byte[keySize]; unpacker.readPayload(keyBytes); break; } } unpacker.close(); return new KeyValue(offset, keyBytes, Arrays.copyOfRange(mValue.getBytes(), 0, mValue.getLength()), timestamp); } else { return null; } }</code><technical_language>default of timestamp -1, consistent KeyValue class</technical_language>

Target:
public KeyValue next() throws IOException { if (mReader.next(mKey, mValue)) { MessageUnpacker unpacker = MessagePack.newDefaultUnpacker(mKey.getBytes()); int mapSize = unpacker.unpackMapHeader(); long offset = 0; long timestamp = -1; byte[] keyBytes = EMPTY_BYTES; for (int i = 0; i < mapSize; i++) { int key = unpacker.unpackInt(); switch (key) { case KAFKA_MESSAGE_OFFSET: offset = unpacker.unpackLong(); break; case KAFKA_MESSAGE_TIMESTAMP: timestamp = unpacker.unpackLong(); break; case KAFKA_HASH_KEY: int keySize = unpacker.unpackBinaryHeader(); keyBytes = new byte[keySize]; unpacker.readPayload(keyBytes); break; } } unpacker.close(); return new KeyValue(offset, keyBytes, Arrays.copyOfRange(mValue.getBytes(), 0, mValue.getLength()), timestamp); } else { return null; } }
Source:
<code>public Collection<Privileges> getStorageAuthorities(String path) { return getRoles().stream() .flatMap(r -> r.getAccessModel().getPathPrivileges(path) <START> .stream()) <END> .collect(Collectors.toSet()); }</code><technical_language>@carlspring indentation :P</technical_language>

Target:
public Collection<Privileges> getStorageAuthorities(String path) { return getRoles().stream() .flatMap(r -> r.getAccessModel() .getPathAuthorities(path) .stream()) .collect(Collectors.toSet()); }
Source:
<code>public void import_credentials_provider_extension_credentials() { List<DummyCredentials> dummyCred = CredentialsProvider.lookupCredentials( DummyCredentials.class, j.jenkins, ACL.SYSTEM, Collections.emptyList() ); assertThat(dummyCred, hasSize(1)); assertThat(dummyCred.get(0).getUsername(), equalTo("user1")); List<UsernamePasswordCredentials> ups = CredentialsProvider.lookupCredentials( UsernamePasswordCredentials.class, j.jenkins, ACL.SYSTEM, Collections.singletonList(new HostnameRequirement("api.test.com")) ); <START> Assert.assertThat(ups, hasSize(1)); <END> final UsernamePasswordCredentials up = ups.get(0); Assert.assertThat(up.getPassword().getPlainText(), equalTo("password")); }</code><technical_language>i static import Assert classes for improved readability, is a reason do this here</technical_language>

Target:
public void import_credentials_provider_extension_credentials() { List<DummyCredentials> dummyCred = CredentialsProvider.lookupCredentials( DummyCredentials.class, j.jenkins, ACL.SYSTEM, Collections.emptyList() ); assertThat(dummyCred, hasSize(1)); assertThat(dummyCred.get(0).getUsername(), equalTo("user1")); List<UsernamePasswordCredentials> ups = CredentialsProvider.lookupCredentials( UsernamePasswordCredentials.class, j.jenkins, ACL.SYSTEM, Collections.singletonList(new HostnameRequirement("api.test.com")) ); assertThat(ups, hasSize(1)); final UsernamePasswordCredentials up = ups.get(0); assertThat(up.getPassword(), hasPlainText("password")); }
Source:
<code>public void testInsertTaskWithStartAndDueMovedForward() { RowSnapshot<TaskLists> taskList = new VirtualRowSnapshot<>(new LocalTaskListsTable(mAuthority)); RowSnapshot<Tasks> task = new VirtualRowSnapshot<>(new TaskListScoped(taskList, new TasksTable(mAuthority))); DateTime start = DateTime.now(); DateTime due = start.addDuration(new Duration(1, 1, 0)); Duration duration = new Duration(1, 2, 0); DateTime startNew = start.addDuration(duration); DateTime dueNew = due.addDuration(duration); assertThat(new Seq<>( new Put<>(taskList, new EmptyRowData<TaskLists>()), new Put<>(task, new TimeData(start, due)), new Put<>(task, new TimeData(startNew, dueNew)) ), resultsIn(mClient, new Assert<>(task, new TimeData(startNew, dueNew)), new AssertRelated<>( new InstanceTable(mAuthority), Instances.TASK_ID, task, new InstanceData( <START> startNew.shiftTimeZone(TimeZone.getDefault()), <END> dueNew.shiftTimeZone(TimeZone.getDefault()), absent(), Instances.INSTANCE_STATUS_NEXT)) )); }</code><technical_language>TZ check</technical_language>

Target:
public void testInsertTaskWithStartAndDueMovedForward() { RowSnapshot<TaskLists> taskList = new VirtualRowSnapshot<>(new LocalTaskListsTable(mAuthority)); RowSnapshot<Tasks> task = new VirtualRowSnapshot<>(new TaskListScoped(taskList, new TasksTable(mAuthority))); DateTime start = DateTime.now(); DateTime due = start.addDuration(new Duration(1, 1, 0)); Duration duration = new Duration(1, 2, 0); DateTime startNew = start.addDuration(duration); DateTime dueNew = due.addDuration(duration); assertThat(new Seq<>( new Put<>(taskList, new EmptyRowData<TaskLists>()), new Put<>(task, new TimeData(start, due)), new Put<>(task, new TimeData(startNew, dueNew)) ), resultsIn(mClient, new Assert<>(task, new TimeData(startNew, dueNew)), new AssertRelated<>( new InstanceTable(mAuthority), Instances.TASK_ID, task, new Composite<Instances>( new InstanceTestData( startNew.shiftTimeZone(TimeZone.getDefault()), dueNew.shiftTimeZone(TimeZone.getDefault()), absent(), 0), new CharSequenceRowData<>(Tasks.TZ, "UTC")) ))); }
Source:
<code>private Map<String, String> getHeaderMap(HttpServletRequest request) { Map<String, String> map = new HashMap<String, String>(); <START> Enumeration<String> headerNames = request.getHeaderNames(); <END> while (headerNames.hasMoreElements()) { String key = headerNames.nextElement(); Enumeration<String> headerValues = request.getHeaders(key); StringBuilder value = new StringBuilder(headerValues.nextElement()); while (headerValues.hasMoreElements()) { value.append(",").append(headerValues.nextElement()); } map.put(key, value.toString()); } return map; }</code><technical_language>This return null</technical_language>

Target:
private Map<String, String> getHeaderMap(HttpServletRequest request) { Map<String, String> headers = new HashMap<String, String>(); Enumeration<String> headerNames = request.getHeaderNames(); while (headerNames != null && headerNames.hasMoreElements()) { String key = headerNames.nextElement(); Enumeration<String> headerValues = request.getHeaders(key); StringBuilder value = new StringBuilder(); if (headerValues != null && headerValues.hasMoreElements()) { value.append(headerValues.nextElement()); while (headerValues.hasMoreElements()) { value.append(",").append(headerValues.nextElement()); } } headers.put(key, value.toString()); } return headers; }
Source:
<code>private void handleBlock1Response(final Exchange exchange, final Response response) { BlockOption block1 = response.getOptions().getBlock1(); LOGGER.debug("received response acknowledging block1 {}", block1); final KeyUri key = getKey(exchange, exchange.getRequest()); synchronized (block1Transfers) { Block1BlockwiseStatus status = getBlock1Status(key); if (status == null) { LOGGER.debug("discarding unexpected block1 response: {}", response); } else if (!status.hasMatchingToken(response)) { LOGGER.debug("discarding obsolete block1 response: {}", response); } else if (exchange.getRequest().isCanceled()) { clearBlock1Status(key, status); } else if (response.getCode() == ResponseCode.REQUEST_ENTITY_TOO_LARGE && block1.getSize() < status.getCurrentSize()) { <START> SendBlockAgain(exchange, response, key, status); <END> } else if (!status.isComplete()) { if (block1.isM()) { if (response.getCode() == ResponseCode.CONTINUE) { sendNextBlock(exchange, response, key, status); } else { clearBlock1Status(key, status); exchange.getRequest().setRejected(true); } } else { sendNextBlock(exchange, response, key, status); } } else { clearBlock1Status(key, status); if (response.getOptions().hasBlock2()) { LOGGER.debug("Block1 followed by Block2 transfer"); } else { exchange.setResponse(response); upper().receiveResponse(exchange, response); } } } }</code><technical_language>block1.getSize() < status.getCurrentSize() If blocksize is changed begin, I guess, checks result test. If blocksize changed transfer, sure, this test fail why</technical_language>

Target:
private void handleBlock1Response(final Exchange exchange, final Response response) { BlockOption block1 = response.getOptions().getBlock1(); LOGGER.debug("received response acknowledging block1 {}", block1); final KeyUri key = getKey(exchange, exchange.getRequest()); synchronized (block1Transfers) { Block1BlockwiseStatus status = getBlock1Status(key); if (status == null) { LOGGER.debug("discarding unexpected block1 response: {}", response); } else if (!status.hasMatchingToken(response)) { LOGGER.debug("discarding obsolete block1 response: {}", response); } else if (exchange.getRequest().isCanceled()) { clearBlock1Status(key, status); } else if (!status.isComplete()) { if (block1.isM()) { if (response.getCode() == ResponseCode.CONTINUE) { sendNextBlock(exchange, response, key, status); } else { clearBlock1Status(key, status); exchange.getRequest().setRejected(true); } } else { sendNextBlock(exchange, response, key, status); } } else { clearBlock1Status(key, status); if (response.getOptions().hasBlock2()) { LOGGER.debug("Block1 followed by Block2 transfer"); } else { exchange.setResponse(response); upper().receiveResponse(exchange, response); } } } }
Source:
<code>public void testRebaseWithUncommittedMasterChange() throws Exception { writeTrashFile(FILE1, "file1"); git.add().addFilepattern(FILE1).call(); RevCommit commit = git.commit().setMessage("commit1").call(); createBranch(commit, "refs/heads/topic"); checkoutBranch("refs/heads/topic"); writeTrashFile("file2", "file2"); git.add().addFilepattern("file2").call(); git.commit().setMessage("commit2").call(); checkoutBranch("refs/heads/master"); writeTrashFile(FILE1, "modified file1"); git.add().addFilepattern(FILE1).call(); git.commit().setMessage("commit3").call(); checkoutBranch("refs/heads/topic"); writeTrashFile(FILE1, "uncommitted modified file1"); git.add().addFilepattern(FILE1).call(); RebaseResult result = git.rebase().setUpstream("refs/heads/master") .call(); assertEquals(result.getStatus(), Status.CONFLICTS); assertEquals(result.getConflicts().size(), 1); <START> assertEquals(result.getConflicts().get(0), FILE1); <END> }</code><technical_language>assertEquals(excpected, actual)</technical_language>

Target:
public void testRebaseWithUncommittedMasterChange() throws Exception { writeTrashFile(FILE1, "file1"); git.add().addFilepattern(FILE1).call(); RevCommit commit = git.commit().setMessage("commit1").call(); createBranch(commit, "refs/heads/topic"); checkoutBranch("refs/heads/topic"); writeTrashFile("file2", "file2"); git.add().addFilepattern("file2").call(); git.commit().setMessage("commit2").call(); checkoutBranch("refs/heads/master"); writeTrashFile(FILE1, "modified file1"); git.add().addFilepattern(FILE1).call(); git.commit().setMessage("commit3").call(); checkoutBranch("refs/heads/topic"); writeTrashFile(FILE1, "uncommitted modified file1"); git.add().addFilepattern(FILE1).call(); RebaseResult result = git.rebase().setUpstream("refs/heads/master") .call(); assertEquals(Status.CONFLICTS, result.getStatus()); assertEquals(1, result.getConflicts().size()); assertEquals(FILE1, result.getConflicts().get(0)); }
Source:
<code><START> public void testAlterTableUnsupportedType() { <END> assertUpdate("CREATE TABLE test_alter_table (c1 bigint, c2 bigint)"); assertQueryFails("ALTER TABLE test_alter_table ADD COLUMN c3 row(bigint)", "Type not supported: row\\(bigint\\)"); }</code><technical_language>nit: Move left brace next line, check style complain :)</technical_language>

Target:
public void testAlterTableUnsupportedType() { assertUpdate("CREATE TABLE test_alter_table_unsupported_type (c1 bigint, c2 bigint)"); assertQueryFails("ALTER TABLE test_alter_table_unsupported_type ADD COLUMN c3 row(bigint)", "Type not supported: row\\(bigint\\)"); assertUpdate("DROP TABLE test_alter_table_unsupported_type"); }
Source:
<code>public void setupActions(View layout, T value) { for (ViewAction<T> action : actionList) { View view = layout.findViewById(action.getViewId()); if (view == null) { String message = "Invalid Configuration for " + action.getTriggerType() + " Event. No View with Id " + action.getViewId() + " found in row " + layout.getId(); IllegalStateException exception = new IllegalStateException(message); Log.e(TAG, message, exception); throw exception; } action.prepareView(view, value); } <START> setActionPerformer(layout); <END> }</code><technical_language>reason want traverse actions Map's entrySet. traverse actions once, lookup view move setActionPerformer loop, avoiding actions twice</technical_language>

Target:
public void setupActions(View layout, T value) { for (ViewAction<T> action : viewMap.values()) { View view = layout.findViewById(action.getViewId()); if (view == null) { String message = "Invalid Configuration for " + action.getTriggerType() + " Event. No View with Id " + action.getViewId() + " found in row " + layout.getId(); IllegalStateException exception = new IllegalStateException(message); Log.e(TAG, message, exception); throw exception; } action.prepareView(view, value); setActionPerformer(view, action); } }
Source:
<code><START> private Void persistAndRunJob(JobGraph jobGraph) throws Exception { <END> jobGraphWriter.putJobGraph(jobGraph); runJob(jobGraph, false); return null; }</code><technical_language>suggestion private void persistAndRunJob(JobGraph jobGraph) throws Exception {</technical_language>

Target:
private void persistAndRunJob(JobGraph jobGraph) throws Exception { jobGraphWriter.putJobGraph(jobGraph); runJob(jobGraph, ExecutionType.SUBMISSION); }
Source:
<code>private boolean isVulnerableClassToPrint(String classConstantOperand) { switch(classConstantOperand) { case "java/io/FileNotFoundException": case "java/sql/SQLException": case "java/net/BindException": case "java/util/ConcurrentModificationException": case "javax/naming/InsufficientResourcesException": case "java/util/MissingResourceException": case "java/util/jar/JarException": case "java/security/acl/NotOwnerException": case "java/lang/OutOfMemoryError": case "java/lang/StackOverflowError": <START> return true; <END> default: return false; } }</code><technical_language>if Throwable Exception catch. java try { Connection conn = DriverManager.getConnection("jdbc:mysql://prod.company.com/production"); } catch(Exception e) { e.printStackTrace(out); } I added parent Exception classes. This introduce some additional false positive I this is needed catching Exception is popular</technical_language>

Target:
private boolean isVulnerableClassToPrint(String classConstantOperand) { switch(classConstantOperand) { case "java/lang/Throwable": case "java/lang/Exception": case "java/lang/Error": case "java/io/FileNotFoundException": case "java/sql/SQLException": case "java/net/BindException": case "java/util/ConcurrentModificationException": case "javax/naming/InsufficientResourcesException": case "java/util/MissingResourceException": case "java/util/jar/JarException": case "java/security/acl/NotOwnerException": case "java/lang/OutOfMemoryError": case "java/lang/StackOverflowError": return true; default: return false; } }
Source:
<code>private DMNShape findShapeByDMNI(org.kie.dmn.model.api.dmndi.DMNDiagram root, String id) { return root.getDMNDiagramElement().stream() .filter(DMNShape.class::isInstance) .map(DMNShape.class::cast) .filter(shape -> shape.getDmnElementRef().getLocalPart().equals(id)) <START> .findFirst().get(); <END> }</code><technical_language>a .get isPresent check, I a good idea explain present do this: java private DMNShape findShapeByDMNI(org.kie.dmn.model.api.dmndi.DMNDiagram root, String id) { return root.getDMNDiagramElement() .stream() .filter(DMNShape.class::isInstance) .map(DMNShape.class::cast) .filter(shape -> shape.getDmnElementRef().getLocalPart().equals(id)) .findFirst() .orElseThrow(() -> new UnsupportedOperationException("the explanation here")); }</technical_language>

Target:
private static DMNShape findShapeByDMNI(org.kie.dmn.model.api.dmndi.DMNDiagram root, String id) { return root.getDMNDiagramElement().stream() .filter(DMNShape.class::isInstance) .map(DMNShape.class::cast) .filter(shape -> shape.getDmnElementRef().getLocalPart().equals(id)) .findFirst() .orElseThrow(() -> new UnsupportedOperationException("There is no DMNShape with id '" + id + "' in DMNDiagram " + root)); }
Source:
<code>public void testLiveErrorVault() throws ClientException { try { Request<Token> request = new Token.CreateRequestBuilder() .card(new Card.Create() .name("Omise Co., Ltd.") .number("4242424242424242") .expiration(10, 2020) .securityCode("123")) .build(); new Client("pkey_test_123", "skey_test_123").sendRequest(request, Token.class); } catch (OmiseException e) { assertEquals("authentication_failure", e.getCode()); } catch (IOException e) { <START> e.printStackTrace(); <END> } }</code><technical_language>failed() here</technical_language>

Target:
public void testLiveErrorVault() throws ClientException { try { Request<Token> request = new Token.CreateRequestBuilder() .card(new Card.Create() .name("Omise Co., Ltd.") .number("4242424242424242") .expiration(10, 2020) .securityCode("123")) .build(); new Client("pkey_test_123", "skey_test_123").sendRequest(request, Token.class); } catch (OmiseException e) { assertEquals("authentication_failure", e.getCode()); } catch (IOException e) { Assert.fail(); } }