auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public static int hashCodeAscii(CharSequence bytes) { int hash = HASH_CODE_ASCII_SEED; <START> final int length = bytes.length(), remainingBytes = length & 7; <END> if (length >= 32) { for (int i = length - 8; i >= remainingBytes; i -= 8) { hash = hashCodeAsciiCompute(bytes, i, hash); } } else if (length >= 8) { hash = hashCodeAsciiCompute(bytes, length - 8, hash); if (length >= 16) { hash = hashCodeAsciiCompute(bytes, length - 16, hash); if (length >= 24) { hash = hashCodeAsciiCompute(bytes, length - 24, hash); } } } if (remainingBytes == 0) { return hash; } int offset = 0; if (remainingBytes != 2 & remainingBytes != 4 & remainingBytes != 6) { hash = hash * HASH_CODE_C1 + hashCodeAsciiSanitizeByte(bytes.charAt(0)); offset = 1; } if (remainingBytes != 1 & remainingBytes != 4 & remainingBytes != 5) { hash = hash * (offset == 0 ? HASH_CODE_C1 : HASH_CODE_C2) + hashCodeAsciiSanitize(hashCodeAsciiSanitizeShort(bytes, offset)); offset += 2; } if (remainingBytes >= 4) { return hash * ((offset == 0 | offset == 3) ? HASH_CODE_C1 : HASH_CODE_C2) + hashCodeAsciiSanitizeInt(bytes, offset); } return hash; }</code><technical_language>defer @normanmaurer this, comma locals good for readability</technical_language>

Target:
public static int hashCodeAscii(CharSequence bytes) { final int length = bytes.length(); final int remainingBytes = length & 7; int hash = HASH_CODE_ASCII_SEED; if (length >= 32) { for (int i = length - 8; i >= remainingBytes; i -= 8) { hash = hashCodeAsciiCompute(bytes, i, hash); } } else if (length >= 8) { hash = hashCodeAsciiCompute(bytes, length - 8, hash); if (length >= 16) { hash = hashCodeAsciiCompute(bytes, length - 16, hash); if (length >= 24) { hash = hashCodeAsciiCompute(bytes, length - 24, hash); } } } if (remainingBytes == 0) { return hash; } int offset = 0; if (remainingBytes != 2 & remainingBytes != 4 & remainingBytes != 6) { hash = hash * HASH_CODE_C1 + hashCodeAsciiSanitizeByte(bytes.charAt(0)); offset = 1; } if (remainingBytes != 1 & remainingBytes != 4 & remainingBytes != 5) { hash = hash * (offset == 0 ? HASH_CODE_C1 : HASH_CODE_C2) + hashCodeAsciiSanitize(hashCodeAsciiSanitizeShort(bytes, offset)); offset += 2; } if (remainingBytes >= 4) { return hash * ((offset == 0 | offset == 3) ? HASH_CODE_C1 : HASH_CODE_C2) + hashCodeAsciiSanitizeInt(bytes, offset); } return hash; }
Source:
<code>private void modifyNearbyAI() { float x = getPos().getX(); float y = getPos().getY(); float z = getPos().getZ(); <START> List<EntityVillager> villagers = MiscTools.getNearbyEntities(worldObj, EntityVillager.class, x, y - 1, y + 3, z, 20); <END> for (EntityVillager villager : villagers) { AIPlugin.addAITask(villager, 9, new EntityAIWatchBlock(villager, getMachineType().getBlock(), getMachineType().ordinal(), 4, 0.08F)); AIPlugin.addAITask(villager, 9, new EntityAIMoveToBlock(villager, getMachineType().getBlock(), getMachineType().ordinal(), 16, 0.002F)); } }</code><technical_language>TODO: function</technical_language>

Target:
private void modifyNearbyAI() { for (EntityVillager villager : findNearbyVillagers(20)) { AIPlugin.addAITask(villager, 9, new EntityAIWatchBlock(villager, getMachineType().getState(), 4, 0.08F)); AIPlugin.addAITask(villager, 9, new EntityAIMoveToBlock(villager, getMachineType().getState(), 16, 0.002F)); } }
Source:
<code>public static List<String> getEnclosingBlockNames(@Nonnull List<FlowNode> nodes) { List<String> names = new ArrayList<>(); for (FlowNode n : nodes) { ThreadNameAction threadNameAction = n.getAction(ThreadNameAction.class); <START> if (n.getAction(LabelAction.class) != null && threadNameAction != null) { <END> names.add(threadNameAction.getThreadName()); } else { names.add(n.getDisplayName()); } } return names; }</code><technical_language>do need check for LabelAction here</technical_language>

Target:
public static List<String> getEnclosingBlockNames(@Nonnull List<FlowNode> nodes) { List<String> names = new ArrayList<>(); for (FlowNode n : nodes) { ThreadNameAction threadNameAction = n.getAction(ThreadNameAction.class); LabelAction labelAction = n.getAction(LabelAction.class); if (threadNameAction != null) { names.add(threadNameAction.getThreadName()); } else if (labelAction != null) { names.add(labelAction.getDisplayName()); } } return names; }
Source:
<code>public int updateDevicePingMins(String deviceId, int newPingMins) throws DeviceOrganizationDAOException { Connection conn; PreparedStatement stmt = null; int rows; int updatedPingMins = -1; try { conn = this.getConnection(); String sql = "UPDATE DEVICE_ORGANIZATION_MAP SET MINUTES_SINCE_LAST_PING = ? WHERE DEVICE_ID = ?"; stmt = conn.prepareStatement(sql, new String[]{"id"}); stmt.setInt(1, newPingMins); stmt.setString(2, deviceId); rows = stmt.executeUpdate(); if (rows > 0) { updatedPingMins = newPingMins; } } catch (SQLException e) { <START> throw new DeviceOrganizationDAOException("Error occurred while updating No. of mins since last ping of device '" + <END> deviceId + "'", e); } finally { DeviceManagementDAOUtil.cleanupResources(stmt, null); return updatedPingMins; } }</code><technical_language>Please check this line exceeds column length. check this other code lines well</technical_language>

Target:
public int updateDevicePingMins(String deviceId, int newPingMins) throws DeviceOrganizationDAOException { Connection conn; PreparedStatement stmt = null; int rows; int updatedPingMins = -1; try { conn = this.getConnection(); String sql = "UPDATE DEVICE_ORGANIZATION_MAP SET MINUTES_SINCE_LAST_PING = ? WHERE DEVICE_ID = ?"; stmt = conn.prepareStatement(sql, new String[]{"id"}); stmt.setInt(1, newPingMins); stmt.setString(2, deviceId); rows = stmt.executeUpdate(); if (rows > 0) { updatedPingMins = newPingMins; } } catch (SQLException e) { throw new DeviceOrganizationDAOException("Error occurred while " + "updating No. of mins since last ping of device '" + deviceId + "'", e); } finally { DeviceManagementDAOUtil.cleanupResources(stmt, null); return updatedPingMins; } }
Source:
<code>public void testParseHost( String test_description, String uri_host, String partToExtract, String result ) { <START> if (result.equals("")) { <END> result = null; } assertEquals( test_description, result, HostParser.parse( uri_host, partToExtract ) ); }</code><technical_language>Tabs</technical_language>

Target:
public void testParseHost( String test_description, String uri_host, String partToExtract, String result ) { if (result.equals("__null__")) { result = null; } assertEquals( test_description, result, HostParser.parse( uri_host, partToExtract ) ); }
Source:
<code>public ConnectionAnchor(Block block) { this.loadFXML("ConnectionAnchor"); this.block = block; this.errorState = new SimpleBooleanProperty(false); this.activeState = new SimpleBooleanProperty(true); <START> connections = new ArrayList<Connection>(); <END> activeState.addListener(a -> invalidateActive()); errorState.addListener(this::checkError); }</code><technical_language>this. prefix here</technical_language>

Target:
public ConnectionAnchor(Block block) { this.loadFXML("ConnectionAnchor"); this.block = block; this.errorState = new SimpleBooleanProperty(false); this.activeState = new SimpleBooleanProperty(true); this.connections = new ArrayList<Connection>(); this.activeState.addListener(a -> invalidateActive()); this.errorState.addListener(this::checkError); }
Source:
<code>private static Token decode(String value) { try { byte[] byteValue = Base64.getUrlDecoder().decode(value); byte[] mac = Arrays.copyOf(byteValue, 32); byte[] restBytes = Arrays.copyOfRange(byteValue, 32, byteValue.length); String rest = new String(restBytes, StandardCharsets.UTF_8); if (!KEY.checkMac(restBytes, mac)) { throw new IllegalArgumentException("Failed mac check for " + rest); } String[] splits = rest.split("[:]", 3); String epoch = splits[0]; int authenticationNameLength = Integer.parseInt(splits[1]); String authenticationNameAndBrowserUrl = Util.fixEmpty(splits[2]); <START> String authenticationName = authenticationNameAndBrowserUrl.substring(0, authenticationNameLength); <END> String browserUrl = authenticationNameAndBrowserUrl.substring(authenticationNameLength + 1); return new Token(browserUrl, authenticationName, ofEpochMilli(Long.parseLong(epoch))); } catch (Exception ex) { LOGGER.log(Level.FINE, "Failure decoding", ex); return null; } }</code><technical_language>Is letting authenticationNameAndBrowserUrl null a nullptr dereference intentional</technical_language>

Target:
private static Token decode(String value) { try { byte[] byteValue = Base64.getUrlDecoder().decode(value); byte[] mac = Arrays.copyOf(byteValue, 32); byte[] restBytes = Arrays.copyOfRange(byteValue, 32, byteValue.length); String rest = new String(restBytes, StandardCharsets.UTF_8); if (!KEY.checkMac(restBytes, mac)) { throw new IllegalArgumentException("Failed mac check for " + rest); } String[] splits = rest.split("[:]", 3); String epoch = splits[0]; int authenticationNameLength = Integer.parseInt(splits[1]); String authenticationNameAndBrowserUrl = splits[2]; String authenticationName = authenticationNameAndBrowserUrl.substring(0, authenticationNameLength); String browserUrl = authenticationNameAndBrowserUrl.substring(authenticationNameLength + 1); return new Token(browserUrl, authenticationName, ofEpochMilli(Long.parseLong(epoch))); } catch (Exception ex) { LOGGER.log(Level.FINE, "Failure decoding", ex); return null; } }
Source:
<code><START> public void cleaUp() throws ServerConnectorException, InterruptedException { <END> primaryClient.shutDown(); secondaryClient.shutDown(); serverConnectors.forEach( serverConnector -> { serverConnector.stop(); } ); }</code><technical_language>Typo in method name</technical_language>

Target:
public void cleaUp() throws ServerConnectorException, InterruptedException { serverConnectors.forEach( serverConnector -> { serverConnector.stop(); } ); }
Source:
<code>public String toString() { <START> return "InternalSinkRecord{" + "consumerRecord=" + originalRecord.toString() + "} " + super.toString(); <END> }</code><technical_language>Hmm, this delegate super method. internal, need include original record details. suggestion return super.toString();</technical_language>

Target:
public String toString() { return super.toString(); }
Source:
<code>protected void customLoadScript(String processpath, String[] icons, String path){ <START> String tempFolderPath = coreWorkspace.getApplicationFolder(); <END> File tempFolder = new File(tempFolderPath, "wpsscripts"); if(!tempFolder.exists()) { if(!tempFolder.mkdirs()){ LOGGER.error("Unable to create the OrbisGIS temporary folder."); return; } } URL scriptUrl = this.getClass().getResource(processpath); final File tempFile = new File(tempFolder.getAbsolutePath(), new File(scriptUrl.getFile()).getName()); if(!tempFile.exists()) { try{ if(tempFile.createNewFile()){ LOGGER.error("Unable to create the script file."); return; } } catch (IOException e) { LoggerFactory.getLogger(WpsScriptsPackage.class).error(e.getMessage()); } } try (FileOutputStream out = new FileOutputStream(tempFile)) { IOUtils.copy(scriptUrl.openStream(), out); } catch (Exception e){ LOGGER.error("Unable to copy the content of the script to the temporary file."); return; } List<ProcessIdentifier> piList = localWpsService.addLocalSource(tempFile, icons, false, path); for(ProcessIdentifier pi : piList){ listIdProcess.add(pi.getProcessDescriptionType().getIdentifier()); } }</code><technical_language>workspace .OrbisGIS</technical_language>

Target:
protected void customLoadScript(String processpath, String[] icons, String path){ String tempFolderPath = coreWorkspace.getApplicationFolder(); File tempFolder = new File(tempFolderPath, "wpsscripts"); if(!tempFolder.exists()) { if(!tempFolder.mkdirs()){ LOGGER.error("Unable to create the OrbisGIS temporary folder."); return; } } URL scriptUrl = this.getClass().getResource(processpath); final File tempFile = new File(tempFolder.getAbsolutePath(), new File(scriptUrl.getFile()).getName()); if(!tempFile.exists()) { try{ if(!tempFile.createNewFile()){ LOGGER.error("Unable to create the script file."); return; } } catch (IOException e) { LoggerFactory.getLogger(WpsScriptsPackage.class).error(e.getMessage()); } } try (FileOutputStream out = new FileOutputStream(tempFile)) { IOUtils.copy(scriptUrl.openStream(), out); } catch (Exception e){ LOGGER.error("Unable to copy the content of the script to the temporary file."); return; } List<ProcessIdentifier> piList = localWpsService.addLocalSource(tempFile, icons, false, path); for(ProcessIdentifier pi : piList){ listIdProcess.add(pi.getProcessDescriptionType().getIdentifier()); } }
Source:
<code>private Watch pvcIsWaitingForConsumerWatcher( CompletableFuture<PersistentVolumeClaim> future, PersistentVolumeClaim actualPvc) throws InfrastructureException { return clientFactory .create(workspaceId) .events() .inNamespace(namespace) .withField("reason", "WaitForFirstConsumer") .withField("involvedObject.uid", actualPvc.getMetadata().getUid()) .watch( new Watcher<Event>() { private final Logger log = LoggerFactory.getLogger(getClass()); @Override public void eventReceived(Action action, Event resource) { log.debug( "PVC is waiting for first consumer. Don't wait to bound to avoid deadlock."); future.complete(actualPvc); } @Override public void onClose(KubernetesClientException cause) { <START> log.debug(cause.toString()); <END> } }); }</code><technical_language>Future is completed exceptionally in another listener closing here. do in way</technical_language>

Target:
private Watch pvcIsWaitingForConsumerWatcher( CompletableFuture<PersistentVolumeClaim> future, PersistentVolumeClaim actualPvc) throws InfrastructureException { return clientFactory .create(workspaceId) .events() .inNamespace(namespace) .withField(PVC_EVENT_REASON_FIELD_KEY, PVC_EVENT_WAIT_CONSUMER_REASON) .withField(PVC_EVENT_UID_FIELD_KEY, actualPvc.getMetadata().getUid()) .watch( new Watcher<Event>() { @Override public void eventReceived(Action action, Event resource) { LOG.debug( "PVC '" + actualPvc.getMetadata().getName() + "' is waiting for first consumer. Don't wait to bound to avoid deadlock."); future.complete(actualPvc); } @Override public void onClose(KubernetesClientException cause) { safelyFinishFutureOnClose(cause, future, actualPvc.getMetadata().getName()); } }); }
Source:
<code>public final void draw(GC gc, ITimeGraphPresentationProvider provider) { Rectangle bounds = getBounds(); if (bounds.width <= 0) { return; } RGBAColor backgroundRgba = getBackgroundColor(); if (backgroundRgba != null) { int prevAlpha = gc.getAlpha(); Color prevBgColor = gc.getBackground(); Color prevFgColor = gc.getForeground(); int prevLineWidth = gc.getLineWidth(); setContext(gc); innerDraw(gc); RGBAColor foregroundRgb = getForegroundColor(); <START> if (foregroundRgb != null) { <END> setContext(gc); drawBorder(gc); } gc.setLineWidth(prevLineWidth); gc.setBackground(prevBgColor); gc.setForeground(prevFgColor); gc.setAlpha(prevAlpha); postDraw(provider, gc); gc.setLineWidth(prevLineWidth); gc.setBackground(prevBgColor); gc.setForeground(prevFgColor); gc.setAlpha(prevAlpha); } }</code><technical_language>I drawing border conditional line width</technical_language>

Target:
public final void draw(GC gc, ITimeGraphPresentationProvider provider) { Rectangle bounds = getBounds(); if (bounds.width <= 0) { return; } RGBAColor backgroundRgba = getBackgroundColor(); if (backgroundRgba != null) { int prevAlpha = gc.getAlpha(); Color prevBgColor = gc.getBackground(); Color prevFgColor = gc.getForeground(); int prevLineWidth = gc.getLineWidth(); setContext(gc); innerDraw(gc); if (fLineWidth != NO_BORDER) { setContext(gc); drawBorder(gc); } gc.setLineWidth(prevLineWidth); gc.setBackground(prevBgColor); gc.setForeground(prevFgColor); gc.setAlpha(prevAlpha); postDraw(provider, gc); gc.setLineWidth(prevLineWidth); gc.setBackground(prevBgColor); gc.setForeground(prevFgColor); gc.setAlpha(prevAlpha); } }
Source:
<code>public Map<String, JobValidatorService> getRegisteredFactories() throws IllegalAccessException, InstantiationException { <START> return new HashMap<>(jobValidators); <END> }</code><technical_language>Return [ImmutableMap](<LINK_0> create ImmutableMap [ImmutableMap.Builder](<LINK_1> loading services</technical_language>

Target:
public ImmutableMap<String, JobValidatorService> getRegisteredFactories() throws IllegalAccessException, InstantiationException { return jobValidators; }
Source:
<code>private void notifySelect(boolean ctrl) { int stateMask1 = (ctrl) ? (SWT.NONE | SWT.CTRL) : SWT.NONE; int stateMask2 = (ctrl) ? (SWT.BUTTON1 | SWT.CTRL) : SWT.BUTTON1; SWTBotTreeItem item = new SWTBotTreeItem(lastSelectionItem); notifyTree(SWT.MouseEnter); notifyTree(SWT.MouseMove); notifyTree(SWT.Activate); notifyTree(SWT.FocusIn); notifyTree(SWT.MouseDown, item.createMouseEvent(1, stateMask1, 1)); notifyTree(SWT.Selection, item.createSelectionEvent(stateMask2)); notifyTree(SWT.MouseUp, item.createMouseEvent(1, stateMask2, 1)); <START> notifyTree(SWT.MouseHover); notifyTree(SWT.MouseMove); notifyTree(SWT.MouseExit); notifyTree(SWT.Deactivate); <END> }</code><technical_language>I remove events SWT.MouseUp. select item</technical_language>

Target:
private void notifySelect(boolean ctrl) { int stateMask1 = (ctrl) ? (SWT.NONE | SWT.CTRL) : SWT.NONE; int stateMask2 = (ctrl) ? (SWT.BUTTON1 | SWT.CTRL) : SWT.BUTTON1; SWTBotTreeItem item = new SWTBotTreeItem(lastSelectionItem); notifyTree(SWT.MouseEnter); notifyTree(SWT.MouseMove); notifyTree(SWT.Activate); notifyTree(SWT.FocusIn); notifyTree(SWT.MouseDown, item.createMouseEvent(1, stateMask1, 1)); notifyTree(SWT.Selection, item.createSelectionEvent(stateMask2)); notifyTree(SWT.MouseUp, item.createMouseEvent(1, stateMask2, 1)); }
Source:
<code>private MessageEvent doActionRefreshCurrentPage(TestCaseExecution tCExecution) { MessageEvent message; try { LOG.debug("REFRESH CURRENT PAGE"); if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_GUI)) { return this.webdriverService.doSeleniumActionRefreshCurrentPage(tCExecution.getSession()); } message = new MessageEvent(MessageEventEnum.ACTION_NOTEXECUTED_NOTSUPPORTED_FOR_APPLICATION); <START> message.setDescription(message.getDescription().replace("%ACTION%", "OpenURL[WithBase]")); <END> message.setDescription(message.getDescription().replace("%APPLICATIONTYPE%", tCExecution.getApplicationObj().getType())); return message; } catch (Exception e) { message = new MessageEvent(MessageEventEnum.ACTION_FAILED_REFRESHCURRENTPAGE); String messageString = e.getMessage().split("\n")[0]; message.setDescription(message.getDescription().replace("%DETAIL%", messageString)); LOG.debug("Exception Running scroll to :" + messageString, e); return message; } }</code><technical_language>OpenURL[WithBase] --> refreshPage</technical_language>

Target:
private MessageEvent doActionRefreshCurrentPage(TestCaseExecution tCExecution) { MessageEvent message; try { LOG.debug("REFRESH CURRENT PAGE"); if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_GUI)) { return this.webdriverService.doSeleniumActionRefreshCurrentPage(tCExecution.getSession()); } message = new MessageEvent(MessageEventEnum.ACTION_NOTEXECUTED_NOTSUPPORTED_FOR_APPLICATION); message.setDescription(message.getDescription().replace("%ACTION%", "refreshCurrentPage")); message.setDescription(message.getDescription().replace("%APPLICATIONTYPE%", tCExecution.getApplicationObj().getType())); return message; } catch (Exception e) { message = new MessageEvent(MessageEventEnum.ACTION_FAILED_REFRESHCURRENTPAGE); String messageString = e.getMessage().split("\n")[0]; message.setDescription(message.getDescription().replace("%DETAIL%", messageString)); LOG.debug("Exception doing action refreshCurrentPage :" + messageString, e); return message; } }
Source:
<code>private DiskImage createMemoryDisk(Snapshot snapshot) { List<Guid> guids = Guid.createGuidListFromString(snapshot.getMemoryVolume()); StorageDomainStatic sd = validateStorageDomainExistsInDb(snapshot, guids.get(0), guids.get(2), guids.get(3)); DiskImage disk = isMemoryDiskAlreadyExistsInDb(snapshot, guids.get(2), guids.get(3)); if (sd == null || disk != null) { return null; } VM vm = snapshotVmConfigurationHelper.getVmFromConfiguration( snapshot.getVmConfiguration(), snapshot.getVmId(), snapshot.getId()); DiskImage memoryDisk = MemoryUtils.createSnapshotMemoryDisk( vm, sd.getStorageType(), vmOverheadCalculator, MemoryUtils.generateMemoryDiskDescription(vm, snapshot.getDescription())); memoryDisk.setId(guids.get(2)); memoryDisk.setImageId(guids.get(3)); memoryDisk.setStorageIds(new ArrayList<>(Collections.singletonList(guids.get(0)))); memoryDisk.setStoragePoolId(guids.get(1)); memoryDisk.setCreationDate(snapshot.getCreationDate()); memoryDisk.setActive(true); <START> memoryDisk.setWipeAfterDelete(vm.getDiskList().stream().anyMatch(d -> d.isWipeAfterDelete())); <END> return memoryDisk; }</code><technical_language>replaced DiskImage::isWipeAfterDelete</technical_language>

Target:
private DiskImage createMemoryDisk(Snapshot snapshot) { List<Guid> guids = Guid.createGuidListFromString(snapshot.getMemoryVolume()); StorageDomainStatic sd = validateStorageDomainExistsInDb(snapshot, guids.get(0), guids.get(2), guids.get(3)); DiskImage disk = isMemoryDiskAlreadyExistsInDb(snapshot, guids.get(2), guids.get(3)); if (sd == null || disk != null) { return null; } VM vm = snapshotVmConfigurationHelper.getVmFromConfiguration( snapshot.getVmConfiguration(), snapshot.getVmId(), snapshot.getId()); DiskImage memoryDisk = MemoryUtils.createSnapshotMemoryDisk( vm, sd.getStorageType(), vmOverheadCalculator, MemoryUtils.generateMemoryDiskDescription(vm, snapshot.getDescription())); memoryDisk.setId(guids.get(2)); memoryDisk.setImageId(guids.get(3)); memoryDisk.setStorageIds(new ArrayList<>(Collections.singletonList(guids.get(0)))); memoryDisk.setStoragePoolId(guids.get(1)); memoryDisk.setCreationDate(snapshot.getCreationDate()); memoryDisk.setActive(true); memoryDisk.setWipeAfterDelete(vm.getDiskList().stream().anyMatch(DiskImage::isWipeAfterDelete)); return memoryDisk; }
Source:
<code>public Object open(Connection connection, long oid, int mode) throws SQLException { if (shouldUseReflection) { Object largeObjectManager = getLargeObjectManager(connection); try { Method method = largeObjectManager.getClass().getMethod("open", Connection.class, long.class, int.class); <START> return method.invoke(largeObjectManager, connection, oid, mode); <END> } catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException ex) { throw new SQLException("Couldn't access org.postgresql.largeobject.LargeObjectManager", ex); } } else { return ((PGConnection) unwrap(connection)).getLargeObjectAPI().open(oid, mode); } }</code><technical_language>connection is a parameter of this method</technical_language>

Target:
public Object open(Connection connection, long oid, int mode) throws SQLException { if (shouldUseReflection) { Object largeObjectManager = getLargeObjectManager(connection); try { Method method = largeObjectManager.getClass().getMethod("open", long.class, int.class); return method.invoke(largeObjectManager, oid, mode); } catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException ex) { throw new SQLException("Couldn't access org.postgresql.largeobject.LargeObjectManager", ex); } } else { return ((PGConnection) unwrap(connection)).getLargeObjectAPI().open(oid, mode); } }
Source:
<code>public synchronized AdHocPlannedStatement planSqlCalcite(SqlTask task) throws ValidationException, RelConversionException, PlannerFallbackException { <START> VoltPlanner planner = new VoltPlanner(m_schemaPlus); <END> planner.validate(task.getParsedQuery()); RelNode rel = planner.convert(task.getParsedQuery()); RelTraitSet requiredLogicalOutputTraits = rel.getTraitSet().replace(VoltLogicalRel.VOLTDB_LOGICAL); RelNode transformed = planner.transform( VoltPlannerPrograms.directory.LOGICAL.ordinal(), requiredLogicalOutputTraits, rel); transformed = VoltDBRelUtil.addTraitRecurcively(transformed, RelDistributions.SINGLETON); RelTraitSet requiredPhysicalOutputTraits = transformed.getTraitSet().replace(VoltDBPRel.VOLTDB_PHYSICAL); RelNode nodeAfterPhysicalConversion = planner.transform( VoltPlannerPrograms.directory.VOLT_PHYSICAL_CONVERSION.ordinal(), requiredPhysicalOutputTraits, transformed); Util.discard(nodeAfterPhysicalConversion); planner.close(); throw new PlannerFallbackException(); }</code><technical_language>duplicate this code block in tests if works. literally assertPlanMatch method in TestCalciteLogicalRules, TestLogicalRules TestPhysicalConversionRules</technical_language>

Target:
public synchronized AdHocPlannedStatement planSqlCalcite(SqlTask task) throws ValidationException, RelConversionException, PlannerFallbackException { VoltPlanner planner = new VoltPlanner(m_schemaPlus); planner.validate(task.getParsedQuery()); RelNode rel = planner.convert(task.getParsedQuery()); compileLog.info("ORIGINAL\n" + RelOptUtil.toString(rel)); RelTraitSet requiredLogicalOutputTraits = planner.getEmptyTraitSet().replace(VoltLogicalRel.CONVENTION); RelNode transformed = planner.transform( PlannerRules.Phase.LOGICAL.ordinal(), requiredLogicalOutputTraits, rel); compileLog.info("LOGICAL\n" + RelOptUtil.toString(transformed)); transformed.getCluster().getPlanner().addRelTraitDef(RelDistributionTraitDef.INSTANCE); transformed = VoltRelUtil.addTraitRecurcively(transformed, RelDistributions.SINGLETON); planner.close(); throw new PlannerFallbackException(); }
Source:
<code>private static LocalDate convertDate(Attribute attr, String valueAsString) { try { return parseLocalDate(valueAsString); } <START> catch (java.time.format.DateTimeParseException e) <END> { throw new DateParseException(attr, valueAsString); } }</code><technical_language>fix imports</technical_language>

Target:
private static LocalDate convertDate(Attribute attr, String valueAsString) { try { return parseLocalDate(valueAsString); } catch (DateTimeParseException e) { throw new DateParseException(attr, valueAsString); } }
Source:
<code>public static byte[] rowFollowingSameLength(byte[] rowKey) { byte[] result = Arrays.copyOf(rowKey, rowKey.length); <START> result[rowKey.length - 1] = 0; <END> for (int index = rowKey.length - 1; index >= 0; index--) { result[index] = (byte) (rowKey[index] + 1); if (result[index] != 0) { break; } } return result; }</code><technical_language>is this necessary</technical_language>

Target:
public static byte[] rowFollowingSameLength(byte[] rowKey) { byte[] result = Arrays.copyOf(rowKey, rowKey.length); for (int index = rowKey.length - 1; index >= 0; index--) { result[index] = (byte) (rowKey[index] + 1); if (result[index] != 0) { break; } } return result; }
Source:
<code>public void resolveMessageOrDefaultShouldReturnMessageKeyWhenMessageResolutionFails() { String message = messageKeyResolver.resolveMessageOrDefault(NON_EXISTENT_MESSAGE_KEY, DEFAULT_MESSAGE); <START> assertThat(message, equalTo("[ ! " + NON_EXISTENT_MESSAGE_KEY + " ! ]")); <END> }</code><technical_language>[ ! ! ] delimiters public constants in message key resolver implementation in tests</technical_language>

Target:
public void resolveMessageOrDefaultShouldReturnMessageKeyWhenMessageResolutionFails() { given(messageSource .getMessage(eq(NON_EXISTENT_MESSAGE_KEY), any(Object[].class), any(Locale.class))) .willThrow(new NoSuchMessageException(NON_EXISTENT_MESSAGE_KEY)); String message = messageKeyResolver.resolveMessageOrDefault(NON_EXISTENT_MESSAGE_KEY); assertThat(message, equalTo( MessageKeyResolverImpl.DEFAULT_MESSAGE_PREFIX + NON_EXISTENT_MESSAGE_KEY + MessageKeyResolverImpl.DEFAULT_MESSAGE_POSTFIX)); }
Source:
<code><START> public void testAttachAndWrite() throws Exception { <END> final int nEvents = index.getTotalEventCount(); final Index index = this.index; Socket socket = this.tcpInput.attach(); PrintStream output = new PrintStream(socket.getOutputStream()); output.print(createTimestamp() + " Boris the mad baboon!\r\n"); output.flush(); socket.close(); SplunkTestCase.assertEventuallyTrue(new EventuallyTrueBehavior() { public boolean predicate() { index.refresh(); return index.getTotalEventCount() == nEvents + 1; } }); }</code><technical_language>throws Exception avoided. Ditto for next 2 methods</technical_language>

Target:
public void testAttachAndWrite() { final int nEvents = index.getTotalEventCount(); final Index index = this.index; try { Socket socket = this.tcpInput.attach(); PrintStream output = new PrintStream(socket.getOutputStream()); output.print(createTimestamp() + " Boris the mad baboon!\r\n"); output.flush(); socket.close(); } catch (IOException e) { SplunkTestCase.fail("Got an IO exception in attaching."); } SplunkTestCase.assertEventuallyTrue(new EventuallyTrueBehavior() { public boolean predicate() { index.refresh(); return index.getTotalEventCount() == nEvents + 1; } }); }
Source:
<code>private void doBackupCheck() { <START> final int DAY_IN_MILLISEC= 60 * 60 * 24 *1000; <END> AuditLogableBase alert = new AuditLogableBase(); EngineBackupHistory lastBackup = DbFacade.getInstance().getEngineBackupHistoryDAO().getLastSuccessfulEngineBackup(DB); if (lastBackup == null) { auditLogDirector.log(alert, AuditLogType.ENGINE_NO_BACKUP); } else { if (Config.<Boolean>getValue(ConfigValues.BackupAlertPeriodInDays)) { Integer backupAlertPeriodInDays = Config.<Integer> getValue(ConfigValues.BackupAlertPeriodInDays); Date dt = lastBackup.getDoneAt(); long diffInDays = (Calendar.getInstance().getTimeInMillis() - dt.getTime())/DAY_IN_MILLISEC; if (diffInDays > backupAlertPeriodInDays) { alert.addCustomValue("Date", lastBackup.getDoneAt().toString()); auditLogDirector.log(alert, AuditLogType.ENGINE_NO_WARM_BACKUP); } } } }</code><technical_language>please TimeUnit.DAYS.toMillis()</technical_language>

Target:
private void doBackupCheck() { AuditLogableBase alert = new AuditLogableBase(); EngineBackupLog lastBackup = engineBackupLogDAO.getLastSuccessfulEngineBackup(ENGINE_DB_ID); if (lastBackup == null) { auditLogDirector.log(alert, AuditLogType.ENGINE_NO_BACKUP); } else { if (Config.<Boolean>getValue(ConfigValues.BackupAlertPeriodInDays)) { Integer backupAlertPeriodInDays = Config.<Integer>getValue(ConfigValues.BackupAlertPeriodInDays); Date dt = lastBackup.getDoneAt(); long diffInDays = (Calendar.getInstance().getTimeInMillis() - dt.getTime()) / TimeUnit.DAYS.toMillis(1); if (diffInDays > backupAlertPeriodInDays) { alert.addCustomValue("Date", lastBackup.getDoneAt().toString()); auditLogDirector.log(alert, AuditLogType.ENGINE_NO_WARM_BACKUP); } } } }
Source:
<code>private void teleportAAllPlayers(final Server server, final CommandSource sender, final User target) { sender.sendMessage(tl("teleportAAll")); for (User player : ess.getOnlineUsers()) { if (target == player) { continue; } if (!player.isTeleportEnabled()) { continue; } if (sender.equals(target.getBase()) && target.getWorld() != player.getWorld() && ess.getSettings().isWorldTeleportPermissions() && !target.isAuthorized("essentials.worlds." + target.getWorld().getName())) { continue; } <START> try { <END> TPARequestEvent tpaEvent = new TPARequestEvent(sender, player, true); ess.getServer().getPluginManager().callEvent(tpaEvent); if(tpaEvent.isCancelled()) { return; } player.requestTeleport(target, true); player.sendMessage(tl("teleportHereRequest", target.getDisplayName())); player.sendMessage(tl("typeTpaccept")); if (ess.getSettings().getTpaAcceptCancellation() != 0) { player.sendMessage(tl("teleportRequestTimeoutInfo", ess.getSettings().getTpaAcceptCancellation())); } } catch (Exception ex) { ess.showError(sender, ex, getName()); } } }</code><technical_language>line spacing.</technical_language>

Target:
private void teleportAAllPlayers(final Server server, final CommandSource sender, final User target) { sender.sendMessage(tl("teleportAAll")); for (User player : ess.getOnlineUsers()) { if (target == player) { continue; } if (!player.isTeleportEnabled()) { continue; } if (sender.equals(target.getBase()) && target.getWorld() != player.getWorld() && ess.getSettings().isWorldTeleportPermissions() && !target.isAuthorized("essentials.worlds." + target.getWorld().getName())) { continue; } try { TPARequestEvent tpaEvent = new TPARequestEvent(sender, player, true); ess.getServer().getPluginManager().callEvent(tpaEvent); if (tpaEvent.isCancelled()) { sender.sendMessage(tl("teleportRequestCancelled", player.getDisplayName())); continue; } player.requestTeleport(target, true); player.sendMessage(tl("teleportHereRequest", target.getDisplayName())); player.sendMessage(tl("typeTpaccept")); if (ess.getSettings().getTpaAcceptCancellation() != 0) { player.sendMessage(tl("teleportRequestTimeoutInfo", ess.getSettings().getTpaAcceptCancellation())); } } catch (Exception ex) { ess.showError(sender, ex, getName()); } } }
Source:
<code>private ORawBuffer readRecordIfNotLatest(final OCluster cluster, final ORecordId rid, final int recordVersion) throws ORecordNotFoundException { checkOpenness(); if (!rid.isPersistent()) throw new ORecordNotFoundException(rid, "Cannot read record " + rid + " since the position is invalid in database '" + name + '\''); if (transaction.get() != null) { return doReadRecordIfNotLatest(cluster, rid, recordVersion); } stateLock.acquireReadLock(); try { if (pessimisticLock) { acquireReadLock(rid); } ORawBuffer buff; checkOpenness(); buff = doReadRecordIfNotLatest(cluster, rid, recordVersion); return buff; } finally { <START> if (pessimisticLock) { <END> releaseReadLock(rid); } stateLock.releaseReadLock(); } }</code><technical_language>check if lock acquired. If throws a OLockException exception</technical_language>

Target:
private ORawBuffer readRecordIfNotLatest(final OCluster cluster, final ORecordId rid, final int recordVersion) throws ORecordNotFoundException { checkOpenness(); if (!rid.isPersistent()) throw new ORecordNotFoundException(rid, "Cannot read record " + rid + " since the position is invalid in database '" + name + '\''); if (transaction.get() != null) { return doReadRecordIfNotLatest(cluster, rid, recordVersion); } stateLock.acquireReadLock(); try { if (pessimisticLock) { acquireReadLock(rid); } ORawBuffer buff; checkOpenness(); buff = doReadRecordIfNotLatest(cluster, rid, recordVersion); return buff; } finally { try { if (pessimisticLock) { releaseReadLock(rid); } } finally { stateLock.releaseReadLock(); } } }
Source:
<code>public static BlobColumn buildFromProtobuf(final ColumnMessage message, final int numTuples) { Preconditions.checkArgument( message.getType().ordinal() == ColumnMessage.Type.BLOB_VALUE, "Trying to construct Bytes from non-bytes ColumnMessage %s", message.getType()); Preconditions.checkArgument(message.hasBlobColumn(), "ColumnMessage is missing DateColumn"); final BlobColumnMessage BlobColumn = message.getBlobColumn(); ByteBuffer[] newData = new ByteBuffer[numTuples]; ByteBuffer data = BlobColumn.getData().asReadOnlyByteBuffer(); for (int i = 0; i < numTuples; i++) { newData[i] = ByteBuffer.allocate(data.capacity()); <START> newData[i].put(data); <END> } return new BlobColumnBuilder(newData, numTuples).build(); }</code><technical_language>I get it: tuples same? (Is tested more 1 tuple in a column?)</technical_language>

Target:
public static BlobColumn buildFromProtobuf(final ColumnMessage message, final int numTuples) { Preconditions.checkArgument( message.getType().ordinal() == ColumnMessage.Type.BLOB_VALUE, "Trying to construct BlobColumn from non-bytes ColumnMessage %s", message.getType()); Preconditions.checkArgument(message.hasBlobColumn(), "ColumnMessage is missing BlobColumn"); final BlobColumnMessage BlobColumn = message.getBlobColumn(); List<Integer> startIndices = BlobColumn.getStartIndicesList(); List<Integer> endIndices = BlobColumn.getEndIndicesList(); ByteBuffer[] newData = new ByteBuffer[numTuples]; ByteBuffer data = BlobColumn.getData().asReadOnlyByteBuffer(); for (int i = 0; i < numTuples; i++) { int length = endIndices.get(i) - startIndices.get(i); newData[i] = ByteBuffer.allocate(length); data.get(newData[i].array(), 0, length); } return new BlobColumnBuilder(newData, numTuples).build(); }
Source:
<code>private void deleteOldPacks(Collection<PackFile> oldPacks, Collection<PackFile> newPacks, boolean ignoreErrors) throws IOException { int deleteOptions = FileUtils.RETRY | FileUtils.SKIP_MISSING; if (ignoreErrors) deleteOptions |= FileUtils.IGNORE_ERRORS; oldPackLoop: for (PackFile oldPack : oldPacks) { String oldName = oldPack.getPackName(); for (PackFile newPack : newPacks) if (oldName.equals(newPack.getPackName())) continue oldPackLoop; <START> if (!nameFor(oldName, ".pack.keep").exists()) { <END> oldPack.close(); FileUtils.delete(nameFor(oldName, ".pack"), deleteOptions); FileUtils.delete(nameFor(oldName, ".idx"), deleteOptions); } } repo.getObjectDatabase().close(); }</code><technical_language>new File(oldPack.getPackFile().getPath() + ".keep").exists()</technical_language>

Target:
private void deleteOldPacks(Collection<PackFile> oldPacks, Collection<PackFile> newPacks, boolean ignoreErrors) throws IOException { int deleteOptions = FileUtils.RETRY | FileUtils.SKIP_MISSING; if (ignoreErrors) deleteOptions |= FileUtils.IGNORE_ERRORS; oldPackLoop: for (PackFile oldPack : oldPacks) { String oldName = oldPack.getPackName(); for (PackFile newPack : newPacks) if (oldName.equals(newPack.getPackName())) continue oldPackLoop; if (!oldPack.shouldBeKept()) { oldPack.close(); FileUtils.delete(nameFor(oldName, ".pack"), deleteOptions); FileUtils.delete(nameFor(oldName, ".idx"), deleteOptions); } } repo.getObjectDatabase().close(); }
Source:
<code>public void messageFormatTtlUpdateRecordTest() throws IOException, MessageFormatException { StoreKey key = new MockId("id1"); short accountId = Utils.getRandomShort(TestUtils.RANDOM); short containerId = Utils.getRandomShort(TestUtils.RANDOM); long ttlUpdateTimeMs = SystemTime.getInstance().milliseconds() + TestUtils.RANDOM.nextInt(); long updatedExpiryMs = ttlUpdateTimeMs + TestUtils.RANDOM.nextInt(); MessageFormatInputStream messageFormatStream = new TtlUpdateMessageFormatInputStream(key, accountId, containerId, updatedExpiryMs, ttlUpdateTimeMs); long ttlUpdateRecordSize = MessageFormatRecord.Update_Format_V3.getRecordSize(UpdateRecord.Type.TTL_UPDATE); int headerSize = MessageFormatRecord.getHeaderSizeForVersion(MessageFormatRecord.headerVersionToUse); Assert.assertEquals(headerSize + ttlUpdateRecordSize + key.sizeInBytes(), messageFormatStream.getSize()); <START> checkTtlUpdateMessage(messageFormatStream, ttlUpdateRecordSize, key, accountId, containerId, ttlUpdateTimeMs, <END> updatedExpiryMs); }</code><technical_language>Suggests order for updatedExpiryMs ttlUpdateTimeMs in TtlUpdateMessageFormatInputStream checkTtlUpdateMessage methods avoid mistakes later</technical_language>

Target:
public void messageFormatTtlUpdateRecordTest() throws IOException, MessageFormatException { StoreKey key = new MockId("id1"); short accountId = Utils.getRandomShort(TestUtils.RANDOM); short containerId = Utils.getRandomShort(TestUtils.RANDOM); long ttlUpdateTimeMs = SystemTime.getInstance().milliseconds() + TestUtils.RANDOM.nextInt(); long updatedExpiryMs = ttlUpdateTimeMs + TestUtils.RANDOM.nextInt(); MessageFormatInputStream messageFormatStream = new TtlUpdateMessageFormatInputStream(key, accountId, containerId, updatedExpiryMs, ttlUpdateTimeMs); long ttlUpdateRecordSize = MessageFormatRecord.Update_Format_V3.getRecordSize(UpdateRecord.Type.TTL_UPDATE); int headerSize = MessageFormatRecord.getHeaderSizeForVersion(MessageFormatRecord.headerVersionToUse); Assert.assertEquals(headerSize + ttlUpdateRecordSize + key.sizeInBytes(), messageFormatStream.getSize()); checkTtlUpdateMessage(messageFormatStream, ttlUpdateRecordSize, key, accountId, containerId, updatedExpiryMs, ttlUpdateTimeMs); }
Source:
<code>protected boolean canDoAction() { if (getParameters().getDiskImage().getDiskStorageType() != DiskStorageType.IMAGE) <START> { <END> addCanDoActionMessage("$diskId " + getParameters().getDiskImage().getId()); addCanDoActionMessage("$storageType " + getParameters().getDiskImage().getDiskStorageType()); addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_UNSUPPORTED_DISK_STORAGE_TYPE); return false; } else { return true; } }</code><technical_language>push "{" a line, me</technical_language>

Target:
protected boolean canDoAction() { if (getParameters().getDiskImage().getDiskStorageType() != DiskStorageType.IMAGE) { addCanDoActionMessage("$diskId " + getParameters().getDiskImage().getId()); addCanDoActionMessage("$storageType " + getParameters().getDiskImage().getDiskStorageType()); addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_UNSUPPORTED_DISK_STORAGE_TYPE); return false; } else if (!validate(new StorageDomainValidator(getStorageDomain()).isDomainExistAndActive())) { addCanDoActionMessage("$diskId " + getParameters().getDiskImage().getId()); addCanDoActionMessage("$domainId " + getStorageDomainId()); addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_DOMAIN_UNAVAILABLE); return false; } else if (getStorageDomain().getStorageDomainType() != StorageDomainType.Data) { addCanDoActionMessage("$domainId " + getParameters().getStorageDomainId()); addCanDoActionMessage("$domainType " + getStorageDomain().getStorageDomainType()); addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_DOMAIN_TYPE_UNSUPPORTED); } return true; }
Source:
<code>public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean b) { if(stack.hasTagCompound()) { if(!stack.stackTagCompound.getBoolean("Active")) { <START> list.add(EnumChatFormatting.RED + "Inactive!"); <END> } else { list.add("Mode: " + EnumChatFormatting.AQUA + MODES[stack.getItemDamage()]); } } }</code><technical_language>I missed this time, raw English strings in code. Do + StatCollector.translateToLocal("pe.arcana.inactive"); put pe.arcana.inactive=Inactive! in en_US.lang. lets string translated other languages</technical_language>

Target:
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean b) { if(stack.hasTagCompound()) { if(!stack.stackTagCompound.getBoolean("Active")) { list.add(EnumChatFormatting.RED + StatCollector.translateToLocal("pe.arcana.inactive")); } else { list.add(StatCollector.translateToLocal("pe.arcana.mode") + EnumChatFormatting.AQUA + StatCollector.translateToLocal("pe.arcana.mode." + stack.getItemDamage())); } } }
Source:
<code>private void bounce(TaskIdWithUsage task, TaskCleanupType cleanupType, Optional<String> message) { taskManager.createTaskCleanup(new SingularityTaskCleanup( Optional.empty(), cleanupType, System.currentTimeMillis(), task.getTaskId(), message, <START> Optional.of(UUID.randomUUID().toString()), <END> Optional.empty(), Optional.empty() )); requestManager.addToPendingQueue(new SingularityPendingRequest( task.getTaskId().getRequestId(), task.getTaskId().getDeployId(), System.currentTimeMillis(), Optional.empty(), PendingType.TASK_BOUNCE, Optional.empty(), Optional.empty(), Optional.empty(), message, Optional.of(UUID.randomUUID().toString()) )); }</code><technical_language>Small nit, good for actionId in SingularityPendingRequest match. For this case lasting effect actions themselves, easier trace data for debugging if equal</technical_language>

Target:
private void bounce(TaskIdWithUsage task, TaskCleanupType cleanupType, Optional<String> message) { String actionId = UUID.randomUUID().toString(); taskManager.createTaskCleanup(new SingularityTaskCleanup( Optional.empty(), cleanupType, System.currentTimeMillis(), task.getTaskId(), message, Optional.of(actionId), Optional.empty(), Optional.empty() )); requestManager.addToPendingQueue(new SingularityPendingRequest( task.getTaskId().getRequestId(), task.getTaskId().getDeployId(), System.currentTimeMillis(), Optional.empty(), PendingType.TASK_BOUNCE, Optional.empty(), Optional.empty(), Optional.empty(), message, Optional.of(actionId) )); }
Source:
<code>private int getSize(Node item) throws NumberFormatException { Node val = item.getFirstChild(); assertNotNull(val); assertEquals(Node.TEXT_NODE, val.getNodeType()); try { return Integer.parseInt(val.getNodeValue().trim()); } catch (NumberFormatException ex) { <START> if (DirectoryListing.DIRECTORY_SIZE_PLACEHOLDER.equals(val.getNodeValue().trim())) { <END> return DIRECTORY_INTERNAL_SIZE; } return -1; } }</code><technical_language>check - equality convert integer ? Checking character exception a bit convoluted</technical_language>

Target:
private int getSize(Node item) throws NumberFormatException { Node val = item.getFirstChild(); assertNotNull(val); assertEquals(Node.TEXT_NODE, val.getNodeType()); if (DirectoryListing.DIRECTORY_SIZE_PLACEHOLDER.equals(val.getNodeValue().trim())) { return DIRECTORY_INTERNAL_SIZE; } try { return Integer.parseInt(val.getNodeValue().trim()); } catch (NumberFormatException ex) { return INVALID_SIZE; } }
Source:
<code>public SortedSet<DescriptorLanguage.FileType> getVersionsFileTypes(@Parameter(hidden = true, name = "user")@Auth Optional<User> user, @Parameter(name = "entryId", description = "Entry to retrieve the version from", required = true, in = ParameterIn.PATH) @PathParam("entryId") Long entryId, @Parameter(name = "versionId", description = "Version to retrieve the sourcefile types from", required = true, in = ParameterIn.PATH) @PathParam("versionId") Long versionId) { Entry<? extends Entry, ? extends Version> entry = toolDAO.getGenericEntryById(entryId); checkEntry(entry); if (!entry.getIsPublished()) { checkUser(user.get(), entry); } Version version = versionDAO.findVersionInEntry(entryId, versionId); if (version == null) { throw new CustomWebApplicationException("Version " + versionId + " does not exist for this entry", HttpStatus.SC_BAD_REQUEST); } <START> SortedSet<DescriptorLanguage.FileType> fileTypes = new TreeSet<>(); <END> SortedSet<SourceFile> sourceFiles = version.getSourceFiles(); fileTypes = sourceFiles.stream().map(sourceFile -> sourceFile.getType()).collect(Collectors.toCollection(TreeSet::new)); return fileTypes; }</code><technical_language>reason create a TreeSet here, overwrite line 186. I get rid of this line define line 186. Or, more subjectively, declare return line 186 directly</technical_language>

Target:
public SortedSet<DescriptorLanguage.FileType> getVersionsFileTypes(@Parameter(hidden = true, name = "user")@Auth Optional<User> user, @Parameter(name = "entryId", description = "Entry to retrieve the version from", required = true, in = ParameterIn.PATH) @PathParam("entryId") Long entryId, @Parameter(name = "versionId", description = "Version to retrieve the sourcefile types from", required = true, in = ParameterIn.PATH) @PathParam("versionId") Long versionId) { Entry<? extends Entry, ? extends Version> entry = toolDAO.getGenericEntryById(entryId); checkEntry(entry); checkEntryPermissions(user, entry); Version version = versionDAO.findVersionInEntry(entryId, versionId); if (version == null) { throw new CustomWebApplicationException("Version " + versionId + " does not exist for this entry", HttpStatus.SC_BAD_REQUEST); } SortedSet<SourceFile> sourceFiles = version.getSourceFiles(); return sourceFiles.stream().map(sourceFile -> sourceFile.getType()).collect(Collectors.toCollection(TreeSet::new)); }