auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void testUpdateAnnotation() throws IOException { DocumentModel file = session.createDocumentModel("/", "testDoc", "File"); file = session.createDocument(file); fetchInvalidations(); String xpath = "file:content"; Annotation annotation = new AnnotationImpl(); annotation.setOpacity(0.5); annotation.setName("testAnnotation"); annotation = annotationService.createAnnotation(session, file.getId(), xpath, annotation); fetchInvalidations(); annotation.setName("testUpdatedAnnotation"); annotation.setSecurity("Private"); String jsonAnnotation = MarshallerHelper.objectToJson(annotation, CtxBuilder.get()); <START> try (CloseableClientResponse response = getResponse(RequestType.PUT, <END> "id/" + file.getId() + "/@annotation/" + xpath + "/" + annotation.getId(), jsonAnnotation)) { assertEquals(Response.Status.OK.getStatusCode(), response.getStatus()); fetchInvalidations(); Annotation updatedAnnotation = annotationService.getAnnotation(session, file.getId(), xpath, annotation.getId()); assertEquals(0.5, updatedAnnotation.getOpacity(), 0.0); assertEquals("testUpdatedAnnotation", updatedAnnotation.getName()); assertEquals("Private", updatedAnnotation.getSecurity()); } }</code><technical_language>create a n ew Annotation ? code rely a PUT, able send name and/or security updates persisted objects. this allow check need put id in path body object</technical_language>

Target:
public void testUpdateAnnotation() throws IOException { DocumentModel file = session.createDocumentModel("/", "testDoc", "File"); file = session.createDocument(file); fetchInvalidations(); String xpath = "file:content"; Annotation annotation = new AnnotationImpl(); annotation.setOpacity(0.5); annotation.setName("testAnnotation"); annotation.setDocumentId(file.getId()); annotation.setXpath(xpath); annotation = annotationService.createAnnotation(session, annotation); fetchInvalidations(); annotation.setName("testUpdatedAnnotation"); annotation.setSecurity("Private"); String jsonAnnotation = MarshallerHelper.objectToJson(annotation, CtxBuilder.get()); try (CloseableClientResponse response = getResponse(RequestType.PUT, "id/" + file.getId() + "/@annotation", jsonAnnotation)) { assertEquals(Response.Status.OK.getStatusCode(), response.getStatus()); fetchInvalidations(); Annotation updatedAnnotation = annotationService.getAnnotation(session, annotation.getId()); assertEquals(0.5, updatedAnnotation.getOpacity(), 0.0); assertEquals("testUpdatedAnnotation", updatedAnnotation.getName()); assertEquals("Private", updatedAnnotation.getSecurity()); } }
Source:
<code>protected TmfTimeRange getSignalTimeRange(ITmfTimestamp startTime) { if (startTime == null) { return TmfTimeRange.NULL_RANGE; } fLock.lock(); try { ITmfTrace trace = fTrace; long offset = 0; if (trace != null) { TmfTimeRange currentRange = TmfTraceManager.getInstance().getTraceContext(trace).getWindowRange(); offset = currentRange.getEndTime().getDelta(currentRange.getStartTime()).toNanos(); } ITmfTimestamp initialEndOfWindow = <START> offset == 0 ? startTime : TmfTimestamp.create(startTime.getValue() + offset, startTime.getScale()); <END> return new TmfTimeRange(startTime, initialEndOfWindow); } finally { fLock.unlock(); } }</code><technical_language>kinda redundant , avoid creating object</technical_language>

Target:
protected TmfTimeRange getSignalTimeRange(ITmfTimestamp startTime) { if (startTime == null) { return TmfTimeRange.NULL_RANGE; } fLock.lock(); try { ITmfTrace trace = fTrace; long offset = 0; if (trace != null) { TmfTimeRange currentRange = TmfTraceManager.getInstance().getTraceContext(trace).getWindowRange(); offset = currentRange.getEndTime().getDelta(currentRange.getStartTime()).toNanos(); } return new TmfTimeRange(startTime, TmfTimestamp.create(startTime.getValue() + offset, startTime.getScale())); } finally { fLock.unlock(); } }
Source:
<code>public void onStart(ITestContext iTestContext) { getLifecycle().fire(new TestSuiteStartedEvent( <START> getSuiteUid(iTestContext), getCurrentSuiteName(iTestContext) <END> ).withLabels( AllureModelUtils.createTestFrameworkLabel("TestNG"), AllureModelUtils.createFeatureLabel(getCurrentSuiteName(iTestContext)) )); }</code><technical_language>In allure model name title. Name string in internal format, title - string in report. I suite name iTestContext.getSuite().getName(), suite title is getCurrentSuiteName(iTestContext)</technical_language>

Target:
public void onStart(ITestContext iTestContext) { getLifecycle().fire(new TestSuiteStartedEvent( getSuiteUid(iTestContext), iTestContext.getSuite().getName() ).withTitle( getCurrentSuiteTitle(iTestContext) ).withLabels( AllureModelUtils.createTestFrameworkLabel("TestNG") )); }
Source:
<code>protected void contributeButtons(Composite parent) { ((GridLayout) parent.getLayout()).numColumns++; Button button = new Button(parent, SWT.NONE); button.setText("&Import a theme..."); button.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { FileDialog dialog = new FileDialog(getShell()); String file = dialog.open(); FileInputStream fileStream = null; BufferedInputStream bufferedFileStream = null; try { fileStream = new FileInputStream(file); <START> bufferedFileStream = new BufferedInputStream(fileStream); <END> colorThemeManager.saveTheme(bufferedFileStream); } catch (CharConversionException e) { showErrorMessage("Invalid file encoding."); return; } catch (Exception e) { showErrorMessage("This is not a valid theme file."); return; } finally { try { if(bufferedFileStream != null) bufferedFileStream.close(); if(fileStream != null) fileStream.close(); } catch (IOException e) { e.printStackTrace(); } } reloadThemeSelectionList(); } }); }</code><technical_language>Closing bufferedFileStream is enough, simplify a bit</technical_language>

Target:
protected void contributeButtons(Composite parent) { ((GridLayout) parent.getLayout()).numColumns++; Button button = new Button(parent, SWT.NONE); button.setText("&Import a theme..."); button.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { FileDialog dialog = new FileDialog(getShell()); String file = dialog.open(); BufferedInputStream bufferedFileStream = null; try { bufferedFileStream = new BufferedInputStream(new FileInputStream(file)); colorThemeManager.saveTheme(bufferedFileStream); } catch (CharConversionException e) { showErrorMessage("Invalid file encoding."); return; } catch (Exception e) { showErrorMessage("This is not a valid theme file."); return; } finally { try { if(bufferedFileStream != null) bufferedFileStream.close(); } catch (IOException e) { e.printStackTrace(); } } reloadThemeSelectionList(); } }); }
Source:
<code>public void testLogCleanup() throws ExecutorManagerException { final File logDir = ExecutionsTestUtil.getFlowDir(LOG_TEST_DIR_NAME); final File[] largelog = {new File(logDir, "largeLog1.log"), new File(logDir, "largeLog2.log"), new File(logDir, "largeLog3.log")}; this.executionLogsDao.uploadLogFile(1, "largeFiles", 0, largelog); final LogData logsResult = this.executionLogsDao.fetchLogs(1, "largeFiles", 0, 0, 64000); assertThat(logsResult).isNotNull(); assertThat(logsResult.getLength()).isEqualTo(64000); final LogData logsResult2 = this.executionLogsDao.fetchLogs(1, "largeFiles", 0, 1000, 64000); assertThat(logsResult2).isNotNull(); assertThat(logsResult2.getLength()).isEqualTo(64000); final LogData logsResult3 = this.executionLogsDao.fetchLogs(1, "largeFiles", 0, 150000, 250000); assertThat(logsResult3).isNotNull(); assertThat(logsResult3.getLength()).isEqualTo(185493); final long currentTimeMillis = System.currentTimeMillis(); int totalRemovedRecords = executionLogsDao.removeExecutionLogsByTime(currentTimeMillis, 3); <START> assertThat(totalRemovedRecords).isEqualTo(7); <END> }</code><technical_language>Clarification: asserting 7? get earlier test lines</technical_language>

Target:
public void testLogCleanup() throws ExecutorManagerException { final File logDir = ExecutionsTestUtil.getFlowDir(LOG_TEST_DIR_NAME); final File[] largeLog1 = {new File(logDir, "largeLog1.log")}; this.executionLogsDao.uploadLogFile(1, "largeFiles", 0, largeLog1); final long currentTimeMillis = System.currentTimeMillis() + 1000; int totalRemovedRecords = executionLogsDao.removeExecutionLogsByTime(currentTimeMillis, 2); assertThat(totalRemovedRecords).isEqualTo(3); final File[] largeLog2 = {new File(logDir, "largeLog2.log")}; this.executionLogsDao.uploadLogFile(2, "largeFiles", 0, largeLog2); final long currentTimeMillisSecond = System.currentTimeMillis() + 1000; totalRemovedRecords = executionLogsDao.removeExecutionLogsByTime(currentTimeMillisSecond, 3); assertThat(totalRemovedRecords).isEqualTo(1); final File[] largeLogMultiple = {new File(logDir, "largeLog2.log")}; this.executionLogsDao.uploadLogFile(3, "largeFiles", 0, largeLogMultiple); final File[] largeLog4 = {new File(logDir, "largeLog1.log")}; this.executionLogsDao.uploadLogFile(4, "largeFiles", 0, largeLog4); final long currentTimeMillis2 = System.currentTimeMillis() + 1000; totalRemovedRecords = executionLogsDao.removeExecutionLogsByTime(currentTimeMillis2, 2); assertThat(totalRemovedRecords).isEqualTo(4); }
Source:
<code>public SingleInputNode(ReteContainer reteContainer) { super(reteContainer); <START> mailbox = new DefaultMailbox(this); <END> reteContainer.registerClearable(mailbox); parent = null; }</code><technical_language>move this constructor call overridable method instantiateMailbox(), some node types customize kind of mailbox want</technical_language>

Target:
public SingleInputNode(ReteContainer reteContainer) { super(reteContainer); mailbox = instantiateMailbox(); reteContainer.registerClearable(mailbox); parent = null; }
Source:
<code>public void setSelectionRange(int beginIndex, int endIndex) { if (fTableItemCount > 0) { <START> fSelectedBeginRank = beginIndex; <END> fSelectedEventRank = endIndex; if ((beginIndex < fTableTopEventRank + fFrozenRowCount && beginIndex >= fFrozenRowCount) || (beginIndex >= fTableTopEventRank + fFullyVisibleRows)) { int lastPageTopEntryRank = Math.max(0, fTableItemCount - fFullyVisibleRows); fTableTopEventRank = Math.max(0, Math.min(lastPageTopEntryRank, beginIndex - fFrozenRowCount - fFullyVisibleRows / 2)); } if (fFullyVisibleRows < fTableItemCount) { fSlider.setSelection(fTableTopEventRank); } refreshTable(); } }</code><technical_language>clamp values in range [0, fTableItemCount - 1]</technical_language>

Target:
public void setSelectionRange(int beginIndex, int endIndex) { if (fTableItemCount > 0) { int begin = Math.min(beginIndex, fTableItemCount - 1); begin = Math.max(begin, 0); int end = Math.min(endIndex, fTableItemCount - 1); end = Math.max(end, 0); fSelectedBeginRank = begin; fSelectedEventRank = end; if ((begin < fTableTopEventRank + fFrozenRowCount && begin >= fFrozenRowCount) || (begin >= fTableTopEventRank + fFullyVisibleRows)) { int lastPageTopEntryRank = Math.max(0, fTableItemCount - fFullyVisibleRows); fTableTopEventRank = Math.max(0, Math.min(lastPageTopEntryRank, begin - fFrozenRowCount - fFullyVisibleRows / 2)); } if (fFullyVisibleRows < fTableItemCount) { fSlider.setSelection(fTableTopEventRank); } refreshTable(); } }
Source:
<code>private SearchResult parseToSearchResult(@Nonnull final IMAPResponse[] ir) throws ImapAsyncClientException { if (ir.length < 1) { throw new ImapAsyncClientException(FailureType.INVALID_INPUT); } final Response taggedResponse = ir[ir.length - 1]; if (!taggedResponse.isOK()) { throw new ImapAsyncClientException(FailureType.INVALID_INPUT); } final List<Long> v = new ArrayList<Long>(); Long modSeq = null; long num; for (final IMAPResponse sr : ir) { if (sr.keyEquals("SEARCH")) { while ((num = sr.readLong()) != -1) { v.add(num); } if (sr.readByte() == '(') { final String s = sr.readAtom(); <START> if (s.equalsIgnoreCase("MODSEQ")) { <END> modSeq = sr.readLong(); } } } } return new SearchResult(v, modSeq); }</code><technical_language>allows case</technical_language>

Target:
private SearchResult parseToSearchResult(@Nonnull final IMAPResponse[] ir) throws ImapAsyncClientException { if (ir.length < 1) { throw new ImapAsyncClientException(FailureType.INVALID_INPUT); } final Response taggedResponse = ir[ir.length - 1]; if (!taggedResponse.isOK()) { throw new ImapAsyncClientException(FailureType.INVALID_INPUT); } final List<Long> v = new ArrayList<Long>(); Long modSeq = null; long num; for (final IMAPResponse sr : ir) { if (sr.keyEquals("SEARCH")) { while ((num = sr.readLong()) != -1) { v.add(Long.valueOf(num)); } if (sr.readByte() == L_PAREN) { final String s = sr.readAtom(); if (MODSEQ.equals(s)) { modSeq = sr.readLong(); } } } } return new SearchResult(v, modSeq); }
Source:
<code>public boolean shouldUseNativeIO(VM vm, DiskImage diskImage, VmDevice device) { StorageType storageType = diskImage.getStorageTypes().get(0); String diskType = getDiskType(vm, diskImage, device); boolean isNativeIO = !"file".equals(diskType) || (storageType == StorageType.GLUSTERFS && FeatureSupported.useNativeIOForGluster(vm.getCompatibilityVersion())); if <START> (device.getSnapshotId() != null) { <END> isNativeIO = false; } return isNativeIO; }</code><technical_language>add boolean expression in line #1377</technical_language>

Target:
public boolean shouldUseNativeIO(VM vm, DiskImage diskImage, VmDevice device) { StorageType storageType = diskImage.getStorageTypes().get(0); String diskType = getDiskType(vm, diskImage, device); return (!"file".equals(diskType) || (storageType == StorageType.GLUSTERFS && FeatureSupported.useNativeIOForGluster(vm.getCompatibilityVersion()))) && device.getSnapshotId() == null; }
Source:
<code>void printUsageInfo() { <START> StringBuffer usage = new StringBuffer(); <END> usage.append(SEPARATOR); usage.append("To use SeLion Grid"); usage.append(SEPARATOR); usage.append("\n"); usage.append("Usage: java [system properties] -jar SeLion-Grid.jar [options] \n"); usage.append(" [driver options] \n"); usage.append("\n"); usage.append(" Options:\n"); usage.append(" " + SELION_CONFIG_ARG + " <config file name>: \n"); usage.append(" A SeLion Grid configuration JSON file \n"); usage.append(" " + SELION_NOCONTINUOS_ARG + "\n"); usage.append(" Disable continuous restarting of node/hub sub-process \n"); usage.append("\n"); usage.append(" Driver Options: \n"); usage.append(" Any valid driver (appium, selendroid, or ios-driver) dash option(s). \n"); usage.append("\n"); usage.append(" System Properties: \n"); usage.append(" -DselionHome=<folderPath>: \n"); usage.append(" Path of SeLion home directory. Defaults to \n"); usage.append(" <user.home>/.selion/ \n"); usage.append(" -D[property]=[value]: \n"); usage.append(" Any other System Property you wish to pass to the JVM \n"); System.out.print(usage.toString()); }</code><technical_language>resort StringBuilder</technical_language>

Target:
void printUsageInfo() { StringBuilder usage = new StringBuilder(); usage.append(SEPARATOR); usage.append("To use SeLion Grid"); usage.append(SEPARATOR); usage.append("\n"); usage.append("Usage: java [system properties] -jar SeLion-Grid.jar [options] \n"); usage.append(" [driver options] \n"); usage.append("\n"); usage.append(" Options:\n"); usage.append(" " + SELION_CONFIG_ARG + " <config file name>: \n"); usage.append(" A SeLion Grid configuration JSON file \n"); usage.append(" " + SELION_NOCONTINUOUS_ARG + "\n"); usage.append(" Disable continuous restarting of node/hub sub-process \n"); usage.append("\n"); usage.append(" Driver Options: \n"); usage.append(" Any valid driver (appium, selendroid, or ios-driver) dash option(s). \n"); usage.append("\n"); usage.append(" System Properties: \n"); usage.append(" -DselionHome=<folderPath>: \n"); usage.append(" Path of SeLion home directory. Defaults to \n"); usage.append(" <user.home>/.selion/ \n"); usage.append(" -D[property]=[value]: \n"); usage.append(" Any other System Property you wish to pass to the JVM \n"); System.out.print(usage.toString()); }
Source:
<code>public int hashCode() { int result = super.hashCode(); <START> result = 31 * result + (host != null ? host.hashCode() : 0); <END> return result; }</code><technical_language>this replaced java.util.Objects.hashCode(host)</technical_language>

Target:
public int hashCode() { int result = super.hashCode(); result = 31 * result + Objects.hashCode(host); return result; }
Source:
<code>public int getUnhealthy() { <START> return unhealthy ? 1 : 0; <END> }</code><technical_language>sort of weird getter is int setter is a boolean. int, including underlying variable? Also, consider making this error count instead of 1/0 provide additional information</technical_language>

Target:
public int getUnhealthy() { return unhealthy; }
Source:
<code><START> public static void initMarkerSets() { <END> if (!MARKER_CONFIG_FILE.exists()) { try { File defaultConfigFile = new File(FileLocator.toFileURL(DEFAULT_MARKER_CONFIG_URL).toURI()); Files.copy(defaultConfigFile.toPath(), MARKER_CONFIG_FILE.toPath(), StandardCopyOption.REPLACE_EXISTING); } catch (URISyntaxException | IOException e) { Activator.logError("Error copying " + DEFAULT_MARKER_CONFIG_URL + " to " + MARKER_CONFIG_FILE.getAbsolutePath(), e); } } if (!MARKER_CONFIG_SCHEMA_FILE.exists()) { try { File schemaFile = new File(FileLocator.toFileURL(MARKER_CONFIG_SCHEMA_URL).toURI()); Files.copy(schemaFile.toPath(), MARKER_CONFIG_SCHEMA_FILE.toPath(), StandardCopyOption.REPLACE_EXISTING); } catch (URISyntaxException | IOException e) { Activator.logError("Error copying " + MARKER_CONFIG_SCHEMA_URL + " to " + MARKER_CONFIG_SCHEMA_FILE.getAbsolutePath(), e); } } if (!MARKER_CONFIG_DIR.exists()) { MARKER_CONFIG_DIR.mkdir(); } Collection<String> extensionPoint = getExtensionDefinitionsPaths(); for (String extensionBookmark : extensionPoint) { try { Path path = Paths.get(extensionBookmark); Files.copy(path, Paths.get(MARKER_CONFIG_DIR.getPath(), path.getFileName().toString()), StandardCopyOption.REPLACE_EXISTING); } catch (IOException e) { Activator.logError("Error copying " + extensionBookmark + " to " + MARKER_CONFIG_FILE.getAbsolutePath(), e); } } }</code><technical_language>In original code, this method is 'Edit...' in plug-in state location. is called repeatedly in case user manually deleted file in plug-in state location runtime. If want (not sure?) parse extension-point-defined marker sets once, a separate method is called initialization. parse time getMarkerSets() is called. want editable, want a new plug-in version able update built-in marker sets. necessary a copy plugin</technical_language>

Target:
public static void initMarkerSets() { if (!MARKER_CONFIG_FILE.exists()) { try { File defaultConfigFile = new File(FileLocator.toFileURL(DEFAULT_MARKER_CONFIG_URL).toURI()); Files.copy(defaultConfigFile.toPath(), MARKER_CONFIG_FILE.toPath(), StandardCopyOption.REPLACE_EXISTING); } catch (URISyntaxException | IOException e) { Activator.logError("Error copying " + DEFAULT_MARKER_CONFIG_URL + " to " + MARKER_CONFIG_FILE.getAbsolutePath(), e); } } if (!MARKER_CONFIG_SCHEMA_FILE.exists()) { try { File schemaFile = new File(FileLocator.toFileURL(MARKER_CONFIG_SCHEMA_URL).toURI()); Files.copy(schemaFile.toPath(), MARKER_CONFIG_SCHEMA_FILE.toPath(), StandardCopyOption.REPLACE_EXISTING); } catch (URISyntaxException | IOException e) { Activator.logError("Error copying " + MARKER_CONFIG_SCHEMA_URL + " to " + MARKER_CONFIG_SCHEMA_FILE.getAbsolutePath(), e); } } }
Source:
<code>public void populateEntityDictionary(EntityDictionary dictionary) { <START> ClassScanner.getAllClasses(Table.class.getPackage().getName()).stream().forEach(cls -> { <END> dictionary.bindEntity(cls); }); }</code><technical_language>ClassScanner.getAllClasses(META_DATA_PACKAGE.getName())</technical_language>

Target:
public void populateEntityDictionary(EntityDictionary dictionary) { ClassScanner.getAllClasses(META_DATA_PACKAGE.getName()).stream().forEach(cls -> { dictionary.bindEntity(cls); }); }
Source:
<code>public void process(WatchedEvent event) { if (log.isTraceEnabled()) { log.trace("{}", event); } <START> setWatcherForTableConfigVersion(event); <END> switch (event.getType()) { case NodeDataChanged: if (event.getPath().endsWith(Constants.ZTABLE_CONFIG_VERSION)) { processTableConfigurationItem(event); break; } case NodeChildrenChanged: case NodeCreated: case NodeDeleted: remove(event.getPath()); break; case None: switch (event.getState()) { case Disconnected: if (log.isTraceEnabled()) { log.trace("Zoo keeper connection disconnected, clearing cache"); } clear(); break; case SyncConnected: break; case Expired: if (log.isTraceEnabled()) { log.trace("Zoo keeper connection expired, clearing cache"); } clear(); break; default: log.warn("Unhandled: {}", event); break; } break; default: log.warn("Unhandled: {}", event); break; } if (externalWatcher != null) { externalWatcher.process(event); } }</code><technical_language>event trigger this set up? this called in constructor instead</technical_language>

Target:
public void process(WatchedEvent event) { if (log.isTraceEnabled()) { log.trace("{}", event); } setWatcherForTableConfigVersion(event.getPath()); switch (event.getType()) { case NodeDataChanged: if (event.getPath().endsWith(Constants.ZTABLE_CONFIG_VERSION)) { try { processTableConfigurationItem(event); } catch (KeeperException | InterruptedException e) { log.error( "ZCacheWatcher::processTableConfigurationItem failed to process a table configuration change"); updateAllTableConfigurations(); tableConfigWatcherSet = false; setWatcherForTableConfigVersion(event.getPath()); } break; } case NodeChildrenChanged: if (event.getPath().endsWith("conf") && event.getType().equals(Event.EventType.NodeChildrenChanged)) { try { clear(event.getPath()); getZooKeeper().exists(event.getPath(), watcher); if (log.isTraceEnabled()){ log.trace("NodeChildrenChanged: resetting watcher for " + event.getPath()); if (externalWatcher != null) log.trace("external watcher with process this zpath also " + event.getPath()); } } catch (KeeperException | InterruptedException e) { log.error("could not reset watcher on parent node: " + event.getPath()); } } case NodeCreated: case NodeDeleted: remove(event.getPath()); break; case None: switch (event.getState()) { case Disconnected: if (log.isTraceEnabled()) { log.trace("Zoo keeper connection disconnected, clearing cache"); } clear(); break; case SyncConnected: break; case Expired: if (log.isTraceEnabled()) { log.trace("Zoo keeper connection expired, clearing cache"); } clear(); break; default: log.warn("Unhandled: {}", event); break; } break; default: log.warn("Unhandled: {}", event); break; } if (externalWatcher != null) { externalWatcher.process(event); } }
Source:
<code>public static CryptoService newDefaultInstance() { <START> return newInstance(DefaultConfiguration.getInstance(), false); <END> }</code><technical_language>I this get is configured default. Calling newDefaultInstance is NoCryptoService, is break special parts of code crypto is configured</technical_language>

Target:
public static CryptoService newDefaultInstance() { return newInstance(DefaultConfiguration.getInstance(), ClassloaderType.JAVA); }
Source:
<code>public Response isAdmin(@FormParam("user") String username, @FormParam("token") String token, @Context UriInfo uriInfo) { User user = spawn.getPermissionsManager().authenticate(username, token); boolean isamdin = spawn.getPermissionsManager().isamdin(user); Response.ResponseBuilder builder; if (!isamdin) { builder = Response.ok(Boolean.toString(false)); } else { builder = Response.ok(Boolean.toString(true)); <START> } <END> builder.header("Access-Control-Allow-Origin", "http://" + uriInfo.getAbsolutePath().getHost() + ":" + configuration.webPort); builder.header("Access-Control-Allow-Methods", "POST"); return builder.build(); }</code><technical_language>do: builder = Response.ok(Boolean.toString(isadmin))</technical_language>

Target:
public Response isAdmin(@FormParam("user") String username, @FormParam("token") String token, @Context UriInfo uriInfo) { User user = spawn.getPermissionsManager().authenticate(username, token); boolean isAmdin = spawn.getPermissionsManager().isAdmin(user); Response.ResponseBuilder builder; builder = Response.ok(Boolean.toString(isAmdin)); builder.header("Access-Control-Allow-Origin", "http://" + uriInfo.getAbsolutePath().getHost() + ":" + configuration.webPort); builder.header("Access-Control-Allow-Methods", "POST"); return builder.build(); }
Source:
<code>private void validate() { <START> assertThat(discoveryClient, <END> Objects::nonNull, () -> new AxonConfigurationException( "The DiscoveryClient is a hard requirement and should be provided")); assertThat(localServiceInstance, Objects::nonNull, () -> new AxonConfigurationException( "The Registration is a hard requirement and should be provided")); assertThat(routingStrategy, Objects::nonNull, () -> new AxonConfigurationException( "The RoutingStrategy is a hard requirement and should be provided")); assertThat(serviceInstanceFilter, Objects::nonNull, () -> new AxonConfigurationException( "The ServiceInstanceFilter is a hard requirement and should be provided")); assertThat(consistentHashChangeListener, Objects::nonNull, () -> new AxonConfigurationException( "The ConsistentHashChangeListener is a hard requirement and should be provided")); }</code><technical_language>Extraction a separate method</technical_language>

Target:
protected void validate() { assertNonNull(discoveryClient, "The DiscoveryClient is a hard requirement and should be provided"); assertNonNull(localServiceInstance, "The Registration is a hard requirement and should be provided"); assertNonNull(routingStrategy, "The RoutingStrategy is a hard requirement and should be provided"); assertNonNull(serviceInstanceFilter, "The ServiceInstanceFilter is a hard requirement and should be provided"); assertNonNull(consistentHashChangeListener, "The ConsistentHashChangeListener is a hard requirement and should be provided"); }
Source:
<code>static <T1, T2> Tuple2<Seq<T1>, Seq<T2>> sequence2(Iterable<? extends Tuple2<? extends T1, ? extends T2>> tuples) { Objects.requireNonNull(tuples, "tuples is null"); <START> return new Tuple2<>(Stream.narrow(Iterator.ofAll(tuples).map(Tuple2::_1).toStream()), <END> Stream.narrow(Iterator.ofAll(tuples).map(Tuple2::_2).toStream())); }</code><technical_language>I time investigate, narrow iterator toStream new Tuple2, simply: java static <T1, T2> Tuple2<Seq<T1>, Seq<T2>> sequence2(Iterable<? extends Tuple2<? extends T1, ? extends T2>> tuples) { return Tuple.of(Stream.ofAll(tuples).map(Tuple2::_1), Stream.ofAll(tuples).map(Tuple2::_2)); }</technical_language>

Target:
static <T1, T2> Tuple2<Seq<T1>, Seq<T2>> sequence2(Iterable<? extends Tuple2<? extends T1, ? extends T2>> tuples) { Objects.requireNonNull(tuples, "tuples is null"); final Stream<Tuple2<? extends T1, ? extends T2>> s = Stream.ofAll(tuples); return new Tuple2<>(s.map(Tuple2::_1), s.map(Tuple2::_2)); }
Source:
<code>public Map<SchemaTableName, List<ColumnMetadata>> listTableColumns(ConnectorSession session, SchemaTablePrefix prefix) { requireNonNull(prefix, "prefix is null"); if (prefix.getSchemaName() != null && !prefix.getSchemaName().equals(JMX_SCHEMA_NAME) && !prefix.getSchemaName().equals(HISTORY_SCHEMA_NAME)) { return ImmutableMap.of(); } List<SchemaTableName> tableNames; if (prefix.getTableName() == null) { tableNames = listTables(session, prefix.getSchemaName()); } else { tableNames = ImmutableList.of(new SchemaTableName(prefix.getSchemaName(), prefix.getTableName())); } return tableNames.stream() <START> .collect(toImmutableMap(tableName -> tableName, tableName -> getTableHandle(session, tableName).getTableMetadata().getColumns())); <END> }</code><technical_language>Functions.identity()</technical_language>

Target:
public Map<SchemaTableName, List<ColumnMetadata>> listTableColumns(ConnectorSession session, SchemaTablePrefix prefix) { requireNonNull(prefix, "prefix is null"); if (prefix.getSchemaName() != null && !prefix.getSchemaName().equals(JMX_SCHEMA_NAME) && !prefix.getSchemaName().equals(HISTORY_SCHEMA_NAME)) { return ImmutableMap.of(); } List<SchemaTableName> tableNames; if (prefix.getTableName() == null) { tableNames = listTables(session, prefix.getSchemaName()); } else { tableNames = ImmutableList.of(new SchemaTableName(prefix.getSchemaName(), prefix.getTableName())); } return tableNames.stream() .collect(toImmutableMap(Function.identity(), tableName -> getTableHandle(session, tableName).getTableMetadata().getColumns())); }
Source:
<code><START> public static Features<VersionLevelRange> emptyFinalizedFeatures() { <END> return new Features<>(new HashMap<>()); }</code><technical_language>Is this function in unit test</technical_language>

Target:
public static Features<FinalizedVersionRange> emptyFinalizedFeatures() { return new Features<>(new HashMap<>()); }
Source:
<code>public int hashCode() { return Objects.hash(url, tableName, driverName, username, password, <START> dialect, <END> connectionCheckTimeoutSeconds); }</code><technical_language>Add empty line this</technical_language>

Target:
public int hashCode() { return Objects.hash(url, tableName, driverName, username, password, dialect.getClass().getName(), parallelism, connectionCheckTimeoutSeconds); }
Source:
<code>public boolean renew() { <START> if (!this.delegate.isHeldByCurrentThread()) { <END> throw new IllegalMonitorStateException("You do not own mutex at " + this.path); } while (true) { try { boolean renewed = this.mutex.renew(this.path); if (renewed) { this.lastUsed = System.currentTimeMillis(); } return renewed; } catch (TransientDataAccessException e) { } catch (Exception e) { throw new DataAccessResourceFailureException("Failed to renew mutex at " + this.path, e); } } }</code><technical_language>need combine this condition isAcquiredInThisProcess(). I reason separately - outcome is anyway. More is consult this jump DB for isAcquired()</technical_language>

Target:
public boolean renew() { if (!this.delegate.isHeldByCurrentThread()) { throw new IllegalMonitorStateException("The current thread doesn't own mutex at " + this.path); } while (true) { try { boolean renewed = this.mutex.renew(this.path); if (renewed) { this.lastUsed = System.currentTimeMillis(); } return renewed; } catch (TransientDataAccessException | TransactionTimedOutException e) { } catch (Exception e) { throw new DataAccessResourceFailureException("Failed to renew mutex at " + this.path, e); } } }
Source:
<code>public Configuration getConfiguration(final GraphContext grCtx) { return ConfigurationBuilder.begin() .addRule() <START> .perform(new AddSortedFileIndexOperation()) <END> .addRule() .perform(new AddLuceneFileIndexOperation()); }</code><technical_language>I guess this is useful people add hashes. expect sorted</technical_language>

Target:
public Configuration getConfiguration(final GraphContext grCtx) { return ConfigurationBuilder.begin() .addRule() .perform(new AddDelimitedFileIndexOperation()) .addRule() .perform(new AddLuceneFileIndexOperation()); }
Source:
<code>public void allTests() throws Exception { <START> testNavLinkToPage(); <END> testContent(); }</code><technical_language>Nav link is part of this page's test se</technical_language>

Target:
public void allTests() throws Exception { testContent(); }
Source:
<code>private long download(T object, File outFile) throws IOException { try { <START> return RetryUtils.retry( <END> () -> { try (final InputStream is = openObjectFunction.open(object); final OutputStream os = new FileOutputStream(outFile)) { return IOUtils.copyLarge(is, os, buffer); } }, retryCondition, maxFetchRetry + 1, StringUtils.format("Failed to download object[%s]", object) ); } catch (Exception e) { throw new IOException(e); } }</code><technical_language>need try do some cleanup a failed download attempt</technical_language>

Target:
private long download(T object, File outFile) throws IOException { try { return RetryUtils.retry( () -> { try (final InputStream is = openObjectFunction.open(object); final OutputStream os = new FileOutputStream(outFile)) { return IOUtils.copyLarge(is, os, buffer); } }, retryCondition, outFile::delete, maxFetchRetry + 1, StringUtils.format("Failed to download object[%s]", object) ); } catch (Exception e) { throw new IOException(e); } }
Source:
<code>protected void doBeginRead() throws Exception { if (!tempInboundMessages().isEmpty()) { Object msg; while ((msg = tempInboundMessages().poll()) != null) { ChannelPipeline p = pipeline(); p.fireChannelRead(msg); } <START> tempInboundMessages().clear(); <END> flushInbound(false, voidPromise()); } }</code><technical_language>call clear() ? This needed polled it</technical_language>

Target:
protected void doBeginRead() throws Exception { if (isNotEmpty(tempInboundMessages)) { for (;;) { AbstractMap.SimpleEntry<Object, ChannelPromise> pair = tempInboundMessages.poll(); if (pair == null) { break; } Object msg = pair.getKey(); if (msg != null) { pipeline().fireChannelRead(msg); } ChannelPromise promise = pair.getValue(); if (promise != null) { checkException(promise); } } flushInbound(false, voidPromise()); } }
Source:
<code>public Schema getSchemaForDependency(String PackageName, String SchemaName) { String FullName = PackageName + "." + SchemaName; Schema S = _Dependencies.get(FullName); if (S == null) <START> LOG.debug("Schema "+ FullName +" has been found in the schema dependency list."); <END> return S; }</code><technical_language>message read "has found"</technical_language>

Target:
public Schema getSchemaForDependency(String PackageName, String SchemaName) { String FullName = PackageName + "." + SchemaName; Schema S = _Dependencies.get(FullName); if (S == null) LOG.debug("Schema "+ FullName +" has not been found in the schema dependency list."); return S; }
Source:
<code>public boolean doCuration(Context c, BasicWorkflowItem wfi) throws AuthorizeException, IOException, SQLException { FlowStep step = getFlowStep(wfi); if (step != null) { Curator curator = new Curator(); if (step.queue != null) { for (Task task : step.tasks) { curator.addTask(task.name); } curator.queue(c, String.valueOf(wfi.getID()), step.queue); basicWorkflowItemService.update(c, wfi); return false; } else { Date now = GregorianCalendar.getInstance().getTime(); SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddThhmmssSSS"); String filename = String.format("curation-%s.log", sdf.format(now)); Path logPath = Paths.get( configurationService.getProperty("dspace.dir"), "logs", filename); <START> try (PrintWriter reporter = new PrintWriter(logPath.toFile())) { <END> curator.setReporter(reporter); return curate(curator, c, wfi); } } } return true; }</code><technical_language>"manually" managing this log file? Is a log4j for this? a bit odd do this of log4j.properties file, hardcode a specific name/date format. Ideally, want manage this other DSpace logs</technical_language>

Target:
public boolean doCuration(Context c, BasicWorkflowItem wfi) throws AuthorizeException, IOException, SQLException { FlowStep step = getFlowStep(wfi); if (step != null) { Curator curator = new Curator(); if (step.queue != null) { for (Task task : step.tasks) { curator.addTask(task.name); } curator.queue(c, String.valueOf(wfi.getID()), step.queue); basicWorkflowItemService.update(c, wfi); return false; } else { PluginService plugins = CoreServiceFactory.getInstance() .getPluginService(); try (Reporter reporter = (Reporter) plugins .getSinglePlugin(Reporter.class);) { curator.setReporter(reporter); boolean status = curate(curator, c, wfi); reporter.close(); return status; } catch (Exception e) { log.error("Failed to close report", e); } } } return true; }
Source:
<code>public void sendOreonSpawnEvent(Prefab prefabToSpawn) { setPortalEntity(); <START> if(portalEntity.hasComponent(LocationComponent.class)) { <END> localPlayer.getCharacterEntity().send(new OreonSpawnEvent(prefabToSpawn, portalEntity.getComponent(LocationComponent.class).getWorldPosition())); } }</code><technical_language>extract portalEntity.hasComponent(LocationComponent.class) a local variable</technical_language>

Target:
private void sendOreonSpawnEvent(Prefab prefabToSpawn) { setPortalEntity(); LocationComponent portalLocation = portalEntity.getComponent(LocationComponent.class); if (portalLocation != null) { localPlayer.getCharacterEntity().send(new OreonSpawnEvent(prefabToSpawn, portalLocation.getWorldPosition())); } }
Source:
<code>public static void writeRegistry(CompoundNBT data) { data.putInt("version", 1); List<SavedEntry> list = new ArrayList<>(); for (DimensionType type : REGISTRY) { <START> if (type.getModType() == null){ <END> list.add(new SavedEntry(type)); }else{ if (type.getModType().saveToLevelDat()) { list.add(new SavedEntry(type)); } } } savedEntries.values().forEach(list::add); Collections.sort(list, (a, b) -> a.id - b.id); ListNBT lst = new ListNBT(); list.forEach(e -> lst.add(e.write())); data.put("entries", lst); }</code><technical_language>Please add spaces brackets (same below)</technical_language>

Target:
public static void writeRegistry(CompoundNBT data) { data.putInt("version", 1); List<SavedEntry> list = new ArrayList<>(); for (DimensionType type : REGISTRY) { if (type.getModType() == null) { list.add(new SavedEntry(type)); } else { if (type.getModType().persistToLevelDat()) { list.add(new SavedEntry(type)); } } } savedEntries.values().forEach(list::add); Collections.sort(list, (a, b) -> a.id - b.id); ListNBT lst = new ListNBT(); list.forEach(e -> lst.add(e.write())); data.put("entries", lst); }
Source:
<code>public JobScheduler(final CoordinatorRegistryCenter regCenter, final String elasticJobType, final JobConfiguration jobConfig, final TracingConfiguration<?> tracingConfig) { this.regCenter = regCenter; this.elasticJobType = elasticJobType; final Collection<ElasticJobListener> elasticJobListeners = jobConfig.getJobListenerTypes().stream() <START> .map(type -> ElasticJobListenerFactory.getListener(type)).collect(Collectors.toList()); <END> setUpFacade = new SetUpFacade(regCenter, jobConfig.getJobName(), elasticJobListeners); schedulerFacade = new SchedulerFacade(regCenter, jobConfig.getJobName()); jobFacade = new LiteJobFacade(regCenter, jobConfig.getJobName(), elasticJobListeners, tracingConfig); jobExecutor = new ElasticJobExecutor(elasticJobType, jobConfig, jobFacade); this.jobConfig = setUpFacade.setUpJobConfiguration(elasticJobType, jobConfig); setGuaranteeServiceForElasticJobListeners(regCenter, elasticJobListeners); jobScheduleController = createJobScheduleController(); }</code><technical_language>I replace lambda method reference 'ElasticJobListenerFactory::getListener' is more elegant</technical_language>

Target:
public JobScheduler(final CoordinatorRegistryCenter regCenter, final String elasticJobType, final JobConfiguration jobConfig, final TracingConfiguration<?> tracingConfig) { this.regCenter = regCenter; this.elasticJobType = elasticJobType; final Collection<ElasticJobListener> elasticJobListeners = jobConfig.getJobListenerTypes().stream() .map(ElasticJobListenerFactory::getListener).collect(Collectors.toList()); setUpFacade = new SetUpFacade(regCenter, jobConfig.getJobName(), elasticJobListeners); schedulerFacade = new SchedulerFacade(regCenter, jobConfig.getJobName()); jobFacade = new LiteJobFacade(regCenter, jobConfig.getJobName(), elasticJobListeners, tracingConfig); jobExecutor = new ElasticJobExecutor(elasticJobType, jobConfig, jobFacade); this.jobConfig = setUpFacade.setUpJobConfiguration(elasticJobType, jobConfig); setGuaranteeServiceForElasticJobListeners(regCenter, elasticJobListeners); jobScheduleController = createJobScheduleController(); }
Source:
<code>public void generate() throws IOException { Log.info("Running %s", () -> getClass().getSimpleName()); File root = sourceRoot.getRoot().toFile(); <START> visit(root, ""); <END> List<String> sortedPackages = new ArrayList<>(packages); sortedPackages.sort(String::compareTo); File projectRoot = root.getParentFile().getParentFile().getParentFile(); File template = new File(projectRoot, "bnd.bnd.template"); File output = new File(projectRoot, "bnd.bnd"); String lineSeparator = System.getProperty("line.separator"); StringBuilder packagesList = new StringBuilder("\\" + lineSeparator); boolean first = true; for(String pkg : sortedPackages) { if(!first) { packagesList.append(", \\").append(lineSeparator); } packagesList.append(" ").append(pkg); first = false; } try(BufferedReader reader = new BufferedReader(new FileReader(template))) { try(PrintWriter writer = new PrintWriter(new FileWriter(output))) { reader.lines().forEach(l -> writer.println(l.replace("{exportedPackages}", packagesList))); } } Log.info("Written " + output.getAbsolutePath()); }</code><technical_language>SourceRoot built for common file traversal tasks - avoiding it, is lacking</technical_language>

Target:
public void generate() throws IOException { Log.info("Running %s", () -> getClass().getSimpleName()); Path root = sourceRoot.getRoot(); Path projectRoot = root.getParent().getParent().getParent(); String lineSeparator = System.getProperty("line.separator"); String packagesList = Files.walk(root) .filter(Files::isRegularFile) .map(path -> getPackageName(root, path)) .distinct() .sorted() .reduce(null, (packageList, packageName) -> concatPackageName(packageName, packageList, lineSeparator)); Path output = projectRoot.resolve("bnd.bnd"); try(Writer writer = Files.newBufferedWriter(output)) { Path templateFile = projectRoot.resolve("bnd.bnd.template"); String template = new String(Files.readAllBytes(templateFile), StandardCharsets.UTF_8); writer.write(template.replace("{exportedPackages}", packagesList)); } Log.info("Written " + output); }
Source:
<code>public static Map.Entry<String, Map<String, ?>> pushFileCommand(String remotePath, byte[] base64Data) { String[] parameters = new String[] {"path", "data"}; String data; try { <START> data = new String(base64Data, "UTF-8"); <END> } catch (UnsupportedEncodingException e) { throw new IllegalArgumentException(e); } Object[] values = new Object[]{remotePath, data}; return new AbstractMap.SimpleEntry<>(PUSH_FILE, prepareArguments(parameters, values)); }</code><technical_language>java import java.nio.charset.StandardCharsets; ... data = new String(base64Data, StandardCharsets.UTF_8)</technical_language>

Target:
public static Map.Entry<String, Map<String, ?>> pushFileCommand(String remotePath, byte[] base64Data) { String[] parameters = new String[] {"path", "data"}; Object[] values = new Object[]{remotePath, new String(base64Data, StandardCharsets.UTF_8)}; return new AbstractMap.SimpleEntry<>(PUSH_FILE, prepareArguments(parameters, values)); }
Source:
<code>private void initializeTimerEventListenerJobDeclaration(CmmnElement element, CmmnActivity activity, CmmnHandlerContext context) { TimerEventListenerJobDeclaration timerEventListenerJobDeclaration = parseTimerExpression(element,context); activity.setProperty(ItemHandler.PROPERTY_TIMERVEVENTLISTENER_JOBDECLARATION, timerEventListenerJobDeclaration); <START> CaseDefinitionEntity caseDefinition = (CaseDefinitionEntity) context.getCaseDefinition(); <END> if(caseDefinition.getTimerJobDeclarationMap()==null) caseDefinition.setTimerJobDeclarationMap(new HashMap<String, TimerJobDeclaration<?>>()); caseDefinition.getTimerJobDeclarationMap().put(element.getId(),timerEventListenerJobDeclaration); }</code><technical_language>Instead of caching declaration definition, CmmnHandlerContext cache them, that: private void initializeTimerEventListenerJobDeclaration(CmmnElement element, CmmnActivity activity, CmmnHandlerContext context) { TimerEventListenerJobDeclaration timerEventListenerJobDeclaration = parseTimerExpression(element,context); activity.setProperty(ItemHandler.PROPERTY_TIMERVEVENTLISTENER_JOBDECLARATION, timerEventListenerJobDeclaration); context.addJobDeclaration(timerEventListenerJobDeclaration); }</technical_language>

Target:
private void initializeTimerEventListenerJobDeclaration(CmmnElement element, CmmnActivity activity, CmmnHandlerContext context) { TimerEventListenerJobDeclaration timerEventListenerJobDeclaration = parseTimerExpression(element,context); timerEventListenerJobDeclaration.setActivity(activity); activity.setProperty(ItemHandler.PROPERTY_TIMERVEVENTLISTENER_JOBDECLARATION, timerEventListenerJobDeclaration); context.addJobDeclaration(timerEventListenerJobDeclaration); }
Source:
<code>public synchronized void deserialize(InputArchive ia) throws IOException { clear(); int i = ia.readInt("map"); while (i > 0) { Long val = ia.readLong("long"); if (aclIndex < val) { aclIndex = val; } List<ACL> aclList = new ArrayList<ACL>(); Index j = ia.startVector("acls"); <START> if (j != null) { <END> while (!j.done()) { ACL acl = new ACL(); acl.deserialize(ia, "acl"); aclList.add(acl); j.incr(); } longKeyMap.put(val, aclList); aclKeyMap.put(aclList, val); referenceCounter.put(val, new AtomicLongWithEquals(0)); i--; } } }</code><technical_language>a more elegant process this NPE ? - BTW. incorrect commit message. git commit --amend -m "your new message" modify</technical_language>

Target:
public synchronized void deserialize(InputArchive ia) throws IOException { clear(); int i = ia.readInt("map"); while (i > 0) { Long val = ia.readLong("long"); if (aclIndex < val) { aclIndex = val; } List<ACL> aclList = new ArrayList<ACL>(); Index j = ia.startVector("acls"); if (j == null) { throw new RuntimeException("Incorrent format of InputArchive when deserialize DataTree - missing acls"); } while (!j.done()) { ACL acl = new ACL(); acl.deserialize(ia, "acl"); aclList.add(acl); j.incr(); } longKeyMap.put(val, aclList); aclKeyMap.put(aclList, val); referenceCounter.put(val, new AtomicLongWithEquals(0)); i--; } }
Source:
<code><START> private short Y(short y) { <END> if (y == -1) return (short) (height - 1); if (y == height) return (short) 0; return y; }</code><technical_language>bad name of method <LINK_0></technical_language>

Target:
private short Y(short y) { if (y == -1) { return (short) (height - 1); } if (y == height) { return (short) 0; } return y; }
Source:
<code>public void testMarkRequestExceptionWithRegex() { DropwizardRequestMetrics.Context context = requestMetrics.startLockRequest("lockcommand", "domain"); context.markRequestException(new NullPointerException("this@tests$the_regex#pattern")); <START> Meter exceptionMeter = metricsRegistry.meter("api.lock.domain.lockcommand.requests.exception.NullPointerException.this.tests.the.regex.pattern"); <END> Assert.assertEquals(1, exceptionMeter.getCount()); }</code><technical_language>I mentioned above, get messy entire error message in metric, this test is invalid for reason. However, I test regex handling Error's error codes instead</technical_language>

Target:
public void testMarkRequestExceptionWithRegex() { DropwizardRequestMetrics.Context errorContext1 = requestMetrics.startLockRequest("lockcommand", "domain"); errorContext1.markRequestException(Error.get("(just-checking@some#regex!replace$in%action^)")); Meter exceptionMeter1 = metricsRegistry.meter("api.lock.domain.lockcommand.requests.exception.Error._just_checking_some_regex_replace_in_action__"); Assert.assertEquals(1, exceptionMeter1.getCount()); Assert.assertNotNull(exceptionMeter1.getOneMinuteRate()); DropwizardRequestMetrics.Context errorContext2 = requestMetrics.startEntityRequest("find", "name", null); errorContext2.markRequestException(Error.get("{testing&some*more+regex~replace=in;action'}")); Meter exceptionMeter2 = metricsRegistry.meter("api.find.name.default.requests.exception.Error._testing_some_more_regex_replace_in_action__"); Assert.assertEquals(1, exceptionMeter2.getCount()); Assert.assertNotNull(exceptionMeter2.getMeanRate()); DropwizardRequestMetrics.Context errorContext3 = requestMetrics.startEntityRequest("delete", "name", "version"); errorContext3.markRequestException(Error.get("\\yet<more>regex?replace,action\"in here\\")); Meter exceptionMeter3 = metricsRegistry.meter("api.delete.name.version.requests.exception.Error._yet_more_regex_replace_action_in_here_"); Assert.assertEquals(1, exceptionMeter3.getCount()); Assert.assertNotNull(exceptionMeter3.getMeanRate()); }
Source:
<code>public HttpRequestBuilder setMethod(Method method) { this.javaMethod = method; <START> RequestLine requestLine = RequestLine.fromMethod(method); <END> this.originalRelativePath = requestLine.getRelativePath(); this.httpMethod = requestLine.getHttpMethod(); return this; }</code><technical_language>store RequestLine instance directly</technical_language>

Target:
HttpRequestBuilder setMethod(Method method) { this.javaMethod = method; requestLine = RequestLine.fromMethod(method); return this; }