auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public static long getTxIfoCacheTimeout(FluoConfiguration conf, TimeUnit tu) { int minutes = getTxInfoCacheTimeout(conf); <START> return tu.toMillis((long) minutes); <END> }</code><technical_language>I this return tu.convert(minutes, TimeUnit.MINUTES). This convert minutes passed in time unit</technical_language>

Target:
public static long getTxIfoCacheTimeout(FluoConfiguration conf, TimeUnit tu) { long millis = conf.getLong(TX_INFO_CACHE_TIMEOUT, TX_INFO_CACHE_TIMEOUT_DEFAULT); if (millis <= 0) { throw new IllegalArgumentException("Timeout must positive for " + TX_INFO_CACHE_TIMEOUT); } return tu.convert(millis, TimeUnit.MILLISECONDS); }
Source:
<code>public void setNotification(TransientNotification notification) { titleLabel.setText(notification.getTitle()); messageLabel.setText(notification.getText()); messageLabel.setWrapText(true); <START> messageLabel.setMinHeight(Region.USE_PREF_SIZE); <END> imageView.setImage(notification.getImage()); action = notification.getActionCallback(); }</code><technical_language>values set in FXML</technical_language>

Target:
public void setNotification(TransientNotification notification) { titleLabel.setText(notification.getTitle()); messageLabel.setText(notification.getText()); imageView.setImage(notification.getImage()); action = notification.getActionCallback(); }
Source:
<code>private void addFolderToZip(String path, String srcFolder, ZipOutputStream zip) { File folder = new File(srcFolder); String[] fileList = folder.list(); try { if (fileList != null) { int i = 0; while (true) { if (fileList.length == i) break; String newPath = folder.getName(); <START> if (!path.equalsIgnoreCase("")) { <END> newPath = path + "/" + newPath; } if (new File(folder, fileList[i]).isDirectory()) { zip.putNextEntry(new ZipEntry(newPath + "/" + fileList[i] + "/")); } addToZip(newPath, srcFolder + "/" + fileList[i], zip); i++; } } } catch (Exception ex) { getLog().error("Error occurred while creating CAR file. " + ex); } }</code><technical_language>path null? switch avoid NPE</technical_language>

Target:
private void addFolderToZip(String path, String srcFolder, ZipOutputStream zip) throws ArchiveException { File folder = new File(srcFolder); String[] fileList = folder.list(); if (fileList == null) { return; } try { int i = 0; while (true) { if (fileList.length == i) break; String newPath = folder.getName(); if (!path.equalsIgnoreCase(Constants.EMPTY_STRING)) { newPath = path + File.separator + newPath; } if (new File(folder, fileList[i]).isDirectory()) { zip.putNextEntry(new ZipEntry(newPath + File.separator + fileList[i] + File.separator)); } addToZip(newPath, srcFolder + File.separator + fileList[i], zip); i++; } } catch (IOException ex) { throw new ArchiveException(Constants.ARCHIVE_EXCEPTION_MSG, ex); } }
Source:
<code><START> protected String createSearchPattern(Collection<RegisterVmData> entities) { <END> String vm_guidKey = "ID ="; String vm_nameKey = "NAME ="; String orKey = " or "; StringBuilder searchPattern = new StringBuilder(); searchPattern.append("VM: "); for (RegisterVmData vmData : entities) { VM vm = vmData.getVm(); searchPattern.append(vm_guidKey); searchPattern.append(vm.getId().toString()); searchPattern.append(orKey); searchPattern.append(vm_nameKey); searchPattern.append(vm.getName()); searchPattern.append(orKey); } return searchPattern.substring(0, searchPattern.length() - orKey.length()); }</code><technical_language>This similar ImportVmModel.createSearchPattern() great if query extracted shared</technical_language>

Target:
protected String createSearchPattern(Collection<RegisterVmData> entities) { String vm_guidKey = "ID = "; String vm_nameKey = "NAME = "; String orKey = " or "; String prefix = "VM: "; StringJoiner sj = new StringJoiner(orKey, prefix, ""); entities.stream().map(ImportVmData::getVm).forEach(vm -> { sj.add(vm_guidKey + vm.getId().toString()); sj.add(vm_nameKey + vm.getName()); }); return sj.toString(); }
Source:
<code>private Map<String, Properties> getBundleDefaultProperties(long bundleId) throws IOException { Bundle bundle = bundleContext.getBundle(bundleId); Enumeration<URL> enumeration = bundle.findEntries("", "*.properties", false); Map<String, Properties> allDefaultProperties = new LinkedHashMap<>(); <START> if (CollectionUtils.isNotEmpty(Collections.list(enumeration))) { <END> while (enumeration.hasMoreElements()) { InputStream is = null; URL url = enumeration.nextElement(); try { is = url.openStream(); Properties defaultBundleProperties = new Properties(); defaultBundleProperties.load(is); if (!url.getFile().isEmpty()) { allDefaultProperties.put(url.getFile().substring(1), defaultBundleProperties); } } catch (IOException e) { LOGGER.error("Error while reading or retrieving default properties", e); } finally { IOUtils.closeQuietly(is); } } } return allDefaultProperties; }</code><technical_language>@jhopen @mkruszynski explain adding this if solves problems? if this enumeration is empty null, skip while loop return empty map. this null? If yes, when? is this a correct behaviour</technical_language>

Target:
private Map<String, Properties> getBundleDefaultProperties(long bundleId) throws IOException { Bundle bundle = bundleContext.getBundle(bundleId); Enumeration<URL> enumeration = bundle.findEntries("", "*.properties", false); Map<String, Properties> allDefaultProperties = new LinkedHashMap<>(); if (enumeration != null) { while (enumeration.hasMoreElements()) { InputStream is = null; URL url = enumeration.nextElement(); try { is = url.openStream(); Properties defaultBundleProperties = new Properties(); defaultBundleProperties.load(is); if (!url.getFile().isEmpty()) { allDefaultProperties.put(url.getFile().substring(1), defaultBundleProperties); } } catch (IOException e) { LOGGER.error("Error while reading or retrieving default properties", e); } finally { IOUtils.closeQuietly(is); } } } return allDefaultProperties; }
Source:
<code>public List<String> getPKStrings() { ArrayList<String> list = new ArrayList<>(); String pkString = "db:" + table.getDatabase().getName() + "/" <START> + "tbl:" + table.getName() + "/"; <END> for ( Row r : filteredRows()) { list.add(pkString + getPKStringForRow(r)); } return list; }</code><technical_language>this is counter-intuitive. expect getPKStrings get PK strings only, sure</technical_language>

Target:
public List<String> getPKStrings() { ArrayList<String> list = new ArrayList<>(); for ( Row r : filteredRows()) { list.add(new MaxwelllPKJSONObject(table.getDatabase().getName(), table.getName(), getPKMapForRow(r)).toString()); } return list; }
Source:
<code>public void accountSession(String username, String password) throws TmdbInvalidParametersException { <START> if (username == null || password==null) <END> throw new TmdbInvalidParametersException(401,"Username and Password may not be null"); this.username = username; this.password = password; hasAccountSession = true; }</code><technical_language>Please add braces conditionals (like if { })</technical_language>

Target:
public void accountSession(String username, String password) throws TmdbInvalidParametersException { if (username == null || password == null) { throw new TmdbInvalidParametersException(401, "Username and Password may not be null"); } this.username = username; this.password = password; hasAccountSession = true; }
Source:
<code>public byte[] getUuidBytesArray() { ByteBuffer uuidBuf; switch (version) { case BLOB_ID_V1: case BLOB_ID_V2: case BLOB_ID_V3: case BLOB_ID_V4: case BLOB_ID_V5: byte[] uuidBytes = getUuid().getBytes(); uuidBuf = ByteBuffer.allocate(UUID_SIZE_FIELD_LENGTH_IN_BYTES + (short) uuidBytes.length); <START> uuidBuf.putInt(uuidBytes.length); <END> uuidBuf.put(uuidBytes); break; case BLOB_ID_V6: uuidBuf = ByteBuffer.allocate(UuidSerDe.SIZE_IN_BYTES); UuidSerDe.serialize(uuid, uuidBuf); break; default: throw new IllegalArgumentException("blobId version=" + version + " not supported"); } return uuidBuf.array(); }</code><technical_language>Is length prefix needed in this case return uuidBytes directly? is item (the UUID) in array</technical_language>

Target:
public byte[] getUuidBytesArray() { ByteBuffer uuidBuf; switch (version) { case BLOB_ID_V1: case BLOB_ID_V2: case BLOB_ID_V3: case BLOB_ID_V4: case BLOB_ID_V5: byte[] uuidBytes = getUuid().getBytes(); uuidBuf = ByteBuffer.allocate((short) uuidBytes.length); uuidBuf.put(uuidBytes); break; case BLOB_ID_V6: uuidBuf = ByteBuffer.allocate(UuidSerDe.SIZE_IN_BYTES); UuidSerDe.serialize(uuid, uuidBuf); break; default: throw new IllegalArgumentException("blobId version=" + version + " not supported"); } return uuidBuf.array(); }
Source:
<code>public boolean equals(Object o) { if ( this == o ) { return true; } if ( o == null || getClass() != o.getClass() ) { return false; } ConstraintViolationImpl<?> that = (ConstraintViolationImpl<?>) o; if ( interpolatedMessage != null ? !interpolatedMessage.equals( that.interpolatedMessage ) : that.interpolatedMessage != null ) { return false; } <START> if ( messageTemplate != null ? !messageTemplate.equals( that.messageTemplate ) : that.messageTemplate != null ) { <END> return false; } if ( propertyPath != null ? !propertyPath.equals( that.propertyPath ) : that.propertyPath != null ) { return false; } if ( rootBean != null ? ( rootBean != that.rootBean ) : that.rootBean != null ) { return false; } if ( leafBeanInstance != null ? ( leafBeanInstance != that.leafBeanInstance ) : that.leafBeanInstance != null ) { return false; } if ( value != null ? ( value != that.value ) : that.value != null ) { return false; } if ( constraintDescriptor != null ? !constraintDescriptor.equals( that.constraintDescriptor ) : that.constraintDescriptor != null ) { return false; } if ( elementType != null ? !elementType.equals( that.elementType ) : that.elementType != null ) { return false; } if ( rootBeanClass != null ? !rootBeanClass.equals( that.rootBeanClass ) : that.rootBeanClass != null ) { return false; } return true; }</code><technical_language>Interesting change</technical_language>

Target:
public boolean equals(Object o) { if ( this == o ) { return true; } if ( o == null || getClass() != o.getClass() ) { return false; } ConstraintViolationImpl<?> that = (ConstraintViolationImpl<?>) o; if ( interpolatedMessage != null ? !interpolatedMessage.equals( that.interpolatedMessage ) : that.interpolatedMessage != null ) { return false; } if ( messageTemplate != null ? !messageTemplate.equals( that.messageTemplate ) : that.messageTemplate != null ) { return false; } if ( propertyPath != null ? !propertyPath.equals( that.propertyPath ) : that.propertyPath != null ) { return false; } if ( rootBean != null ? ( rootBean != that.rootBean ) : that.rootBean != null ) { return false; } if ( leafBeanInstance != null ? ( leafBeanInstance != that.leafBeanInstance ) : that.leafBeanInstance != null ) { return false; } if ( value != null ? ( value != that.value ) : that.value != null ) { return false; } if ( constraintDescriptor != null ? !constraintDescriptor.equals( that.constraintDescriptor ) : that.constraintDescriptor != null ) { return false; } if ( elementType != null ? !elementType.equals( that.elementType ) : that.elementType != null ) { return false; } return true; }
Source:
<code>public GraphicsConsoles list() { GraphicsConsoles consoles = new GraphicsConsoles(); Map<GraphicsType, GraphicsInfo> graphicsTypeToGraphicsInfo; T entity = loadEntity(); boolean current = ParametersHelper.getBooleanParameter(httpHeaders, uriInfo, CURRENT, true, false); if (current) { graphicsTypeToGraphicsInfo = extractGraphicsInofs(entity); } else { List<GraphicsType> graphicsTypes = DisplayHelper.getGraphicsTypesForEntity(this, guid, true); graphicsTypeToGraphicsInfo = new HashMap<>(); for (GraphicsType type : graphicsTypes) { graphicsTypeToGraphicsInfo.put(type, null); } } for (Map.Entry<GraphicsType, GraphicsInfo> graphicsInfo : graphicsTypeToGraphicsInfo.entrySet()) { GraphicsConsole graphicsConsole = addLinks(populate(VmMapper.map(graphicsInfo, null), entity)); graphicsConsole.setRemoteViewerConnectionFile(getRemoteViewerConnectionFileContent(graphicsInfo)); <START> consoles.getGraphicsConsoles().add(graphicsConsole); <END> } return consoles; }</code><technical_language>This adds support for new parameter "list" method of GraphicsConsolesService, "get" method of GraphicsConsoleService</technical_language>

Target:
public GraphicsConsoles list() { GraphicsConsoles consoles = new GraphicsConsoles(); Map<GraphicsType, GraphicsInfo> graphicsTypeToGraphicsInfo; T entity = loadEntity(); boolean current = ParametersHelper.getBooleanParameter(httpHeaders, uriInfo, CURRENT, true, false); if (current) { graphicsTypeToGraphicsInfo = extractGraphicsInofs(entity); } else { List<GraphicsType> graphicsTypes = DisplayHelper.getGraphicsTypesForEntity(this, guid, true); graphicsTypeToGraphicsInfo = new HashMap<>(); for (GraphicsType type : graphicsTypes) { graphicsTypeToGraphicsInfo.put(type, null); } } for (Map.Entry<GraphicsType, GraphicsInfo> graphicsInfo : graphicsTypeToGraphicsInfo.entrySet()) { consoles.getGraphicsConsoles().add(addLinks(populate(VmMapper.map(graphicsInfo, null), entity))); } return consoles; }
Source:
<code>public ObjectRetentionConfiguration(RetentionMode mode, DateTime retainUntilDate) throws XmlPullParserException, InvalidArgumentException { super(); <START> super.name = "Retention"; <END> if (mode == null) { throw new InvalidArgumentException("null is not allowed in mode. Valid values are 'COMPLIANCE' and 'GOVERNANCE'"); } this.mode = mode.toString(); if (retainUntilDate == null) { throw new InvalidArgumentException("retain until date cant be null, it must be a valid date."); } this.retainUntilDate = retainUntilDate.toString(DateFormat.RETENTION_DATE_FORMAT); }</code><technical_language>call this() repeating lines</technical_language>

Target:
public ObjectRetentionConfiguration(RetentionMode mode, DateTime retainUntilDate) throws XmlPullParserException, InvalidArgumentException { this(); if (mode == null) { throw new InvalidArgumentException("null mode is not allowed"); } this.mode = mode.toString(); if (retainUntilDate == null) { throw new InvalidArgumentException("null retainUntilDate is not allowed"); } this.retainUntilDate = retainUntilDate.toString(DateFormat.EXPIRATION_DATE_FORMAT); }
Source:
<code>private void onTopicPresent(HttpServerExchange exchange, String messageId, Consumer<CachedTopic> consumer) { String qualifiedTopicName = exchange.getQueryParameters().get("qualifiedTopicName").getFirst(); try { Optional<CachedTopic> topic = topicsCache.getTopic(qualifiedTopicName); if (topic.isPresent()) { <START> if (!topicsCache.isBlacklisted(topic.get().getQualifiedName())) { <END> consumer.accept(topic.get()); } else { topicBlacklisted(exchange, qualifiedTopicName, messageId); } } else { nonExistentTopic(exchange, qualifiedTopicName, messageId); } } catch (IllegalArgumentException exception) { missingTopicGroup(exchange, qualifiedTopicName, messageId); } }</code><technical_language>call get in main loop., -> qualifiedTopicName here, need construct (pointing out, this is hottest code in frontend module)</technical_language>

Target:
private void onTopicPresent(HttpServerExchange exchange, String messageId, Consumer<CachedTopic> consumer) { String qualifiedTopicName = exchange.getQueryParameters().get("qualifiedTopicName").getFirst(); try { Optional<CachedTopic> cachedTopic = topicsCache.getTopic(qualifiedTopicName); if (cachedTopic.isPresent()) { CachedTopic topic = cachedTopic.get(); if (!topic.isBlacklisted()) { consumer.accept(topic); } else { topicBlacklisted(exchange, qualifiedTopicName, messageId); } } else { nonExistentTopic(exchange, qualifiedTopicName, messageId); } } catch (IllegalArgumentException exception) { missingTopicGroup(exchange, qualifiedTopicName, messageId); } }
Source:
<code>public void encode(RowData element, OutputStream stream) throws IOException { stream.write(serializationSchema.serialize(element)); <START> stream.write(DEFAULT_LINE_DELIMITER.getBytes()); <END> }</code><technical_language>Standardxxx.UTF-8</technical_language>

Target:
public void encode(RowData element, OutputStream stream) throws IOException { stream.write(serializationSchema.serialize(element)); stream.write(DEFAULT_LINE_DELIMITER.getBytes(StandardCharsets.UTF_8)); }
Source:
<code>public void markNotificationsAsRead() { if (this.getNumberOfUnreadNotifications() > 0) { if (this.markNotificationsAsReadThisWiki.isDisplayed()) { this.click(this.markNotificationsAsReadThisWiki); } else { this.click(this.markNotificationsAsRead); this.waitForElementVisibleByElement(this.markNotificationsAsReadAllWikis); this.click(this.markNotificationsAsReadAllWikis); } <START> this.waitForElementNotPresent("#WallNotifications > li > div.reddot"); <END> } }</code><technical_language>add this selector UI mapping beginning</technical_language>

Target:
public void markNotificationsAsRead() { if (this.getNumberOfUnreadNotifications() > 0) { if (this.markNotificationsAsReadThisWiki.isDisplayed()) { this.click(this.markNotificationsAsReadThisWiki); } else { this.click(this.markNotificationsAsRead); this.waitForElementVisibleByElement(this.markNotificationsAsReadAllWikis); this.click(this.markNotificationsAsReadAllWikis); } this.waitForElementNotPresent(unreadNotificationReddot); } }
Source:
<code>private void visitFunctionParameters(FunctionType ftype, boolean emitTemplatizedTypes) { if (emitTemplatizedTypes) { visitTemplateTypes(ftype); } emit("("); Iterator<Node> parameters = ftype.getParameters().iterator(); Iterator<String> names = null; Node functionSource = ftype.getSource(); if (functionSource != null) { Iterable<Node> parameterNodes = functionSource.getFirstChild().getNext().children(); names = Iterables.transform(parameterNodes, NODE_GET_STRING).iterator(); } <START> char pName = 'a'; END> while (parameters.hasNext()) { Node param = parameters.next(); if (param.isVarArgs()) { emit("..."); } if (names != null && names.hasNext()) { emitNoSpace(names.next()); } else { emitNoSpace("" + pName); if (pName == 'z') { pName = 'A'; } else { pName++; } } if (param.isOptionalArg()) { emit("?"); } visitTypeDeclaration(param.getJSType(), param.isVarArgs()); if (parameters.hasNext()) { emit(", "); } } emit(")"); }</code><technical_language>number p1, p2, this point</technical_language>

Target:
private void visitFunctionParameters(FunctionType ftype, boolean emitTemplatizedTypes) { if (emitTemplatizedTypes) { visitTemplateTypes(ftype); } emit("("); Iterator<Node> parameters = ftype.getParameters().iterator(); Iterator<String> names = null; Node functionSource = ftype.getSource(); if (functionSource != null) { Iterable<Node> parameterNodes = functionSource.getFirstChild().getNext().children(); names = Iterables.transform(parameterNodes, NODE_GET_STRING).iterator(); } int paramCount = 0; while (parameters.hasNext()) { Node param = parameters.next(); if (param.isVarArgs()) { emit("..."); } if (names != null && names.hasNext()) { emitNoSpace(names.next()); } else { String pName; if (paramCount < 26) { pName = Character.toString((char) (97 + paramCount)); } else { pName = "p" + (paramCount - 26); } emitNoSpace("" + pName); paramCount++; } if (param.isOptionalArg()) { emit("?"); } visitTypeDeclaration(param.getJSType(), param.isVarArgs()); if (parameters.hasNext()) { emit(", "); } } emit(")"); }
Source:
<code>public DigitalTwinsAsyncClient buildAsyncClient() { Objects.requireNonNull(tokenCredential, "'tokenCredential' cannot be null."); Objects.requireNonNull(endpoint, "'endpoint' cannot be null"); this.serviceVersion = this.serviceVersion != null ? this.serviceVersion : DigitalTwinsServiceVersion.getLatest(); this.retryPolicy = this.retryPolicy != null ? this.retryPolicy : new RetryPolicy(); <START> this.httpPipeline = this.httpPipeline != null ? httpPipeline : buildPipeline(this.tokenCredential, this.endpoint, this.logOptions, this.httpClient, this.additionalPolicies, this.retryPolicy); <END> return new DigitalTwinsAsyncClient(this.httpPipeline, this.serviceVersion, this.endpoint); }</code><technical_language>split this multiple lines add tab support</technical_language>

Target:
public DigitalTwinsAsyncClient buildAsyncClient() { Objects.requireNonNull(tokenCredential, "'tokenCredential' cannot be null."); Objects.requireNonNull(endpoint, "'endpoint' cannot be null"); this.serviceVersion = this.serviceVersion != null ? this.serviceVersion : DigitalTwinsServiceVersion.getLatest(); this.retryPolicy = this.retryPolicy != null ? this.retryPolicy : new RetryPolicy(); if (this.httpPipeline == null) { this.httpPipeline = buildPipeline( this.tokenCredential, this.endpoint, this.logOptions, this.httpClient, this.additionalPolicies, this.retryPolicy); } return new DigitalTwinsAsyncClient(this.httpPipeline, this.serviceVersion, this.endpoint); }
Source:
<code>public void addReferencePointMapping(String referencePointId, IReferencePoint referencePoint) { if (referencePointMapper.getReferencePoint(referencePointId) == null) { if (wouldCreateNestedReferencePoint(referencePoint)) { leaveSessionDueToNestedReferencePoint(referencePoint); return; } referencePointMapper.addReferencePoint(referencePointId, referencePoint); <START> listenerDispatch.referencePointAdded(referencePoint); <END> } }</code><technical_language>thrown Exception</technical_language>

Target:
public void addReferencePointMapping(String referencePointId, IReferencePoint referencePoint) { if (referencePointMapper.getReferencePoint(referencePointId) == null) { referencePointMapper.addReferencePoint(referencePointId, referencePoint); listenerDispatch.referencePointAdded(referencePoint); } }
Source:
<code>public void shouldAnswerToPingWithPong() throws Exception { ServerConnectionEstablisher establisher = new ServerConnectionEstablisher(); HttpMessage handshakeRequest = new HttpMessage(HttpHandshakeBuilder.getHttpHandshakeRequestHeader(super.getServertUrl())); WebSocketProxy webSocketProxy = establisher.send(new HandshakeConfig(handshakeRequest,false,false)); NanoWebSocketConnection webSocketConnection = super.getLastConnection(); webSocketConnection.setPingScheduling(50,("1010").getBytes()); Thread.sleep(250); assertTrue(webSocketProxy.isConnected()); <START> List<NanoWSD.WebSocketFrame> messages = webSocketConnection.getListOfIncomingMessages(); <END> assertEquals(4, messages.size()); for(int i = 0; i < messages.size(); i++){ assertEquals("1010", messages.get(i).getTextPayload()); } }</code><technical_language>For a matter of consistency changed WebSocketFrame (like done in other class)</technical_language>

Target:
public void shouldAnswerToPingWithPong() throws Exception { ServerConnectionEstablisher establisher = new ServerConnectionEstablisher(); HttpMessage handshakeRequest = new HttpMessage(HttpHandshakeBuilder.getHttpHandshakeRequestHeader(super.getServertUrl())); WebSocketProxy webSocketProxy = establisher.send(new HandshakeConfig(handshakeRequest,false,false)); NanoWebSocketConnection webSocketConnection = super.getLastConnection(); webSocketConnection.setPingScheduling(50,("1010").getBytes()); Thread.sleep(250); assertTrue(webSocketProxy.isConnected()); List<WebSocketFrame> messages = webSocketConnection.getListOfIncomingMessages(); assertEquals(4, messages.size()); for(WebSocketFrame message : messages){ assertEquals("1010", message.getTextPayload()); assertEquals("Pong", message.getOpCode().toString()); } }
Source:
<code><START> public Map<String, String> getProperties(PropertyArgs pa, List<OperatorConf> opConfs, String appName) <END> { Map<String, String> opProps = Maps.newHashMap(); Map<String, TemplateConf> templates = stramConf.getChildren(StramElement.TEMPLATE); if (!templates.isEmpty()) { TreeMap<Integer, TemplateConf> matchingTemplates = getMatchingTemplates(pa, appName, templates); if (matchingTemplates != null && !matchingTemplates.isEmpty()) { for (TemplateConf t : matchingTemplates.descendingMap().values()) { opProps.putAll(Maps.fromProperties(t.properties)); } } List<TemplateConf> refTemplates = getDirectTemplates(opConfs, templates); for (TemplateConf t : refTemplates) { opProps.putAll(Maps.fromProperties(t.properties)); } } for (int i = opConfs.size()-1; i >= 0; i--) { Conf conf1 = opConfs.get(i); opProps.putAll(Maps.fromProperties(conf1.properties)); } return opProps; }</code><technical_language>this public</technical_language>

Target:
private Map<String, String> getProperties(PropertyArgs pa, List<OperatorConf> opConfs, String appName) { Map<String, String> opProps = Maps.newHashMap(); Map<String, TemplateConf> templates = stramConf.getChildren(StramElement.TEMPLATE); if (!templates.isEmpty()) { TreeMap<Integer, TemplateConf> matchingTemplates = getMatchingTemplates(pa, appName, templates); if (matchingTemplates != null && !matchingTemplates.isEmpty()) { for (TemplateConf t : matchingTemplates.descendingMap().values()) { opProps.putAll(Maps.fromProperties(t.properties)); } } List<TemplateConf> refTemplates = getDirectTemplates(opConfs, templates); for (TemplateConf t : refTemplates) { opProps.putAll(Maps.fromProperties(t.properties)); } } for (int i = opConfs.size()-1; i >= 0; i--) { Conf conf1 = opConfs.get(i); opProps.putAll(Maps.fromProperties(conf1.properties)); } return opProps; }
Source:
<code>public int testCarts(List<EntityMinecart> carts) { if (logic == null || !logic.isValid()) return NO_POWER; for (EntityMinecart cart : carts) { if (routingController.getButtonState() == RoutingButtonState.PRIVATE) if (!getOwner().equals(CartToolsAPI.getCartOwner(cart))) continue; int value = logic.evaluate(this, cart); <START> if (value != 0) <END> return (value == -1 ? FULL_POWER : value); } return NO_POWER; }</code><technical_language>Unnecessary</technical_language>

Target:
public int testCarts(List<EntityMinecart> carts) { if (logic == null || !logic.isValid()) return NO_POWER; int value = NO_POWER; for (EntityMinecart cart : carts) { if (routingController.getButtonState() == RoutingButtonState.PRIVATE) if (!getOwner().equals(CartToolsAPI.getCartOwner(cart))) continue; value = Math.max(value, logic.evaluate(this, cart)); } return value; }
Source:
<code>private Callback<Long> fetchStitchRequestBodyCallback(CopyingAsyncWritableChannel channel, BlobInfo blobInfo) { return buildCallback(frontendMetrics.postReadStitchRequestMetrics, bytesRead -> router.stitchBlob(blobInfo.getBlobProperties(), blobInfo.getUserMetadata(), <START> getChunksToStitch(blobInfo.getBlobProperties(), FrontendUtils.readJsonFromChannel(channel)), <END> routerStitchBlobCallback(blobInfo)), uri, LOGGER, finalCallback); }</code><technical_language>FrontendUtils is imported beginning, readJsonFromChannel here</technical_language>

Target:
private Callback<Long> fetchStitchRequestBodyCallback(CopyingAsyncWritableChannel channel, BlobInfo blobInfo) { return buildCallback(frontendMetrics.postReadStitchRequestMetrics, bytesRead -> router.stitchBlob(blobInfo.getBlobProperties(), blobInfo.getUserMetadata(), getChunksToStitch(blobInfo.getBlobProperties(), readJsonFromChannel(channel)), routerStitchBlobCallback(blobInfo)), uri, LOGGER, finalCallback); }
Source:
<code>void assign(AssignableReplica assignableReplica) { if (addToAssignmentRecord(assignableReplica)) { assignableReplica.getCapacity().entrySet().stream().forEach( capacity -> updateCapacityAndUtilization(capacity.getKey(), capacity.getValue())); <START> } else { <END> throw new HelixException(String .format("Resource %s already has a replica from partition %s on node %s", assignableReplica.getResourceName(), assignableReplica.getPartitionName(), getInstanceName())); } }</code><technical_language>throw this exception addToAssignmentRecord()? code is more concise. need for this if statement. Also, avoid return a boolean in addToAssignmentRecord(), which, least, is unreadable..</technical_language>

Target:
void assign(AssignableReplica assignableReplica) { addToAssignmentRecord(assignableReplica); assignableReplica.getCapacity().entrySet().stream() .forEach(capacity -> updateCapacityAndUtilization(capacity.getKey(), capacity.getValue())); }
Source:
<code>public void testPLFM_5989() throws IOException { String fileName = "testPLFM_5989.csv"; String csvString = null; try(InputStream in =UploadPreviewBuilderTest.class.getClassLoader().getResourceAsStream(fileName)){ assertNotNull("Cannot find: "+fileName+" on classpath", in); csvString = IOUtils.toString(in, StandardCharsets.UTF_8); } <START> System.out.println(Arrays.toString(csvString.getBytes(StandardCharsets.UTF_8))); <END> CsvTableDescriptor descriptor = new CsvTableDescriptor(); descriptor.setIsFirstLineHeader(true); UploadToTablePreviewRequest request = new UploadToTablePreviewRequest(); request.setCsvTableDescriptor(descriptor); StringReader sReader = new StringReader(csvString); Long linesToSkip = 0L; CSVReader reader = CSVUtils.createCSVReader(sReader, descriptor, linesToSkip); UploadPreviewBuilder builder = new UploadPreviewBuilder(reader, mockProgressCallback, request); UploadToTablePreviewResult result = builder.buildResult(); assertNotNull(result); assertNotNull(result.getSuggestedColumns()); assertEquals(2, result.getSuggestedColumns().size()); ColumnModel cm = result.getSuggestedColumns().get(0); assertEquals(ColumnType.STRING, cm.getColumnType()); assertEquals("column1", cm.getName()); assertEquals(new Long(5), cm.getMaximumSize()); cm = result.getSuggestedColumns().get(1); assertEquals(ColumnType.DOUBLE, cm.getColumnType()); assertEquals("column2", cm.getName()); }</code><technical_language>Remove sysout</technical_language>

Target:
public void testPLFM_5989() throws IOException { String fileName = "testPLFM_5989.csv"; String csvString = null; try(InputStream in =UploadPreviewBuilderTest.class.getClassLoader().getResourceAsStream(fileName)){ assertNotNull("Cannot find: "+fileName+" on classpath", in); csvString = IOUtils.toString(in, StandardCharsets.UTF_8); } CsvTableDescriptor descriptor = new CsvTableDescriptor(); descriptor.setIsFirstLineHeader(true); UploadToTablePreviewRequest request = new UploadToTablePreviewRequest(); request.setCsvTableDescriptor(descriptor); StringReader sReader = new StringReader(csvString); Long linesToSkip = 0L; CSVReader reader = CSVUtils.createCSVReader(sReader, descriptor, linesToSkip); UploadPreviewBuilder builder = new UploadPreviewBuilder(reader, mockProgressCallback, request); UploadToTablePreviewResult result = builder.buildResult(); assertNotNull(result); assertNotNull(result.getSuggestedColumns()); assertEquals(2, result.getSuggestedColumns().size()); ColumnModel cm = result.getSuggestedColumns().get(0); assertEquals(ColumnType.STRING, cm.getColumnType()); assertEquals("column1", cm.getName()); assertEquals(new Long(5), cm.getMaximumSize()); cm = result.getSuggestedColumns().get(1); assertEquals(ColumnType.DOUBLE, cm.getColumnType()); assertEquals("column2", cm.getName()); }
Source:
<code>public Map<Client, PaxosLong> apply(Set<Client> clients) { try { return unsafeGetLatest(clients); } catch (RemoteException e) { if (e.getError().errorName().equals(BatchPaxosAcceptor.CACHE_KEY_NOT_FOUND.name())) { log.info("Cache key is invalid, invalidating cache"); return handleCacheMiss(clients); } log.error("received remote exception that is not a cache key miss", e); throw e; } catch (RuntimeException e) { if (e.getMessage().contains(BatchPaxosAcceptor.CACHE_KEY_NOT_FOUND.name())) { log.info("Cache key is invalid, invalidating cache - using deprecated detection method"); return handleCacheMiss(clients); } <START> log.error("received unexpected runtime exception", e); <END> throw e; } }</code><technical_language>logged error? Specifically thinking exceptions node is unreachable delegate throw</technical_language>

Target:
public Map<Client, PaxosLong> apply(Set<Client> clients) { try { return unsafeGetLatest(clients); } catch (RemoteException e) { if (e.getError().errorName().equals(BatchPaxosAcceptor.CACHE_KEY_NOT_FOUND.name())) { log.info("Cache key is invalid, invalidating cache"); return handleCacheMiss(clients); } log.warn("received remote exception that is not a cache key miss", e); throw e; } catch (RuntimeException e) { if (e.getMessage().contains(BatchPaxosAcceptor.CACHE_KEY_NOT_FOUND.name())) { log.info("Cache key is invalid, invalidating cache - using deprecated detection method"); return handleCacheMiss(clients); } log.warn("received unexpected runtime exception", e); throw e; } }
Source:
<code>private WifiMode getWifiMode(List<? extends NetInterfaceAddressConfig> netInterfaceAddresses) { WifiMode wifiMode = WifiMode.UNKNOWN; for (NetInterfaceAddressConfig netInterfaceAddress : netInterfaceAddresses) { if (netInterfaceAddress instanceof WifiInterfaceAddressConfig) { <START> wifiMode = ((WifiInterfaceAddressConfig) netInterfaceAddress).getMode(); <END> } } return wifiMode; }</code><technical_language>a break put</technical_language>

Target:
private WifiMode getWifiMode(List<? extends NetInterfaceAddressConfig> netInterfaceAddresses) { WifiMode wifiMode = WifiMode.UNKNOWN; for (NetInterfaceAddressConfig netInterfaceAddress : netInterfaceAddresses) { if (netInterfaceAddress instanceof WifiInterfaceAddressConfig) { wifiMode = ((WifiInterfaceAddressConfig) netInterfaceAddress).getMode(); break; } } return wifiMode; }
Source:
<code>protected ApplicationInterfaceEntity saveApplicationInterface( ApplicationInterfaceDescription applicationInterfaceDescription, String gatewayId) throws AppCatalogException { String applicationInterfaceId = applicationInterfaceDescription.getApplicationInterfaceId(); Mapper mapper = ObjectMapperSingleton.getInstance(); ApplicationInterfaceEntity applicationInterfaceEntity = mapper.map(applicationInterfaceDescription, ApplicationInterfaceEntity.class); <START> if (gatewayId != null) <END> applicationInterfaceEntity.setGatewayId(gatewayId); if (applicationInterfaceEntity.getApplicationInputs() != null) { applicationInterfaceEntity.getApplicationInputs().forEach(applicationInputEntity -> applicationInputEntity.setInterfaceId(applicationInterfaceId)); } if (applicationInterfaceEntity.getApplicationOutputs() != null) { applicationInterfaceEntity.getApplicationOutputs().forEach(applicationOutputEntity -> applicationOutputEntity.setInterfaceId(applicationInterfaceId)); } if (!isApplicationInterfaceExists(applicationInterfaceId)) applicationInterfaceEntity.setCreationTime(new Timestamp(System.currentTimeMillis())); applicationInterfaceEntity.setUpdateTime(new Timestamp(System.currentTimeMillis())); return execute(entityManager -> entityManager.merge(applicationInterfaceEntity)); }</code><technical_language>Debug logs</technical_language>

Target:
protected ApplicationInterfaceEntity saveApplicationInterface( ApplicationInterfaceDescription applicationInterfaceDescription, String gatewayId) throws AppCatalogException { String applicationInterfaceId = applicationInterfaceDescription.getApplicationInterfaceId(); Mapper mapper = ObjectMapperSingleton.getInstance(); ApplicationInterfaceEntity applicationInterfaceEntity = mapper.map(applicationInterfaceDescription, ApplicationInterfaceEntity.class); if (gatewayId != null) { logger.debug("Setting the gateway ID of the Application Interface"); applicationInterfaceEntity.setGatewayId(gatewayId); } if (applicationInterfaceEntity.getApplicationInputs() != null) { logger.debug("Populating the Primary Key of ApplicationInputs objects for the Application Interface"); applicationInterfaceEntity.getApplicationInputs().forEach(applicationInputEntity -> applicationInputEntity.setInterfaceId(applicationInterfaceId)); } if (applicationInterfaceEntity.getApplicationOutputs() != null) { logger.debug("Populating the Primary Key of ApplicationOutputs objects for the Application Interface"); applicationInterfaceEntity.getApplicationOutputs().forEach(applicationOutputEntity -> applicationOutputEntity.setInterfaceId(applicationInterfaceId)); } if (!isApplicationInterfaceExists(applicationInterfaceId)) { logger.debug("Checking if the Application Interface already exists"); applicationInterfaceEntity.setCreationTime(new Timestamp(System.currentTimeMillis())); } applicationInterfaceEntity.setUpdateTime(new Timestamp(System.currentTimeMillis())); return execute(entityManager -> entityManager.merge(applicationInterfaceEntity)); }
Source:
<code>default ColumnValueSelector<Float> makeColumnValueSelector(ReadableOffset offset, ImmutableBitmap nullValueBitmap) { <START> final boolean hasNulls = !nullValueBitmap.isEmpty(); <END> class HistoricalFloatColumnSelector implements FloatColumnSelector, HistoricalColumnSelector<Float> { @Override public float getFloat() { return ColumnarFloats.this.get(offset.getOffset()); } @Override public boolean isNull() { return hasNulls && nullValueBitmap.get(offset.getOffset()); } @Override public double getDouble(int offset) { return ColumnarFloats.this.get(offset); } @Override public void inspectRuntimeShape(RuntimeShapeInspector inspector) { inspector.visit("columnar", ColumnarFloats.this); inspector.visit("offset", offset); } } return new HistoricalFloatColumnSelector(); }</code><technical_language>Please align logic double. if is method, checks returns optimized impl</technical_language>

Target:
default ColumnValueSelector<Float> makeColumnValueSelector(ReadableOffset offset, ImmutableBitmap nullValueBitmap) { if (nullValueBitmap.isEmpty()) { class HistoricalFloatColumnSelector implements FloatColumnSelector, HistoricalColumnSelector<Float> { @Override public boolean isNull() { return false; } @Override public float getFloat() { return ColumnarFloats.this.get(offset.getOffset()); } @Override public double getDouble(int offset) { return ColumnarFloats.this.get(offset); } @Override public void inspectRuntimeShape(RuntimeShapeInspector inspector) { inspector.visit("columnar", ColumnarFloats.this); inspector.visit("offset", offset); } } return new HistoricalFloatColumnSelector(); } else { class HistoricalFloatColumnSelectorwithNulls implements FloatColumnSelector, HistoricalColumnSelector<Float> { @Override public boolean isNull() { return nullValueBitmap.get(offset.getOffset()); } @Override public float getFloat() { assert NullHandling.replaceWithDefault() || !isNull(); return ColumnarFloats.this.get(offset.getOffset()); } @Override public double getDouble(int offset) { assert NullHandling.replaceWithDefault() || !nullValueBitmap.get(offset); return ColumnarFloats.this.get(offset); } @Override public void inspectRuntimeShape(RuntimeShapeInspector inspector) { inspector.visit("columnar", ColumnarFloats.this); inspector.visit("offset", offset); inspector.visit("nullValueBitmap", nullValueBitmap); } } return new HistoricalFloatColumnSelectorwithNulls(); } }
Source:
<code>public InstanceInZoneToNodeMetadata(Map<Instance.Status, NodeMetadata.Status> toPortableNodeStatus, GroupNamingConvention.Factory namingConvention, @Memoized Supplier<Map<URI, ? extends Image>> images, @Memoized Supplier<Map<URI, ? extends Hardware>> hardwares, @Memoized Supplier<Map<URI, ? extends Location>> locations, FirewallTagNamingConvention.Factory firewallTagNamingConvention) { this.toPortableNodeStatus = toPortableNodeStatus; this.nodeNamingConvention = namingConvention.createWithoutPrefix(); this.images = images; this.hardwares = hardwares; this.locations = locations; <START> this.firewallTagNamingConvention = firewallTagNamingConvention; <END> }</code><technical_language>null check</technical_language>

Target:
public InstanceInZoneToNodeMetadata(Map<Instance.Status, NodeMetadata.Status> toPortableNodeStatus, GroupNamingConvention.Factory namingConvention, @Memoized Supplier<Map<URI, ? extends Image>> images, @Memoized Supplier<Map<URI, ? extends Hardware>> hardwares, @Memoized Supplier<Map<URI, ? extends Location>> locations, FirewallTagNamingConvention.Factory firewallTagNamingConvention) { this.toPortableNodeStatus = toPortableNodeStatus; this.nodeNamingConvention = namingConvention.createWithoutPrefix(); this.images = images; this.hardwares = hardwares; this.locations = locations; this.firewallTagNamingConvention = checkNotNull(firewallTagNamingConvention, "firewallTagNamingConvention"); }
Source:
<code>void setConsentStatuses(Map<SubpopulationGuid,ConsentStatus> consentStatuses) { <START> this.consentStatuses = consentStatuses; <END> }</code><technical_language>this a copy? (Not reference counting is handled for Java)</technical_language>

Target:
void setConsentStatuses(Map<SubpopulationGuid,ConsentStatus> consentStatuses) { this.consentStatuses = (consentStatuses == null) ? ImmutableMap.<SubpopulationGuid,ConsentStatus>of() : ImmutableMap.copyOf(consentStatuses); }
Source:
<code>private static String getMimeTypeFromMessage(MimeMessage message) throws MessagingException { try { return new MimeType(message.getContentType()).getBaseType(); } catch (MimeTypeParseException e) { LOGGER.warn(e.toString()); <START> return ""; <END> } }</code><technical_language>If return nothing, explicit type. handle this in a clean is java Optional. then: - Modify mimeType of this method return Optional<String> - returning something, return Optional.of(something) - encouter error, return Optional.empty() - Finally in **match** methods, handle if resoluion in a functional manner *filter* *orElse* (that replace if block)</technical_language>

Target:
private static Optional<String> getMimeTypeFromMessage(MimeMessage message) throws MessagingException { try { return Optional.of(new MimeType(message.getContentType()).getBaseType()); } catch (MimeTypeParseException e) { LOGGER.warn(String.format("Error while parsing message's mimeType %s", message.getContentType()), e); return Optional.empty(); } }
Source:
<code>public final void destroy() <START> throws IOException <END> { try (Closer closer = Closer.create()) { closer.register(queryRunner); closer.register(embeddedElasticsearch); } catch (IOException e) { throw new UncheckedIOException(e); } }</code><technical_language>throws IOException removed</technical_language>

Target:
public final void destroy() throws IOException { try (Closer closer = Closer.create()) { closer.register(queryRunner); closer.register(embeddedElasticsearchNode); } queryRunner = null; }
Source:
<code>private int calculateValue(NetworkCluster networkCluster) { int res = 0; if (networkCluster != null) { if (networkCluster.isDefaultRoute()) { res += 16; } if (networkCluster.isManagement()) { <START> res += 8; <END> } if (networkCluster.isDisplay()) { res += 4; } if (networkCluster.isMigration()) { res += 2; } if (networkCluster.isGluster()) { res += 1; } } return res; }</code><technical_language>Please management network highest number. displayed first</technical_language>

Target:
private int calculateValue(NetworkCluster networkCluster) { int res = 0; if (networkCluster != null) { if (networkCluster.isManagement()) { res += 16; } if (networkCluster.isDefaultRoute()) { res += 8; } if (networkCluster.isDisplay()) { res += 4; } if (networkCluster.isMigration()) { res += 2; } if (networkCluster.isGluster()) { res += 1; } } return res; }
Source:
<code>private static String getPatternForSite(RequestMapping mappingAnnotation, Site site) { final Theme theme = site.getTheme(); String[] annotationValue = mappingAnnotation.value(); if (annotationValue.length == 0) return null; <START> String annotationPattern = Iterables.getOnlyElement(Arrays.asList(annotationValue)); <END> Map<String, Object> mappingsConfig; try { mappingsConfig = theme.getConfigMap("mappings"); } catch (IOException e) { throw new RuntimeException(e); } Map<String, Object> override = (Map<String, Object>) mappingsConfig.get(mappingAnnotation.name()); if (override == null) { return annotationPattern; } else { Boolean enabled = (Boolean) override.get("enabled"); if (enabled == null || enabled) { String overridePattern = (String) override.get("pattern"); return (overridePattern != null) ? overridePattern : annotationPattern; } else { return null; } } }</code><technical_language>Forgive ignorance, perform calls if expect a single element? EG: String annotationPattern = annotationValue[0]</technical_language>

Target:
private static String getPatternForSite(RequestMapping mappingAnnotation, Site site) { final Theme theme = site.getTheme(); String[] annotationValue = mappingAnnotation.value(); if (annotationValue.length == 0) return null; String annotationPattern = Iterables.getOnlyElement(Arrays.asList(annotationValue)); Map<String, Object> mappingsConfig; try { mappingsConfig = theme.getConfigMap("mappings"); } catch (IOException e) { throw new RuntimeException(e); } Map<String, Object> override = (Map<String, Object>) mappingsConfig.get(mappingAnnotation.name()); if (override == null) { return annotationPattern; } else { Boolean disabled = (Boolean) override.get("disabled"); if (disabled != null && disabled) return null; String overridePattern = (String) override.get("pattern"); return (overridePattern != null) ? overridePattern : annotationPattern; } }
Source:
<code>public boolean apply(final String serverId) { checkNotNull(serverId, "serverId"); logger.trace("looking for state on Server %s", serverId); final Server server = api.getServer(serverId); if (server == null) return false; <START> logger.trace("%s: looking for server %s deployed: currently: %s", server, server.state()); <END> if (server.state().isFailed()) { throw new IllegalStateException(MessageFormat.format("Server {0} is in FAILED state", server.id())); } return server.started() == started && server.deployed() == deployed; }</code><technical_language>Missing parameter for log message</technical_language>

Target:
public boolean apply(final String serverId) { checkNotNull(serverId, "serverId"); logger.trace("looking for start status on Server %s", serverId); final Server server = api.getServer(serverId); if (server == null) return false; logger.trace("Looking for Server %s to be started: %s currently: %s", server.id(), started, server.started()); if (server.state().isFailed()) { throw new IllegalStateException(String.format("Server %s is in FAILED state", server.id())); } return server.started() == started && server.deployed() == deployed; }
Source:
<code>public static boolean isWindows() { <START> return getOsName().startsWith("Windows"); <END> }</code><technical_language>npe</technical_language>

Target:
public static boolean isWindows() { String osname = getOsName(); return osname != null ? osname.startsWith("Windows") : false; }
Source:
<code>protected AsyncPackageDataModelOracle getOracle() { final AsyncPackageDataModelOracle oracle = super.getOracle(); oracle.addModelFields(new HashMap<String, ModelField[]>() { { put("Applicant", new ModelField[]{ <START> new ModelField("this", <END> "Applicant", ModelField.FIELD_CLASS_TYPE.REGULAR_CLASS, ModelField.FIELD_ORIGIN.SELF, FieldAccessorsAndMutators.ACCESSOR, "Applicant"), new ModelField("age", Integer.class.getName(), ModelField.FIELD_CLASS_TYPE.REGULAR_CLASS, ModelField.FIELD_ORIGIN.SELF, FieldAccessorsAndMutators.ACCESSOR, DataType.TYPE_NUMERIC_INTEGER)}); } } ); return oracle; }</code><technical_language>Please assume usage of org.drools.workbench.screens.guided.rule.client.util.ModelFieldUtil.modelField method</technical_language>

Target:
protected AsyncPackageDataModelOracle getOracle() { final AsyncPackageDataModelOracle oracle = super.getOracle(); oracle.addModelFields(Collections.singletonMap("Applicant", new ModelField[]{ modelField("this", "Applicant"), modelField("age", DataType.TYPE_NUMERIC_INTEGER)})); return oracle; }
Source:
<code>private boolean isPricePanel(Element element) { <START> if (!element.hasClassName(res.style().productSection())) { <END> return true; } return false; }</code><technical_language>Inline</technical_language>

Target:
private boolean isPricePanel(Element element) { return !element.hasClassName(res.style().productSection()); }