auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code><START> private String[] appendBookmarksIfFolder(String selection, String[] selectionArgs) { <END> final SQLiteDatabase db = mOpenHelper.getReadableDatabase(); final String[] bookmarksProjection = new String[] { Bookmarks._ID, Bookmarks.IS_FOLDER }; List<String> newSelectionArgs = new ArrayList<String>(); Cursor cursor = null; try { cursor = db.query(TABLE_BOOKMARKS, bookmarksProjection, selection, selectionArgs, null, null, null); if (cursor != null) { while (cursor.moveToNext()) { String id = Long.toString(cursor.getLong(0)); newSelectionArgs.add(id); if (cursor.getInt(1) != 0) { String[] bookmarks = appendBookmarksIfFolder( Bookmarks.PARENT + "=?", new String[] { id }); for (String bookmark : bookmarks) { newSelectionArgs.add(bookmark); } } } } } finally { if (cursor != null) { cursor.close(); } } return newSelectionArgs.toArray(new String[newSelectionArgs.size()]); }</code><technical_language>Instead of returning a modified selectionArgs selection please switch this follow existing pattern of returning Object[] updated selectionArgs selection. risk of bugs out of sync</technical_language>

Target:
private Object[] appendBookmarksIfFolder(String selection, String[] selectionArgs) { final SQLiteDatabase db = mOpenHelper.getReadableDatabase(); final String[] bookmarksProjection = new String[] { Bookmarks._ID, Bookmarks.IS_FOLDER }; StringBuilder newSelection = new StringBuilder(selection); newSelection.append(" OR " + TABLE_BOOKMARKS + "._id IN ("); List<String> newSelectionArgs = new ArrayList<String>(); Cursor cursor = null; try { cursor = db.query(TABLE_BOOKMARKS, bookmarksProjection, selection, selectionArgs, null, null, null); if (cursor != null) { while (cursor.moveToNext()) { String id = Long.toString(cursor.getLong(0)); newSelectionArgs.add(id); if (cursor.getInt(1) != 0) { Object[] bookmarks = appendBookmarksIfFolder( Bookmarks.PARENT + "=?", new String[] { id }); String[] bookmarkIds = (String[]) bookmarks[1]; for (String bookmarkId : bookmarkIds) { newSelection.append("'" + bookmarkId + "',"); newSelectionArgs.add(bookmarkId); } newSelection.deleteCharAt(newSelection.length() - 1); } } } } finally { if (cursor != null) { cursor.close(); } } newSelection.append(")"); return new Object[] { newSelection.toString(), newSelectionArgs.toArray(new String[newSelectionArgs.size()]) }; }
Source:
<code>public boolean equals(Object other) { if (other == null) { return false; } if (other == this) { return true; } if (!(other instanceof JcrManagedConnectionFactory)) { return false; } <START> return this == (JcrManagedConnectionFactory) other; <END> }</code><technical_language>This code is correct, implemented in a more succinct manner is a bit easier read: public boolean equals(Object other) { if ( other == this ) return true; if ( other instanceof JcrManagedConnectionFactory ) return this == other; return false; }</technical_language>

Target:
public boolean equals(Object other) { if (other == this) { return true; } if (other instanceof JcrManagedConnectionFactory) { return this == other; } return false; }
Source:
<code>public IStatus releaseResourceAtResourceSetDispose(Resource resource, IProgressMonitor monitor) { <START> return null; <END> }</code><technical_language>return explicit IStatus.ERROR instead? * avoid potential NPEs client side. * clear this method called ResourceStrategy explicity handle this method</technical_language>

Target:
public IStatus releaseResourceAtResourceSetDispose(Resource resource, IProgressMonitor monitor) { return new Status(IStatus.ERROR, SiriusPlugin.ID, 1, Messages.AbstractResourceStrategyImpl_methodReleaseNotHandleMsg, null); }
Source:
<code>public BugzillaRestConnector connector() { if (connector == null) { <START> connector = new BugzillaRestConnector(); <END> } return connector; }</code><technical_language>Is a reason initialize this declared</technical_language>

Target:
public BugzillaRestConnector connector() { return connector; }
Source:
<code><START> public Map<String, String> getGenericInformation() { <END> return genericInformation; }</code><technical_language>return a copy of this map don t risk client change state mistake</technical_language>

Target:
public ImmutableMap<String, String> getGenericInformation() { return genericInformation; }
Source:
<code>public void should_return_422_if_organisation_unit_id_not_in_correct_format() throws Exception { var validIssuer = "54i0917n10va4428b69l5id0"; var validJwtMacKey = "4cabd5d2-0133-4e82-b0e5-2024dbeddaa9"; <START> var jsonFields = new HashMap<String, String>(); jsonFields.put("issuer", validIssuer); jsonFields.put("organisational_unit_id", "incorrectFormat"); jsonFields.put("jwt_mac_key", validJwtMacKey); <END> var payload = objectMapper.writeValueAsString(jsonFields); givenSetup() .body(payload) .post(format(VALIDATE_3DS_FLEX_CREDENTIALS_URL, accountId)) .then() .statusCode(HttpStatus.SC_UNPROCESSABLE_ENTITY) .body("error_identifier", is(ErrorIdentifier.GENERIC.name())) .body("message[0]", is("Field [organisational_unit_id] must be 24 lower-case hexadecimal characters")); }</code><technical_language>able Map.of( ) here</technical_language>

Target:
public void should_return_422_if_organisation_unit_id_not_in_correct_format() throws Exception { var validIssuer = "54i0917n10va4428b69l5id0"; var validJwtMacKey = "4cabd5d2-0133-4e82-b0e5-2024dbeddaa9"; var payload = objectMapper.writeValueAsString(Map.of("issuer", validIssuer, "organisational_unit_id", "incorrectFormat", "jwt_mac_key", validJwtMacKey)); givenSetup() .body(payload) .post(format(VALIDATE_3DS_FLEX_CREDENTIALS_URL, accountId)) .then() .statusCode(HttpStatus.SC_UNPROCESSABLE_ENTITY) .body("error_identifier", is(ErrorIdentifier.GENERIC.name())) .body("message[0]", is("Field [organisational_unit_id] must be 24 lower-case hexadecimal characters")); }
Source:
<code>void epollInReady() { assert eventLoop().inEventLoop(); DatagramChannelConfig config = config(); if (shouldBreakEpollInReady(config)) { clearEpollIn0(); return; } final EpollRecvByteAllocatorHandle allocHandle = recvBufAllocHandle(); allocHandle.edgeTriggered(isFlagSet(Native.EPOLLET)); final ChannelPipeline pipeline = pipeline(); final ByteBufAllocator allocator = config.getAllocator(); allocHandle.reset(config); epollInBefore(); Throwable exception = null; try { try { boolean connected = isConnected(); do { ByteBuf byteBuf = allocHandle.allocate(allocator); final boolean read; int datagramSize = config().getMaxDatagramPayloadSize(); int numDatagram = datagramSize == 0 ? 1 : byteBuf.writableBytes() / datagramSize; try { if (numDatagram <= 1) { if (connected) { <START> read = connectedRead(allocHandle, byteBuf); <END> } else { read = read(allocHandle, byteBuf, datagramSize); } } else { read = scatteringRead(allocHandle, byteBuf, datagramSize, numDatagram); } } catch (NativeIoException e) { if (connected) { throw translateForConnected(e); } throw e; } if (read) { readPending = false; } else { break; } } while (allocHandle.continueReading()); } catch (Throwable t) { exception = t; } allocHandle.readComplete(); pipeline.fireChannelReadComplete(); if (exception != null) { pipeline.fireExceptionCaught(exception); } } finally { epollInFinally(config); } }</code><technical_language>I similar changes needed in connectedRead read w.r.t. datagramSize truncation byte counts reported RecvByteAllocator</technical_language>

Target:
void epollInReady() { assert eventLoop().inEventLoop(); DatagramChannelConfig config = config(); if (shouldBreakEpollInReady(config)) { clearEpollIn0(); return; } final EpollRecvByteAllocatorHandle allocHandle = recvBufAllocHandle(); allocHandle.edgeTriggered(isFlagSet(Native.EPOLLET)); final ChannelPipeline pipeline = pipeline(); final ByteBufAllocator allocator = config.getAllocator(); allocHandle.reset(config); epollInBefore(); Throwable exception = null; try { try { boolean connected = isConnected(); do { ByteBuf byteBuf = allocHandle.allocate(allocator); final boolean read; int datagramSize = config().getMaxDatagramPayloadSize(); int numDatagram = datagramSize == 0 ? 1 : byteBuf.writableBytes() / datagramSize; try { if (numDatagram <= 1) { if (connected) { read = connectedRead(allocHandle, byteBuf, datagramSize); } else { read = read(allocHandle, byteBuf, datagramSize); } } else { read = scatteringRead(allocHandle, byteBuf, datagramSize, numDatagram); } } catch (NativeIoException e) { if (connected) { throw translateForConnected(e); } throw e; } if (read) { readPending = false; } else { break; } } while (allocHandle.continueReading()); } catch (Throwable t) { exception = t; } allocHandle.readComplete(); pipeline.fireChannelReadComplete(); if (exception != null) { pipeline.fireExceptionCaught(exception); } } finally { epollInFinally(config); } }
Source:
<code>private String AvailableName(ArrayList<String> list) { String commonName = getCommonName(); ArrayList<Integer> notAvailableNumberList = new ArrayList<Integer>(); String temp; for (String str : list) { temp = str.replace(getCommonName(), ""); if (StringHelper.isNullOrEmpty(temp)) { temp = "0"; } ListUtils.nullSafeElemAdd(notAvailableNumberList, IntegerCompat.tryParse(temp)); } Collections.sort(notAvailableNumberList); int i; for (i = 0; i < notAvailableNumberList.size(); i++) { if (notAvailableNumberList.get(i) == i) { continue; } break; } if (i > 0) { <START> commonName = getCommonName() + (Integer.valueOf(i)).toString(); <END> } return commonName; }</code><technical_language>Instead of Integer.valueOf(int).toString(), String.valueOf(int)</technical_language>

Target:
private String AvailableName(ArrayList<String> list) { String commonName = getCommonName(); ArrayList<Integer> notAvailableNumberList = new ArrayList<Integer>(); String temp; for (String str : list) { temp = str.replace(getCommonName(), ""); if (StringHelper.isNullOrEmpty(temp)) { temp = "0"; } ListUtils.nullSafeElemAdd(notAvailableNumberList, IntegerCompat.tryParse(temp)); } Collections.sort(notAvailableNumberList); int i; for (i = 0; i < notAvailableNumberList.size(); i++) { if (notAvailableNumberList.get(i) == i) { continue; } break; } if (i > 0) { commonName = getCommonName() + String.valueOf(i); } return commonName; }
Source:
<code>private String handleException(Exception e) { logger.error(e.getMessage(), e); JsonObject jsonObject = new JsonObject(); jsonObject.addProperty("message", e.getMessage()); Gson gson = new Gson(); <START> return gson.toJson(jsonObject); <END> }</code><technical_language>change handleException method in commcare controller change message response in javascript handlers for other ones. Please find handlers affected changes fix</technical_language>

Target:
private MotechMessage handleException(Exception e) { logger.error(e.getMessage(), e); return new MotechMessage(e.getMessage()); }
Source:
<code>public void onProjectInitialized(String projectFolder) throws ServerException, ForbiddenException, ConflictException, NotFoundException { if (!languageServerLauncher.get().isStarted()) { return; } String wsPath = absolutize(projectFolder); ProjectConfig project = projectRegistryProvider .get() .get(wsPath) .orElseThrow(() -> new ServerException("Can't find a project: " + wsPath)); <START> List<String> library = project.getAttributes().get(LIBRARY_FOLDER); <END> if (library != null && !library.isEmpty()) { extensionService.get().addJars(project.getPath(), library.get(0)); } }</code><technical_language>If this property is set, classpath updated before? need this code</technical_language>

Target:
public void onProjectInitialized(String projectFolder) throws ServerException, ForbiddenException, ConflictException, NotFoundException { if (!languageServerLauncher.get().isStarted()) { return; } String wsPath = absolutize(projectFolder); ProjectConfig project = projectRegistryProvider .get() .get(wsPath) .orElseThrow(() -> new ServerException("Can't find a project: " + wsPath)); List<String> library = project.getAttributes().get(LIBRARY_FOLDER); if (library != null && !library.isEmpty()) { String libraryFolder = library.get(0); if (!isNullOrEmpty(libraryFolder)) { extensionService.get().addJars(project.getPath(), libraryFolder); } } }
Source:
<code>private Collection<Contact> fillContacts(Collection<RosterEntry> entryIter, Set<String> skipList) { Roster roster = mConnection.getRoster(); Collection<Contact> contacts = new ArrayList<Contact>(); for (RosterEntry entry : entryIter) { String address = entry.getUser(); if (skipList != null && !skipList.add(address)) continue; String name = entry.getName(); if (name == null) name = address; XmppAddress xaddress = new XmppAddress(name, address); <START> <END> org.jivesoftware.smack.packet.Presence presence = roster.getPresence(address); String status = presence.getStatus(); String resource = null; String from = presence.getFrom(); if (from != null && from.lastIndexOf("/") > 0) { resource = from.substring(from.lastIndexOf("/") + 1); if (resource.indexOf('.')!=-1) resource = resource.substring(0,resource.indexOf('.')); } if (resource != null) xaddress.appendResource(resource); Contact contact = mContactListManager.getContact(xaddress.getFullName()); if (contact == null) contact = new Contact(xaddress, name); contact.setPresence(new Presence(parsePresence(presence), status, null, null, Presence.CLIENT_TYPE_DEFAULT)); contacts.add(contact); } return contacts; }</code><technical_language>handle presences better. I confident changes work surrounding code is structured. I places in code is assumption UI contact entry. For example, if a presence offline, code remove entry display. Also, if user remove entry, send a roster remove-contact request, error out if a presence, remove entire contact. I multiple-presence commit needs more research attempting introduce</technical_language>

Target:
private Collection<Contact> fillContacts(Collection<RosterEntry> entryIter, Set<String> skipList) { Roster roster = mConnection.getRoster(); Collection<Contact> contacts = new ArrayList<Contact>(); for (RosterEntry entry : entryIter) { String address = entry.getUser(); if (skipList != null && !skipList.add(address)) continue; String name = entry.getName(); if (name == null) name = address; XmppAddress xaddress = new XmppAddress(name, address); org.jivesoftware.smack.packet.Presence presence = roster.getPresence(address); String status = presence.getStatus(); String resource = null; Presence p = new Presence(parsePresence(presence), status, null, null, Presence.CLIENT_TYPE_DEFAULT); String from = presence.getFrom(); if (from != null && from.lastIndexOf("/") > 0) { resource = from.substring(from.lastIndexOf("/") + 1); if (resource.indexOf('.')!=-1) resource = resource.substring(0,resource.indexOf('.')); p.setResource(resource); } Contact contact = mContactListManager.getContact(xaddress.getFullName()); if (contact == null) contact = new Contact(xaddress, xaddress.getScreenName()); contact.setPresence(p); contacts.add(contact); } return contacts; }
Source:
<code>private void verifyUserMetadataHeaders(JSONObject expectedHeaders, MockRestResponseChannel restResponseChannel) throws JSONException { Iterator itr = expectedHeaders.keys(); while (itr.hasNext()) { String key = (String) itr.next(); if (key.startsWith(RestUtils.Headers.UserMetaData_Header_Prefix)) { <START> String outValue = restResponseChannel.getHeader(key, MockRestResponseChannel.DataStatus.Flushed); <END> assertTrue("Key " + key + "value does not match in user metadata, input " + expectedHeaders.getString(key) + ", output " + outValue, expectedHeaders.getString(key).equals(outValue)); } } }</code><technical_language>MockRestResponseChannel needs a getHeader() API - return multiple values. I build start. talk this</technical_language>

Target:
private void verifyUserMetadataHeaders(JSONObject expectedHeaders, MockRestResponseChannel restResponseChannel) throws JSONException { Iterator itr = expectedHeaders.keys(); while (itr.hasNext()) { String key = (String) itr.next(); if (key.startsWith(RestUtils.Headers.UserMetaData_Header_Prefix)) { String outValue = restResponseChannel.getHeader(key, MockRestResponseChannel.DataStatus.Flushed); assertEquals("Value for " + key + "does not match in user metadata", expectedHeaders.getString(key), outValue); } } }
Source:
<code>public void intraWikiSearch_016_communityPushToTopWikiResult() { <START> IntraWikiSearchPageObject search = new IntraWikiSearchPageObject(driver, testedWiki); <END> search.goToSearchPage(wikiCommunityURL); search.searchCommunityFor(searchWiki); search.verifyPushToTopWikiTitle(searchWiki); search.verifyPushToTopWikiThumbnail(); }</code><technical_language>1. testedWiki is muppets 2. wikiCommunityURL better: 3. remove wikiCommunityURL create new variable in IntraWikiSearch() constructor instead</technical_language>

Target:
public void intraWikiSearch_016_communityPushToTopWikiResult() { IntraWikiSearchPageObject search = new IntraWikiSearchPageObject(driver); search.openWikiPage(communityWiki); search.searchFor(searchWiki); search.verifyPushToTopWikiTitle(searchWiki); search.verifyPushToTopWikiThumbnail(); }
Source:
<code>private static Channel createChannel(ChannelDefinition channelDefinition, ThingUID thingUID, String groupId, ConfigDescriptionRegistry configDescriptionRegistry) { ChannelType type = withChannelTypeRegistry(channelTypeRegistry -> { return (channelTypeRegistry != null) ? channelTypeRegistry.getChannelType(channelDefinition.getChannelTypeUID()) : null; }); if (type == null) { logger.warn( "Could not create channel '{}' for thing type '{}', because channel type '{}' could not be found.", channelDefinition.getId(), thingUID, channelDefinition.getChannelTypeUID()); return null; } ChannelUID channelUID = new ChannelUID(thingUID, groupId, channelDefinition.getId()); ChannelBuilder channelBuilder = createChannelBuilder(channelUID, type, configDescriptionRegistry); if (channelDefinition.getLabel() != null) { channelBuilder = channelBuilder.withLabel(channelDefinition.getLabel()); } if (channelDefinition.getDescription() != null) { channelBuilder = channelBuilder.withDescription(channelDefinition.getDescription()); } channelBuilder = channelBuilder.withProperties(channelDefinition.getProperties()); <START> Channel channel = channelBuilder.build(); <END> return channel; }</code><technical_language>IIRC JVM do optimization if create a temporary (useless) variable</technical_language>

Target:
private static Channel createChannel(ChannelDefinition channelDefinition, ThingUID thingUID, String groupId, ConfigDescriptionRegistry configDescriptionRegistry) { ChannelType type = withChannelTypeRegistry(channelTypeRegistry -> { return (channelTypeRegistry != null) ? channelTypeRegistry.getChannelType(channelDefinition.getChannelTypeUID()) : null; }); if (type == null) { logger.warn( "Could not create channel '{}' for thing type '{}', because channel type '{}' could not be found.", channelDefinition.getId(), thingUID, channelDefinition.getChannelTypeUID()); return null; } ChannelUID channelUID = new ChannelUID(thingUID, groupId, channelDefinition.getId()); ChannelBuilder channelBuilder = createChannelBuilder(channelUID, type, configDescriptionRegistry); if (channelDefinition.getLabel() != null) { channelBuilder = channelBuilder.withLabel(channelDefinition.getLabel()); } if (channelDefinition.getDescription() != null) { channelBuilder = channelBuilder.withDescription(channelDefinition.getDescription()); } channelBuilder = channelBuilder.withProperties(channelDefinition.getProperties()); return channelBuilder.build(); }
Source:
<code>private void registerEventHandlers(EventBus eventBus) { eventBus.addHandler(WorkspaceReadyEvent.getType(), new WorkspaceReadyEvent.WorkspaceReadyHandler() { @Override public void onWorkspaceReady(WorkspaceReadyEvent event) { <START> breakpointStorage.readAll().then(new Operation<List<Breakpoint>>() { <END> @Override public void apply(List<Breakpoint> breakpoints) throws OperationException { for (Breakpoint breakpoint : breakpoints) { addBreakpoint(breakpoint); } } }); } }); eventBus.addHandler(EditorOpenedEvent.TYPE, new EditorOpenedEventHandler() { @Override public void onEditorOpened(EditorOpenedEvent event) { onOpenEditor(event.getFile().getLocation().toString(), event.getEditor()); } }); eventBus.addHandler(DeleteProjectEvent.TYPE, new DeleteProjectHandler() { @Override public void onProjectDeleted(DeleteProjectEvent event) { if (breakpoints.isEmpty()) { return; } ProjectConfigDto config = event.getProjectConfig(); String path = config.getPath() + "/"; deleteBreakpoints(getBreakpointPaths(path)); } }); eventBus.addHandler(ResourceChangedEvent.getType(), new ResourceChangedEvent.ResourceChangedHandler() { @Override public void onResourceChanged(ResourceChangedEvent event) { if (event.getDelta().getKind() == ResourceDelta.REMOVED) { if (breakpoints.isEmpty()) { return; } final Resource resource = event.getDelta().getResource(); Path path = resource.getLocation(); if (resource.isFolder()) { path.addTrailingSeparator(); deleteBreakpoints(getBreakpointPaths(path.toString())); } else if (resource.isFile()) { deleteBreakpoints(Collections.singleton(path.toString())); } } } }); }</code><technical_language>streams: breakpointStorage.readAll().then(breakpoints -> { breakpoints.forEach(breakpoint -> addBreakpoint(breakpoint)); }); }</technical_language>

Target:
private void registerEventHandlers(EventBus eventBus) { eventBus.addHandler(WorkspaceReadyEvent.getType(), new WorkspaceReadyEvent.WorkspaceReadyHandler() { @Override public void onWorkspaceReady(WorkspaceReadyEvent event) { breakpointStorage.readAll().then(breakpoints -> { breakpoints.forEach(BreakpointManagerImpl.this::addBreakpoint); }); } }); eventBus.addHandler(EditorOpenedEvent.TYPE, event -> onOpenEditor(event.getFile().getLocation().toString(), event.getEditor())); eventBus.addHandler(DeleteProjectEvent.TYPE, event -> { if (breakpoints.isEmpty()) { return; } ProjectConfigDto config = event.getProjectConfig(); String path = config.getPath() + "/"; deleteBreakpoints(getBreakpointPaths(path)); }); eventBus.addHandler(ResourceChangedEvent.getType(), event -> { if (event.getDelta().getKind() == ResourceDelta.REMOVED) { if (breakpoints.isEmpty()) { return; } final Resource resource = event.getDelta().getResource(); Path path = resource.getLocation(); if (resource.isFolder()) { path.addTrailingSeparator(); deleteBreakpoints(getBreakpointPaths(path.toString())); } else if (resource.isFile()) { deleteBreakpoints(Collections.singleton(path.toString())); } } }); }
Source:
<code>public boolean processBarrier( CheckpointBarrier receivedBarrier, int channelIndex, long bufferedBytes) throws Exception { long barrierId = receivedBarrier.getId(); if (currentCheckpointId < barrierId) { handleNewCheckpoint(barrierId); <START> notifyCheckpointAsync(receivedBarrier, bufferedBytes, 0); <END> } barrierConsumedChannels[channelIndex] = true; return false; }</code><technical_language>notifyCheckpoint instead of notifyCheckpointAsync? some considerations? bring confuse current processing is thread performing checkpoint, thread</technical_language>

Target:
public boolean processBarrier( CheckpointBarrier receivedBarrier, int channelIndex, long bufferedBytes) throws Exception { long barrierId = receivedBarrier.getId(); if (currentConsumedCheckpointId < barrierId) { currentConsumedCheckpointId = barrierId; numBarrierConsumed = 0; Arrays.fill(hasInflightBuffers, true); } if (currentConsumedCheckpointId == barrierId) { hasInflightBuffers[channelIndex] = false; numBarrierConsumed++; } threadSafeUnaligner.notifyBarrierReceived(receivedBarrier, channelInfos[channelIndex]); return false; }
Source:
<code>public FeedInbound(Properties properties, String name, SynapseEnvironment synapseEnvironment, long scanInterval, String injectingSeq, String onErrorSeq, boolean coordination, boolean sequential) { super(properties, name, synapseEnvironment, scanInterval, injectingSeq, onErrorSeq, coordination, sequential); registryHandler = new FeedRegistryHandler(); this.name = name; <START> log.info("Scan Interval Passing " + scanInterval); <END> this.scanInterval = scanInterval; this.sequential = true; this.host = properties.getProperty(FeedEPConstant.FEED_URL); this.feedType = properties.getProperty(FeedEPConstant.FEED_TYPE); log.info("URL : " + host + "Feed Type : " + feedType); if (!StringUtils.isEmpty(properties.getProperty(FeedEPConstant.FEED_TIME_FORMAT))) { this.dateFormat = properties.getProperty(FeedEPConstant.FEED_TIME_FORMAT); } this.sequential = sequential; this.coordination = true; this.coordination = coordination; this.injectingSeq = injectingSeq; this.onErrorSeq = onErrorSeq; this.synapseEnvironment = synapseEnvironment; init(); }</code><technical_language>Do need this log? If so, change this debug level log</technical_language>

Target:
public FeedInbound(Properties properties, String name, SynapseEnvironment synapseEnvironment, long scanInterval, String injectingSeq, String onErrorSeq, boolean coordination, boolean sequential) { super(properties, name, synapseEnvironment, scanInterval, injectingSeq, onErrorSeq, coordination, sequential); registryHandler = new FeedRegistryHandler(); this.name = name; this.scanInterval = scanInterval; this.sequential = true; this.host = properties.getProperty(FeedEPConstant.FEED_URL); this.feedType = properties.getProperty(FeedEPConstant.FEED_TYPE); if (!StringUtils.isEmpty(properties.getProperty(FeedEPConstant.FEED_TIME_FORMAT))) { this.dateFormat = properties.getProperty(FeedEPConstant.FEED_TIME_FORMAT); } this.sequential = sequential; this.coordination = true; this.coordination = coordination; this.injectingSeq = injectingSeq; this.onErrorSeq = onErrorSeq; this.synapseEnvironment = synapseEnvironment; init(); }
Source:
<code>public void confirmExternalNameUniqueForProjectIfRequired(String newExternalName, Sample sample) <START> throws IOException, ConstraintViolationException { <END> if (!isUniqueExternalNameWithinProjectRequired()) return; Collection<SampleIdentity> matches = getIdentitiesByExactExternalNameAndProject(newExternalName, sample.getProject().getId()); if(matches.size() != 0) { SampleIdentity existingIdentity = matches.iterator().next(); throw new ConstraintViolationException("Duplicate external names not allowed within a project: External name " + newExternalName + " is already associated with Identity " + existingIdentity.getAlias() + " (" + existingIdentity.getExternalName() + ")", null, "externalName"); } }</code><technical_language>![MINOR](<LINK_2> 'Severity: MINOR') Remove declaration of thrown exception 'org.hibernate.exception.ConstraintViolationException' is a runtime exception. [![rule](<LINK_1>](<LINK_0></technical_language>

Target:
public void confirmExternalNameUniqueForProjectIfRequired(String newExternalName, Sample sample) throws IOException, ConstraintViolationException { if (!isUniqueExternalNameWithinProjectRequired()) return; Collection<SampleIdentity> matches = getIdentitiesByExactExternalNameAndProject(newExternalName, sample.getProject().getId()); if (!matches.isEmpty()) { SampleIdentity existingIdentity = matches.iterator().next(); throw new ConstraintViolationException("Duplicate external names not allowed within a project: External name " + newExternalName + " is already associated with Identity " + existingIdentity.getAlias() + " (" + existingIdentity.getExternalName() + ")", null, "externalName"); } }
Source:
<code>public Model read(InputStream input, Map<String, ?> options) throws IOException, ModelParseException { String location = PolyglotModelUtil.getLocation(options); String fixLocation = fixLocation(location); File file = new File(fixLocation); if (!fixLocation.equals(location)) { try (FileInputStream stream = new FileInputStream(file)) { return read(new InputStreamReader(stream, getPrimaryArtifactCharset()), file, options); } } <START> return read(new InputStreamReader(input, getPrimaryArtifactCharset()), file, options); <END> }</code><technical_language>I is another location need try-with-resource</technical_language>

Target:
public Model read(InputStream input, Map<String, ?> options) throws IOException, ModelParseException { String location = PolyglotModelUtil.getLocation(options); String fixLocation = fixLocation(location); File file = new File(fixLocation); if (!fixLocation.equals(location)) { try (InputStreamReader stream = new InputStreamReader(new FileInputStream(file), getPrimaryArtifactCharset())) { return read(stream, file, options); } } try (InputStreamReader stream = new InputStreamReader(input, getPrimaryArtifactCharset())) { return read(stream, file, options); } }
Source:
<code>public GrimlockFerociousKing(UUID ownerId, CardSetInfo setInfo) { super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT,CardType.CREATURE},""); this.addSuperType(SuperType.LEGENDARY); <START> this.subtype.add("Dinosaur"); <END> this.power = new MageInt(8); this.toughness = new MageInt(8); this.color.setRed(true); this.color.setGreen(true); this.color.setWhite(true); this.transformable = true; this.nightCard = true; this.addAbility(TrampleAbility.getInstance()); this.addAbility(new TransformAbility()); this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new TransformSourceEffect(false), new ManaCostsImpl("{2}"))); }</code><technical_language>Please new method of adding more subtypes a card. String methods deprecated</technical_language>

Target:
public GrimlockFerociousKing(UUID ownerId, CardSetInfo setInfo) { super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT,CardType.CREATURE},""); this.addSuperType(SuperType.LEGENDARY); this.subtype.add(SubType.DINOSAUR); this.power = new MageInt(8); this.toughness = new MageInt(8); this.color.setRed(true); this.color.setGreen(true); this.color.setWhite(true); this.transformable = true; this.nightCard = true; this.addAbility(TrampleAbility.getInstance()); this.addAbility(new TransformAbility()); this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new TransformSourceEffect(false), new ManaCostsImpl("{2}"))); }
Source:
<code>public ConfigurationElement[] getChildren(String childrenName) { if (getRawChildren().length == 0) return ConfigurationElement.EMPTY_ARRAY; ConfigurationElement[] result = new ConfigurationElement[1]; int idx = 0; RegistryObjectManager objectManager = registry.getObjectManager(); for (int <START> element : <END> children) { ConfigurationElement toTest = (ConfigurationElement) objectManager.getObject(element, noExtraData() ? RegistryObjectManager.CONFIGURATION_ELEMENT : RegistryObjectManager.THIRDLEVEL_CONFIGURATION_ELEMENT); if (toTest.name.equals(childrenName)) { if (idx != 0) { ConfigurationElement[] copy = new ConfigurationElement[result.length + 1]; System.arraycopy(result, 0, copy, 0, result.length); result = copy; } result[idx++] = toTest; } } if (idx == 0) result = ConfigurationElement.EMPTY_ARRAY; return result; }</code><technical_language>rename child</technical_language>

Target:
public ConfigurationElement[] getChildren(String childrenName) { if (getRawChildren().length == 0) return ConfigurationElement.EMPTY_ARRAY; ConfigurationElement[] result = new ConfigurationElement[1]; int idx = 0; RegistryObjectManager objectManager = registry.getObjectManager(); for (int child : children) { ConfigurationElement toTest = (ConfigurationElement) objectManager.getObject(child, noExtraData() ? RegistryObjectManager.CONFIGURATION_ELEMENT : RegistryObjectManager.THIRDLEVEL_CONFIGURATION_ELEMENT); if (toTest.name.equals(childrenName)) { if (idx != 0) { ConfigurationElement[] copy = new ConfigurationElement[result.length + 1]; System.arraycopy(result, 0, copy, 0, result.length); result = copy; } result[idx++] = toTest; } } if (idx == 0) result = ConfigurationElement.EMPTY_ARRAY; return result; }
Source:
<code>private void initServer(String intf, int portReq) { QueuedThreadPool qtp = null; Server server = null; ServerConnector connector = null; try { qtp = new QueuedThreadPool(POOLSIZE, 0, REQTMO, new ArrayBlockingQueue<>(QUEUELIM)); qtp.setName("status-thread-pool"); server = new Server(qtp); connector = initConnector(server, intf, portReq); server.addConnector(connector); ServletContextHandler ctxHandler = new ServletContextHandler(); ctxHandler.setContextPath("/"); ctxHandler.setMaxFormContentSize(MAXQUERY); ctxHandler.setMaxFormKeys(MAXKEYS); ctxHandler.addServlet(StatusServlet.class, "/status").setAsyncSupported(true); server.setHandler(ctxHandler); } catch (Exception ex) { logError("StatusListener: initialization failure: %s", ex); try { connector.close(); } catch (Exception e2) { } try { server.destroy(); } catch (Exception e2) { } try { qtp.join(); } catch (Exception e2) { } <START> throw new RuntimeException("Failed to initialize status listener", ex); <END> } m_server = server; m_connector = connector; }</code><technical_language>is discouraged turn exceptions runtime exceptions</technical_language>

Target:
private void initServer(String intf, int portReq) throws InitException { QueuedThreadPool qtp = null; Server server = null; ServerConnector connector = null; try { qtp = new QueuedThreadPool(POOLSIZE, 0, REQTMO, new ArrayBlockingQueue<>(QUEUELIM)); qtp.setName("status-thread-pool"); server = new Server(qtp); connector = initConnector(server, intf, portReq); server.addConnector(connector); ServletContextHandler ctxHandler = new ServletContextHandler(); ctxHandler.setContextPath("/"); ctxHandler.setMaxFormContentSize(MAXQUERY); ctxHandler.setMaxFormKeys(MAXKEYS); ctxHandler.addServlet(StatusServlet.class, "/status").setAsyncSupported(true); server.setHandler(ctxHandler); } catch (Exception ex) { logError("StatusListener: initialization failure: %s", ex); try { connector.close(); } catch (Exception e2) { } try { server.destroy(); } catch (Exception e2) { } try { qtp.join(); } catch (Exception e2) { } throw new InitException("Failed to initialize status listener", ex); } m_server = server; m_connector = connector; }
Source:
<code>Credentials addThirdPartyCredentials(Credentials creds) throws KeyException, IllegalAccessException { <START> String privateKeyPath = PASchedulerProperties.getAbsolutePath(PASchedulerProperties.SCHEDULER_AUTH_PRIVKEY_PATH.getValueAsString()); <END> String publicKeyPath = PASchedulerProperties.getAbsolutePath(PASchedulerProperties.SCHEDULER_AUTH_PUBKEY_PATH.getValueAsString()); PrivateKey privateKey = Credentials.getPrivateKey(privateKeyPath); PublicKey publicKey = Credentials.getPublicKey(publicKeyPath); CredData credData = creds.decrypt(privateKey); SchedulerDBManager dbManager = getInfrastructure().getDBManager(); if (dbManager != null) { Map<String, HybridEncryptedData> thirdPartyCredentials = null; thirdPartyCredentials = dbManager.thirdPartyCredentialsMap(credData.getLogin()); if (thirdPartyCredentials == null) { logger.error("Failed to retrieve Third Party Credentials!"); throw new KeyException("Failed to retrieve thirdPartyCredentials!"); } else { for (Map.Entry<String, HybridEncryptedData> thirdPartyCredential : thirdPartyCredentials.entrySet()) { String decryptedValue = HybridEncryptionUtil.decryptString(thirdPartyCredential.getValue(), privateKey); credData.addThirdPartyCredential(thirdPartyCredential.getKey(), decryptedValue); } } } Credentials nodeEncryptedUserCredentials = Credentials.createCredentials(credData, publicKey); return nodeEncryptedUserCredentials; }</code><technical_language>create a private method this : PrivateKey privateKey = getKey(PASchedulerProperties.SCHEDULER_AUTH_PRIVKEY_PATH.getValueAsString()) PrivateKey privateKey = getKey(PASchedulerProperties. SCHEDULER_AUTH_PUBKEY_PATH.getValueAsString())</technical_language>

Target:
Credentials addThirdPartyCredentials(Credentials creds) throws KeyException, IllegalAccessException { String privateKeyPath = PASchedulerProperties.getAbsolutePath(PASchedulerProperties.SCHEDULER_AUTH_PRIVKEY_PATH.getValueAsString()); String publicKeyPath = PASchedulerProperties.getAbsolutePath(PASchedulerProperties.SCHEDULER_AUTH_PUBKEY_PATH.getValueAsString()); PrivateKey privateKey = Credentials.getPrivateKey(privateKeyPath); PublicKey publicKey = Credentials.getPublicKey(publicKeyPath); CredData credData = creds.decrypt(privateKey); SchedulerDBManager dbManager = getInfrastructure().getDBManager(); if (dbManager != null) { Map<String, HybridEncryptedData> thirdPartyCredentials = dbManager.thirdPartyCredentialsMap(credData.getLogin()); if (thirdPartyCredentials == null) { logger.error("Failed to retrieve Third Party Credentials!"); throw new KeyException("Failed to retrieve thirdPartyCredentials!"); } else { for (Map.Entry<String, HybridEncryptedData> thirdPartyCredential : thirdPartyCredentials.entrySet()) { String decryptedValue = HybridEncryptionUtil.decryptString(thirdPartyCredential.getValue(), privateKey); credData.addThirdPartyCredential(thirdPartyCredential.getKey(), decryptedValue); } } } return Credentials.createCredentials(credData, publicKey); }
Source:
<code>public void punctuate(final ProcessorNode node, final long timestamp, final PunctuationType type, final Punctuator punctuator) { if (processorContext.currentNode() != null) { throw new IllegalStateException(String.format("%sCurrent node is not null", logPrefix)); } updateProcessorContext(new StampedRecord(DUMMY_RECORD, timestamp), node); if (log.isTraceEnabled()) { log.trace("Punctuating processor with timestamp and punctuation type {}", node.name(), timestamp, type); } try { StreamsMetricsImpl.maybeMeasureLatency( <START> () -> { <END> node.punctuate(timestamp, punctuator); return null; }, time, punctuateLatencySensor ); } catch (final ProducerFencedException fatal) { throw new TaskMigratedException(this, fatal); } catch (final KafkaException e) { throw new StreamsException(String.format("%sException caught while punctuating processor '%s'", logPrefix, node.name()), e); } finally { processorContext.setCurrentNode(null); } }</code><technical_language>need return here? Instead of a Supplier a Runnable in signature get rid of return null statements</technical_language>

Target:
public void punctuate(final ProcessorNode node, final long timestamp, final PunctuationType type, final Punctuator punctuator) { if (processorContext.currentNode() != null) { throw new IllegalStateException(String.format("%sCurrent node is not null", logPrefix)); } updateProcessorContext(new StampedRecord(DUMMY_RECORD, timestamp), node); if (log.isTraceEnabled()) { log.trace("Punctuating processor with timestamp and punctuation type {}", node.name(), timestamp, type); } try { StreamsMetricsImpl.maybeMeasureLatency( () -> { node.punctuate(timestamp, punctuator); }, time, punctuateLatencySensor ); } catch (final ProducerFencedException fatal) { throw new TaskMigratedException(this, fatal); } catch (final KafkaException e) { throw new StreamsException(String.format("%sException caught while punctuating processor '%s'", logPrefix, node.name()), e); } finally { processorContext.setCurrentNode(null); } }
Source:
<code>private VersionDto createResultVersionIfNoneExist(ProjectDto targetProject) { final List<VersionDto> projectVersions = jiraService.project().getProjectVersions(targetProject.key); final Optional<VersionDto> targetVersion = projectVersions.stream() .filter(versionDto -> versionDto.name.equals(Property.RESULT_VERSION.getValue())) .findFirst(); targetVersion.ifPresent(foundVersion -> logger.info(() -> format("Found in Zephyr; resultVersion: \"{0}\" with resultVersionId: \"{1}\"", Property.RESULT_VERSION.getValue(), foundVersion.id))); return targetVersion.orElseGet(() -> { <START> final VersionDto createdVersion = jiraService.version().createVersion(VersionDto.newBuilder() .projectId(targetProject.id) .name(Property.RESULT_VERSION.getValue()) .build()); <END> logger.info(() -> format("Created in Zephyr; resultVersion: \"{0}\" with resultVersionId: \"{1}\"", Property.RESULT_VERSION.getValue(), createdVersion.id)); return createdVersion; }); }</code><technical_language>move this a private method</technical_language>

Target:
private VersionDto createResultVersionIfNoneExist(ProjectDto targetProject) { final List<VersionDto> projectVersions = jiraService.project().getProjectVersions(targetProject.key); final Optional<VersionDto> targetVersion = projectVersions.stream() .filter(versionDto -> versionDto.name.equals(Property.RESULT_VERSION.getValue())) .findFirst(); targetVersion.ifPresent(foundVersion -> logger.info(() -> format("Found in Zephyr; [ resultVersion: %s ] with [ resultVersionId: %s ]", Property.RESULT_VERSION.getValue(), foundVersion.id))); return targetVersion.orElseGet(() -> { final VersionDto createdVersion = jiraService.version() .createVersion(VersionDto.newBuilder() .projectId(targetProject.id) .name(Property.RESULT_VERSION.getValue()) .build()); logger.info(() -> format("Created in Zephyr; [ resultVersion: %s ] with [ resultVersionId: %s ]", Property.RESULT_VERSION.getValue(), createdVersion.id)); return createdVersion; }); }
Source:
<code>public void anonCanNotLogInWithInvalidPassword() { ArticlePage article = new ArticlePage(); SignInPage signIn = article.open(MercurySubpages.MAIN_PAGE) .getTopbar() .openNavigation() .clickOnSignInRegisterButton() .navigateToSignIn(); signIn.login(Configuration.getCredentials().userName10, "someinvalidpassw0rd"); <START> assertTrue(signIn.getError().contains(expectedErrorMessage)); <END> }</code><technical_language>expectedErrorMessage a good fit for a constant</technical_language>

Target:
public void anonCanNotLogInWithInvalidPassword() { ArticlePage article = new ArticlePage(); SignInPage signIn = article.open(MercurySubpages.MAIN_PAGE) .getTopbar() .openNavigation() .clickOnSignInRegisterButton() .navigateToSignIn(); signIn.login(Configuration.getCredentials().userName10, "someinvalidpassw0rd"); assertTrue(signIn.getError().contains(EXPECTED_ERROR_MESSAGE)); }
Source:
<code>public static int getApplicationIconBadgeNumber(Context context){ SharedPreferences settings = context.getSharedPreferences("badge", Context.MODE_PRIVATE); int badge = settings.getInt("badge", 0); <START> return badge; <END> }</code><technical_language>need create a temporary log badge number. return of settings.getInt()</technical_language>

Target:
public static int getApplicationIconBadgeNumber(Context context){ SharedPreferences settings = context.getSharedPreferences(BADGE, Context.MODE_PRIVATE); return settings.getInt(BADGE, 0); }
Source:
<code>public void testDoNotExtendWidgetOrProvideElement() throws FileNotFoundException { final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile( getProcessorUnderTest(), "org/uberfire/annotations/processors/WorkbenchClientEditorTest2"); assertFailedCompilation(diagnostics); assertCompilationMessage(diagnostics, Kind.ERROR, Diagnostic.NOPOS, Diagnostic.NOPOS, <START> "org.uberfire.annotations.processors.WorkbencPhClientEditorTest2Activity: The WorkbenchClientEditor must either extend IsWidget or provide a @WorkbenchPartView annotated method to return a com.google.gwt.user.client.ui.IsWidget."); <END> assertNull(result.getActualCode()); }</code><technical_language>typo</technical_language>

Target:
public void testDoNotExtendWidgetOrProvideElement() throws FileNotFoundException { final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile( getProcessorUnderTest(), "org/uberfire/annotations/processors/WorkbenchClientEditorTest2"); assertFailedCompilation(diagnostics); assertCompilationMessage(diagnostics, Kind.ERROR, Diagnostic.NOPOS, Diagnostic.NOPOS, "org.uberfire.annotations.processors.WorkbenchClientEditorTest2Activity: The WorkbenchClientEditor must either extend IsWidget or provide a @WorkbenchPartView annotated method to return a com.google.gwt.user.client.ui.IsWidget."); assertNull(result.getActualCode()); }
Source:
<code>public boolean onTarget() { <START> return super.onTarget() && derivativeTolerance != 0 && Math.abs(lastErrorDerivative) < derivativeTolerance; <END> }</code><technical_language>derivative logic in function onTarget()? I guess kind of is, kind of weird here</technical_language>

Target:
public boolean onTarget() { return super.onTarget() && derivativeOnTarget(); }
Source:
<code>private String getDefaultErrorMessage(MergeResult mergeResult) { <START> return new StringBuilder().append("Unsupported merge status '").append( <END> mergeResult.getMergeStatus().toString()).append("'\n").toString(); }</code><technical_language>System.getProperty("line.separator") instead of \n</technical_language>

Target:
private String getDefaultErrorMessage(MergeResult mergeResult) { return new StringBuilder().append("Unsupported merge status '").append( mergeResult.getMergeStatus().toString()).append("'").append(EOL).toString(); }
Source:
<code>public void setAllowedHostnames(Predicate<String> allowedHostnames) { <START> if (allowedHostnames != null) { <END> this.allowedHostnames = allowedHostnames; } }</code><technical_language>please this throw exception if a null predicate is given. like: java if (allowedHostnames == null) { throw new IllegalArgumentException("allowedHostnames null"); }</technical_language>

Target:
public void setAllowedHostnames(Predicate<String> allowedHostnames) { if (allowedHostnames == null) { throw new IllegalArgumentException("allowedHostnames cannot be null"); } this.allowedHostnames = allowedHostnames; }
Source:
<code><START> public List<Item> contents() { <END> return Collections.unmodifiableList((contents == null) ? new LinkedList<>() : contents); }</code><technical_language>Add @Override annotation, change implementation call emptyIfNull() if accept suggestion in ListObjectsResult</technical_language>

Target:
public List<Contents> contents() { return emptyIfNull(contents); }
Source:
<code>public void claimTaskCmdExecutorTest() { ClaimTaskCmd claimTaskCmd = new ClaimTaskCmd("taskId", "assignee"); <START> assertThat(claimTaskCmdExecutor).isNotNull(); <END> assertThat(claimTaskCmdExecutor.getHandledType()).isEqualTo(ClaimTaskCmd.class); claimTaskCmdExecutor.execute(claimTaskCmd); verify(processEngine).claimTask(claimTaskCmd); verify(commandResults).send(ArgumentMatchers.<Message<ClaimTaskResults>>any()); }</code><technical_language>removed</technical_language>

Target:
public void claimTaskCmdExecutorTest() { ClaimTaskCmd claimTaskCmd = new ClaimTaskCmd("taskId", "assignee"); assertThat(claimTaskCmdExecutor.getHandledType()).isEqualTo(ClaimTaskCmd.class); claimTaskCmdExecutor.execute(claimTaskCmd); verify(processEngine).claimTask(claimTaskCmd); verify(commandResults).send(ArgumentMatchers.<Message<ClaimTaskResults>>any()); }
Source:
<code>public List<GridColumn.HeaderMetaData> makeHeaderMetaData( final BaseColumn column ) { return new ArrayList<GridColumn.HeaderMetaData>() {{ if ( column instanceof ActionSetFieldCol52 ) { ActionSetFieldCol52 actionSetFieldColumn = ( ActionSetFieldCol52 ) column; <START> if ( actionSetFieldColumn.getBoundName() != null && !actionSetFieldColumn.getBoundName().isEmpty() ) { <END> add( new BaseHeaderMetaData( actionSetFieldColumn.getBoundName(), ActionCol52.class.getName() ) ); } add( new BaseHeaderMetaData( column.getHeader(), actionSetFieldColumn.getBoundName() ) ); } else { add( new BaseHeaderMetaData( column.getHeader(), ActionCol52.class.getName() ) ); } }}; }</code><technical_language>This false; if is want include second-level BaseHeaderMetaData entry if(..) {..} block</technical_language>

Target:
public List<GridColumn.HeaderMetaData> makeHeaderMetaData( final BaseColumn column ) { return new ArrayList<GridColumn.HeaderMetaData>() {{ if ( column instanceof ActionSetFieldCol52 ) { ActionSetFieldCol52 actionSetFieldColumn = ( ActionSetFieldCol52 ) column; if ( actionSetFieldColumn.getBoundName() != null && !actionSetFieldColumn.getBoundName().isEmpty() ) { add( new BaseHeaderMetaData( actionSetFieldColumn.getBoundName(), ActionCol52.class.getName() ) ); add( new BaseHeaderMetaData( column.getHeader(), actionSetFieldColumn.getBoundName() ) ); } } else { add( new BaseHeaderMetaData( column.getHeader(), ActionCol52.class.getName() ) ); } }}; }
Source:
<code>public Builder useEdgeFunctionMiddleware(JSMiddleware middleware) { <START> <END> assertNotNull(middleware, "middleware"); this.edgeFunctionMiddleware = middleware; return this; }</code><technical_language>add IllegalStateException here, in case sourceMiddleware/destinationMiddleware</technical_language>

Target:
public Builder useEdgeFunctionMiddleware(JSMiddleware middleware) { assertNotNull(middleware, "middleware"); if (this.sourceMiddleware != null || this.destinationMiddleware != null) { throw new IllegalStateException( "Can not use native middleware and edge function middleware"); } this.edgeFunctionMiddleware = middleware; return this; }