auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void doFilter(ServletRequest sr, ServletResponse sr1, FilterChain fc) throws IOException, ServletException { HttpServletRequest httpReq = (HttpServletRequest) sr; HttpServletResponse httpRes = (HttpServletResponse) sr1; PageConfig config = PageConfig.get(httpReq); long processTime = System.currentTimeMillis(); Project p = config.getProject(); if (p != null && !config.isAllowed(p)) { if (httpReq.getRemoteUser() != null) { <START> LOGGER.log(Level.INFO, "Access denied for user {0} for URI: {1}", <END> new Object[]{httpReq.getRemoteUser(), httpReq.getRequestURI()}); } else { LOGGER.log(Level.INFO, "Access denied for URI: {0}", httpReq.getRequestURI()); } config.getEnv().getStatistics().addRequest(httpReq); config.getEnv().getStatistics().addRequest(httpReq, "requests_forbidden"); config.getEnv().getStatistics().addRequestTime(httpReq, "requests_forbidden", System.currentTimeMillis() - processTime); httpRes.sendError(HttpServletResponse.SC_FORBIDDEN, "Access forbidden"); return; } fc.doFilter(sr, sr1); }</code><technical_language>possibly enclosing user identity in quotes if some long/strange</technical_language>

Target:
public void doFilter(ServletRequest sr, ServletResponse sr1, FilterChain fc) throws IOException, ServletException { HttpServletRequest httpReq = (HttpServletRequest) sr; HttpServletResponse httpRes = (HttpServletResponse) sr1; PageConfig config = PageConfig.get(httpReq); long processTime = System.currentTimeMillis(); Project p = config.getProject(); if (p != null && !config.isAllowed(p)) { if (httpReq.getRemoteUser() != null) { LOGGER.log(Level.INFO, "Access denied for user ''{0}'' for URI: {1}", new Object[]{httpReq.getRemoteUser(), httpReq.getRequestURI()}); } else { LOGGER.log(Level.INFO, "Access denied for URI: {0}", httpReq.getRequestURI()); } config.getEnv().getStatistics().addRequest(httpReq); config.getEnv().getStatistics().addRequest(httpReq, "requests_forbidden"); config.getEnv().getStatistics().addRequestTime(httpReq, "requests_forbidden", System.currentTimeMillis() - processTime); if (!config.getEnv().getConfiguration().getForbiddenIncludeFileContent().isEmpty()) { sr.getRequestDispatcher("/eforbidden").forward(sr, sr1); return; } httpRes.sendError(HttpServletResponse.SC_FORBIDDEN, "Access forbidden"); return; } fc.doFilter(sr, sr1); }
Source:
<code>public FilePersistenceResult create(FileName fileName, FileSize fileSize) { if (fileSize.isTotalSizeUnknown()) { return FilePersistenceResult.newInstance(Status.ERROR_UNKNOWN_TOTAL_FILE_SIZE); } long usableSpace = context.getFilesDir().getUsableSpace(); if (usableSpace < fileSize.totalSize()) { return FilePersistenceResult.newInstance(Status.ERROR_INSUFFICIENT_SPACE); } File internalFileDir = context.getFilesDir(); <START> String absolutePath = internalFileDir.getAbsolutePath() + File.separatorChar + fileName.name(); <END> FilePath filePath = FilePathCreator.create(absolutePath); return create(filePath); }</code><technical_language>new File(internalFileDir, fileName.name()).getAbsolutePath()? I create paths concatenating strings</technical_language>

Target:
public FilePersistenceResult create(FileName fileName, FileSize fileSize) { if (fileSize.isTotalSizeUnknown()) { return FilePersistenceResult.newInstance(Status.ERROR_UNKNOWN_TOTAL_FILE_SIZE); } long usableSpace = context.getFilesDir().getUsableSpace(); if (usableSpace < fileSize.totalSize()) { return FilePersistenceResult.newInstance(Status.ERROR_INSUFFICIENT_SPACE); } File internalFileDir = context.getFilesDir(); String absolutePath = new File(internalFileDir, fileName.name()).getAbsolutePath(); FilePath filePath = FilePathCreator.create(absolutePath); return create(filePath); }
Source:
<code>private Validator<String> newSourceValidator() { return new Validator<String>() { @Override public List<EditorError> validate(Editor<String> editor, String value) { List<EditorError> result = new ArrayList<>(); if (!NatTabUi.this.source.getText().trim().isEmpty() && !NatTabUi.this.source.getText().trim().matches(FieldType.NETWORK.getRegex())) { result.add(new BasicEditorError(NatTabUi.this.source, value, MSGS.firewallNatFormSourceNetwork())); <START> } <END> return result; } @Override public int getPriority() { return 0; } }; }</code><technical_language>MSGS.firewallNatFormSourceNetworkToolTip()</technical_language>

Target:
private Validator<String> newSourceValidator() { return new Validator<String>() { @Override public List<EditorError> validate(Editor<String> editor, String value) { List<EditorError> result = new ArrayList<>(); if (!NatTabUi.this.source.getText().trim().isEmpty() && !NatTabUi.this.source.getText().trim().matches(FieldType.NETWORK.getRegex())) { result.add(new BasicEditorError(NatTabUi.this.source, value, MSGS.firewallNatFormSourceNetworkErrorMessage())); } return result; } @Override public int getPriority() { return 0; } }; }
Source:
<code>public static ArrayByteSource from(ByteSource other) { if (other instanceof BeanByteSource) { <START> return ((BeanByteSource) other).load(); <END> } String fileName = null; String str = other.toString(); if (str.startsWith("Files.asByteSource(")) { int pos = str.indexOf(')', 19); fileName = Paths.get(str.substring(19, pos)).getFileName().toString(); } else if (str.startsWith("Resources.asByteSource(")) { int pos = str.indexOf(')', 23); String path = str.substring(23, pos); int lastSlash = path.lastIndexOf('/'); fileName = path.substring(lastSlash + 1); } return new ArrayByteSource(Unchecked.wrap(() -> other.read()), fileName); }</code><technical_language>This worries - default implementation calls this method, if forgets override (or yet) get infinite recursion a stack overflow</technical_language>

Target:
public static ArrayByteSource from(ByteSource other) { if (other instanceof ArrayByteSource) { return (ArrayByteSource) other; } String fileName = null; if (other instanceof BeanByteSource) { fileName = ((BeanByteSource) other).getFileName().orElse(null); } else { String str = other.toString(); if (str.startsWith("Files.asByteSource(")) { int pos = str.indexOf(')', 19); fileName = Paths.get(str.substring(19, pos)).getFileName().toString(); } else if (str.startsWith("Resources.asByteSource(")) { int pos = str.indexOf(')', 23); String path = str.substring(23, pos); int lastSlash = path.lastIndexOf('/'); fileName = path.substring(lastSlash + 1); } } return new ArrayByteSource(Unchecked.wrap(() -> other.read()), fileName); }
Source:
<code>public void onInterstitialActivityDestroyed() { <START> if (mInterstitalAdCallback != null) { <END> mInterstitalAdCallback.onAdClosed(); } }</code><technical_language>Hey Xabi, atomic boolean set ad closed? This prevents a situation onAdClosed() is called multiple times forwarded publisher. Similar rewarded: <LINK_0> Please do this for OB non-OB interstitial adapters</technical_language>

Target:
public void onInterstitialActivityDestroyed() { if (!didRewardedAdClose.getAndSet(true) && mInterstitalAdCallback != null) { mInterstitalAdCallback.onAdClosed(); } }
Source:
<code>protected Object handleRequestMessage(Message<?> requestMessage) { Assert.isTrue(this.initialized, "This class is not yet initialized. Invoke its afterPropertiesSet() method"); Object result = this.mongoDbExecutor.execute(requestMessage); if (result == null) { return null; } <START> return this.getMessageBuilderFactory().withPayload(result).copyHeaders(requestMessage.getHeaders()).build(); <END> }</code><technical_language>This logic is fully implemented in AbstractReplyProducingMessageHandler super-classes. return result of query</technical_language>

Target:
protected Object handleRequestMessage(Message<?> requestMessage) { String collectionName = this.collectionNameExpression.getValue(this.evaluationContext, requestMessage, String.class); Query query = buildQuery(requestMessage); Object result; if (this.expectSingleResult) { result = this.mongoTemplate.findOne(query, this.entityClass, collectionName); } else { result = this.mongoTemplate.find(query, this.entityClass, collectionName); } return result; }
Source:
<code>private void getChildFiles(final File base, final List<File> childFiles) { for (File child : base.listFiles()) { <START> childFiles.add(child); <END> if (child.isFile()) { childFiles.add(child); } else if (isEmpty(child)) { childFiles.add(child); } else { getChildFiles(child, childFiles); } } }</code><technical_language>This odd, L181 L183 do same</technical_language>

Target:
private void getChildFiles(final File base, final List<File> childFiles) { for (File child : base.listFiles()) { childFiles.add(child); if (child.isFile() || isEmpty(child)) { childFiles.add(child); } else { getChildFiles(child, childFiles); } } }
Source:
<code>private void importAnalysis() { FileDialog dialog = new FileDialog(Display.getCurrent().getActiveShell(), SWT.OPEN); dialog.setText(Messages.ManageXMLAnalysisDialog_SelectFileImport); dialog.setFilterNames(new String[] { Messages.ManageXMLAnalysisDialog_ImportXmlFile + " (*.xml)" }); dialog.setFilterExtensions(new String[] { XML_FILTER_EXTENSION }); String path = dialog.open(); if (path != null) { File file = new File(path); IStatus status = XmlUtils.xmlValidate(file); if (status.isOK()) { status = XmlUtils.addXmlFile(file); if (status.isOK()) { fillAnalysesList(); XmlAnalysisModuleSource.notifyModuleChange(); refreshProject(); } else { Activator.logError(Messages.ManageXMLAnalysisDialog_ImportFileFailed); } } else { <START> Activator.logError(Messages.ManageXMLAnalysisDialog_ImportFileFailed); <END> } } }</code><technical_language>is feedback user importing invalid files. for import, a message box XML parser error</technical_language>

Target:
private void importAnalysis() { FileDialog dialog = new FileDialog(Display.getCurrent().getActiveShell(), SWT.OPEN); dialog.setText(Messages.ManageXMLAnalysisDialog_SelectFileImport); dialog.setFilterNames(new String[] { Messages.ManageXMLAnalysisDialog_ImportXmlFile + " (*.xml)" }); dialog.setFilterExtensions(new String[] { XML_FILTER_EXTENSION }); String path = dialog.open(); if (path != null) { File file = new File(path); IStatus status = XmlUtils.xmlValidate(file); if (status.isOK()) { status = XmlUtils.addXmlFile(file); if (status.isOK()) { fillAnalysesList(); XmlAnalysisModuleSource.notifyModuleChange(); refreshProject(); } else { Activator.logError(Messages.ManageXMLAnalysisDialog_ImportFileFailed); TraceUtils.displayErrorMsg(Messages.ManageXMLAnalysisDialog_ImportFileFailed, status.getMessage()); } } else { Activator.logError(Messages.ManageXMLAnalysisDialog_ImportFileFailed); TraceUtils.displayErrorMsg(Messages.ManageXMLAnalysisDialog_ImportFileFailed, status.getMessage()); } } }
Source:
<code>private static Collection<CommandAssociatedEntity> buildCommandAssociatedEntities(Guid cmdId, Collection<SubjectEntity> subjectEntities) { <START> if (subjectEntities.isEmpty()) { <END> return Collections.emptyList(); } return subjectEntities.stream().map(subjectEntity -> new CommandAssociatedEntity(cmdId, subjectEntity.getEntityType(), subjectEntity.getEntityId())) .collect(Collectors.toSet()); }</code><technical_language>while returning a collection times, returning a set list? I previous code returns list times</technical_language>

Target:
private static Collection<CommandAssociatedEntity> buildCommandAssociatedEntities(Guid cmdId, Collection<SubjectEntity> subjectEntities) { if (subjectEntities.isEmpty()) { return Collections.emptySet(); } return subjectEntities.stream().map(subjectEntity -> new CommandAssociatedEntity(cmdId, subjectEntity.getEntityType(), subjectEntity.getEntityId())) .collect(Collectors.toSet()); }
Source:
<code>public String[] getServerIDs(int CategoryID) { ArrayList<String> serverIDs = new ArrayList<String>(); String[] columns = new String[] { "serverID" }; SQLiteDatabase db = mContext.openOrCreateDatabase("base.sqlite3", Context.MODE_PRIVATE, null); <START> Cursor cursor = db <END> .query("words", columns, null, null, null, null, null); while (cursor.moveToNext()) { serverIDs.add(cursor.getString(0)); } return serverIDs.toArray(new String[serverIDs.size()]); }</code><technical_language>IIRC, I rawQuery result yours. Please check rawQuery API simplify this function call..</technical_language>

Target:
public String[] getServerIDs(int CategoryID) { ArrayList<String> serverIDs = new ArrayList<String>(); SQLiteDatabase db = mContext.openOrCreateDatabase("base.sqlite3", Context.MODE_PRIVATE, null); Cursor cursor = db.rawQuery("select serverID from words", null); while (cursor.moveToNext()) { serverIDs.add(cursor.getString(0)); } return serverIDs.toArray(new String[serverIDs.size()]); }
Source:
<code>public void testReplaceLabel() throws UnsupportedOperationException, Exception { PID pid = makePid(); String oldLabel = "old_work_label"; Model workModel = ModelFactory.createDefaultModel(); workModel.add(workModel.createResource(pid.getRepositoryPath()), DcElements.title, oldLabel); <START> WorkObject work = repositoryObjectFactory.createWorkObject(pid, null); <END> String newLabel = "new_work_label"; MvcResult result = mvc.perform(put("/edit/label/" + pid.getUUID()) .param("label", newLabel)) .andExpect(status().is2xxSuccessful()) .andReturn(); Map<String, Object> respMap = getMapFromResponse(result); assertEquals(pid.getUUID(), respMap.get("pid")); assertEquals("editLabel", respMap.get("action")); assertEquals("new_work_label", work.getModel().getRequiredProperty(work.getResource(), DcElements.title).getLiteral().toString()); }</code><technical_language>I meant pass model this method instead of null start a label</technical_language>

Target:
public void testReplaceLabel() throws UnsupportedOperationException, Exception { PID pid = makePid(); String oldLabel = "old_work_label"; Model workModel = ModelFactory.createDefaultModel(); workModel.add(workModel.createResource(pid.getRepositoryPath()), DcElements.title, oldLabel); WorkObject work = repositoryObjectFactory.createWorkObject(pid, workModel); String newLabel = "new_work_label"; MvcResult result = mvc.perform(put("/edit/label/" + pid.getUUID()) .param("label", newLabel)) .andExpect(status().is2xxSuccessful()) .andReturn(); Map<String, Object> respMap = getMapFromResponse(result); assertEquals(pid.getUUID(), respMap.get("pid")); assertEquals("editLabel", respMap.get("action")); assertEquals("new_work_label", work.getModel().getRequiredProperty(work.getResource(), DcElements.title).getLiteral().toString()); }
Source:
<code>private Response getSearchResponse(Account account, Map<String, String> queryParams) { queryParams.put("transactionType", "charge"); String url = connectorUriGenerator.chargesURIWithParams(account, queryParams); Response connectorResponse = client .target(url) .request() .header(HttpHeaders.ACCEPT, APPLICATION_JSON) .get(); <START> LOGGER.info("response from connector for transaction search: {}", connectorResponse); <END> if (connectorResponse.getStatus() == SC_OK) { return processResponse(connectorResponse); } throw new SearchPaymentsException(connectorResponse); }</code><technical_language>logging this is useful</technical_language>

Target:
private Response getSearchResponse(Account account, Map<String, String> queryParams) { queryParams.put("transactionType", "charge"); String url = connectorUriGenerator.chargesURIWithParams(account, queryParams); Response connectorResponse = client .target(url) .request() .header(HttpHeaders.ACCEPT, APPLICATION_JSON) .get(); if (connectorResponse.getStatus() == SC_OK) { return processResponse(connectorResponse); } throw new SearchPaymentsException(connectorResponse); }
Source:
<code>public ResponseEntity rebuild(@ApiParam(value = "The storageId", required = true) @PathVariable String storageId) throws IOException { if (getStorage(storageId) == null) { return ResponseEntity.status(HttpStatus.NOT_FOUND) .body("The specified storageId does not exist!"); } try { artifactIndexesService.rebuildIndexes(storageId); <START> return ResponseEntity.ok("The Indexes was successfully rebuilt!"); <END> } catch (ArtifactStorageException e) { logger.error(e.getMessage(), e); return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) .body(e.getMessage()); } }</code><technical_language>@kate-novik , please correct response string to: return ResponseEntity.ok("The indexes successfully re-built!"); other places below...? Thanks! :)</technical_language>

Target:
public ResponseEntity rebuild(@ApiParam(value = "The storageId", required = true) @PathVariable String storageId) throws IOException { if (getStorage(storageId) == null) { return ResponseEntity.status(HttpStatus.NOT_FOUND) .body("The specified storageId does not exist!"); } try { artifactIndexesService.rebuildIndexes(storageId); return ResponseEntity.ok("The indexes were successfully re-built!"); } catch (ArtifactStorageException e) { logger.error(e.getMessage(), e); return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) .body(e.getMessage()); } }
Source:
<code>public void testIndexesOnKeyAttributes() { String name = randomMapName(); Config config = smallInstanceConfig(); config.getMapConfig(name) .addMapIndexConfig(new MapIndexConfig("__key.a", false)) .addMapIndexConfig(new MapIndexConfig("__key#b", true)); HazelcastInstance instance = createHazelcastInstance(config); IMap<CompositeKey, Integer> map = instance.getMap(name); map.addIndex("__key.c", true); map.addIndex("__key#d", false); for (int i = 0; i < 10; i++) { map.put(new CompositeKey(i), i); } map.values(Predicates.equal("__key.a", 5)); map.values(Predicates.equal("__key#b", 5)); map.values(Predicates.equal("__key#c", 5)); map.values(Predicates.equal("__key.d", 5)); Map<String, LocalIndexStats> stats = map.getLocalMapStats().getIndexStats(); <START> assertEquals(1, stats.get("__key.a").getQueryCount()); <END> assertEquals(1, stats.get("__key.b").getQueryCount()); assertEquals(1, stats.get("__key.c").getQueryCount()); assertEquals(1, stats.get("__key.d").getQueryCount()); }</code><technical_language>I check queries stats values zero</technical_language>

Target:
public void testIndexesOnKeyAttributes() { String name = randomMapName(); Config config = smallInstanceConfig(); config.getMapConfig(name) .addMapIndexConfig(new MapIndexConfig("__key.a", false)) .addMapIndexConfig(new MapIndexConfig("__key#b", true)); HazelcastInstance instance = createHazelcastInstance(config); IMap<CompositeKey, Integer> map = instance.getMap(name); map.addIndex("__key.c", true); map.addIndex("__key#d", false); for (int i = 0; i < 10; i++) { map.put(new CompositeKey(i), i); } Map<String, LocalIndexStats> stats = map.getLocalMapStats().getIndexStats(); assertEquals(0, stats.get("__key.a").getQueryCount()); assertEquals(0, stats.get("__key.b").getQueryCount()); assertEquals(0, stats.get("__key.c").getQueryCount()); assertEquals(0, stats.get("__key.d").getQueryCount()); map.values(Predicates.equal("__key.a", 5)); map.values(Predicates.equal("__key#b", 5)); map.values(Predicates.equal("__key#c", 5)); map.values(Predicates.equal("__key.d", 5)); stats = map.getLocalMapStats().getIndexStats(); assertEquals(1, stats.get("__key.a").getQueryCount()); assertEquals(1, stats.get("__key.b").getQueryCount()); assertEquals(1, stats.get("__key.c").getQueryCount()); assertEquals(1, stats.get("__key.d").getQueryCount()); }
Source:
<code>private void processWebhookPayload(JSONObject payload) { if (payload.has("repository")) { JSONObject repo = payload.getJSONObject("repository"); <START> LOGGER.info("Received commit hook notification for "+repo); <END> String user = payload.getJSONObject("actor").getString("username"); String url = repo.getJSONObject("links").getJSONObject("html").getString("href"); String scm = repo.has("scm") ? repo.getString("scm") : "git"; probe.triggerMatchingJobs(user, url, scm); } else if (payload.has("scm")) { LOGGER.info("Received commit hook notification for hg " + payload); String user = payload.getJSONObject("owner").getString("username"); String url = payload.getJSONObject("links").getJSONObject("html").getString("href"); String scm = payload.has("scm") ? payload.getString("scm") : "hg"; probe.triggerMatchingJobs(user, url, scm); } }</code><technical_language>Please, change: LOGGER.info("Received commit hook notification for "+repo); LOGGER.info("Received commit hook notification for "+ repo); right is: LOGGER.log(Level.INFO, "Received commit hook notification for {0}", repo);</technical_language>

Target:
private void processWebhookPayload(JSONObject payload) { if (payload.has("repository")) { JSONObject repo = payload.getJSONObject("repository"); LOGGER.log(Level.INFO, "Received commit hook notification for {0}", repo); String user = payload.getJSONObject("actor").getString("username"); String url = repo.getJSONObject("links").getJSONObject("html").getString("href"); String scm = repo.has("scm") ? repo.getString("scm") : "git"; probe.triggerMatchingJobs(user, url, scm); } else if (payload.has("scm")) { LOGGER.log(Level.INFO, "Received commit hook notification for hg: {0}", payload); String user = payload.getJSONObject("owner").getString("username"); String url = payload.getJSONObject("links").getJSONObject("html").getString("href"); String scm = payload.has("scm") ? payload.getString("scm") : "hg"; probe.triggerMatchingJobs(user, url, scm); } }
Source:
<code>public void test_negative() { check.maximum = 3; PythonCheckVerifier.verify("src/test/resources/checks/tooManyLinesInFile-2.py", check); <START> } <END></code><technical_language>@pynicolas Detail file naming: name file tooManyLinesInFile-**3**.py name tooManyLinesInFile-**2**.py in next @Test method</technical_language>

Target:
public void test_negative() { check.maximum = 3; PythonCheckVerifier.verify("src/test/resources/checks/tooManyLinesInFile-3.py", check); }
Source:
<code>public void cleanUpDeletedVariables(Project project) { synchronized (LOCK) { if (!deviceVariablesFile.exists()) { return; } try { HashMap deviceVariableMap = readMapFromJson(); if (deviceVariableMap == null) { return; } Set<UUID> keysToRemove = new HashSet<UUID>(deviceVariableMap.keySet()); List<UserVariable> globalVars = new ArrayList<>(project.getUserVariables()); for (UserVariable variable: globalVars) { keysToRemove.remove(variable.getDeviceValueKey()); } List<UUID> localVariableKeys = new ArrayList<>(); for (Scene scene: project.getSceneList()) { for (Sprite sprite: scene.getSpriteList()) { for (UserVariable variable : sprite.getUserVariables()) { localVariableKeys.add(variable.getDeviceValueKey()); } } } for (UUID key: localVariableKeys) { keysToRemove.remove(key); <START> } <END> for (UUID key: keysToRemove) { deviceVariableMap.remove(key); } writeMapToJson(deviceVariableMap); } catch (Exception e) { Log.e(TAG, e.getMessage()); } } }</code><technical_language>move "try" here</technical_language>

Target:
public void cleanUpDeletedVariables(Project project) { synchronized (LOCK) { if (!deviceVariablesFile.exists()) { return; } HashMap<UUID, Object> deviceVariableMap = readMapFromJson(); if (deviceVariableMap == null) { return; } List<UUID> globalVariableKeys = getKeyList(project.getUserVariables()); List<UUID> localVariableKeys = new ArrayList<>(); for (Scene scene: project.getSceneList()) { for (Sprite sprite: scene.getSpriteList()) { localVariableKeys.addAll(getKeyList(sprite.getUserVariables())); } } Set<UUID> keysToRemove = new HashSet<>(deviceVariableMap.keySet()); keysToRemove.removeAll(globalVariableKeys); keysToRemove.removeAll(localVariableKeys); for (UUID key: keysToRemove) { deviceVariableMap.remove(key); } try { writeMapToJson(deviceVariableMap); } catch (Exception e) { Log.e(TAG, e.getMessage()); } } }
Source:
<code>public byte[] readValue() throws IOException { try { if (length < 0) { throw new EOFException("DicomInputStream length is less than zero"); } if (length > allocateLimit) { LOG.warn("Expected value length exceeds allocate limit {}", length, allocateLimit); } byte[] value = new byte[length]; readFully(value, 0, length); return value; } catch (IOException e) { throw new IOException(String.format("IOException during read of %s #%d @ %d", <START> TagUtils.toString(tag), length, tagPos), e); <END> } }</code><technical_language>I prefer original exception thrown instead of wrapping exception another IOException</technical_language>

Target:
public byte[] readValue() throws IOException { try { if (length < 0) { throw new EOFException("DicomInputStream length is less than zero"); } if (allocateLimit > 0 && length > allocateLimit) { LOG.warn("Expected value length exceeds allocate limit {}", length, allocateLimit); } byte[] value = new byte[length]; readFully(value, 0, length); return value; } catch (IOException e) { if ((Objects.isNull(e.getMessage()) || e.getMessage().trim().equals("")) && Objects.nonNull(e.getCause())) { throw new IOException(String.format("IOException during read of %s #%d @ %d", TagUtils.toString(tag), length, tagPos), e.getCause()); } throw e; } }
Source:
<code>private void setBestValue(TransactionBuilder txBuilder, ArtifactReadable source, ArtifactReadable dest, IAttributeType attributeType) throws Exception { <START> String value = dest.getSoleAttributeValue(attributeType, ""); <END> String sourceValue = source.getSoleAttributeValue(attributeType, "Unspecified"); if (sourceValue.equals("Unspecified")) { if (value.isEmpty() && attributeType.equals(CoreAttributeTypes.DataRightsClassification)) { txBuilder.setSoleAttributeValue(dest, attributeType, "Unspecified"); } } else { if (value.isEmpty()) { txBuilder.setSoleAttributeValue(dest, attributeType, sourceValue); } else { if (!value.equals(sourceValue)) { System.out.println(dest.getName() + " conflict with " + attributeType); } } } }</code><technical_language>Convert Unspecified constant. a framework constant for this string somewhere</technical_language>

Target:
private void setBestValue(TransactionBuilder txBuilder, ArtifactReadable source, ArtifactReadable dest, IAttributeType attributeType) throws Exception { String value = dest.getSoleAttributeValue(attributeType, ""); String sourceValue = source.getSoleAttributeValue(attributeType, CoreAttributeTypes.UNSPECIFIED); if (sourceValue.equals(CoreAttributeTypes.UNSPECIFIED)) { if (value.isEmpty() && attributeType.equals(CoreAttributeTypes.DataRightsClassification)) { txBuilder.setSoleAttributeValue(dest, attributeType, CoreAttributeTypes.UNSPECIFIED); } } else { if (value.isEmpty()) { txBuilder.setSoleAttributeValue(dest, attributeType, sourceValue); } else { if (!value.equals(sourceValue)) { logger.warn("%s", dest.getName() + " conflict with " + attributeType); } } } }
Source:
<code>public Object get() { <START> return StringAggregatorUtils.chop(foundValue, maxStringBytes); <END> }</code><technical_language>nit: is worth pushing chop StringUtils renaming widening usage of StringAggregatorUtils</technical_language>

Target:
public Object get() { return StringUtils.chop(foundValue, maxStringBytes); }
Source:
<code>protected String getBeanClassName(Element element) { <START> return IntegrationNamespaceUtils.BASE_PACKAGE + ".gateway.GatewayProxyFactoryBean"; <END> }</code><technical_language>GatewayProxyFactoryBean class</technical_language>

Target:
protected String getBeanClassName(Element element) { return GatewayProxyFactoryBean.class.getName(); }
Source:
<code>private boolean checkConnection(SonyAudioClientSocket socket) { if (!socket.isConnected()) { logger.debug("checkConnection: try to connect to {}", socket.getURI().toString()); try { socket.open(); return socket.isConnected(); } catch (Throwable t) { logger.error("exception during connect to {}", socket.getURI().toString(), t); try { socket.close(); } catch (Exception e) { <START> } <END> return false; } } return true; }</code><technical_language>add a debug logging</technical_language>

Target:
private boolean checkConnection(SonyAudioClientSocket socket) { if (!socket.isConnected()) { logger.debug("checkConnection: try to connect to {}", socket.getURI().toString()); socket.open(webSocketClient); return socket.isConnected(); } return true; }
Source:
<code>protected static Set<Address> getOwners(Cache<?, ?> cache, Object key) { Collection<Address> owners = extractComponent(cache, ClusteringDependentLogic.class).getOwners(key); if (owners == null) { <START> owners = cache.getAdvancedCache().getRpcManager().getMembers(); <END> } return new HashSet<>(owners); }</code><technical_language>cache.getAdvancedCache().getDistributionManager().locate(key) instead</technical_language>

Target:
protected static Collection<Address> getOwners(Cache<?, ?> cache, Object key) { return new ArrayList<>(cache.getAdvancedCache().getDistributionManager().locate(key)); }
Source:
<code>public void loadMetadataDir() throws IOException, AlluxioException { String dirPath = "/testRoot/layer1/layer2/layer3/"; String filePathA = dirPath + "testFileA"; String filePathB = dirPath + "testFileB"; <START> FileSystemTestUtils .createByteFile(sFileSystem, filePathA, WritePType.CACHE_THROUGH, 10); FileSystemTestUtils .createByteFile(sFileSystem, filePathB, WritePType.THROUGH, 30); <END> AlluxioURI uriDir = new AlluxioURI(dirPath); AlluxioURI uriA = new AlluxioURI(filePathA); AlluxioURI uriB = new AlluxioURI(filePathB); URIStatus statusBeforeA = sFileSystem.getStatus(uriA); URIStatus statusBeforeB = sFileSystem.getStatus(uriB); DeletePOptions deletePOptions = DeletePOptions.newBuilder().setAlluxioOnly(true).setRecursive(true).build(); sFileSystem.delete(uriDir, deletePOptions); sFsShell.run("loadMetadata", dirPath); GetStatusPOptions getStatusPOptions = GetStatusPOptions.newBuilder().setLoadMetadataType(LoadMetadataPType.NEVER).build(); URIStatus statusAfterA = sFileSystem.getStatus(uriA, getStatusPOptions); assertEquals(statusBeforeA.getFileInfo().getName(), statusAfterA.getFileInfo().getName()); assertEquals(statusBeforeA.getFileInfo().getLength(), statusAfterA.getFileInfo().getLength()); URIStatus statusAfterB = sFileSystem.getStatus(uriB, getStatusPOptions); assertEquals(statusBeforeB.getFileInfo().getName(), statusAfterB.getFileInfo().getName()); assertEquals(statusBeforeB.getFileInfo().getLength(), statusAfterB.getFileInfo().getLength()); }</code><technical_language>creating files WriteType? If want validation write types, add files for of them</technical_language>

Target:
public void loadMetadataDir() throws IOException, AlluxioException { String dirPath = "/testRoot/layer1/layer2/layer3/"; String filePathA = PathUtils.concatPath(dirPath, "testFileA"); String filePathB = PathUtils.concatPath(dirPath, "testFileB"); FileSystemTestUtils .createByteFile(sFileSystem, filePathA, WritePType.CACHE_THROUGH, 10); FileSystemTestUtils .createByteFile(sFileSystem, filePathB, WritePType.CACHE_THROUGH, 30); AlluxioURI uriDir = new AlluxioURI(dirPath); AlluxioURI uriA = new AlluxioURI(filePathA); AlluxioURI uriB = new AlluxioURI(filePathB); URIStatus statusBeforeA = sFileSystem.getStatus(uriA); URIStatus statusBeforeB = sFileSystem.getStatus(uriB); DeletePOptions deletePOptions = DeletePOptions.newBuilder().setAlluxioOnly(true).setRecursive(true).build(); sFileSystem.delete(uriDir, deletePOptions); sFsShell.run("loadMetadata", dirPath); GetStatusPOptions getStatusPOptions = GetStatusPOptions.newBuilder().setLoadMetadataType(LoadMetadataPType.NEVER).build(); URIStatus statusAfterA = sFileSystem.getStatus(uriA, getStatusPOptions); assertEquals(statusBeforeA.getFileInfo().getName(), statusAfterA.getFileInfo().getName()); assertEquals(statusBeforeA.getFileInfo().getLength(), statusAfterA.getFileInfo().getLength()); URIStatus statusAfterB = sFileSystem.getStatus(uriB, getStatusPOptions); assertEquals(statusBeforeB.getFileInfo().getName(), statusAfterB.getFileInfo().getName()); assertEquals(statusBeforeB.getFileInfo().getLength(), statusAfterB.getFileInfo().getLength()); }
Source:
<code>public void readCsvFileThrowsExceptionIfTooManyColumns() throws Exception { <START> String csv = "Site,Longitude,Latitude,Precision,Country,Disease,Occurrence Date,Feed Name,Alert Title,Summary,URL\n" + <END> "My site,10,20,PRECISE,England,Dengue,2012,My feed,My title,My summary,My URL,Extra column\n"; CsvDiseaseOccurrence.readFromCsv(csv); }</code><technical_language>Feed Name -> Feed</technical_language>

Target:
public void readCsvFileThrowsExceptionIfTooManyColumns() throws Exception { String csv = "Site,Longitude,Latitude,Precision,Country,Disease,Occurrence Date,Feed,Alert Title,Summary,URL\n" + "My site,10,20,PRECISE,England,Dengue,2012,My feed,My title,My summary,My URL,Extra column\n"; CsvDiseaseOccurrence.readFromCsv(csv); }
Source:
<code>Boolean equals(int leftMapIndex, int rightMapIndex) throws Throwable; } public static Boolean genericEqual( MethodHandle keyEqualsFunction, MethodHandle keyHashcodeFunction, Type keyType, Block leftMapBlock, Block rightMapBlock, EqualityPredicate predicate) { if (leftMapBlock.getPositionCount() != rightMapBlock.getPositionCount()) { return false; } SingleMapBlock mapLeftBlock = (SingleMapBlock) leftMapBlock; SingleMapBlock mapRightBlock = (SingleMapBlock) rightMapBlock; for (int position = 0; position < leftMapBlock.getPositionCount(); position += 2) { Object key = readNativeValue(keyType, mapLeftBlock, position); <START> int leftPosition = mapLeftBlock.seekKey(key); <END> int rightPosition = mapRightBlock.seekKey(key); if (rightPosition == -1) { return false; } try { Boolean result = predicate.equals(leftPosition, rightPosition); if (result == null) { return null; } else if (!result) { return false; } } catch (Throwable t) { throw internalError(t); } } return true; }</code><technical_language>int leftPosition = position + 1 Map block in Presto is laid out k1, v1, k2, v2, k3, v3, .... This is part of contract of map block. safely assume that. Therefore, is unnecessary call seekKey blocks</technical_language>

Target:
Boolean equals(int leftMapIndex, int rightMapIndex) throws Throwable; } public static Boolean genericEqual( Type keyType, Block leftBlock, Block rightBlock, EqualityPredicate predicate) { if (leftBlock.getPositionCount() != rightBlock.getPositionCount()) { return false; } SingleMapBlock leftSingleMapLeftBlock = (SingleMapBlock) leftBlock; SingleMapBlock rightSingleMapBlock = (SingleMapBlock) rightBlock; for (int position = 0; position < leftSingleMapLeftBlock.getPositionCount(); position += 2) { Object key = readNativeValue(keyType, leftBlock, position); int leftPosition = position + 1; int rightPosition = rightSingleMapBlock.seekKey(key); if (rightPosition == -1) { return false; } try { Boolean result = predicate.equals(leftPosition, rightPosition); if (result == null) { return null; } else if (!result) { return false; } } catch (Throwable t) { throw internalError(t); } } return true; }
Source:
<code>public Iterable<Object> loadObjects(EntityProjection entityProjection, RequestScope scope) { try { log.debug("LoadObjects Sleep for delay test"); if (entityProjection.getType().toString().trim().equals("class example.Book")) { <START> Thread.sleep(5000); <END> } } catch (InterruptedException e) { log.debug("Test delay interrupted"); } return tx.loadObjects(entityProjection, scope); }</code><technical_language>this a constructor parameter. Also, instead of for specific types - some other. mechanism trigger sleep (like a toggle function turn off)</technical_language>

Target:
public Iterable<Object> loadObjects(EntityProjection entityProjection, RequestScope scope) { try { log.debug("LoadObjects Sleep for delay test"); if (sleep) { Thread.sleep(testDelay); } } catch (InterruptedException e) { log.debug("Test delay interrupted"); } return super.loadObjects(entityProjection, scope); }
Source:
<code>public String getPropertyString() { <START> return getMythicMob().getMob().getUniqueId().toString(); <END> }</code><technical_language>This is extremely wrong</technical_language>

Target:
public String getPropertyString() { return null; }
Source:
<code>private void handleNormalSignInFlow(final FirebaseAuth auth, final HelperActivityBase activity, final OAuthProvider provider) { auth.startActivityForSignInWithProvider(activity, provider) <START> .addOnSuccessListener( <END> new OnSuccessListener<AuthResult>() { @Override public void onSuccess(@NonNull AuthResult authResult) { FirebaseUser user = authResult.getUser(); IdpResponse idpResponse = new IdpResponse.Builder( new User.Builder(provider.getProviderId(), user.getEmail()) .setName(user.getDisplayName()) .setPhotoUri(user.getPhotoUrl()) .build()) .build(); setResult(Resource.<IdpResponse>forSuccess(idpResponse)); } }) .addOnFailureListener( new OnFailureListener() { @Override public void onFailure(@NonNull Exception e) { if (e instanceof FirebaseAuthUserCollisionException) { FirebaseAuthUserCollisionException collisionException = (FirebaseAuthUserCollisionException) e; setResult(Resource.<IdpResponse>forFailure( new FirebaseUiUserCollisionException( ErrorCodes.ERROR_GENERIC_IDP_RECOVERABLE_ERROR, "Recoverable error.", provider.getProviderId(), collisionException.getEmail(), collisionException.getUpdatedCredential()))); } else { setResult(Resource.<IdpResponse>forFailure(e)); } } }); }</code><technical_language>this survive rotation, etc? Do check for pending results well</technical_language>

Target:
protected void handleNormalSignInFlow(final FirebaseAuth auth, final HelperActivityBase activity, final OAuthProvider provider) { auth.startActivityForSignInWithProvider(activity, provider) .addOnSuccessListener( new OnSuccessListener<AuthResult>() { @Override public void onSuccess(@NonNull AuthResult authResult) { handleSuccess(provider.getProviderId(), authResult.getUser(), (OAuthCredential) authResult.getCredential()); } }) .addOnFailureListener( new OnFailureListener() { @Override public void onFailure(@NonNull Exception e) { if (e instanceof FirebaseAuthUserCollisionException) { FirebaseAuthUserCollisionException collisionException = (FirebaseAuthUserCollisionException) e; setResult(Resource.<IdpResponse>forFailure( new FirebaseUiUserCollisionException( ErrorCodes.ERROR_GENERIC_IDP_RECOVERABLE_ERROR, "Recoverable error.", provider.getProviderId(), collisionException.getEmail(), collisionException.getUpdatedCredential()))); } else { setResult(Resource.<IdpResponse>forFailure(e)); } } }); }
Source:
<code>public static File findSecrets(File xmlFile) throws ParserConfigurationException, SAXException, IOException, XMLStreamException, TransformerException { XMLReader xr = new XMLFilterImpl(XMLReaderFactory.createXMLReader()) { private String tagName = ""; @Override public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException { tagName = qName; super.startElement(uri, localName, qName, atts); } public void endElement(String uri, String localName, String qName) throws SAXException { tagName = ""; super.endElement(uri, localName, qName); } @Override public void characters(char[] ch, int start, int length) throws SAXException { if (!tagName.equals("")) { String value = new String(ch, start, length).trim(); <START> if (!value.equals("") && Secret.decrypt(value) != null) { <END> ch = SECRET_MARKER.toCharArray(); start = 0; length = ch.length; } } super.characters(ch, start, length); } }; Source src = new SAXSource(xr, new InputSource(new StringReader(FileUtils.readFileToString(xmlFile)))); File patchedFile = File.createTempFile("patched", ".xml"); Result res = new StreamResult(new FileOutputStream(patchedFile)); Transformer transformer = TransformerFactory.newInstance().newTransformer(); transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); transformer.transform(src, res); return patchedFile; }</code><technical_language>"".equals(value) is IMO generally safer encounter NPE, putting static strings left hand side</technical_language>

Target:
public static File findSecrets(File xmlFile) throws ParserConfigurationException, SAXException, IOException, XMLStreamException, TransformerException { XMLReader xr = new XMLFilterImpl(XMLReaderFactory.createXMLReader()) { private String tagName = ""; @Override public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException { tagName = qName; super.startElement(uri, localName, qName, atts); } public void endElement(String uri, String localName, String qName) throws SAXException { tagName = ""; super.endElement(uri, localName, qName); } @Override public void characters(char[] ch, int start, int length) throws SAXException { if (!"".equals(tagName)) { String value = new String(ch, start, length).trim(); if (!"".equals(value)) { if ((Secret.decrypt(value)) != null || SecretBytes.isSecretBytes(value)) { ch = SECRET_MARKER.toCharArray(); start = 0; length = ch.length; } } } super.characters(ch, start, length); } }; Source src = new SAXSource(xr, new InputSource(new StringReader(FileUtils.readFileToString(xmlFile)))); File patchedFile = File.createTempFile("patched", ".xml", SupportPlugin.getRootDirectory()); Result res = new StreamResult(new FileOutputStream(patchedFile)); Transformer transformer = TransformerFactory.newInstance().newTransformer(); transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); transformer.transform(src, res); return patchedFile; }
Source:
<code>private Collection<EClass> collectAllFromRegistry() { final Registry registry = EPackage.Registry.INSTANCE; final Set<EClass> result = new LinkedHashSet<EClass>(); for (final String uri : registry.keySet()) { final EPackage ePackage = registry.getEPackage(uri); for (final EClassifier eClassifier : ePackage.getEClassifiers()) { <START> if (eClassifier instanceof EClass && !((EClass) eClassifier).isAbstract()) { <END> result.add((EClass) eClassifier); } } } return result; }</code><technical_language>In practice, deep knowledge of EMF interface EClasses, technically susceptible letting slip here</technical_language>

Target:
private Collection<EClass> collectAllFromRegistry() { final Registry registry = EPackage.Registry.INSTANCE; final Set<EClass> result = new LinkedHashSet<EClass>(); for (final String uri : registry.keySet()) { final EPackage ePackage = registry.getEPackage(uri); for (final EClassifier eClassifier : ePackage.getEClassifiers()) { if (eClassifier instanceof EClass && !((EClass) eClassifier).isAbstract() && !((EClass) eClassifier).isInterface()) { result.add((EClass) eClassifier); } } } return result; }
Source:
<code>private void store( AttachmentInfo createInfo, Consumer<String> idConsumer, Consumer<String> errorMessageConsumer) { CreateStorageRequest streamCreateRequest = new CreateStorageRequestImpl( Collections.singletonList( new IncomingContentItem( uuidGenerator, createInfo.getStream(), createInfo.getContentType(), createInfo.getFilename())), null); try { CreateResponse createResponse = catalogFramework.create(streamCreateRequest); createResponse.getCreatedMetacards().stream().map(Metacard::getId).forEach(idConsumer); } catch (IngestException e) { <START> String errorMessage = "Error while storing entry in catalog: "; <END> LOGGER.info(errorMessage, e); errorMessageConsumer.accept(errorMessage); } catch (SourceUnavailableException e) { String exceptionMessage = "Cannot create catalog entry because source is unavailable: "; LOGGER.info(exceptionMessage, e); throw new InternalServerErrorException(exceptionMessage); } }</code><technical_language>more sense for error messages end in periods related messages added them</technical_language>

Target:
private void store( AttachmentInfo createInfo, Consumer<String> idConsumer, Consumer<String> errorMessageConsumer) { CreateStorageRequest streamCreateRequest = new CreateStorageRequestImpl( Collections.singletonList( new IncomingContentItem( uuidGenerator, createInfo.getStream(), createInfo.getContentType(), createInfo.getFilename())), null); try { CreateResponse createResponse = catalogFramework.create(streamCreateRequest); createResponse.getCreatedMetacards().stream().map(Metacard::getId).forEach(idConsumer); } catch (IngestException e) { String errorMessage = "Error while storing entry in catalog."; LOGGER.info(errorMessage, e); INGEST_LOGGER.warn(errorMessage, e); errorMessageConsumer.accept(errorMessage); } catch (SourceUnavailableException e) { String exceptionMessage = "Cannot create catalog entry because source is unavailable."; LOGGER.info(exceptionMessage, e); INGEST_LOGGER.warn(exceptionMessage, e); throw new InternalServerErrorException(exceptionMessage); } }
Source:
<code>public ComputedStatistics build() { return new ComputedStatistics( <START> unmodifiableList(groupingColumns), <END> unmodifiableList(gropingValues), unmodifiableMap(tableStatistics), unmodifiableMap(columnStatistics)); }</code><technical_language>new ArrayList<>(groupingColumns)? this is redundant (ctor that) allows creating mutable ComputedStatistics objects</technical_language>

Target:
public ComputedStatistics build() { return new ComputedStatistics(groupingColumns, groupingValues, tableStatistics, columnStatistics); }
Source:
<code>private void updateCommitStatus(@Nonnull Run<?, ?> build, @Nonnull TaskListener listener) throws InterruptedException, IOException { final String sha1 = ObjectId.toString(BuildDataHelper.getCommitSHA1(build)); StatusResult status = statusFrom(build); String message = defaultIfEmpty(firstNonNull(statusMessage, DEFAULT_MESSAGE) .expandAll(build, listener), status.getMsg()); String contextName = displayNameFor(build.getParent()); for (GitHubRepositoryName name : GitHubRepositoryNameContributor.parseAssociatedNames(build.getParent())) { for (GHRepository repository : name.resolve()) { listener.getLogger().println( GitHubCommitNotifier_SettingCommitStatus(repository.getHtmlUrl() + "/commit/" + sha1) ); try { repository.createCommitStatus( sha1, status.getState(), build.getAbsoluteUrl(), message, contextName ); } catch (FileNotFoundException e) { <START> listener.getLogger().println("Commit doesn't exist in " + <END> repository.getFullName() + ". Status is not set"); } } } }</code><technical_language>+ newline pass checkstyle</technical_language>

Target:
private void updateCommitStatus(@Nonnull Run<?, ?> build, @Nonnull TaskListener listener) throws InterruptedException, IOException { final String sha1 = ObjectId.toString(BuildDataHelper.getCommitSHA1(build)); StatusResult status = statusFrom(build); String message = defaultIfEmpty(firstNonNull(statusMessage, DEFAULT_MESSAGE) .expandAll(build, listener), status.getMsg()); String contextName = displayNameFor(build.getParent()); for (GitHubRepositoryName name : GitHubRepositoryNameContributor.parseAssociatedNames(build.getParent())) { for (GHRepository repository : name.resolve()) { listener.getLogger().println( GitHubCommitNotifier_SettingCommitStatus(repository.getHtmlUrl() + "/commit/" + sha1) ); try { repository.createCommitStatus( sha1, status.getState(), build.getAbsoluteUrl(), message, contextName ); } catch (FileNotFoundException e) { LOGGER.debug("Failed to update commit status", e); listener.getLogger() .format("Commit doesn't exist in %s. Status is not set%n", repository.getFullName()); } } } }
Source:
<code>public void adsLeaderboardOnPageWithoutInfobox(String wikiName, String article, String adUnit) { String testedPage = urlBuilder.getUrlForPath(wikiName, article); MobileAdsBaseObject ads = new MobileAdsBaseObject(driver, testedPage); ads.verifyGptIframe(adUnit, MOBILE_TOP_LEADERBOARD, SRC); Point leaderboardLocation = driver.findElement(By.id(MOBILE_TOP_LEADERBOARD)).getLocation(); <START> Point pageHeader = driver.findElement(By.className("wiki-page-header")).getLocation(); <END> Assertion.assertTrue(leaderboardLocation.getY() > pageHeader.getY()); }</code><technical_language>Consider moving wiki-page-header static var</technical_language>

Target:
public void adsLeaderboardOnPageWithoutInfobox(String wikiName, String article, String adUnit) { String testedPage = urlBuilder.getUrlForPath(wikiName, article); MobileAdsBaseObject ads = new MobileAdsBaseObject(driver, testedPage); ads.verifyGptIframe(adUnit, MOBILE_TOP_LEADERBOARD, SRC); Assertion.assertTrue( ads.getElementTopPositionByCssSelector(AdsContent.getSlotSelector(AdsContent.MOBILETOP_LB)) >= ads.getElementBottomPositionByCssSelector(ARTICLE_HEADER) ); }
Source:
<code>private VdsNetworkInterface createVlan(String baseIfaceName) { <START> VdsNetworkInterface iface = new Vlan(); <END> int vlanId = RandomUtils.instance().nextInt(100); iface.setBaseInterface(baseIfaceName); iface.setVlanId(vlanId); iface.setName(baseIfaceName + "." + vlanId); return iface; }</code><technical_language>2 parameter Vlan ctor here, instead of setters</technical_language>

Target:
private VdsNetworkInterface createVlan(String baseIfaceName) { VdsNetworkInterface iface = new Vlan(RandomUtils.instance().nextInt(100), baseIfaceName); return iface; }