auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void addSmallCategory(List<SmallCategory> categories, Category parentCat, String langCode, boolean completeTitle) { String[] childrenCodes = parentCat.getChildrenCodes(); <START> for (int i = 0; i < childrenCodes.length; i++) { <END> Category cat = this.getCategory(childrenCodes[i]); if (null == cat.getChildrenCodes() || cat.getChildrenCodes().length == 0) { SmallCategory catSmall = new SmallCategory(); catSmall.setCode(cat.getCode()); if (!completeTitle) { catSmall.setTitle(cat.getTitles().getProperty(langCode)); } else { catSmall.setTitle(cat.getFullTitle(langCode)); } categories.add(catSmall); } this.addSmallCategory(categories, cat, langCode, completeTitle); } }</code><technical_language>this need a null check</technical_language>

Target:
private void addSmallCategory(List<SmallCategory> categories, Category parentCat, String langCode, boolean completeTitle) { String[] childrenCodes = parentCat.getChildrenCodes(); if (null == childrenCodes) { return; } for (int i = 0; i < childrenCodes.length; i++) { Category cat = this.getCategory(childrenCodes[i]); if (null == cat.getChildrenCodes() || cat.getChildrenCodes().length == 0) { SmallCategory catSmall = new SmallCategory(); catSmall.setCode(cat.getCode()); if (!completeTitle) { catSmall.setTitle(cat.getTitles().getProperty(langCode)); } else { catSmall.setTitle(cat.getFullTitle(langCode)); } categories.add(catSmall); } this.addSmallCategory(categories, cat, langCode, completeTitle); } }
Source:
<code>private File handleStringMessage(final String content, File originalFile, File tempFile, final File resultFile, final Message<?> requestMessage) throws IOException { final File fileToWriteTo = this.determineFileToWrite(resultFile, tempFile); final boolean append = FileExistsMode.APPEND.equals(this.fileExistsMode); WhileLockedProcessor whileLockedProcessor = new WhileLockedProcessor(this.lockRegistry, fileToWriteTo.getAbsolutePath()) { @Override protected void whileLocked() throws IOException { <START> if (newFileCallback != null && !fileToWriteTo.exists() && (FileExistsMode.APPEND.equals(fileExistsMode) <END> || FileExistsMode.APPEND_NO_FLUSH.equals(fileExistsMode))) { newFileCallback.accept(fileToWriteTo, requestMessage); } FileState state = getFileState(fileToWriteTo, true); BufferedWriter writer = null; try { writer = state != null ? state.writer : createWriter(fileToWriteTo, append); writer.write(content); if (FileWritingMessageHandler.this.appendNewLine) { writer.newLine(); } } finally { try { if (state == null || FileWritingMessageHandler.this.flushTask == null) { if (writer != null) { writer.close(); } clearState(fileToWriteTo, state); } else { state.lastWrite = System.currentTimeMillis(); } } catch (IOException ex) { } } } }; whileLockedProcessor.doWhileLocked(); this.cleanUpAfterCopy(fileToWriteTo, resultFile, originalFile); return resultFile; }</code><technical_language>I this factored some common code, for now. a merge polishing... bring working shape of all. So, I need add a FileWritingMessageHandler.this. prefix this property in classes</technical_language>

Target:
private File handleStringMessage(final String content, File originalFile, File tempFile, final File resultFile, final Message<?> requestMessage) throws IOException { final File fileToWriteTo = this.determineFileToWrite(resultFile, tempFile); final boolean append = FileExistsMode.APPEND.equals(this.fileExistsMode); WhileLockedProcessor whileLockedProcessor = new WhileLockedProcessor(this.lockRegistry, fileToWriteTo.getAbsolutePath()) { @Override protected void whileLocked() throws IOException { if (FileWritingMessageHandler.this.newFileCallback != null && !fileToWriteTo.exists() && (FileExistsMode.APPEND.equals(FileWritingMessageHandler.this.fileExistsMode) || FileExistsMode.APPEND_NO_FLUSH.equals(FileWritingMessageHandler.this.fileExistsMode))) { FileWritingMessageHandler.this.newFileCallback.accept(fileToWriteTo, requestMessage); } FileState state = getFileState(fileToWriteTo, true); BufferedWriter writer = null; try { writer = state != null ? state.writer : createWriter(fileToWriteTo, append); writer.write(content); if (FileWritingMessageHandler.this.appendNewLine) { writer.newLine(); } } finally { try { if (state == null || FileWritingMessageHandler.this.flushTask == null) { if (writer != null) { writer.close(); } clearState(fileToWriteTo, state); } else { state.lastWrite = System.currentTimeMillis(); } } catch (IOException ex) { } } } }; whileLockedProcessor.doWhileLocked(); this.cleanUpAfterCopy(fileToWriteTo, resultFile, originalFile); return resultFile; }
Source:
<code>public ResourceResponse retrieveResource(URI resourceURI, Map<String, Serializable> properties) throws IOException, ResourceNotFoundException { logger.entry(); String bytesToSkip = null; if (resourceURI == null) { logger.warn("Resource URI was null"); throw new ResourceNotFoundException("Unable to find resource"); } if (properties.containsKey(BYTES_TO_SKIP)) { bytesToSkip = properties.get(BYTES_TO_SKIP).toString(); } if (resourceURI.getScheme().equals(URL_HTTP_SCHEME) <START> || resourceURI.getScheme().equals(URL_HTTPS_SCHEME)) { <END> logger.debug("Resource URI is HTTP or HTTPS"); String fileAddress = resourceURI.toURL().getFile(); logger.debug("resource name: {}", fileAddress); return doRetrieveProduct(resourceURI, fileAddress, bytesToSkip); } else if (resourceURI.getScheme().equals(URL_FILE_SCHEME)) { logger.debug("Resource URI is a File"); File filePathName = new File(resourceURI); String fileName = filePathName.getName(); logger.debug("resource name: {}", fileName); return doRetrieveProduct(resourceURI, fileName, bytesToSkip); } else { ResourceNotFoundException ce = new ResourceNotFoundException("Resource qualifier ( " + resourceURI.getScheme() + " ) not valid. " + URLResourceReader.TITLE + " requires a qualifier of " + URL_HTTP_SCHEME + " or " + URL_HTTPS_SCHEME + " or " + URL_FILE_SCHEME); logger.throwing(XLogger.Level.DEBUG, ce); logger.exit(); throw ce; } }</code><technical_language>I leave logging of this in update a more verbose. this in handy for debugging in if a bytesToSkip property</technical_language>

Target:
public ResourceResponse retrieveResource(URI resourceURI, Map<String, Serializable> properties) throws IOException, ResourceNotFoundException { logger.entry(); String bytesToSkip = null; if (resourceURI == null) { logger.warn("Resource URI was null"); throw new ResourceNotFoundException("Unable to find resource"); } if (properties.containsKey(BYTES_TO_SKIP)) { bytesToSkip = properties.get(BYTES_TO_SKIP).toString(); logger.debug("bytesToSkip: {}", bytesToSkip); } if (resourceURI.getScheme().equals(URL_HTTP_SCHEME) || resourceURI.getScheme().equals(URL_HTTPS_SCHEME)) { logger.debug("Resource URI is HTTP or HTTPS"); String fileAddress = resourceURI.toURL().getFile(); logger.debug("resource name: {}", fileAddress); return doRetrieveProduct(resourceURI, fileAddress, bytesToSkip); } else if (resourceURI.getScheme().equals(URL_FILE_SCHEME)) { logger.debug("Resource URI is a File"); File filePathName = new File(resourceURI); String fileName = filePathName.getName(); logger.debug("resource name: {}", fileName); return doRetrieveProduct(resourceURI, fileName, bytesToSkip); } else { ResourceNotFoundException ce = new ResourceNotFoundException("Resource qualifier ( " + resourceURI.getScheme() + " ) not valid. " + URLResourceReader.TITLE + " requires a qualifier of " + URL_HTTP_SCHEME + " or " + URL_HTTPS_SCHEME + " or " + URL_FILE_SCHEME); logger.throwing(XLogger.Level.DEBUG, ce); logger.exit(); throw ce; } }
Source:
<code>private List<List<Scan>> getParallelScans() throws SQLException { if (scan == null || (ScanUtil.isLocalIndex(scan) && Bytes.compareTo(context.getScan().getStartRow(), scan.getStartRow()) == 0 && Bytes <START> .compareTo(context.getScan().getStopRow(), scan.getStopRow()) == 0)) { <END> return getParallelScans(EMPTY_BYTE_ARRAY, EMPTY_BYTE_ARRAY); } else { return getParallelScans(scan.getStartRow(), scan.getStopRow()); } }</code><technical_language>Cover ScanUtil method, this code repeated a number of times</technical_language>

Target:
private List<List<Scan>> getParallelScans() throws SQLException { if (!ScanUtil.isConextScan(scan, context)) { return getParallelScans(scan); } return getParallelScans(EMPTY_BYTE_ARRAY, EMPTY_BYTE_ARRAY); }
Source:
<code>public void updateSubscription(Subscription newSubscription) { rateLimiter.updateSubscription(newSubscription); sender.updateSubscription(newSubscription); <START> if (messageReceiver != null) { <END> messageReceiver.update(newSubscription); } this.subscription = newSubscription; }</code><technical_language>for cleaner code, check this consumer is consuming updating subscription avoid null checks. Also, private method startConsuming field instead of a parameter</technical_language>

Target:
public void updateSubscription(Subscription newSubscription) { rateLimiter.updateSubscription(newSubscription); sender.updateSubscription(newSubscription); messageReceiver.update(newSubscription); this.subscription = newSubscription; }
Source:
<code>public SERVICE_FAILURE_ACTIONS getFailureActions() { Pointer buffer = queryServiceConfig2(Winsvc.SERVICE_CONFIG_FAILURE_ACTIONS); SERVICE_FAILURE_ACTIONS result = new SERVICE_FAILURE_ACTIONS(buffer); <START> result.read(); <END> return result; }</code><technical_language>read() call part of SERVICE_FAILURE_ACTIONS(Pointer) constructor</technical_language>

Target:
public SERVICE_FAILURE_ACTIONS getFailureActions() { Pointer buffer = queryServiceConfig2(Winsvc.SERVICE_CONFIG_FAILURE_ACTIONS); SERVICE_FAILURE_ACTIONS result = new SERVICE_FAILURE_ACTIONS(buffer); return result; }
Source:
<code>public String getPath(@Assisted("workspace") String workspaceId) throws IOException { if (projectsFolder != null) { return projectsFolder; } else { <START> Path folder = Paths.get(workspacesFolder + "/" + workspaceId); <END> if (Files.notExists(folder)) { Files.createDirectory(folder).toString(); } return folder.toString(); } }</code><technical_language>Paths.get(workspaceFolder).resolve(workspaceId), cleaner os independent code</technical_language>

Target:
public String getPath(@Assisted("workspace") String workspaceId) throws IOException { if (hostProjectsFolder != null) { return hostProjectsFolder; } else { Path folder = Paths.get(workspacesMountPoint).resolve(workspaceId); if (Files.notExists(folder)) { Files.createDirectory(folder); } return folder.toString(); } }
Source:
<code>public void init(HelixManager helixManager, TableConfig tableConfig) { _helixManager = helixManager; _offlineTableName = tableConfig.getTableName(); _tenantConfig = tableConfig.getTenantConfig(); <START> Preconditions.checkState(tableConfig.isDimTable(), "Not a dimension table: %s" + _offlineTableName); <END> }</code><technical_language>nit: precondition top</technical_language>

Target:
public void init(HelixManager helixManager, TableConfig tableConfig) { Preconditions.checkState(tableConfig.isDimTable(), "Not a dimension table: %s" + _offlineTableName); _helixManager = helixManager; _offlineTableName = tableConfig.getTableName(); _tenantConfig = tableConfig.getTenantConfig(); }
Source:
<code>DigestSaslClient(String mechanism, String protocol, String serverName, CallbackHandler callbackHandler, String authorizationId, boolean hasInitialResponse, Charset charset, String[] qops, String[] ciphers) throws SaslException { super(mechanism, protocol, serverName, callbackHandler, FORMAT.CLIENT, charset, ciphers); this.hasInitialResponse = hasInitialResponse; this.authorizationId = authorizationId; this.clientQops = qops == null ? new String[] {DigestUtils.QOP_AUTH} : qops; this.demandedCiphers = ciphers == null ? new String[] : ciphers; try { this.messageDigest = MessageDigest.getInstance(DigestUtils.messageDigestAlgorithm(mechanism)); } catch (NoSuchAlgorithmException e) { <START> throw new SaslException(getMechanismName() + ": Expected message digest algorithm is not available", e); <END> } }</code><technical_language>need get mechanism error messages converted ElytronMessages, this instead of concatenating values this a formatted message used. unavailable digest error message mechanism implementations</technical_language>

Target:
DigestSaslClient(String mechanism, String protocol, String serverName, CallbackHandler callbackHandler, String authorizationId, boolean hasInitialResponse, Charset charset, String[] qops, String[] ciphers) throws SaslException { super(mechanism, protocol, serverName, callbackHandler, FORMAT.CLIENT, charset, ciphers); this.hasInitialResponse = hasInitialResponse; this.authorizationId = authorizationId; this.clientQops = qops == null ? new String[] {QOP_AUTH} : qops; this.demandedCiphers = ciphers == null ? new String[] : ciphers; try { this.messageDigest = MessageDigest.getInstance(messageDigestAlgorithm(mechanism)); } catch (NoSuchAlgorithmException e) { throw new SaslException(getMechanismName() + ": Expected message digest algorithm is not available", e); } }
Source:
<code>public static void savePrivateMessageAsDraft(PrivateMessage pm) throws NoSuchElementException, ValidationException { composeMessage(pm); if (pmPage.isSaveButtonEnabled()) { info("Clicking Save PM button"); try { pmPage.clickSaveButton(); } catch (NoSuchElementException e) { info("No such button found!"); <START> throw new NoSuchElementException("Couldn't find Save button."); <END> } } assertFormValid(); info("Draft had to be saved"); }</code><technical_language>re-throw exception: throw e add root exception newly created: throw new NoSuchElementException("blah-blah", e)</technical_language>

Target:
public static void savePrivateMessageAsDraft(PrivateMessage pm) throws NoSuchElementException, ValidationException { composeMessage(pm); if (pmPage.isSaveButtonEnabled()) { try { pmPage.clickSaveButton(); } catch (NoSuchElementException e) { throw new NoSuchElementException("Couldn't find Save button.", e); } } assertFormValid(); info("Draft had to be saved"); }
Source:
<code>public void loadNodesFromModels(final List<DMNIncludedModel> includedModels, final ServiceCallback<List<DMNIncludedNode>> callback) { final List<DMNIncludedNode> result = new Vector<>(); final List<Promise> fileLoadPromises = new ArrayList<>(); for (final DMNIncludedModel model : includedModels) { final String path = model.getPath(); final Promise promise = contentService.loadFile(path).then(content -> { diagramService.transform(content, new ServiceCallback<Diagram>() { @Override public void onSuccess(final Diagram item) { final Optional<DMNIncludedModel> diagramImport = getDiagramImport(item, includedModels); final List<DMNIncludedNode> nodes = diagramImport .map(dmn -> diagramUtils .getDRGElements(item) .stream() .map(node -> includedModelFactory.makeDMNIncludeNode(path, dmn, node)) .collect(Collectors.toList())) <START> .orElse(new ArrayList<>()); <END> result.addAll(nodes); } @Override public void onError(final ClientRuntimeError error) { LOGGER.log(Level.SEVERE, error.getMessage()); } }); return promises.resolve(); } ); fileLoadPromises.add(promise); } promises.all(fileLoadPromises.toArray(new Promise[]{})).then(p -> { callback.onSuccess(result); return promises.resolve(); }); }</code><technical_language>orElse(Collections.emptyList()) manipulating nodes afterwards</technical_language>

Target:
public void loadNodesFromModels(final List<DMNIncludedModel> includedModels, final ServiceCallback<List<DMNIncludedNode>> callback) { final List<DMNIncludedNode> result = new Vector<>(); if (includedModels.isEmpty()) { callback.onSuccess(result); } else { loadDMNDefinitions() .then(existingDefinitions -> promises.all(includedModels, model -> loadNodes(existingDefinitions, model, result)) .then(p -> { callback.onSuccess(result); return promises.resolve(); })); } }
Source:
<code><START> public void setSessionLocaleFieldId() { <END> String key = ""; if (Objects.isNull(serviceManager.getUserService().getAuthenticatedUser())) { key = ConfigCore.getParameter("language.force-default", "de"); } else { try { User user = serviceManager.getUserService().getById(serviceManager.getUserService().getAuthenticatedUser().getId()); key = ConfigCore.getParameter("language.force-default", user.getLanguage()); } catch (DAOException e) { logger.error("Error in retrieving user : " + e.getMessage()); } } Locale locale = new Locale.Builder().setLanguageTag(key).build(); if (LocaleUtils.isAvailableLocale(locale)) { FacesContext context = FacesContext.getCurrentInstance(); if (Objects.nonNull(context.getViewRoot())) { context.getViewRoot().setLocale(locale); context.getExternalContext().getSessionMap().put(SESSION_LOCALE_FIELD_ID, locale); } } }</code><technical_language>Method public this method is this class</technical_language>

Target:
private void setSessionLocaleFieldId() { String key = ""; if (Objects.isNull(serviceManager.getUserService().getAuthenticatedUser())) { key = ConfigCore.getParameter(Parameters.LANGUAGE_DEFAULT, DefaultValues.LANGUAGE_DEFAULT); } else { try { User user = serviceManager.getUserService().getById(serviceManager.getUserService().getAuthenticatedUser().getId()); key = user.getLanguage(); } catch (DAOException e) { Helper.setErrorMessage("Error in retrieving user ", logger, e); } } Locale locale = new Locale.Builder().setLanguageTag(key).build(); if (LocaleUtils.isAvailableLocale(locale)) { FacesContext context = FacesContext.getCurrentInstance(); if (Objects.nonNull(context.getViewRoot())) { context.getViewRoot().setLocale(locale); context.getExternalContext().getSessionMap().put(SESSION_LOCALE_FIELD_ID, locale); } } }
Source:
<code>public void onLanguageTabSelected(String selectedLanguageCode) { <START> Log.e("####", "HERE"); <END> searchLanguageCode = selectedLanguageCode; startSearch(query, query != null && query.length() > 1); }</code><technical_language>is Log.e for</technical_language>

Target:
public void onLanguageTabSelected(String selectedLanguageCode) { searchLanguageCode = selectedLanguageCode; startSearch(query, query != null && query.length() > 1); }
Source:
<code>private Collection<ControlModel> convertBannerButtons(Collection<BannerButton> buttons) { Collection<ControlModel> convertedItems = new ArrayList<ControlModel>(); <START> if (!(buttons == null)) { <END> for (BannerButton button : buttons) { convertedItems.add(new CustomControlModel(button)); } } return convertedItems; }</code><technical_language>suggestion if (buttons != null) {</technical_language>

Target:
private Collection<CustomControlModel> convertBannerButtons(Collection<BannerButton> buttons) { if (buttons != null) { return buttons.stream().map(CustomControlModel::new).collect(Collectors.toList()); } else { return new ArrayList<CustomControlModel>(); } }
Source:
<code>private static void saveToFile(Mets mets, URI xmlFile) throws JAXBException, IOException { FileManagementInterface fileManagementModule = new KitodoServiceLoader<FileManagementInterface>( FileManagementInterface.class).loadModule(); <START> OutputStream out = fileManagementModule.write(fileManagementModule.getFile(xmlFile).toURI()); <END> JAXBContext context = JAXBContext.newInstance(Mets.class); Marshaller marshal = context.createMarshaller(); marshal.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); marshal.marshal(mets, out); }</code><technical_language>Please close stream. a try-with-resources statement for this: URI metsFileUri = fileManagementModule.getFile(xmlFile).toURI(); try (OutputStream outputStream = fileManagementModule.write(metsFileUri)) { marshal.marshal(mets, outputStream); } _marshal_ a _marshaller_ (a mashal is a law enforcement officer) leave you. :wink:</technical_language>

Target:
private static void saveToFile(Mets mets, URI xmlFile) throws JAXBException, IOException { URI metsFileUri = fileManagementModule.getFile(xmlFile).toURI(); try (OutputStream outputStream = fileManagementModule.write(metsFileUri)) { JAXBContext context = JAXBContext.newInstance(Mets.class); Marshaller marshaller = context.createMarshaller(); marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); marshaller.marshal(mets, outputStream); } }
Source:
<code>public StreamLogFiles(ServerContext serverContext, boolean noVerify) { logDir = Paths.get(serverContext.getServerConfig().get("--log-path").toString(), "log"); writeChannels = new ConcurrentHashMap<>(); channelsToSync = new HashSet<>(); this.verify = !noVerify; this.dataStore = StreamLogDataStore.builder().dataStore(serverContext.getDataStore()).build(); String logSizeLimitPercParam = (String) serverContext.getServerConfig().get("--log-size-quota-percentage"); logSizeLimitPercentage = Double.parseDouble(logSizeLimitPercParam); initStreamLogDirectory(); long initialLogSize = estimateSize(logDir); log.info("StreamLogFiles: size is bytes, limit {}", logDir, initialLogSize, logSizeLimit); <START> logSizeQuota = new ResourceQuota("LogSizeQuota", logSizeLimit); <END> logSizeQuota.consume(initialLogSize); verifyLogs(); logMetadata = new LogMetadata(); initializeLogMetadata(); if (Math.max(logMetadata.getGlobalTail(), 0L) < getTrimMark()) { syncTailSegment(getTrimMark() - 1); } }</code><technical_language>Is a explicitly initialize logSizeLimit in this constructor? I initialization of logSizeLimit is initStreamLogDirectory(), confusing, right</technical_language>

Target:
public StreamLogFiles(ServerContext serverContext, boolean noVerify) { logDir = Paths.get(serverContext.getServerConfig().get("--log-path").toString(), "log"); writeChannels = new ConcurrentHashMap<>(); channelsToSync = new HashSet<>(); this.verify = !noVerify; this.dataStore = StreamLogDataStore.builder().dataStore(serverContext.getDataStore()).build(); String logSizeLimitPercentageParam = (String)serverContext.getServerConfig().get("--log-size-quota-percentage"); final double logSizeLimitPercentage = Double.parseDouble(logSizeLimitPercentageParam); if (logSizeLimitPercentage < 0.0 || 100.0 < logSizeLimitPercentage) { String msg = String.format("Invalid quota: quota(%d)% must be between 0-100%", logSizeLimitPercentage); throw new LogUnitException(msg); } long fileSystemCapacity = initStreamLogDirectory(); logSizeLimit = (long)(fileSystemCapacity * logSizeLimitPercentage / 100.0); long initialLogSize = estimateSize(logDir); log.info("StreamLogFiles: size is bytes, limit {}", logDir, initialLogSize, logSizeLimit); logSizeQuota = new ResourceQuota("LogSizeQuota", logSizeLimit); logSizeQuota.consume(initialLogSize); verifyLogs(); logMetadata = new LogMetadata(); initializeLogMetadata(); if (Math.max(logMetadata.getGlobalTail(), 0L) < getTrimMark()) { syncTailSegment(getTrimMark() - 1); } }
Source:
<code>private Point getPointForTime(long time) { return UIThreadRunnable.syncExec((Result<Point>) () -> { ITimeDataProvider timeDataProvider = widget.getTimeDataProvider(); <START> if (timeDataProvider.getTime0() >= time || timeDataProvider.getTime1() <= time) { <END> return null; } int x = widget.getXForTime(time); Rectangle bounds = widget.getItemBounds(fEntry); int y = bounds.y + bounds.height / 2; return new Point(x, y); }); }</code><technical_language>time bound limits allowed</technical_language>

Target:
private Point getPointForTime(long time) { return UIThreadRunnable.syncExec((Result<Point>) () -> { ITimeDataProvider timeDataProvider = widget.getTimeDataProvider(); if (timeDataProvider.getTime0() > time || timeDataProvider.getTime1() < time) { return null; } int x = widget.getXForTime(time); Rectangle bounds = widget.getItemBounds(fEntry); int y = bounds.y + bounds.height / 2; return new Point(x, y); }); }
Source:
<code>private Guid findAvailableStorageDomain( Map<Guid, Long> targetDomainsSize, long diskSize, List<Guid> storageIds) { Guid dest = storageIds.stream() <START> .min(Comparator.comparingLong(targetDomainsSize::get)) <END> .orElse(storageIds.get(0)); long destSize = targetDomainsSize.get(dest); targetDomainsSize.put(dest, destSize - diskSize); return dest; }</code><technical_language>'max'</technical_language>

Target:
private Guid findAvailableStorageDomain( Map<Guid, Long> targetDomainsSize, long diskSize, List<Guid> storageIds) { Guid dest = storageIds.stream() .max(Comparator.comparingLong(targetDomainsSize::get)) .orElse(storageIds.get(0)); long destSize = targetDomainsSize.get(dest); targetDomainsSize.put(dest, destSize - diskSize); return dest; }
Source:
<code><START> public static <T extends Cborable> PaddedCipherText build(SymmetricKey from, T secret, int paddingBlockSize) { <END> byte[] nonce = from.createNonce(); byte[] cipherText = from.encrypt(pad(secret.serialize(), paddingBlockSize), nonce); return new PaddedCipherText(new CipherText(nonce, cipherText)); }</code><technical_language>validate paddingBlockSize int value</technical_language>

Target:
public static <T extends Cborable> PaddedCipherText build(SymmetricKey from, T secret, int paddingBlockSize) { if (paddingBlockSize < 1) throw new IllegalStateException("Invalid padding block size: " + paddingBlockSize); byte[] nonce = from.createNonce(); byte[] cipherText = from.encrypt(pad(secret.serialize(), paddingBlockSize), nonce); return new PaddedCipherText(new CipherText(nonce, cipherText)); }
Source:
<code>public void doVisitRandomArticle() { final Bus bus = app.getBus(); Handler randomHandler = new Handler(new Handler.Callback(){ @Override public boolean handleMessage(Message msg) { RandomArticleIdTask randomTask = new RandomArticleIdTask(app.getAPIForSite(app.getPrimarySite()), app.getPrimarySite(), app) { <START> private ProgressDialog progressDialog; <END> @Override public void onBeforeExecute() { setState(true); } @Override public void onFinish(PageTitle title) { if (activityStopped) { return; } setState(false); Log.d("Wikipedia", "Random article title pulled: " + title); if (title != null) { HistoryEntry historyEntry = new HistoryEntry(title, HistoryEntry.SOURCE_RANDOM); bus.post(new NewWikiPageNavigationEvent(title, historyEntry)); } else { Toast.makeText(app, app.getString(R.string.error_network_error), Toast.LENGTH_LONG).show(); } } @Override public void onCatch(Throwable caught) { if (activityStopped) { return; } setState(false); Log.d("Wikipedia", "Random article ID retrieval failed"); curRandomArticleIdTask = null; Toast.makeText(app, app.getString(R.string.error_network_error), Toast.LENGTH_LONG).show(); } }; if (curRandomArticleIdTask != null) { curRandomArticleIdTask.cancel(); } curRandomArticleIdTask = randomTask; curRandomArticleIdTask.execute(); return true; } }); randomHandler.removeMessages(MESSAGE_RND); Message randomMessage = Message.obtain(); randomMessage.what = MESSAGE_RND; randomMessage.obj = "random"; randomHandler.sendMessage(randomMessage); }</code><technical_language>anymore</technical_language>

Target:
public void doVisitRandomArticle() { final Bus bus = app.getBus(); Handler randomHandler = new Handler(new Handler.Callback(){ @Override public boolean handleMessage(Message msg) { RandomArticleIdTask randomTask = new RandomArticleIdTask(app.getAPIForSite(app.getPrimarySite()), app.getPrimarySite(), app) { private ProgressDialog progressDialog; @Override public void onBeforeExecute() { setState(true); } @Override public void onFinish(PageTitle title) { if (isClosed) { return; } setState(false); Log.d("Wikipedia", "Random article title pulled: " + title); if (title != null) { HistoryEntry historyEntry = new HistoryEntry(title, HistoryEntry.SOURCE_RANDOM); bus.post(new NewWikiPageNavigationEvent(title, historyEntry)); } else { Toast.makeText(app, app.getString(R.string.error_network_error), Toast.LENGTH_LONG).show(); } } @Override public void onCatch(Throwable caught) { if (isClosed) { return; } setState(false); Log.d("Wikipedia", "Random article ID retrieval failed"); curRandomArticleIdTask = null; Toast.makeText(app, app.getString(R.string.error_network_error), Toast.LENGTH_LONG).show(); } }; if (curRandomArticleIdTask != null) { curRandomArticleIdTask.cancel(); } curRandomArticleIdTask = randomTask; curRandomArticleIdTask.execute(); return true; } }); randomHandler.removeMessages(MESSAGE_RND); Message randomMessage = Message.obtain(); randomMessage.what = MESSAGE_RND; randomMessage.obj = "random"; randomHandler.sendMessage(randomMessage); }
Source:
<code>public void updateModel(final OperationContext context, ModelNode model, ListAttributeDefinition attributeDefinition, ModelNode listAttribute) throws OperationFailedException { ModelNode value = VALUE.resolveModelAttribute(context, model); ModelNode index = INDEX.resolveModelAttribute(context, model); <START> List<ModelNode> res = new LinkedList<>(listAttribute.asList()); <END> if (index.isDefined()) { res.remove(index.asInt()); } else { res.remove(value); } listAttribute.set(res); }</code><technical_language>ArrayList perform here</technical_language>

Target:
void updateModel(final OperationContext context, ModelNode model, ListAttributeDefinition attributeDefinition, ModelNode listAttribute) throws OperationFailedException { ModelNode value = VALUE.resolveModelAttribute(context, model); ModelNode index = INDEX.resolveModelAttribute(context, model); List<ModelNode> res = new ArrayList<>(listAttribute.asList()); if (index.isDefined()) { res.remove(index.asInt()); } else { res.remove(value); } listAttribute.set(res); }
Source:
<code>private static JavaRDD<Vector> parsedToVectorRDD(JavaRDD<String[]> parsedRDD) { <START> return parsedRDD.map(new Function<String[], Vector>() { <END> @Override public Vector call(String[] tokens) { int numTokens = tokens.length; double[] values = new double[numTokens]; for (int i = 0; i < numTokens; i++) { values[i] = Double.parseDouble(tokens[i]); } return Vectors.dense(values); } }); }</code><technical_language>chagne here, whitespace</technical_language>

Target:
private static JavaRDD<Vector> parsedToVectorRDD(JavaRDD<String[]> parsedRDD) { return parsedRDD.map(new Function<String[],Vector>() { @Override public Vector call(String[] tokens) { int numTokens = tokens.length; int i = 0; double[] values = new double[numTokens]; for (String token : tokens) { values[i] = Double.parseDouble(token); i++; } return Vectors.dense(values); } }); }
Source:
<code>public SourceFile testParameterPath(@ApiParam(value = "Tool id", required = true) @PathParam("containerId") Long containerId, @QueryParam("tag") String tag, @QueryParam("type") String type){ <START> if (type.toLowerCase().equals("cwl")) { <END> return entryVersionHelper.getSourceFile(containerId, tag, FileType.CWL_TEST_JSON); } else { return entryVersionHelper.getSourceFile(containerId, tag, FileType.WDL_TEST_JSON); } }</code><technical_language>Enum (going backward)</technical_language>

Target:
public SourceFile testParameterPath(@ApiParam(value = "Tool id", required = true) @PathParam("containerId") Long containerId, @QueryParam("tag") String tag, @QueryParam("type") String type){ if (type.toLowerCase().equals(DescriptorType.CWL.toString())) { return entryVersionHelper.getSourceFile(containerId, tag, FileType.CWL_TEST_JSON); } else { return entryVersionHelper.getSourceFile(containerId, tag, FileType.WDL_TEST_JSON); } }
Source:
<code>public void testDateConvertUtils() throws Exception { Constructor<DateConvertUtils> constructor = DateConvertUtils.class.getDeclaredConstructor(); assertThat(constructor.isAccessible(), is(false)); constructor.setAccessible(true); <START> assertNotNull(constructor.newInstance()); <END> constructor.setAccessible(false); }</code><technical_language>[x] assertNotNull(actual) -> assertThat(actual, notNullValue()) --- modified. 7a881bed48ed8c2e89321c9c793e397de5300eef</technical_language>

Target:
public void testDateConvertUtils() throws Exception { Constructor<DateConvertUtils> constructor = DateConvertUtils.class.getDeclaredConstructor(); assertThat(constructor.isAccessible(), is(false)); constructor.setAccessible(true); assertThat(constructor.newInstance(), notNullValue()); constructor.setAccessible(false); }
Source:
<code>public void multipleQueriesTest() { createAndExecuteVDB(VDB_NAME_MULTIPLE, PROJECT_NAME, NAME_ORACLE_MODEL); setTextToScrapbookAndExecute(QUERY_MULTIPLE); SQLResult result = DatabaseDevelopmentPerspective.getInstance().getSqlResultsView().getByOperation("Group Execution"); if(result.getStatus().equals("Succeeded")) { <START> }else{ <END> new NoButton(new DefaultShell("Continue Execution") ).click(); setTextToScrapbookAndExecute("delete from status where status_id = 97 or status_id = 98 or status_id = 99;"); fail("Queries status is not Succeeded, something is wrong!!"); } }</code><technical_language>is this sth moved method</technical_language>

Target:
public void multipleQueriesTest() { createAndExecuteVDB(VDB_NAME_MULTIPLE, PROJECT_NAME, NAME_ORACLE_MODEL); setTextToScrapbookAndExecute(QUERY_MULTIPLE); SQLResult result = DatabaseDevelopmentPerspective.getInstance().getSqlResultsView().getByOperation("Group Execution"); if (new ShellIsAvailable("Continue Execution").test()) { new NoButton(new DefaultShell("Continue Execution")).click(); } assertEquals("Succeeded", result.getStatus()); }
Source:
<code>private void addOperation(final VdcOperation<?, ?> operation, final boolean isPublic) { if ((loggedIn || isPublic) && (!operationQueue.contains(operation) <START> || operation.allowDuplicates()) && operationQueue.add(operation)) { <END> processor.processOperation(this); } }</code><technical_language>[1] a bit complex expression in if. I assign subparts this: boolean isAllowedToExecute = loggedIn || isPublic; boolean canBeAddedToList = !operationQueue.contains(operation) || operation.allowDuplicates(); if (isAllowedToExecute && canBeAddedToList && operationQueue.add(operation)) { ... } [2] if user is allowed execute operation this code silently ignores it. notify user somehow? For example call onFalure callback</technical_language>

Target:
private boolean addOperation(final VdcOperation<?, ?> operation, final boolean isPublic) { final boolean isAllowedToExecute = loggedIn || isPublic; final boolean operationCanBeAdded = !operationQueue.contains(operation) || operation.allowDuplicates(); if (isAllowedToExecute) { if (operationCanBeAdded && operationQueue.add(operation)) { processor.processOperation(this); } } return isAllowedToExecute; }
Source:
<code>private <T> void notifyListeners(T t, List<Consumer<T>> lsnrs) { for (Consumer<T> lsnr : lsnrs) { try { lsnr.accept(t); } catch (Exception e) { <START> log.warning("Metric listener error", e); <END> } } }</code><technical_language>NPE in case of default constructor. mark 'log' field 'final' initialize in default constructor</technical_language>

Target:
private <T> void notifyListeners(T t, List<Consumer<T>> lsnrs) { for (Consumer<T> lsnr : lsnrs) { try { lsnr.accept(t); } catch (Exception e) { U.warn(log, "Metric listener error", e); } } }
Source:
<code>private Request buildRequest(Message message) throws EndpointAddressResolutionException { Request request = client.newRequest(endpoint.resolveFor(message)) .method(HttpMethod.POST) .header(HttpHeader.KEEP_ALIVE.toString(), "true") .header(MESSAGE_ID.getName(), message.getId()) <START> .header(HttpHeader.CONTENT_TYPE.toString(), MediaType.APPLICATION_JSON) <END> .timeout(timeout, TimeUnit.MILLISECONDS) .content(new BytesContentProvider(message.getData())); return appendTraceInfo(request, message); }</code><technical_language>JSON is hardcoded here</technical_language>

Target:
private Request buildRequest(Message message) throws EndpointAddressResolutionException { Request request = client.newRequest(endpoint.resolveFor(message)) .method(HttpMethod.POST) .header(HttpHeader.KEEP_ALIVE.toString(), "true") .header(MESSAGE_ID.getName(), message.getId()) .header(HttpHeader.CONTENT_TYPE.toString(), contentTypeToMediaType.apply(message.getContentType())) .timeout(timeout, TimeUnit.MILLISECONDS) .content(new BytesContentProvider(message.getData())); return appendTraceInfo(request, message); }
Source:
<code>private void finishCommon() throws ContainedException { if (!unknownSubjects.isEmpty()) { if(statements.isEmpty() && restoredStatements.isEmpty()) { throw new BadSubjectException(unknownSubjects.keySet(), uris); } else { log.debug(String.format(Locale.ROOT, <START> "Unrecognized subjects: %s. Expected only sitelinks and subjects starting with %s and %s", <END> unknownSubjects.keySet(), uris.entityData(), uris.entity())); } } if (revisionId == null) { throw new ContainedException("Didn't get a revision id for " + statements); } if (lastModified == null) { throw new ContainedException("Didn't get a last modified date for " + statements); } statements.add(new StatementImpl(entityUriImpl, new URIImpl(SchemaDotOrg.VERSION), revisionId)); statements.add(new StatementImpl(entityUriImpl, new URIImpl(SchemaDotOrg.DATE_MODIFIED), lastModified)); statements.addAll(restoredStatements); }</code><technical_language>log.debug("Unrecognized subjects: {}." blah blah instead of String.format. skips actual string formatting if debug log level on</technical_language>

Target:
private void finishCommon() throws ContainedException { if (!unknownSubjects.isEmpty()) { if(statements.isEmpty() && restoredStatements.isEmpty()) { throw new BadSubjectException(unknownSubjects.keySet(), uris); } else { log.debug("Unrecognized subjects: {}. Expected only sitelinks and subjects starting with and {}", unknownSubjects.keySet(), uris.entityData(), uris.entity()); } } if (revisionId == null) { throw new ContainedException("Didn't get a revision id for " + statements); } if (lastModified == null) { throw new ContainedException("Didn't get a last modified date for " + statements); } statements.add(new StatementImpl(entityUriImpl, new URIImpl(SchemaDotOrg.VERSION), revisionId)); statements.add(new StatementImpl(entityUriImpl, new URIImpl(SchemaDotOrg.DATE_MODIFIED), lastModified)); statements.addAll(restoredStatements); }
Source:
<code>public FilterPanel(UI ui, IModel model, PanelControl parentPanelControl, int panelIndex) { super(model, parentPanelControl, panelIndex); this.ui = ui; getChildren().addAll(createPanelMenuBar(), createFilterBox()); this.setOnMouseClicked(e-> { <START> ui.triggerEvent(new PanelClickedEvent(this.panelIndex)); <END> requestFocus(); }); focusedProperty().addListener((unused, wasFocused, isFocused) -> { if (isFocused) { getStyleClass().add("panel-focused"); } else { getStyleClass().remove("panel-focused"); } }); }</code><technical_language>Nice catch! prevent this happening factor event handler out method. a lexical reference local panelIndex</technical_language>

Target:
public FilterPanel(UI ui, IModel model, PanelControl parentPanelControl, int panelIndex) { super(model, parentPanelControl, panelIndex); this.ui = ui; getChildren().addAll(createPanelMenuBar(), createFilterBox()); setUpEventHandler(); focusedProperty().addListener((unused, wasFocused, isFocused) -> { if (isFocused) { getStyleClass().add("panel-focused"); } else { getStyleClass().remove("panel-focused"); } }); }
Source:
<code>public void removeTable(Table tableInstance) { <START> getResource().getContents().remove(tableInstance); <END> }</code><technical_language>here; work controlled models</technical_language>

Target:
public void removeTable(Table tableInstance) { if (getResource() != null) { getResource().getContents().remove(tableInstance); } }
Source:
<code>private String token(final String home, final String code) throws IOException { final String uri = new Href(this.github) .path("login").path("oauth").path("access_token") .toString(); final XmlResponse xmlres = new JdkRequest(uri) .method("POST") .header("Accept", "application/xml") .body() .formParam("client_id", this.app) .formParam("redirect_uri", home) .formParam("client_secret", this.key) .formParam("code", code) .back() .fetch().as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_OK) .as(XmlResponse.class); <START> String tokenString = null; <END> try { tokenString = xmlres.xml() .xpath("/OAuth/access_token/text()").get(0); } catch (final IndexOutOfBoundsException exce) { throw new HttpException( HttpURLConnection.HTTP_BAD_REQUEST,"Invalid XML",exce); } return tokenString; }</code><technical_language>@sebing get rid of this variable</technical_language>

Target:
private String token(final String home, final String code) throws IOException { final String uri = new Href(this.github) .path("login").path("oauth").path("access_token") .toString(); final List<String> tokens = new JdkRequest(uri) .method("POST") .header("Accept", "application/xml") .body() .formParam("client_id", this.app) .formParam("redirect_uri", home) .formParam("client_secret", this.key) .formParam("code", code) .back() .fetch().as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_OK) .as(XmlResponse.class) .xml().xpath("/OAuth/access_token/text()"); if (tokens.isEmpty()) { throw new HttpException( HttpURLConnection.HTTP_BAD_REQUEST, "No access token" ); } return tokens.get(0); }
Source:
<code>public Iterable<Organization> iterate( @NotNull(message = "login is never NULL") final String login ) { return new MkIterable<Organization>( this.storage, <START> "/github/orgs/org/login", <END> new MkIterable.Mapping<Organization>() { @Override public Organization map(final XML xml) { return MkOrganizations.this.get( xml.xpath("login/text()").get(0) ); } } ); }</code><technical_language>String.format("%s/org/login", this.xpath())</technical_language>

Target:
public Iterable<Organization> iterate( @NotNull(message = "login is never NULL") final String login ) { return new MkIterable<Organization>( this.storage, String.format("%s/org/login", this.xpath()), new MkIterable.Mapping<Organization>() { @Override public Organization map(final XML xml) { return MkOrganizations.this.get( xml.xpath("login/text()").get(0) ); } } ); }
Source:
<code>public static AmazonS3 createS3ClientForRadosGW(String endpoint) { ClientConfiguration clientConfiguration = new ClientConfiguration(); SignerFactory.registerSigner("S3Signer", S3Signer.class); clientConfiguration.setSignerOverride("S3SignerType"); clientConfiguration.setProtocol(Protocol.HTTPS); <START> AmazonS3 s3Client = new AmazonS3Client(new BasicAWSCredentials("accesskey", "secret"), clientConfiguration); <END> s3Client.setEndpoint(endpoint); s3Client.setS3ClientOptions(new S3ClientOptions().withPathStyleAccess(true)); return s3Client; }</code><technical_language>Is this repeated (e.g. S3Config)? reuse</technical_language>

Target:
public static AmazonS3 createS3ClientForRadosGW(String endpoint) { val clientConfiguration = new ClientConfiguration(); SignerFactory.registerSigner("S3Signer", S3Signer.class); clientConfiguration.setSignerOverride("S3SignerType"); clientConfiguration.setProtocol(Protocol.HTTPS); val s3Client = new AmazonS3Client(new BasicAWSCredentials("accesskey", "secret"), clientConfiguration); s3Client.setEndpoint(endpoint); s3Client.setS3ClientOptions(new S3ClientOptions().withPathStyleAccess(true)); return s3Client; }
Source:
<code>public void purgeDeletedKeySnippets() { KeyAsyncClient keyAsyncClient = createAsyncClient(); keyAsyncClient.purgeDeletedKey("deletedKeyName") .subscribe(purgeResponse -> <START> System.out.println("Successfully Purged deleted Key \n")); <END> END: com.azure.security.keyvault.keys.async.keyclient.purgeDeletedKey#string }</code><technical_language>need \n</technical_language>

Target:
public void purgeDeletedKeySnippets() { KeyAsyncClient keyAsyncClient = createAsyncClient(); keyAsyncClient.purgeDeletedKey("deletedKeyName") .subscribe(purgeResponse -> System.out.println("Successfully Purged deleted Key")); END: com.azure.security.keyvault.keys.async.keyclient.purgeDeletedKey#string }
Source:
<code>public void containsConversion(Class<?> from, Class<?> to) { isNotNull(); boolean foundMatchingConversion = false; for ( GroupConversionDescriptor groupConversionDescriptor : actual ) { if ( groupConversionDescriptor.getFrom().equals( from ) && groupConversionDescriptor.getTo().equals( to ) ) { foundMatchingConversion = true; break; } } if ( !foundMatchingConversion ) { <START> fail( String.format( Locale.getDefault(), "<%s> does not contain a conversion from <%s> to <%s>.", actual, from, to ) ); <END> } }</code><technical_language>@marko-bekhta Is this a left-over? I.e. planning revert this change discussion above? question for some more places Locale.getDefault() is now</technical_language>

Target:
public void containsConversion(Class<?> from, Class<?> to) { isNotNull(); boolean foundMatchingConversion = false; for ( GroupConversionDescriptor groupConversionDescriptor : actual ) { if ( groupConversionDescriptor.getFrom().equals( from ) && groupConversionDescriptor.getTo().equals( to ) ) { foundMatchingConversion = true; break; } } if ( !foundMatchingConversion ) { fail( String.format( "<%s> does not contain a conversion from <%s> to <%s>.", actual, from, to ) ); } }
Source:
<code>public void reboot() { String cmd = ""; if (OS_LINUX.equals(getOsName()) || OS_MAC_OSX.equals(getOsName())) { cmd = "reboot"; } else if (getOsName().toLowerCase().startsWith(OS_WINDOWS)) { cmd = "shutdown -r"; } else { logger.error("Unsupported OS for reboot()"); return; } <START> Command command = new Command(cmd); <END> command.setTimeout(60); CommandStatus status = this.executorService.execute(command); if ((Integer) status.getExitStatus().getExitValue() != 0) { logger.error("failed to issue reboot"); } }</code><technical_language>externalised method (see line 200)</technical_language>

Target:
public void reboot() { if (OS_LINUX.equals(getOsName()) || OS_MAC_OSX.equals(getOsName())) { executeCommand(new String[] { "reboot" }); } else if (getOsName().toLowerCase().startsWith(OS_WINDOWS)) { executeCommand(new String[] { "shutdown", "-r" }); } else { logger.error("Unsupported OS for reboot()"); } }
Source:
<code>private int getNextPosition() throws CoreException { <START> if (nextMemberPosition == -1) { <END> nextMemberPosition = 0; while (nextMemberPosition < MAX_MEMBER_COUNT && getMemberRecord(nextMemberPosition) != 0) { nextMemberPosition++; } } return nextMemberPosition; }</code><technical_language>Better: nextMemberPosition < 0</technical_language>

Target:
private int getNextPosition() throws CoreException { if (nextMemberPosition < 0) { nextMemberPosition = 0; while (nextMemberPosition < MAX_MEMBER_COUNT && getMemberRecord(nextMemberPosition) != 0) { nextMemberPosition++; } } return nextMemberPosition; }
Source:
<code>private void handleControlCarbonMessage(ControlCarbonMessage controlCarbonMessage, PatternPathRouter. RoutableDestination<Object> routableEndpoint, Session session) { Object webSocketEndpoint = routableEndpoint.getDestination(); Map<String, String> paramValues = routableEndpoint.getGroupNameValues(); Method method = new EndpointDispatcher().getOnPongMessageMethod(webSocketEndpoint); if (method != null) { List<Object> parameterList = new LinkedList<>(); Arrays.stream(method.getParameters()).forEach( parameter -> { if (parameter.getType() == PongMessage.class) { parameterList.add(new WebSocketPongMessage(controlCarbonMessage.readBytes())); } else if (parameter.getType() == Session.class) { parameterList.add(session); } else if (parameter.getType() == String.class) { PathParam pathParam = parameter.getAnnotation(PathParam.class); if (pathParam != null) { parameterList.add(paramValues.get(pathParam.value())); } else { throw new IllegalArgumentException("String parameters " + "without @PathParam annotation"); } } else { <START> parameterList.add(null); <END> } } ); } }</code><technical_language>IMO add new Object() avoid null pointer exceptions. Consider new Object()</technical_language>

Target:
private void handleControlCarbonMessage(ControlCarbonMessage controlCarbonMessage, PatternPathRouter. RoutableDestination<Object> routableEndpoint, Session session) { Object webSocketEndpoint = routableEndpoint.getDestination(); Map<String, String> paramValues = routableEndpoint.getGroupNameValues(); Optional<Method> methodOptional = new EndpointDispatcher().getOnPongMessageMethod(webSocketEndpoint); try { methodOptional.ifPresent( method -> { List<Object> parameterList = new LinkedList<>(); Arrays.stream(method.getParameters()).forEach( parameter -> { if (parameter.getType() == PongMessage.class) { parameterList.add(new WebSocketPongMessage(controlCarbonMessage.readBytes())); } else if (parameter.getType() == Session.class) { parameterList.add(session); } else if (parameter.getType() == String.class) { PathParam pathParam = parameter.getAnnotation(PathParam.class); if (pathParam != null) { parameterList.add(paramValues.get(pathParam.value())); } else { throw new IllegalArgumentException("String parameters " + "without @PathParam annotation"); } } else { parameterList.add(null); } } ); executeMethod(method, webSocketEndpoint, parameterList, session); } ); } catch (Throwable throwable) { handleError(throwable, routableEndpoint, session); } }