auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected void setAttributeValuesIfNotDefault(AztecAttributes attributes, MediaFile mediaFile) { <START> if (!mediaFile.getTitle().equalsIgnoreCase(DEFAULT_MEDIA_TITLE)) { <END> attributes.setValue("title", mediaFile.getTitle()); } if (mediaFile.getWidth() != DEFAULT_MEDIA_WIDTH) { attributes.setValue("width", String.valueOf(mediaFile.getWidth())); } if (mediaFile.getHeight() != DEFAULT_MEDIA_HEIGHT) { attributes.setValue("height", String.valueOf(mediaFile.getHeight())); } }</code><technical_language>Is for mediaFile.getTitle() null</technical_language>

Target:
protected void setAttributeValuesIfNotDefault(AztecAttributes attributes, MediaFile mediaFile) { if (mediaFile.getWidth() != DEFAULT_MEDIA_WIDTH) { attributes.setValue(ATTR_DIMEN_WIDTH, String.valueOf(mediaFile.getWidth())); } if (mediaFile.getHeight() != DEFAULT_MEDIA_HEIGHT) { attributes.setValue(ATTR_DIMEN_HEIGHT, String.valueOf(mediaFile.getHeight())); } }
Source:
<code>private void scheduleRelogin(Throwable error) { <START> assert eventLoop.inEventLoop(); <END> if (error instanceof FallbackDisallowedException) { return; } if (!provider.canRetry()) { LOG.trace("SASL Provider does not support retries"); return; } if (reloginInProgress) { return; } reloginInProgress = true; RELOGIN_EXECUTOR.schedule(new Runnable() { @Override public void run() { try { provider.relogin(); } catch (IOException e) { LOG.warn("Relogin failed", e); } eventLoop.execute(() -> { reloginInProgress = false; }); } }, ThreadLocalRandom.current().nextInt(reloginMaxBackoff), TimeUnit.MILLISECONDS); }</code><technical_language>checking want java asserts? production jdks run asserts enabled</technical_language>

Target:
private void scheduleRelogin(Throwable error) { assert eventLoop.inEventLoop(); if (error instanceof FallbackDisallowedException) { return; } if (!provider.canRetry()) { LOG.trace("SASL Provider does not support retries"); return; } if (reloginInProgress) { return; } reloginInProgress = true; RELOGIN_EXECUTOR.schedule(() -> { try { provider.relogin(); } catch (IOException e) { LOG.warn("Relogin failed", e); } eventLoop.execute(() -> { reloginInProgress = false; }); }, ThreadLocalRandom.current().nextInt(reloginMaxBackoff), TimeUnit.MILLISECONDS); }
Source:
<code>public void onUserRestrictionsChanged() { final Bundle restrictions = mUserManager.getUserRestrictions(); final boolean newlyDisallowed = restrictions.getBoolean(UserManager.DISALLOW_CONFIG_TETHERING); final boolean prevDisallowed = mDisallowTethering; mDisallowTethering = newlyDisallowed; final boolean tetheringDisallowedChanged = (newlyDisallowed != prevDisallowed); if (!tetheringDisallowedChanged) { return; } <START> mNotificationUpdater.clearNotification(RESTRICTED_NOTIFICATION_ID); <END> final boolean isTetheringActiveOnDevice = (mWrapper.getTetheredIfaces().length != 0); if (newlyDisallowed && isTetheringActiveOnDevice) { mWrapper.untetherAll(); mNotificationUpdater.setupRestrictedNotification(); } }</code><technical_language>move this else if() clause in l.1001 avoid clearing putting notification again</technical_language>

Target:
public void onUserRestrictionsChanged() { final Bundle restrictions = mUserManager.getUserRestrictions(); final boolean newlyDisallowed = restrictions.getBoolean(UserManager.DISALLOW_CONFIG_TETHERING); final boolean prevDisallowed = mDisallowTethering; mDisallowTethering = newlyDisallowed; final boolean tetheringDisallowedChanged = (newlyDisallowed != prevDisallowed); if (!tetheringDisallowedChanged) { return; } if (!newlyDisallowed) { mNotificationUpdater.tetheringRestrictionLifted(); return; } mNotificationUpdater.notifyTetheringDisabledByRestriction(); if (mWrapper.getTetheredIfaces().length != 0) { mWrapper.untetherAll(); } }
Source:
<code>AbstractChangeNotes(GitRepositoryManager repoManager, Change change) { this.repoManager = repoManager; <START> this.change = change; <END> }</code><technical_language>Defensive copy instead</technical_language>

Target:
AbstractChangeNotes(GitRepositoryManager repoManager, Change change) { this.repoManager = repoManager; this.change = new Change(change); }
Source:
<code>public BytesReference generateSourceAndCheckConstraints(Object[] values) throws IOException { HashMap<String, Object> source = new HashMap<>(); row.firstCells(values); row.secondCells(defaultValues); for (int i = 0; i < targets.size(); i++) { Reference target = targets.get(i); Object value = row.get(i); if (target.granularity() == RowGranularity.DOC) { ColumnIdent column = target.column(); Maps.mergeInto(source, column.name(), column.path(), value, Map::putIfAbsent); } else if (target.granularity() == RowGranularity.PARTITION && !(target instanceof GeneratedReference)) { checks.validate(target.column(), value); } } generatedColumns.setNextRow(row); generatedColumns.validateValues(source); for (var entry : generatedColumns.generatedToInject()) { ColumnIdent column = entry.getKey().column(); Maps.mergeInto(source, column.name(), column.path(), entry.getValue().value()); } checks.validate(source); <START> <END> if (dryRun) { return BytesArray.EMPTY; } else { return BytesReference.bytes(XContentFactory.jsonBuilder().map(source)); } }</code><technical_language>follow some JMH benchmarks for this kind of stuff. amount of work happened this point wondering if this is worth it</technical_language>

Target:
public BytesReference generateSourceAndCheckConstraints(Object[] values) throws IOException { HashMap<String, Object> source = new HashMap<>(); row.firstCells(values); row.secondCells(defaultValues); for (int i = 0; i < targets.size(); i++) { Reference target = targets.get(i); Object value = row.get(i); if (target.granularity() == RowGranularity.DOC) { ColumnIdent column = target.column(); Maps.mergeInto(source, column.name(), column.path(), value, Map::putIfAbsent); } else if (target.granularity() == RowGranularity.PARTITION && !(target instanceof GeneratedReference)) { checks.validate(target.column(), value); } } generatedColumns.setNextRow(row); generatedColumns.validateValues(source); for (var entry : generatedColumns.generatedToInject()) { ColumnIdent column = entry.getKey().column(); Maps.mergeInto(source, column.name(), column.path(), entry.getValue().value()); } checks.validate(source); return BytesReference.bytes(XContentFactory.jsonBuilder().map(source)); }
Source:
<code>public Response triggerGenerateBuildPlan(@Context UriInfo uriInfo) { String plansURI = uriInfo.getAbsolutePath().resolve("../plans/").toString(); String csarURI = uriInfo.getAbsolutePath().resolve("../?csar").toString(); String request = "<generatePlanForTopology><CSARURL>"; request += csarURI; request += "</CSARURL><PLANPOSTURL>"; request += plansURI; request += "</PLANPOSTURL></generatePlanForTopology>"; <START> Client client = Client.create(); <END> Builder wr = null; if (Utils.isResourceAvailable("http://localhost:1339/planbuilder")) { wr = client.resource("http://localhost:1339/planbuilder/sync").type(MediaType.APPLICATION_XML); } else if (Utils.isResourceAvailable("http://localhost:1337/containerapi/planbuilder")) { wr = client.resource("http://localhost:1337/containerapi/planbuilder/sync").type(MediaType.APPLICATION_XML); } try { wr.post(String.class, request); } catch (com.sun.jersey.api.client.UniformInterfaceException e) { return Response.serverError().entity(e.getMessage()).build(); } return Response.ok().build(); }</code><technical_language>new structure of Winery RestUtils instead of Utils. Please follow that</technical_language>

Target:
public Response triggerGenerateBuildPlan(@Context UriInfo uriInfo) { String plansURI = uriInfo.getAbsolutePath().resolve("../plans/").toString(); String csarURI = uriInfo.getAbsolutePath().resolve("../?csar").toString(); String request = "<generatePlanForTopology><CSARURL>"; request += csarURI; request += "</CSARURL><PLANPOSTURL>"; request += plansURI; request += "</PLANPOSTURL></generatePlanForTopology>"; Client client = Client.create(); Builder wr = null; if (RestUtils.isResourceAvailable("http://localhost:1339/planbuilder")) { wr = client.resource("http://localhost:1339/planbuilder/sync").type(MediaType.APPLICATION_XML); } else if (RestUtils.isResourceAvailable("http://localhost:1337/containerapi/planbuilder")) { wr = client.resource("http://localhost:1337/containerapi/planbuilder/sync").type(MediaType.APPLICATION_XML); } try { wr.post(String.class, request); } catch (com.sun.jersey.api.client.UniformInterfaceException e) { return Response.serverError().entity(e.getMessage()).build(); } return Response.ok().build(); }
Source:
<code>@Override protected void doEnqueue(Callback<V> callback) { sendRequest().handle((response, t) -> { if (t != null) { callback.onError(t); } else { try { callback.onSuccess(parseResponse(response, bodyConverter)); <START> } catch (Throwable e) { <END> callback.onError(e); } } return null; }); }</code><technical_language>I do IOException|RuntimeException if Throwable, propagateIfFatal</technical_language>

Target:
@Override protected void doEnqueue(Callback<V> callback) { sendRequest().handle((response, t) -> { if (t != null) { callback.onError(t); } else { try { callback.onSuccess(parseResponse(response, bodyConverter)); } catch (IOException e) { callback.onError(e); } } return null; }); }
Source:
<code>public String send(Map<Header, Object> headers, Map<String, String> properties, ForkliftMessage message) throws ProducerException { <START> throw new UnsupportedOperationException("Kafka Producer does not support headers or properties"); <END> }</code><technical_language>"or properties". Well. a of these</technical_language>

Target:
public String send(Map<Header, Object> headers, Map<String, String> properties, ForkliftMessage message) throws ProducerException { throw new UnsupportedOperationException("Kafka Producer does not support headers"); }
Source:
<code>public DDF transformUDF(String RExp, List<String> columns) throws DDFException { String sqlCmd = String.format("SELECT %s FROM %s", RToSqlUdf(RExp, columns, this.getDDF().getSchema().getColumns()), this.getDDF().getTableName()); <START> System.out.println("Performing: " + sqlCmd); <END> DDF newddf = this.getManager().sql2ddf(sqlCmd); if (this.getDDF().isMutable()) { return this.getDDF().updateInplace(newddf); } else { newddf.getMetaDataHandler().copyFactor(this.getDDF()); return newddf; } }</code><technical_language>log pls</technical_language>

Target:
public DDF transformUDF(String RExp, List<String> columns) throws DDFException { String sqlCmd = String.format("SELECT %s FROM %s", RToSqlUdf(RExp, columns, this.getDDF().getSchema().getColumns()), this.getDDF().getTableName()); DDF newddf = this.getManager().sql2ddf(sqlCmd); if (this.getDDF().isMutable()) { return this.getDDF().updateInplace(newddf); } else { newddf.getMetaDataHandler().copyFactor(this.getDDF()); return newddf; } }
Source:
<code>public void offerPaymentStateTransition(String externalId, ChargeStatus fromChargeState, ChargeStatus targetChargeState, ChargeEventEntity chargeEventEntity) { PaymentGatewayStateTransitions.getInstance() .getEventForTransition(fromChargeState, targetChargeState) <START> .ifPresent(eventType -> { <END> PaymentStateTransition transition = new PaymentStateTransition(chargeEventEntity.getId(), eventType); stateTransitionQueue.offer(transition); logger.info("Offered payment state transition to emitter queue [from={}] [to={}] [chargeEventId={}] [chargeId={}]", fromChargeState, targetChargeState, chargeEventEntity.getId(), externalId); eventService.recordOfferedEvent(ResourceType.PAYMENT, externalId, Event.eventTypeForClass(eventType), chargeEventEntity.getUpdated() ); }); }</code><technical_language>this clearer if call this eventClass? moment line Event.eventTypeForClass(eventType) is a bit confusing</technical_language>

Target:
public void offerPaymentStateTransition(String externalId, ChargeStatus fromChargeState, ChargeStatus targetChargeState, ChargeEventEntity chargeEventEntity) { PaymentGatewayStateTransitions.getInstance() .getEventForTransition(fromChargeState, targetChargeState) .ifPresent(eventClass -> { PaymentStateTransition transition = new PaymentStateTransition(chargeEventEntity.getId(), eventClass); stateTransitionQueue.offer(transition); logger.info("Offered payment state transition to emitter queue [from={}] [to={}] [chargeEventId={}] [chargeId={}]", fromChargeState, targetChargeState, chargeEventEntity.getId(), externalId); eventService.recordOfferedEvent(ResourceType.PAYMENT, externalId, Event.eventTypeForClass(eventClass), chargeEventEntity.getUpdated() ); }); }
Source:
<code>protected DownloadMeta fetch(ClientBlobStore store, String key, IOFunction<Long, Path> pathSupplier, IOFunction<File, OutputStream> outStreamSupplier) throws KeyNotFoundException, AuthorizationException, IOException { try (InputStreamWithMeta in = store.getBlob(key)) { long newVersion = in.getVersion(); <START> if (newVersion == getLocalVersion()) { <END> LOG.warn("The version did not change, but going to download again {}", getLocalVersion(), key); } Path downloadPath = pathSupplier.apply(newVersion); LOG.debug("Downloading to {}", key, downloadPath); long totalRead = 0; try (OutputStream out = outStreamSupplier.apply(downloadPath.toFile())) { byte[] buffer = new byte[4096]; int read; while ((read = in.read(buffer)) >= 0) { out.write(buffer, 0, read); totalRead += read; } } long expectedSize = in.getFileLength(); if (totalRead != expectedSize) { throw new IOException("We expected to download " + expectedSize + " bytes but found we got " + totalRead); } return new DownloadMeta(downloadPath, newVersion); } }</code><technical_language>nit: getLocalVersion cheap. good cache result instead of calling twice</technical_language>

Target:
protected DownloadMeta fetch(ClientBlobStore store, String key, IOFunction<Long, Path> pathSupplier, IOFunction<File, OutputStream> outStreamSupplier) throws KeyNotFoundException, AuthorizationException, IOException { try (InputStreamWithMeta in = store.getBlob(key)) { long newVersion = in.getVersion(); long currentVersion = getLocalVersion(); if (newVersion == currentVersion) { LOG.warn("The version did not change, but going to download again {}", currentVersion, key); } Path downloadPath = pathSupplier.apply(newVersion); LOG.debug("Downloading to {}", key, downloadPath); long totalRead = 0; try (OutputStream out = outStreamSupplier.apply(downloadPath.toFile())) { byte[] buffer = new byte[4096]; int read; while ((read = in.read(buffer)) >= 0) { out.write(buffer, 0, read); totalRead += read; } } long expectedSize = in.getFileLength(); if (totalRead != expectedSize) { throw new IOException("We expected to download " + expectedSize + " bytes but found we got " + totalRead); } return new DownloadMeta(downloadPath, newVersion); } }
Source:
<code>public void testEagerCompact() { List<Type> types = ImmutableList.of(VARCHAR); PagesIndex lazyCompactPagesIndex = newPagesIndex(types, 50, false); PagesIndex eagerCompactPagesIndex = newPagesIndex(types, 50, true); for (int i = 0; i < 5; i++) { lazyCompactPagesIndex.addPage(somePage(types)); eagerCompactPagesIndex.addPage(somePage(types)); } for (int i = 0; i < 5; i++) { Block lazyCompactBlock = lazyCompactPagesIndex.getChannel(0).get(i); Block eagerCompactBlock = eagerCompactPagesIndex.getChannel(0).get(i); <START> assertTrue(eagerCompactBlock.getRetainedSizeInBytes() < lazyCompactBlock.getRetainedSizeInBytes(), "Expect retained size of block in eager compact PagesIndex smaller than lazy compact PagesIndex"); <END> Block compactBlock = lazyCompactBlock.copyRegion(0, lazyCompactBlock.getPositionCount()); assertEquals(eagerCompactBlock.getRetainedSizeInBytes(), compactBlock.getRetainedSizeInBytes()); } }</code><technical_language>operating Blocks comparing lazyCompactPagesIndex.getEstimatedSize() eagerCompactPagesIndex.getEstimatedSize()</technical_language>

Target:
public void testEagerCompact() { List<Type> types = ImmutableList.of(VARCHAR); PagesIndex lazyCompactPagesIndex = newPagesIndex(types, 50, false); PagesIndex eagerCompactPagesIndex = newPagesIndex(types, 50, true); for (int i = 0; i < 5; i++) { lazyCompactPagesIndex.addPage(somePage(types)); eagerCompactPagesIndex.addPage(somePage(types)); assertTrue( eagerCompactPagesIndex.getEstimatedSize().toBytes() < lazyCompactPagesIndex.getEstimatedSize().toBytes(), "Expect eagerCompactPagesIndex retained less data than lazyCompactPagesIndex after adding the page, because the pages used in the test are compactable."); } lazyCompactPagesIndex.compact(); assertEquals(lazyCompactPagesIndex.getEstimatedSize(), eagerCompactPagesIndex.getEstimatedSize()); }
Source:
<code><START> private File getLogsRoot() { <END> final String overriddenLogsRoot = System.getProperty("hudson.triggers.SafeTimerTask.logsTargetDir"); if (overriddenLogsRoot == null) { return new File(Jenkins.get().getRootDir(), "logs"); } else { return new File(overriddenLogsRoot); } }</code><technical_language>common stuff moved a utility class avoids repeated code</technical_language>

Target:
protected static File getLogsRoot() { final String overriddenLogsRoot = System.getProperty("hudson.triggers.SafeTimerTask.logsTargetDir"); if (overriddenLogsRoot == null) { return new File(Jenkins.get().getRootDir(), "logs"); } else { return new File(overriddenLogsRoot); } }
Source:
<code>private void initSqlTypes() { sqlTypes.put("CALLITEM", "VARCHAR"); sqlTypes.put("COLORITEM", "VARCHAR"); sqlTypes.put("CONTACTITEM", "VARCHAR"); sqlTypes.put("DATETIMEITEM", "TIMESTAMP"); sqlTypes.put("DIMMERITEM", "SMALLINT"); sqlTypes.put("LOCATIONITEM", "VARCHAR"); sqlTypes.put("NUMBERITEM", "DOUBLE PRECISION"); sqlTypes.put("ROLLERSHUTTERITEM", "SMALLINT"); sqlTypes.put("STRINGITEM", "VARCHAR"); sqlTypes.put("SWITCHITEM", "VARCHAR"); <START> logger.debug("JDBC::initPostgreSqlTypes: Initialize the type array sqlTypes={}", sqlTypes.values()); <END> }</code><technical_language>minor nitpick: logger message is equal method name :smile:</technical_language>

Target:
private void initSqlTypes() { sqlTypes.put("CALLITEM", "VARCHAR"); sqlTypes.put("COLORITEM", "VARCHAR"); sqlTypes.put("CONTACTITEM", "VARCHAR"); sqlTypes.put("DATETIMEITEM", "TIMESTAMP"); sqlTypes.put("DIMMERITEM", "SMALLINT"); sqlTypes.put("LOCATIONITEM", "VARCHAR"); sqlTypes.put("NUMBERITEM", "DOUBLE PRECISION"); sqlTypes.put("ROLLERSHUTTERITEM", "SMALLINT"); sqlTypes.put("STRINGITEM", "VARCHAR"); sqlTypes.put("SWITCHITEM", "VARCHAR"); logger.debug("JDBC::initSqlTypes: Initialize the type array sqlTypes={}", sqlTypes.values()); }
Source:
<code>public void testConnectionUnavailable() throws IOException, InterruptedException { initialize(); List<RequestInfo> requestInfoList = new ArrayList<RequestInfo>(); List<ResponseInfo> responseInfoList; int requestCount; requestInfoList.add(new RequestInfo(host2, port2, new MockSend(3))); requestInfoList.add(new RequestInfo(host2, port2, new MockSend(4))); requestCount = requestInfoList.size(); responseInfoList = networkClient.sendAndPoll(requestInfoList); requestInfoList.clear(); <START> Assert.assertEquals("There are no responses expected", 0, responseInfoList.size()); <END> time.sleep(CHECKOUT_TIMEOUT_MS + 1); do { responseInfoList = networkClient.sendAndPoll(requestInfoList); requestInfoList.clear(); for (ResponseInfo responseInfo : responseInfoList) { NetworkClientErrorCode error = responseInfo.getError(); ByteBuffer response = responseInfo.getResponse(); Assert.assertNotNull("Should have encountered an error", error); Assert.assertEquals("Should have received a connection unavailable error", NetworkClientErrorCode.ConnectionUnavailable, error); Assert.assertNull("Should not have received a valid response", response); requestCount--; } } while (requestCount > 0); responseInfoList = networkClient.sendAndPoll(requestInfoList); requestInfoList.clear(); Assert.assertEquals("No responses are expected at this time", 0, responseInfoList.size()); }</code><technical_language>I suppose this is true time connections initially</technical_language>

Target:
public void testConnectionUnavailable() throws IOException, InterruptedException { List<RequestInfo> requestInfoList = new ArrayList<RequestInfo>(); List<ResponseInfo> responseInfoList; requestInfoList.add(new RequestInfo(host2, port2, new MockSend(3))); requestInfoList.add(new RequestInfo(host2, port2, new MockSend(4))); int requestCount = requestInfoList.size(); int responseCount = 0; responseInfoList = networkClient.sendAndPoll(requestInfoList); requestInfoList.clear(); Assert.assertEquals("There are no responses expected", 0, responseInfoList.size()); time.sleep(CHECKOUT_TIMEOUT_MS + 1); do { responseInfoList = networkClient.sendAndPoll(requestInfoList); requestInfoList.clear(); for (ResponseInfo responseInfo : responseInfoList) { NetworkClientErrorCode error = responseInfo.getError(); ByteBuffer response = responseInfo.getResponse(); Assert.assertNotNull("Should have encountered an error", error); Assert.assertEquals("Should have received a connection unavailable error", NetworkClientErrorCode.ConnectionUnavailable, error); Assert.assertNull("Should not have received a valid response", response); responseCount++; } } while (requestCount > responseCount); responseInfoList = networkClient.sendAndPoll(requestInfoList); requestInfoList.clear(); Assert.assertEquals("No responses are expected at this time", 0, responseInfoList.size()); }
Source:
<code>private static String lockMapToString(Map<String, Pair<String, String>> map) { if (map == null) { <START> return "null"; <END> } return map.entrySet().stream().map(e -> e.getKey() + '=' + e.getValue().getFirst()).collect(Collectors.joining(", ", "[", "]")); }</code><technical_language>prefer return empty string "null"</technical_language>

Target:
private static String lockMapToString(Map<String, Pair<String, String>> map) { if (map == null) { return ""; } return map.entrySet() .stream() .map(e -> e.getKey() + '=' + e.getValue().getFirst()) .collect(Collectors.joining(", ", "[", "]")); }
Source:
<code>private Mono<TextAnalyticsPagedResponse<DetectLanguageResult>> getDetectedLanguageResponseInPage( Iterable<DetectLanguageInput> documents, TextAnalyticsRequestOptions options, Context context) { return service.languagesWithResponseAsync( new LanguageBatchInput().setDocuments(toLanguageInput(documents)), context.addData(AZ_TRACING_NAMESPACE_KEY, COGNITIVE_TRACING_NAMESPACE_VALUE), options == null ? null : options.getModelVersion(), options == null ? null : options.isIncludeStatistics()) .doOnSubscribe(ignoredValue -> logger.info("A batch of documents - {}", documents.toString())) .doOnSuccess(response -> logger.info("Detected languages for a batch of documents - {}", response.getValue())) .doOnError(error -> logger.warning("Failed to detect language - {}", error)) .map(this::toTextAnalyticsPagedResponse) .onErrorMap(throwable -> { <START> if (throwable instanceof TextAnalyticsErrorException) { <END> TextAnalyticsErrorException errorException = (TextAnalyticsErrorException) throwable; return new HttpResponseException(errorException.getMessage(), errorException.getResponse()); } return throwable; }); }</code><technical_language>Do instances a TextAnalyticsErrorException</technical_language>

Target:
private Mono<TextAnalyticsPagedResponse<DetectLanguageResult>> getDetectedLanguageResponseInPage( Iterable<DetectLanguageInput> documents, TextAnalyticsRequestOptions options, Context context) { return service.languagesWithResponseAsync( new LanguageBatchInput().setDocuments(toLanguageInput(documents)), context.addData(AZ_TRACING_NAMESPACE_KEY, COGNITIVE_TRACING_NAMESPACE_VALUE), options == null ? null : options.getModelVersion(), options == null ? null : options.isIncludeStatistics()) .doOnSubscribe(ignoredValue -> logger.info("A batch of documents - {}", documents.toString())) .doOnSuccess(response -> logger.info("Detected languages for a batch of documents - {}", response.getValue())) .doOnError(error -> logger.warning("Failed to detect language - {}", error)) .map(this::toTextAnalyticsPagedResponse) .onErrorMap(throwable -> mapToHttpResponseExceptionIfExist(throwable)); }
Source:
<code>protected void updateReferences(IProgressMonitor monitor, IProject project) throws JavaModelException { <START> IJavaProject currentProject = JavaCore.create(project); <END> IPluginModelBase[] pluginstoUpdate = fData.getPluginsToUpdate(); for (int i = 0; i < pluginstoUpdate.length; ++i) { IProject proj = pluginstoUpdate[i].getUnderlyingResource().getProject(); if (currentProject.getProject().equals(proj)) continue; IJavaProject javaProject = JavaCore.create(proj); IClasspathEntry[] cp = javaProject.getRawClasspath(); IClasspathEntry[] updated = getUpdatedClasspath(cp, currentProject); if (updated != null) { javaProject.setRawClasspath(updated, monitor); } try { updateRequiredPlugins(javaProject, monitor, pluginstoUpdate[i]); } catch (CoreException e) { PDEPlugin.log(e); } } }</code><technical_language>This method consumes entire monitor for pass for loop, report meaningful progress. Consider fixing SubMonitor</technical_language>

Target:
protected void updateReferences(IProgressMonitor monitor, IProject project) throws JavaModelException { IJavaProject currentProject = JavaCore.create(project); IPluginModelBase[] pluginstoUpdate = fData.getPluginsToUpdate(); SubMonitor subMonitor = SubMonitor.convert(monitor, pluginstoUpdate.length); for (int i = 0; i < pluginstoUpdate.length; ++i) { SubMonitor iterationMonitor = subMonitor.newChild(1).setWorkRemaining(2); IProject proj = pluginstoUpdate[i].getUnderlyingResource().getProject(); if (currentProject.getProject().equals(proj)) continue; IJavaProject javaProject = JavaCore.create(proj); IClasspathEntry[] cp = javaProject.getRawClasspath(); IClasspathEntry[] updated = getUpdatedClasspath(cp, currentProject); if (updated != null) { javaProject.setRawClasspath(updated, iterationMonitor.newChild(1)); } iterationMonitor.setWorkRemaining(1); try { updateRequiredPlugins(javaProject, iterationMonitor.newChild(1), pluginstoUpdate[i]); } catch (CoreException e) { PDEPlugin.log(e); } } }
Source:
<code>public boolean deregisterIncomingRelationships(Long tgt, String relationshipType, Class endNodeType, boolean relationshipEntity) { Iterator<Mappable> iterator = registeredRelationships.iterator(); List<Mappable> candidatesForDeletion = new ArrayList<>(); while (iterator.hasNext()) { Mappable mappedRelationship = iterator.next(); if (mappedRelationship.getEndNodeId() == tgt && mappedRelationship.getRelationshipType().equals(relationshipType) && endNodeType.equals( relationshipEntity ? mappedRelationship.getEndNodeType() : mappedRelationship.getStartNodeType())) { candidatesForDeletion.add(mappedRelationship); iterator.remove(); } } <START> boolean notInGraphAtAll = candidatesForDeletion.size() == 0; <END> return notInGraphAtAll || handleDeletionCandidates(candidatesForDeletion); }</code><technical_language>suggestion boolean notInGraphAtAll = candidatesForDeletion.isEmpty();</technical_language>

Target:
public boolean deregisterIncomingRelationships(Long tgt, String relationshipType, Class endNodeType, boolean relationshipEntity) { Function<Mappable, Class> endNodeTypeExtractor = relationshipEntity ? Mappable::getEndNodeType : Mappable::getStartNodeType; return deregisterRelationshipsImpl(tgt, relationshipType, endNodeType, Mappable::getEndNodeId, endNodeTypeExtractor); }
Source:
<code>protected void checkDatabaseConfiguration(Environment env, DataSource dataSource) { JdbcTemplate jdbc = new JdbcTemplate(dataSource); Long dbTimeZoneOffsetHours = jdbc.queryForObject("select current timezone from sysibm.sysdummy1", Long.class); Long propsTimeZoneOffsetHours = HOURS.convert( TimeZone.getTimeZone(property(env, "timezone")).getOffset(currentTimeMillis()), MILLISECONDS); if (!Objects.equals(dbTimeZoneOffsetHours, propsTimeZoneOffsetHours)) { <START> throw new RuntimeException("Database has unexpected time zone - hour offset DB2: " + dbTimeZoneOffsetHours + <END> ", properties: " + propsTimeZoneOffsetHours); } }</code><technical_language>add expected offset exception message</technical_language>

Target:
protected void checkDatabaseConfiguration(Environment env, DataSource dataSource) { JdbcTemplate jdbc = new JdbcTemplate(dataSource); Long dbTimeZoneOffsetHours = jdbc.queryForObject("select current timezone from sysibm.sysdummy1", Long.class); Long propsTimeZoneOffsetHours = HOURS.convert( TimeZone.getTimeZone(property(env, "timezone")).getOffset(currentTimeMillis()), MILLISECONDS); if (!Objects.equals(dbTimeZoneOffsetHours, propsTimeZoneOffsetHours)) { throw new RuntimeException("Database has unexpected time zone - hour offset in DB2 is " + dbTimeZoneOffsetHours + " but the expected hour offset based on timezone-property is " + propsTimeZoneOffsetHours + ". Change the timezone-property to match with your DB2 time zone."); } }
Source:
<code>public Job dropStudyJob(JobBuilderFactory jobBuilderFactory) { logger.debug("Building '" + DROP_STUDY_JOB + "'"); JobBuilder jobBuilder = jobBuilderFactory .get(DROP_STUDY_JOB) .incrementer(new RunIdIncrementer()) <START> .validator(new AggregatedVcfJobParametersValidator()); <END> SimpleJobBuilder builder = jobBuilder .start(dropSingleStudyVariantsStep); return builder.build(); }</code><technical_language>[Waves hand] This is validator for..</technical_language>

Target:
public Job dropStudyJob(JobBuilderFactory jobBuilderFactory) { logger.debug("Building '" + DROP_STUDY_JOB + "'"); JobBuilder jobBuilder = jobBuilderFactory .get(DROP_STUDY_JOB) .incrementer(new RunIdIncrementer()); SimpleJobBuilder builder = jobBuilder .start(dropSingleStudyVariantsStep); return builder.build(); }
Source:
<code>public String withdrawFunds(WithdrawFundsParams p) throws IOException, NotAvailableFromExchangeException, NotYetImplementedForExchangeException { if (p instanceof DefaultWithdrawFundsParams) { DefaultWithdrawFundsParams params = (DefaultWithdrawFundsParams) p; CoingiWithdrawalRequest request = new CoingiWithdrawalRequest() .setAddress(params.address) .setAmount(params.amount) .setCurrency(params.currency.getCurrencyCode().toUpperCase()); <START> return withdraw(request).toString(); <END> } throw new NotYetImplementedForExchangeException(); }</code><technical_language>try / catch Coingi missing</technical_language>

Target:
public String withdrawFunds(WithdrawFundsParams p) throws IOException, NotAvailableFromExchangeException, NotYetImplementedForExchangeException { try { if (p instanceof DefaultWithdrawFundsParams) { DefaultWithdrawFundsParams params = (DefaultWithdrawFundsParams) p; CoingiWithdrawalRequest request = new CoingiWithdrawalRequest() .setAddress(params.address) .setAmount(params.amount) .setCurrency(params.currency.getCurrencyCode().toUpperCase()); return withdraw(request).toString(); } throw new NotYetImplementedForExchangeException(); } catch (CoingiException e) { throw CoingiErrorAdapter.adapt(e); } }
Source:
<code>protected EnumDeclaration create(CompilationUnit compilationUnit) { EnumDeclaration lambdaClass = super.create(compilationUnit); <START> boolean hasDroolsParameter = lambdaParameters.stream().anyMatch(this::isDroolsParameter); <END> if (hasDroolsParameter) { bitMaskVariables.stream().forEach(vd -> { Optional<ExpressionStmt> expressionStmt = vd.findAncestor(ExpressionStmt.class); MethodCallExpr methodCallExpr = expressionStmt.flatMap(a -> a.findFirst(MethodCallExpr.class)) .orElseThrow(() -> new IllegalStateException("MethodCallExpr is not found")); lambdaClass.addFieldWithInitializer(vd.getType(), vd.getName().asString(), methodCallExpr, Modifier.Keyword.PRIVATE, Modifier.Keyword.FINAL); }); } return lambdaClass; }</code><technical_language>In refactor patch I changed a logic reconstructing original initialization method here, avoid depending JP data input</technical_language>

Target:
protected EnumDeclaration create(CompilationUnit compilationUnit) { EnumDeclaration lambdaClass = super.create(compilationUnit); boolean hasDroolsParameter = lambdaParameters.stream().anyMatch(this::isDroolsParameter); if (hasDroolsParameter) { bitMaskVariables.forEach(vd -> vd.generateBitMaskField(lambdaClass)); } return lambdaClass; }
Source:
<code>public void notifyParameterChanged(String name) { if (!fParameterNames.contains(name)) { throw new RuntimeException(String.format(Messages.TmfAbstractAnalysisModule_InvalidParameter, name, getName())); } <START> synchronized (fParameters) { <END> Object oldValue = fParameters.get(name); Object value = getParameter(name); if ((value != null) && !(value.equals(oldValue))) { parameterChanged(name); } } }</code><technical_language>contains() in synchronized block</technical_language>

Target:
public void notifyParameterChanged(String name) { synchronized (fParameters) { if (!fParameterNames.contains(name)) { throw new RuntimeException(String.format(Messages.TmfAbstractAnalysisModule_InvalidParameter, name, getName())); } Object oldValue = fParameters.get(name); Object value = getParameter(name); if ((value != null) && !(value.equals(oldValue))) { parameterChanged(name); } } }
Source:
<code>public Release tagged(final String name) throws IOException { return this.get( <START> this.tagged.path(name).back().method(Request.GET) <END> .fetch().as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_CREATED) .as(JsonResponse.class) .json().readObject().getInt("id") ); }</code><technical_language>@weisebrazil indentations 4 spaces, 8</technical_language>

Target:
public Release tagged(final String name) throws IOException { return this.get( this.request.uri().path("/tags/").path(name) .back().method(Request.GET) .fetch().as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_CREATED) .as(JsonResponse.class) .json().readObject().getInt("id") ); }
Source:
<code>private void updateSelection() { String lastNavFragment = getLastNavFragment(getContext()); int tagIndex = navAdapter.getTags().indexOf(lastNavFragment); if (tagIndex >= 0) { selectedNavListIndex = tagIndex; } else if (StringUtils.isNumeric(lastNavFragment)) { long feedId = Long.parseLong(lastNavFragment); if (navDrawerData != null) { List<Feed> feeds = navDrawerData.feeds; for (int i = 0; i < feeds.size(); i++) { if (feeds.get(i).getId() == feedId) { selectedNavListIndex = navAdapter.getSubscriptionOffset() + i; break; } } } } navAdapter.notifyDataSetChanged(); if (UserPreferences.getFeedFilter() != UserPreferences.FEED_FILTER_NONE) <START> filteredMsg.setVisibility(View.VISIBLE); <END> else filteredMsg.setVisibility(View.GONE); }</code><technical_language>Please if statements braces (that's CI fails)</technical_language>

Target:
private void updateSelection() { String lastNavFragment = getLastNavFragment(getContext()); int tagIndex = navAdapter.getTags().indexOf(lastNavFragment); if (tagIndex >= 0) { selectedNavListIndex = tagIndex; } else if (StringUtils.isNumeric(lastNavFragment)) { long feedId = Long.parseLong(lastNavFragment); if (navDrawerData != null) { List<Feed> feeds = navDrawerData.feeds; for (int i = 0; i < feeds.size(); i++) { if (feeds.get(i).getId() == feedId) { selectedNavListIndex = navAdapter.getSubscriptionOffset() + i; break; } } } } navAdapter.notifyDataSetChanged(); }
Source:
<code>public SymbolTable build(SymbolTable genericsSymbolTable) throws Exception { if (generics != null) { SymbolType[] syms = ASTSymbolTypeResolver.getInstance().valueOf(generics); genericsSymbolTable.pushScope(); <START> updateTypeMappings(Arrays.asList(syms), method.getTypeParameters(), true, genericsSymbolTable, new HashSet<String>()); <END> } else if (scope != null) { String symbolName = scope.getClazz().getName(); if (scope.getClazz().isMemberClass()) { symbolName = scope.getClazz().getCanonicalName(); } Symbol<?> s = symbolTable.findSymbol(symbolName, ReferenceType.TYPE); if (s != null) { Scope scope = s.getInnerScope(); if (scope != null) { Map<String, SymbolType> typeParams = scope.getTypeParams(); Scope newScope = new Scope(); for (String key : typeParams.keySet()) { SymbolType aux = typeParams.get(key).clone(); aux.setTemplateVariable(key); newScope.addSymbol(key, aux, null); } genericsSymbolTable.pushScope(newScope); } } updateTypeMapping(clazz, genericsSymbolTable, scope, false, new HashSet<String>()); Scope newScope = new Scope(); genericsSymbolTable.pushScope(newScope); if (method != null) { TypeVariable<?>[] typeParams = method.getTypeParameters(); for (int i = 0; i < typeParams.length; i++) { SymbolType aux = SymbolType.valueOf(typeParams[i], null); aux.setTemplateVariable(typeParams[i].getName()); genericsSymbolTable.pushSymbol(typeParams[i].getName(), ReferenceType.TYPE_PARAM, aux, null); } } } else { Scope newScope = new Scope(); genericsSymbolTable.pushScope(newScope); } return genericsSymbolTable; }</code><technical_language>fixing method.getGenericReturnType instead of method.getTypeParameters</technical_language>

Target:
public SymbolTable build(SymbolTable genericsSymbolTable) throws Exception { if (generics != null) { SymbolType[] syms = ASTSymbolTypeResolver.getInstance().valueOf(generics); genericsSymbolTable.pushScope(); updateTypeMappings(Arrays.asList(syms),method.getTypeParameters(), true, genericsSymbolTable,new HashSet<String>()); } else if (scope != null) { String symbolName = scope.getClazz().getName(); if (scope.getClazz().isMemberClass()) { symbolName = scope.getClazz().getCanonicalName(); } Symbol<?> s = symbolTable.findSymbol(symbolName, ReferenceType.TYPE); if (s != null) { Scope scope = s.getInnerScope(); if (scope != null) { Map<String, SymbolType> typeParams = scope.getTypeParams(); Scope newScope = new Scope(); for (String key : typeParams.keySet()) { SymbolType aux = typeParams.get(key).cloneAsTypeVariable(key); newScope.addSymbol(key, aux, null); } genericsSymbolTable.pushScope(newScope); } } updateTypeMapping(clazz, genericsSymbolTable, scope, false, new HashSet<String>()); Scope newScope = new Scope(); genericsSymbolTable.pushScope(newScope); if (method != null) { TypeVariable<?>[] typeParams = method.getTypeParameters(); for (int i = 0; i < typeParams.length; i++) { SymbolType aux = SymbolType.typeVariableOf(typeParams[i]); genericsSymbolTable.pushSymbol(typeParams[i].getName(), ReferenceType.TYPE_PARAM, aux, null); } } } else { Scope newScope = new Scope(); genericsSymbolTable.pushScope(newScope); } return genericsSymbolTable; }
Source:
<code>public byte[][] getByteParams(byte[]... args) { ArrayList<byte[]> byteParams = new ArrayList<byte[]>(); for (byte[] arg : args) { byteParams.add(arg); } if (contains(NX)) { byteParams.add(SafeEncoder.encode(NX)); } if (contains(XX)) { byteParams.add(SafeEncoder.encode(XX)); } if (contains(EX)) { byteParams.add(SafeEncoder.encode(EX)); final Object param = getParam(EX); <START> byteParams.add(SafeEncoder.encode(String.valueOf(param))); <END> } if (contains(PX)) { byteParams.add(SafeEncoder.encode(PX)); final Object param = getParam(PX); byteParams.add(SafeEncoder.encode(String.valueOf(param))); } return byteParams.toArray(new byte[byteParams.size()][]); }</code><technical_language>changes related JDK 8</technical_language>

Target:
public byte[][] getByteParams(byte[]... args) { ArrayList<byte[]> byteParams = new ArrayList<byte[]>(); for (byte[] arg : args) { byteParams.add(arg); } if (contains(NX)) { byteParams.add(SafeEncoder.encode(NX)); } if (contains(XX)) { byteParams.add(SafeEncoder.encode(XX)); } if (contains(EX)) { byteParams.add(SafeEncoder.encode(EX)); byteParams.add(Protocol.toByteArray((int) getParam(EX))); } if (contains(PX)) { byteParams.add(SafeEncoder.encode(PX)); byteParams.add(Protocol.toByteArray((long) getParam(PX))); } return byteParams.toArray(new byte[byteParams.size()][]); }
Source:
<code>private Map<String, Resource> getAllMetacardContent(Metacard metacard) { Map<String, Resource> resourceMap = new HashMap<>(); Attribute attribute = metacard.getAttribute(Metacard.DERIVED_RESOURCE_URI); if (attribute != null) { List<Serializable> serializables = attribute.getValues(); serializables.forEach( serializable -> { String fragment = CONTENT + File.separator; URI uri = null; try { uri = new URI((String) serializable); String derivedResourceFragment = uri.getFragment(); if (ContentItem.CONTENT_SCHEME.equals(uri.getScheme()) && StringUtils.isNotBlank(derivedResourceFragment)) { fragment += derivedResourceFragment + File.separator; Resource resource = getResource(metacard); if (resource != null) { resourceMap.put( fragment + uri.getSchemeSpecificPart() + "-" + resource.getName(), resource); } } <START> } catch (URISyntaxException e) { <END> LOGGER.debug( "Invalid Derived Resource URI Syntax for metacard : {}", metacard.getId(), e); } }); } URI resourceUri = metacard.getResourceURI(); Resource resource = getResource(metacard); if (resource != null) { resourceMap.put( CONTENT + File.separator + resourceUri.getSchemeSpecificPart() + "-" + resource.getName(), resource); } return resourceMap; }</code><technical_language>If this catch is for new URI(..) L 495, clarify some wrap line is throwing error, unnecessary extra code of try block</technical_language>

Target:
private Map<String, Resource> getAllMetacardContent(Metacard metacard) { Attribute attribute = metacard.getAttribute(Metacard.DERIVED_RESOURCE_URI); Map<String, Resource> resourceMap = getResourceMap(metacard, attribute); URI resourceUri = metacard.getResourceURI(); Resource resource = getResource(metacard); if (resource != null) { resourceMap.put( CONTENT + File.separator + resourceUri.getSchemeSpecificPart() + "-" + resource.getName(), resource); } return resourceMap; }
Source:
<code>public void schedulerEntries(WebContext ctx) { <START> BasePageHelper<J, ?, ?, ?> ph = getEntriesAsPage(); <END> ph.withContext(ctx); ph.addBooleanFacet(SchedulerEntry.SCHEDULER_DATA.inner(SchedulerData.ENABLED).getName(), NLS.get("SchedulerData.enabled")); ph.withSearchFields(QueryField.contains(SchedulerEntry.JOB_CONFIG_DATA.inner(JobConfigData.JOB_NAME))); ctx.respondWith().template("templates/biz/jobs/scheduler/entries.html.pasta", ph.asPage()); }</code><technical_language>ph -> pageHelper</technical_language>

Target:
public void schedulerEntries(WebContext ctx) { BasePageHelper<J, ?, ?, ?> pageHelper = getEntriesAsPage(); pageHelper.withContext(ctx); pageHelper.addBooleanFacet(SchedulerEntry.SCHEDULER_DATA.inner(SchedulerData.ENABLED).getName(), NLS.get("SchedulerData.enabled")); pageHelper.withSearchFields(QueryField.contains(SchedulerEntry.JOB_CONFIG_DATA.inner(JobConfigData.JOB_NAME))); ctx.respondWith().template("templates/biz/jobs/scheduler/entries.html.pasta", pageHelper.asPage()); }
Source:
<code>public void setPrimaryColor(int color, int glowRadius, int glowColor, int textureId) { if (clock != null) { <START> ValueAnimator anim = new ValueAnimator(); <END> anim.setIntValues(clock.getCurrentTextColor(), color); anim.setEvaluator(new ArgbEvaluator()); anim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator valueAnimator) { clock.setTextColor((Integer)valueAnimator.getAnimatedValue()); } }); anim.setDuration(1000); anim.start(); applyTexture(clock, glowRadius, glowColor, textureId); } if ( clock_ampm != null ) { clock_ampm.setTextColor(color); applyTexture(clock_ampm, glowRadius, glowColor, textureId); } if (analog_clock != null) { analog_clock.setPrimaryColor(color); } if (layoutId == LAYOUT_ID_DIGITAL_FLIP) { CustomDigitalFlipClock layout = findViewById(R.id.time_layout); layout.setPrimaryColor(color); } if (calendarView != null) { calendarView.setSelectionColor(color); } }</code><technical_language>Unrelated feature. Please add a new PR for this one</technical_language>

Target:
public void setPrimaryColor(int color, int glowRadius, int glowColor, int textureId) { if (clock != null) { clock.setTextColor(color); applyTexture(clock, glowRadius, glowColor, textureId); } if ( clock_ampm != null ) { clock_ampm.setTextColor(color); applyTexture(clock_ampm, glowRadius, glowColor, textureId); } if (analog_clock != null) { analog_clock.setPrimaryColor(color); } if (layoutId == LAYOUT_ID_DIGITAL_FLIP) { CustomDigitalFlipClock layout = findViewById(R.id.time_layout); layout.setPrimaryColor(color); } if (calendarView != null) { calendarView.setSelectionColor(color); } }
Source:
<code>public void launchPictureViewsRecomputation() { if (!StringUtils.isBlank(nxqlQuery)) { BulkService service = Framework.getService(BulkService.class); String user = documentManager.getPrincipal().getName(); <START> service.submit(new BulkCommand.Builder(ACTION_NAME, nxqlQuery).user(user).build()); <END> facesMessages.addFromResourceBundle(StatusMessage.Severity.INFO, "label.imaging.recompute.work.launched"); } }</code><technical_language>user in constructor right</technical_language>

Target:
public void launchPictureViewsRecomputation() { if (!StringUtils.isBlank(nxqlQuery)) { BulkService service = Framework.getService(BulkService.class); String user = documentManager.getPrincipal().getName(); service.submit(new BulkCommand.Builder(ACTION_NAME, nxqlQuery, user) .param(PARAM_XPATH, "file:content") .build()); facesMessages.addFromResourceBundle(StatusMessage.Severity.INFO, "label.imaging.recompute.work.launched"); } }
Source:
<code>public void addBundle(VersionedClause versionedBundle) throws CoreException { loadModel(); fBuildPathBundles.add(versionedBundle.getName()); if (fBuildPathVersioned.add(versionedBundle)) { fBuildPath.add(versionedBundle); } fBndModel.setBuildPath(fBuildPath); fBndModel.saveChangesTo(fBndDoc); InputStream str; try { <START> str = new ByteArrayInputStream(fBndDoc.get() <END> .getBytes(fBndFile.getCharset())); } catch (UnsupportedEncodingException e) { throw new CoreException(new Status(IStatus.ERROR, BndtoolsConstants.CORE_PLUGIN_ID, "Invalid encoding for " + fBndFile, e)); } fBndFile.setContents(str, IResource.KEEP_HISTORY, fMonitor); }</code><technical_language>In general, want avoid ByteArray{Input,Output}Stream classes. excessively synchronized. ByteBuffer{Input,Output}Stream in aQute.lib.io package replacements</technical_language>

Target:
public void addBundle(VersionedClause versionedBundle) throws CoreException { loadModel(); buildPathBundles.add(versionedBundle.getName()); if (buildPathVersioned.add(versionedBundle)) { buildPath.add(versionedBundle); } bndModel.setBuildPath(buildPath); bndModel.saveChangesTo(bndDoc); InputStream str; try { str = new ByteBufferInputStream(bndDoc.get() .getBytes(bndFile.getCharset())); } catch (UnsupportedEncodingException e) { throw new CoreException(new Status(IStatus.ERROR, BndtoolsConstants.CORE_PLUGIN_ID, "Invalid encoding for " + bndFile, e)); } bndFile.setContents(str, IResource.KEEP_HISTORY, monitor); }
Source:
<code>public void missingNonSuffixFieldsAreNotToleratedInPrefixMode() throws JsonProcessingException { JsonNode jsonNode = OBJECT_MAPPER.readTree(MULTIPART_NAME_METADATA_DESCRIPTION.renderToJson(SAMPLE_ROW)); ((ObjectNode) jsonNode).remove(ImmutableList.of("alpha", "omega")); assertThatThrownBy(() -> MULTIPART_NAME_METADATA_DESCRIPTION.parseFromJson(jsonNode.toString(), false)) <START> .isInstanceOf(IllegalArgumentException.class) <END> .hasMessageContaining("JSON object is missing field: alpha"); }</code><technical_language>I flag true for in prefix mode</technical_language>

Target:
public void missingNonSuffixFieldsAreNotToleratedInPrefixMode() throws JsonProcessingException { JsonNode jsonNode = OBJECT_MAPPER.readTree(MULTIPART_NAME_METADATA_DESCRIPTION.renderToJson(SAMPLE_ROW)); ((ObjectNode) jsonNode).remove(ImmutableList.of("alpha", "omega")); assertThatThrownBy(() -> MULTIPART_NAME_METADATA_DESCRIPTION.parseFromJson(jsonNode.toString(), true)) .isInstanceOf(IllegalArgumentException.class) .hasMessageContaining("JSON object is missing field: alpha"); }