auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>static boolean cookieDomainMatches(String cookieDomain, String host) { cookieDomain = <START> cookieDomain.toLowerCase(); <END> host = host.toLowerCase(); if (host.equals(cookieDomain)) { return true; } else { if (!host.endsWith(cookieDomain)) { return false; } String prefix = host.substring(0, host.length() - cookieDomain.length()); return prefix.endsWith("."); } }</code><technical_language>This current Locale. While matter host names US-ASCII, safer Locale.ROOT here</technical_language>

Target:
static boolean cookieDomainMatches(String cookieDomain, String host) { cookieDomain = cookieDomain.toLowerCase(Locale.ROOT); host = host.toLowerCase(Locale.ROOT); if (host.equals(cookieDomain)) { return true; } else { if (!host.endsWith(cookieDomain)) { return false; } return host .charAt(host.length() - cookieDomain.length() - 1) == '.'; } }
Source:
<code>public void restore(RestoreInput in) throws RestApiException { try { restore.get().apply(change, in); } catch (OrmException e) { throw new RestApiException("Cannot restore <START> review", <END> e); } catch (IOException e) { throw new RestApiException("Cannot restore review", e); } }</code><technical_language>change</technical_language>

Target:
public void restore(RestoreInput in) throws RestApiException { try { restore.get().apply(change, in); } catch (OrmException e) { throw new RestApiException("Cannot restore change", e); } catch (IOException e) { throw new RestApiException("Cannot restore change", e); } }
Source:
<code>public Object execute(final ExecutionEvent event) { final IWorkbenchPart activePart = HandlerUtil.getActivePart(event); final List<DockerContainerPortMapping> portMappings = getSelectedPortMappings( activePart); if (portMappings == null || portMappings.isEmpty()) { return null; } final IDockerConnection currentConnection = getCurrentConnection( activePart); final Job job = new Job( CommandMessages.getString("command.showIn.webBrowser")) { @Override protected IStatus run(final IProgressMonitor monitor) { try { final DockerContainerPortMapping selectedPort = portMappings <START> .get(0); <END> final URI connectionURI = new URI( currentConnection.getUri()); if ("tcp".equalsIgnoreCase(connectionURI.getScheme()) || "http" .equalsIgnoreCase(connectionURI.getScheme()) || "https".equalsIgnoreCase( connectionURI.getScheme())) { final String host = connectionURI.getHost(); final URL location = new URL("http", host, selectedPort.getHostPort(), "/"); openLocationInWebBrowser(location); } } catch (URISyntaxException | MalformedURLException e) { Activator.logErrorMessage( CommandMessages.getString( "command.showIn.webBrowser.failure"), e); } monitor.done(); return Status.OK_STATUS; } }; job.setUser(true); job.schedule(); return null; }</code><technical_language>I a do if multiple selected port mappings, open also, intsead of selected</technical_language>

Target:
public Object execute(final ExecutionEvent event) { final IWorkbenchPart activePart = HandlerUtil.getActivePart(event); final List<IDockerPortMapping> portMappings = getSelectedPortMappings( activePart); if (portMappings == null || portMappings.isEmpty()) { return null; } final Job job = new Job( CommandMessages.getString("command.showIn.webBrowser")) { @Override protected IStatus run(final IProgressMonitor monitor) { try { final IDockerConnection currentConnection = getCurrentConnection( activePart); final IDockerPortMapping selectedPort = portMappings .get(0); final URI connectionURI = new URI( currentConnection.getUri()); if ("tcp".equalsIgnoreCase(connectionURI.getScheme()) || "unix" .equalsIgnoreCase(connectionURI.getScheme()) || "http" .equalsIgnoreCase(connectionURI.getScheme()) || "https".equalsIgnoreCase( connectionURI.getScheme())) { final String host = connectionURI.getHost(); final URL location = new URL("http", host, selectedPort.getPublicPort(), "/"); openLocationInWebBrowser(location); } } catch (URISyntaxException | MalformedURLException e) { Activator.logErrorMessage( CommandMessages.getString( "command.showIn.webBrowser.failure"), e); } monitor.done(); return Status.OK_STATUS; } }; job.setUser(true); job.schedule(); return null; }
Source:
<code>private Brand extractBrand(Element element, String id) { String uri = getShowUri(id); <START> Maybe<Identified> maybeBrand = contentResolver.findByCanonicalUris( <END> ImmutableSet.of(uri) ) .getFirstValue(); Brand brand = createBrand(element, id); if (maybeBrand.hasValue()) { return mergeBrand((Brand) maybeBrand.requireValue(), brand); } else { return brand; } }</code><technical_language>Maybes deprecated, a helper method convert Optional</technical_language>

Target:
private Brand extractBrand(Element element, String id) { String uri = getShowUri(id); Optional<Identified> optionalBrand = contentResolver.findByCanonicalUris( ImmutableSet.of(uri) ) .getFirstValue().toOptional(); Brand brand = createBrand(element, id); return optionalBrand.map(identified -> mergeBrand((Brand) identified, brand)).orElse(brand); }
Source:
<code>public void RequestTranslation(final String languageToTranslateTo, final String textToTranslate) { <START> if ((userYandexKey.equals("") || userYandexKey.equals("DEFAULT")) && yandexKey.equals("")){ <END> form.dispatchErrorOccurredEvent(YandexTranslate.this, "RequestTranslation", ErrorMessages.ERROR_TRANSLATE_NO_KEY_FOUND); return; } AsynchUtil.runAsynchronously(new Runnable() { @Override public void run() { try { performRequest(languageToTranslateTo, textToTranslate); } catch (IOException e) { form.dispatchErrorOccurredEvent(YandexTranslate.this, "RequestTranslation", ErrorMessages.ERROR_TRANSLATE_SERVICE_NOT_AVAILABLE); } catch (JSONException je) { form.dispatchErrorOccurredEvent(YandexTranslate.this, "RequestTranslation", ErrorMessages.ERROR_TRANSLATE_JSON_RESPONSE); } } }); }</code><technical_language>userYandexKey set this component, swap equals() call is invoked string constant chance userYandexKey == null</technical_language>

Target:
public void RequestTranslation(final String languageToTranslateTo, final String textToTranslate) { if (TextUtils.isEmpty(yandexKey) && (TextUtils.isEmpty(userYandexKey) || TextUtils.equals(userYandexKey, "DEFAULT"))) { form.dispatchErrorOccurredEvent(YandexTranslate.this, "RequestTranslation", ErrorMessages.ERROR_TRANSLATE_NO_KEY_FOUND); return; } AsynchUtil.runAsynchronously(new Runnable() { @Override public void run() { try { performRequest(languageToTranslateTo, textToTranslate); } catch (IOException e) { form.dispatchErrorOccurredEvent(YandexTranslate.this, "RequestTranslation", ErrorMessages.ERROR_TRANSLATE_SERVICE_NOT_AVAILABLE); } catch (JSONException je) { form.dispatchErrorOccurredEvent(YandexTranslate.this, "RequestTranslation", ErrorMessages.ERROR_TRANSLATE_JSON_RESPONSE); } } }); }
Source:
<code>public static boolean isTarFile(String fileName) { if (fileName.length() == 0) { return false; } TarFile tarFile = null; try { tarFile = new TarFile(fileName); <START> } catch (TarException | IOException tarException) { <END> return false; } finally { if (tarFile != null) { try { tarFile.close(); } catch (IOException e) { } } } return true; }</code><technical_language>rename exception</technical_language>

Target:
public static boolean isTarFile(String fileName) { if (fileName.length() == 0) { return false; } TarFile tarFile = null; try { tarFile = new TarFile(fileName); } catch (TarException | IOException exception) { return false; } finally { if (tarFile != null) { try { tarFile.close(); } catch (IOException e) { } } } return true; }
Source:
<code>public String getUrlFromExternalLinkaAfterPageIsLoaded() { <START> wait.forElementPresent(By.cssSelector("body")); <END> return driver.getCurrentUrl(); }</code><technical_language>declared part of UI mapping top of class</technical_language>

Target:
public String getUrlFromExternalLinkaAfterPageIsLoaded() { wait.forElementVisible(bodyElement); return driver.getCurrentUrl(); }
Source:
<code><START> public ClusterDataToSamConverter withMolecularIndexTag(final String molecularIndexTag) { <END> this.molecularIndexTag = molecularIndexTag; return this; }</code><technical_language>intregued of word "with" in name of this method, verb is "set"...why set\* pattern in other factories? (below well)</technical_language>

Target:
public ClusterDataToSamConverter withMolecularIndexTag(final String molecularIndexTag) { if (molecularIndexTag == null) throw new IllegalArgumentException("Molecular index tag was null"); this.molecularIndexTag = molecularIndexTag; return this; }
Source:
<code>protected void testExecute() throws Exception { ______TS("Not enough parameters"); verifyHttpParameterFailure(); ______TS("Typical case"); CourseAttributes course = typicalBundle.courses.get("typicalCourse1"); FeedbackSessionAttributes session = typicalBundle.feedbackSessions.get("session1InCourse1"); String[] params = { Const.ParamsNames.COURSE_ID, course.getId(), Const.ParamsNames.FEEDBACK_SESSION_NAME, session.getFeedbackSessionName(), }; DeleteFeedbackSessionAction deleteFeedbackSessionAction = getAction(params); assertEquals(session.getFeedbackSessionName(), logic.getFeedbackSessionDetails(session.getFeedbackSessionName(), course.getId()).feedbackSession.getFeedbackSessionName()); logic.moveFeedbackSessionToRecycleBin(session.getFeedbackSessionName(), course.getId()); JsonResult result = getJsonResult(deleteFeedbackSessionAction); MessageOutput messageOutput = (MessageOutput) result.getOutput(); assertEquals(messageOutput.getMessage(), "The feedback session is deleted."); <START> assertThrows(EntityDoesNotExistException.class, () -> { <END> logic.getFeedbackSessionDetails(session.getFeedbackSessionName(), course.getId()); }); }</code><technical_language>Instead of checking for exception attempt get feedback session, verify if logic returns null retrieve it: assertNull(logic.getFeedbackSessionFromRecycleBin(session.getFeedbackSessionName(), course.getId());</technical_language>

Target:
protected void testExecute() throws Exception { }
Source:
<code>private void initControlsFromConfig() { try { editableConfig.load(); tv.setInput(editableConfig); if (editableConfig instanceof FileBasedConfig) { FileBasedConfig fileConfig = (FileBasedConfig) editableConfig; File configFile = fileConfig.getFile(); if (configFile != null) if (isWriteable(configFile)) location.setText(configFile.getPath()); else location.setText(NLS.bind(UIText.ConfigurationEditorComponent_ReadOnlyLocationFormat, configFile.getPath())); else location.setText(UIText.ConfigurationEditorComponent_NoConfigLocationKnown); <START> newValue.setEnabled(configFile != null); <END> } } catch (IOException e) { Activator.handleError(e.getMessage(), e, true); } catch (ConfigInvalidException e) { Activator.handleError(e.getMessage(), e, true); } tv.expandAll(); updateEnablement(); }</code><technical_language>button is enabled configFile is writable. I propose instead setEnabled(false) beginning of this method setEnabled(true) isWritable(...) block</technical_language>

Target:
private void initControlsFromConfig() { try { editableConfig.load(); tv.setInput(editableConfig); editable = true; if (editableConfig instanceof FileBasedConfig) { FileBasedConfig fileConfig = (FileBasedConfig) editableConfig; File configFile = fileConfig.getFile(); if (configFile != null) if (isWriteable(configFile)) location.setText(configFile.getPath()); else { location.setText(NLS.bind(UIText.ConfigurationEditorComponent_ReadOnlyLocationFormat, configFile.getPath())); editable=false; } else { location.setText(UIText.ConfigurationEditorComponent_NoConfigLocationKnown); editable = false; } } } catch (IOException e) { Activator.handleError(e.getMessage(), e, true); } catch (ConfigInvalidException e) { Activator.handleError(e.getMessage(), e, true); } tv.expandAll(); updateEnablement(); }
Source:
<code><START> public Matrix mul(final Matrix matrix) { <END> if (matrix.isDense()) { return new DenseMatrix((breeze.linalg.DenseMatrix<Double>) breezeMatrix.$colon$times(((DenseMatrix) matrix).breezeMatrix, MatrixOps.EMUL_DD)); } else { throw new UnsupportedOperationException(); } }</code><technical_language>UnsupportedOperationException thrown this method</technical_language>

Target:
public Matrix mul(final Matrix matrix) { if (matrix.isDense()) { return new DenseMatrix((breeze.linalg.DenseMatrix<Double>) breezeMatrix.$colon$times(((DenseMatrix) matrix).breezeMatrix, MatrixOps.EMUL_DD)); } else { return new DenseMatrix((breeze.linalg.DenseMatrix<Double>) breezeMatrix.$colon$times(((CSCMatrix) matrix).getBreezeMatrix(), MatrixOps.EMUL_MM)); } }
Source:
<code>private void writeAffinityGroups() { List<AffinityGroup> affinityGroups = fullEntityOvfData.getAffinityGroups(); <START> if (affinityGroups == null || affinityGroups.isEmpty()) { <END> return; } _writer.writeStartElement("Section"); _writer.writeAttributeString(XSI_URI, "type", "ovf:AffinityGroupsSection_Type"); affinityGroups.forEach(affinityGroup -> { _writer.writeStartElement(OvfProperties.AFFINITY_GROUP); _writer.writeAttributeString(OVF_URI, "name", affinityGroup.getName()); _writer.writeEndElement(); }); _writer.writeEndElement(); }</code><technical_language>Try CollectionUtils.isEmpty instead</technical_language>

Target:
private void writeAffinityGroups() { List<AffinityGroup> affinityGroups = fullEntityOvfData.getAffinityGroups(); if (CollectionUtils.isEmpty(affinityGroups)) { return; } _writer.writeStartElement("Section"); _writer.writeAttributeString(XSI_URI, "type", "ovf:AffinityGroupsSection_Type"); affinityGroups.forEach(affinityGroup -> { _writer.writeStartElement(OvfProperties.AFFINITY_GROUP); _writer.writeAttributeString(OVF_URI, "name", affinityGroup.getName()); _writer.writeEndElement(); }); _writer.writeEndElement(); }
Source:
<code>public Boolean getisValueTypeCorrect() { if (this.xmpNode.getChildren().size() != 5) { return Boolean.FALSE; } <START> VeraPDFXMPNode description = null; <END> VeraPDFXMPNode field = null; VeraPDFXMPNode namespaceURI = null; VeraPDFXMPNode prefix = null; VeraPDFXMPNode type = null; for (VeraPDFXMPNode child : this.xmpNode.getChildren()) { if (XMPSchemaRegistryImpl.NS_PDFA_TYPE.equals(child.getNamespaceURI())) { switch (child.getName()) { case "namespaceURI": namespaceURI = child; break; case "prefix": prefix = child; break; case "field": field = child; break; case "description": description = child; break; case "type": type = child; break; } } } return Boolean.valueOf(description != null && prefix != null && field != null && namespaceURI != null && type != null); }</code><technical_language>boolean flag</technical_language>

Target:
public Boolean getisValueTypeCorrect() { boolean isValid = true; boolean isDescriptionPresent = false; boolean isFieldPresent = false; boolean isNamespaceURIPresent = false; boolean isPrefixPresent = false; boolean isTypePresent = false; for (VeraPDFXMPNode child : this.xmpNode.getChildren()) { if (XMPSchemaRegistryImpl.NS_PDFA_TYPE.equals(child.getNamespaceURI())) { switch (child.getName()) { case "namespaceURI": if (isNamespaceURIPresent) { isValid = false; } else { isNamespaceURIPresent = true; } break; case "prefix": if (isPrefixPresent) { isValid = false; } else { isPrefixPresent = true; } break; case "field": if (isFieldPresent) { isValid = false; } else { isFieldPresent = true; } break; case "description": if (isDescriptionPresent) { isValid = false; } else { isDescriptionPresent = true; } break; case "type": if (isTypePresent) { isValid = false; } else { isTypePresent = true; } break; default: isValid = false; } } else { isValid = false; } } return Boolean.valueOf(isValid); }
Source:
<code>public void validate() throws Exception { if (getText() == null) { throw new Exception("The message must contain a text."); } <START> List<String> allowed = Arrays.asList(new String[]{"get", "reload", "clean"}); <END> if (!allowed.contains(getText())) { throw new Exception( String.format("The message text must be one of [%s] - '%s' given", allowed.stream().collect(Collectors.joining(",")), getText())); } super.validate(); }</code><technical_language>defined in file</technical_language>

Target:
public void validate() throws Exception { if (getText() == null) { throw new Exception("The message must contain a text."); } if (!ALLOWED_OPTIONS.contains(getText())) { throw new Exception( String.format("The message text must be one of [%s] - '%s' given", ALLOWED_OPTIONS.stream().collect(Collectors.joining(",")), getText())); } super.validate(); }
Source:
<code>public static LwM2mJsonObject fromJsonLwM2m(String jsonString) throws LwM2mJsonException { try { LwM2mJsonObject element = gson.fromJson(jsonString, LwM2mJsonObject.class); return element; } catch (Exception e) { LOG.error(" Unable to deserialize JSON String to LwM2mJsonElement object: " +e.getMessage()); <START> throw new LwM2mJsonException( <END> " Unable to deserialize JSON String to LwM2mJsonElement object ", e); } }</code><technical_language>log throw, need choose :)</technical_language>

Target:
public static LwM2mJsonObject fromJsonLwM2m(String jsonString) throws LwM2mJsonException { try { LwM2mJsonObject element = gson.fromJson(jsonString, LwM2mJsonObject.class); return element; } catch (Exception e) { throw new LwM2mJsonException( "Unable to deserialize JSON String to LwM2mJsonObject ", e); } }
Source:
<code>public static byte[] byteBufferToArray(ByteBuffer buf) { byte[] arr = new byte[buf.remaining()]; int prevPosition = buf.position(); buf.get(arr); <START> buf.position(prevPosition); <END> return arr; }</code><technical_language>nit: finally restore this value</technical_language>

Target:
public static byte[] byteBufferToArray(ByteBuffer buf) { byte[] arr = new byte[buf.remaining()]; int prevPosition = buf.position(); try { buf.get(arr); } finally { buf.position(prevPosition); } return arr; }
Source:
<code>public void testGetDutyCycleValueSuccess() throws Exception { ATCommandResponse mockedResponse = Mockito.mock(ATCommandResponse.class); Mockito.when(mockedResponse.getResponseStatus()).thenReturn(ATCommandStatus.OK); Mockito.when(mockedResponse.getResponse()).thenReturn(new byte[]{0x03, 0x52}); Mockito.doReturn(mockedResponse).when(xbeeDevice).sendATCommand((ATCommand)Mockito.any()); double dutyCycle = -1; try { dutyCycle = xbeeDevice.getPWMDutyCycle(IOLine.DIO10_PWM0); } catch (InvalidOperatingModeException e) { fail("This exception shouldn't be thrown now."); } catch (XBeeException e) { fail("This exception shouldn't be thrown now."); } <START> assertEquals(83.1, dutyCycle, 0.1); <END> }</code><technical_language>Assertions doubles is fail other computers :S</technical_language>

Target:
public void testGetDutyCycleValueSuccess() throws InvalidOperatingModeException, XBeeException { ATCommandResponse mockedResponse = Mockito.mock(ATCommandResponse.class); Mockito.when(mockedResponse.getResponseStatus()).thenReturn(ATCommandStatus.OK); Mockito.when(mockedResponse.getResponse()).thenReturn(new byte[]{0x03, 0x52}); Mockito.doReturn(mockedResponse).when(xbeeDevice).sendATCommand((ATCommand)Mockito.any()); double dutyCycle = xbeeDevice.getPWMDutyCycle(IOLine.DIO10_PWM0); assertEquals(83.1, dutyCycle, 0.1); }
Source:
<code>protected OpenShiftResourceHandle createResourceFromStream(InputStream stream) throws IOException { try { StringBuilder textBuilder = new StringBuilder(); try (Reader reader = new BufferedReader(new InputStreamReader (stream, Charset.forName(StandardCharsets.UTF_8.name())))) { int c = 0; while ((c = reader.read()) != -1) { textBuilder.append((char) c); } } String content = textBuilder.toString(); char nonwhitespace; int index=0; do { nonwhitespace=content.charAt(index++); } while (index < content.length() && Character.isWhitespace(nonwhitespace)); if ( nonwhitespace == '{' ) { ModelNode json; json = ModelNode.fromJSONString(content); String kind = json.get("kind").asString(); return createResourceFromJson(kind, json); } else { StringTokenizer tokenizer = new StringTokenizer(content.trim(),":\n"); tokenizer.nextToken(); String kind = tokenizer.nextToken().trim(); return createResourceFromYaml(kind, content); } <START> } finally { <END> stream.close(); } }</code><technical_language>createResourceFromXXX implementation, suggest: - Stick method, rename createResourceFromString(kind, content) - Extract content calling passing argument this point I if worth write logic find out file type (JSON YAML) if sense pass entire file (as argument, a string) createResourceFromString()..</technical_language>

Target:
protected OpenShiftResourceHandle createResourceFromStream(InputStream stream) throws IOException { try { String content = IOUtils.toString(stream, StandardCharsets.UTF_8); try { ModelNode json; json = ModelNode.fromJSONString(content); String kind = json.get("kind").asString(); content = json.toJSONString(true); return createResourceFromString(kind, content); } catch (IllegalArgumentException e) { StringTokenizer tokenizer = new StringTokenizer(content.trim(),":\n"); tokenizer.nextToken(); String kind = tokenizer.nextToken().trim(); return createResourceFromString(kind, content); } } finally { stream.close(); } }
Source:
<code>private static void runDashboardServer(final int port) throws IOException { LOG.log(Level.INFO, "Now launch dashboard server"); <START> final Path tmpPath = Paths.get(System.getProperty("java.io.tmpdir") + "/dashboard"); <END> try { final FileSystem fileSystem = FileSystems.newFileSystem( AsyncDolphinLauncher.class.getResource("").toURI(), Collections.<String, String>emptyMap() ); final Path jarPath = fileSystem.getPath("/dashboard"); Files.walkFileTree(jarPath, new SimpleFileVisitor<Path>() { @Override public FileVisitResult preVisitDirectory(final Path dir, final BasicFileAttributes attrs) throws IOException { Files.createDirectories(tmpPath.resolve(jarPath.relativize(dir).toString())); return FileVisitResult.CONTINUE; } @Override public FileVisitResult visitFile(final Path file, final BasicFileAttributes attrs) throws IOException { Files.copy(file, tmpPath.resolve(jarPath.relativize(file).toString()), REPLACE_EXISTING); return FileVisitResult.CONTINUE; } }); } catch (Exception e) { LOG.log(Level.WARNING, "Copy failure: " + e); throw new IOException(); } try { final String tmpScript = tmpPath.toString() + "/dashboard.py"; final ProcessBuilder pb = new ProcessBuilder("python", tmpScript, String.valueOf(port)).inheritIO(); final Process p = pb.start(); Runtime.getRuntime().addShutdownHook(new Thread() { @Override public void run() { p.destroy(); } }); } catch (Exception e) { LOG.log(Level.WARNING, "Launch failure: " + e); throw new IOException(); } }</code><technical_language>"/dashboard" a static variable, DASHBOARD_DIR</technical_language>

Target:
private static void runDashboardServer(final int port) throws IOException { LOG.log(Level.INFO, "Now launch dashboard server"); final Path tmpPath = Paths.get(System.getProperty("java.io.tmpdir"), DASHBOARD_DIR); try { final FileSystem fileSystem = FileSystems.newFileSystem( AsyncDolphinLauncher.class.getResource("").toURI(), Collections.<String, String>emptyMap() ); final Path jarPath = fileSystem.getPath(DASHBOARD_DIR); Files.walkFileTree(jarPath, new SimpleFileVisitor<Path>() { @Override public FileVisitResult preVisitDirectory(final Path dir, final BasicFileAttributes attrs) throws IOException { Files.createDirectories(tmpPath.resolve(jarPath.relativize(dir).toString())); return FileVisitResult.CONTINUE; } @Override public FileVisitResult visitFile(final Path file, final BasicFileAttributes attrs) throws IOException { Files.copy(file, tmpPath.resolve(jarPath.relativize(file).toString()), REPLACE_EXISTING); return FileVisitResult.CONTINUE; } }); final String tmpScript = Paths.get(tmpPath.toString(), DASHBOARD_SCRIPT).toString(); final ProcessBuilder pb = new ProcessBuilder("python", tmpScript, String.valueOf(port)).inheritIO(); final Process p = pb.start(); Runtime.getRuntime().addShutdownHook(new Thread() { @Override public void run() { p.destroy(); } }); } catch (URISyntaxException e) { LOG.log(Level.WARNING, "Failed to access current jar file.", e); } }
Source:
<code>private static boolean _isAlive(VirtualChannel channel, int pid, Launcher launcher) throws IOException, InterruptedException { if (launcher instanceof Launcher.LocalLauncher || launcher instanceof Launcher.RemoteLauncher) { try { return channel.call(new Liveness(pid)); } catch (IllegalStateException x) { <START> LOGGER.log(Level.WARNING, "cannot determine liveness of " + pid, x); <END> } catch (PosixException x) { LOGGER.log(Level.WARNING, "cannot determine liveness of " + pid, x); } return true; } else { return launcher.launch().cmds("ps", "-o", "pid=", Integer.toString(pid)).quiet(true).join() == 0; } }</code><technical_language>check Jenkins core version here: Jenkins.getVersion().isNewerThan(new VersionNumber("2.64")) in order optimize call agent side. check JNR version . polishing, break some use-cases pre-loaded JAR files</technical_language>

Target:
private static boolean _isAlive(VirtualChannel channel, int pid, Launcher launcher) throws IOException, InterruptedException { if (launcher instanceof Launcher.LocalLauncher || launcher instanceof Launcher.RemoteLauncher) { try { return channel.call(new Liveness(pid)); } catch (IllegalStateException x) { LOGGER.log(Level.WARNING, "cannot determine liveness of " + pid, x); } catch (PosixException x) { LOGGER.log(Level.WARNING, "cannot determine liveness of " + pid, x); } return true; } else { return launcher.launch().cmds("ps", "-o", "pid=", Integer.toString(pid)).quiet(true).start().joinWithTimeout(1, TimeUnit.MINUTES, launcher.getListener())== 0; } }
Source:
<code>private void updateTableStat(OverridableConf queryContext, PartitionedTableScanNode scanNode) throws TajoException { if (scanNode.getInputPaths().length > 0) { try { FileSystem fs = scanNode.getInputPaths()[0].getFileSystem(queryContext.getConf()); long totalVolume = 0; for (Path input : scanNode.getInputPaths()) { ContentSummary summary = fs.getContentSummary(input); totalVolume += summary.getLength(); <START> totalVolume += summary.getFileCount(); <END> } scanNode.getTableDesc().getStats().setNumBytes(totalVolume); } catch (Throwable e) { throw new TajoInternalError(e); } } }</code><technical_language>File count added</technical_language>

Target:
private void updateTableStat(OverridableConf queryContext, PartitionedTableScanNode scanNode) throws TajoException { if (scanNode.getInputPaths().length > 0) { try { FileSystem fs = scanNode.getInputPaths()[0].getFileSystem(queryContext.getConf()); long totalVolume = 0; for (Path input : scanNode.getInputPaths()) { ContentSummary summary = fs.getContentSummary(input); totalVolume += summary.getLength(); } scanNode.getTableDesc().getStats().setNumBytes(totalVolume); } catch (Throwable e) { throw new TajoInternalError(e); } } }
Source:
<code>private Optional<String> findIndexFileObjectId(final ObjectNode entities) { <START> for (JsonNode entity : entities.withArray("content")) { <END> String fileName = entity.get("fileName").textValue(); if (fileName.endsWith(".bai")) { return Optional.of(entity.get("id").textValue()); } } return Optional.empty(); }</code><technical_language>a good place val</technical_language>

Target:
private Optional<String> findIndexFileObjectId(final ObjectNode entities) { for (val entity : entities.withArray("content")) { val fileName = entity.get("fileName").textValue(); if (fileName.endsWith(".bai")) { return Optional.of(entity.get("id").textValue()); } } return Optional.empty(); }
Source:
<code>public ApplyNode( @JsonProperty("id") PlanNodeId id, @JsonProperty("input") PlanNode input, @JsonProperty("subquery") PlanNode subquery, @JsonProperty("subqueryAssignments") Assignments subqueryAssignments, @JsonProperty("correlation") List<VariableReferenceExpression> correlation, @JsonProperty("originSubqueryError") String originSubqueryError) { super(id); checkArgument(input.getOutputVariables().containsAll(correlation), "Input does not contain symbols from correlation"); ApplyNodeUtil.verifySubquerySupported(subqueryAssignments); this.input = requireNonNull(input, "input is null"); <START> this.subquery = requireNonNull(subquery, "right is null"); <END> this.subqueryAssignments = requireNonNull(subqueryAssignments, "assignments is null"); this.correlation = ImmutableList.copyOf(requireNonNull(correlation, "correlation is null")); this.originSubqueryError = requireNonNull(originSubqueryError, "originSubqueryError is null"); }</code><technical_language>message "subquery is null"</technical_language>

Target:
public ApplyNode( @JsonProperty("id") PlanNodeId id, @JsonProperty("input") PlanNode input, @JsonProperty("subquery") PlanNode subquery, @JsonProperty("subqueryAssignments") Assignments subqueryAssignments, @JsonProperty("correlation") List<VariableReferenceExpression> correlation, @JsonProperty("originSubqueryError") String originSubqueryError) { super(id); checkArgument(input.getOutputVariables().containsAll(correlation), "Input does not contain symbols from correlation"); verifySubquerySupported(subqueryAssignments); this.input = requireNonNull(input, "input is null"); this.subquery = requireNonNull(subquery, "subquery is null"); this.subqueryAssignments = requireNonNull(subqueryAssignments, "assignments is null"); this.correlation = ImmutableList.copyOf(requireNonNull(correlation, "correlation is null")); this.originSubqueryError = requireNonNull(originSubqueryError, "originSubqueryError is null"); }
Source:
<code>private void sendPollInfoToPositionTracker(Consumer<?, ?> consumer, ConsumerRecords<?, ?> records) { _kafkaPositionTracker.ifPresent(tracker -> { for (final TopicPartition topicPartition : tracker.getPartitionsNeedingInit()) { try { tracker.initializePartition(topicPartition, consumer.position(topicPartition)); } catch (IllegalStateException e) { _logger.trace("Got IllegalStateException when processing partition {}", topicPartition, e); } catch (InvalidOffsetException e) { _logger.trace("Got InvalidOffsetException when processing partition {}", topicPartition, e); } } <START> tracker.onRecordsReceived(records, consumer.metrics()); <END> }); }</code><technical_language>(not expecting in this PR/anytime soon): flushless producer track of positions already. want if leverage there? all, check out</technical_language>

Target:
private void sendPollInfoToPositionTracker(Consumer<?, ?> consumer, ConsumerRecords<?, ?> records) { try { _kafkaPositionTracker.ifPresent(tracker -> { for (final TopicPartition topicPartition : tracker.getUninitializedPartitions()) { try { tracker.initializePartition(topicPartition, consumer.position(topicPartition)); } catch (IllegalStateException e) { _logger.trace("Got IllegalStateException when processing partition {}", topicPartition, e); } catch (InvalidOffsetException e) { _logger.trace("Got InvalidOffsetException when processing partition {}", topicPartition, e); } } tracker.onRecordsReceived(records, consumer.metrics()); }); } catch (WakeupException | InterruptException e) { throw e; } catch (Exception e) { _logger.warn("Got uncaught exception while processing position tracker code (swallowing and continuing)", e); } }
Source:
<code>public int hashCode() { <START> return Objects.hash(getDataLinks(), getChargeId(), getAmount(), getState(), getCardBrand(), <END> getGatewayTransactionId(), getReturnUrl(), getEmail(), getDescription(), getReference(), getProviderName(), createdDate, getRefundSummary(), getSettlementSummary(), getAuth3dsData(), getCardDetails(), getLanguage(), getDelayedCapture(), getCorporateCardSurcharge(), getTotalAmount(), getWalletType()); }</code><technical_language>for getters</technical_language>

Target:
public int hashCode() { return Objects.hash(dataLinks, chargeId, amount, state, cardBrand, gatewayTransactionId, returnUrl, email, description, reference, providerName, createdDate, refundSummary, settlementSummary, auth3dsData, cardDetails, language, delayedCapture, corporateCardSurcharge, totalAmount, walletType); }
Source:
<code>protected void executeCommand() { StoragePoolParametersBase parameters = new StoragePoolParametersBase(getStoragePoolId()); ActionReturnValue actionReturnValue = runInternalAction(ActionType.ProcessOvfUpdateForStoragePool, parameters, getContext()); <START> HashSet<Guid> <END> proccessedDomains = actionReturnValue.getActionReturnValue(); if (!proccessedDomains.isEmpty()) { runInternalActionWithTasksContext(ActionType.ProcessOvfUpdateForStorageDomain, createProcessOvfUpdateForDomainParams()); } setSucceeded(true); }</code><technical_language>Please Set instead of concrete implementation</technical_language>

Target:
protected void executeCommand() { StoragePoolParametersBase parameters = new StoragePoolParametersBase(getStoragePoolId()); ActionReturnValue actionReturnValue = runInternalAction(ActionType.ProcessOvfUpdateForStoragePool, parameters, getContext()); Set<Guid> proccessedDomains = actionReturnValue.getActionReturnValue(); if (!proccessedDomains.isEmpty()) { runInternalActionWithTasksContext(ActionType.ProcessOvfUpdateForStorageDomain, createProcessOvfUpdateForDomainParams()); } setSucceeded(true); }
Source:
<code>protected CheckoutCommand checkoutPaths() throws IOException, RefNotFoundException { RevWalk revWalk = new RevWalk(repo); DirCache dc = repo.lockDirCache(); try { TreeWalk treeWalk = new TreeWalk(revWalk.getObjectReader()); treeWalk.addTree(new DirCacheIterator(dc)); treeWalk.setFilter(PathFilterGroup.createFromStrings(paths)); List<String> files = new LinkedList<String>(); while (treeWalk.next()) if (treeWalk.isSubtree()) treeWalk.enterSubtree(); else <START> files.add(treeWalk.getPathString()); <END> if (startCommit != null || startPoint != null) { DirCacheEditor editor = dc.editor(); TreeWalk startWalk = new TreeWalk(revWalk.getObjectReader()); startWalk.setFilter(treeWalk.getFilter()); startWalk.addTree(revWalk.parseCommit(getStartPoint()) .getTree()); while (startWalk.next()) if (startWalk.isSubtree()) startWalk.enterSubtree(); else { final ObjectId blobId = startWalk.getObjectId(0); editor.add(new PathEdit(startWalk.getPathString()) { public void apply(DirCacheEntry ent) { ent.setObjectId(blobId); } }); } editor.commit(); } File workTree = repo.getWorkTree(); for (String file : files) DirCacheCheckout.checkoutEntry(repo, new File(workTree, file), dc.getEntry(file)); } finally { dc.unlock(); revWalk.release(); } return this; }</code><technical_language>Better: treeWalk.setRecursive(true); (see above)</technical_language>

Target:
protected CheckoutCommand checkoutPaths() throws IOException, RefNotFoundException { RevWalk revWalk = new RevWalk(repo); DirCache dc = repo.lockDirCache(); try { TreeWalk treeWalk = new TreeWalk(revWalk.getObjectReader()); treeWalk.setRecursive(true); treeWalk.addTree(new DirCacheIterator(dc)); treeWalk.setFilter(PathFilterGroup.createFromStrings(paths)); List<String> files = new LinkedList<String>(); while (treeWalk.next()) files.add(treeWalk.getPathString()); if (startCommit != null || startPoint != null) { DirCacheEditor editor = dc.editor(); TreeWalk startWalk = new TreeWalk(revWalk.getObjectReader()); startWalk.setRecursive(true); startWalk.setFilter(treeWalk.getFilter()); startWalk.addTree(revWalk.parseCommit(getStartPoint()) .getTree()); while (startWalk.next()) { final ObjectId blobId = startWalk.getObjectId(0); editor.add(new PathEdit(startWalk.getPathString()) { public void apply(DirCacheEntry ent) { ent.setObjectId(blobId); } }); } editor.commit(); } File workTree = repo.getWorkTree(); for (String file : files) DirCacheCheckout.checkoutEntry(repo, new File(workTree, file), dc.getEntry(file)); } finally { dc.unlock(); revWalk.release(); } return this; }
Source:
<code>private ProjectReadAccess getReadAccessFromForm( final MultipartForm form ) { final ProjectReadAccess.Builder readAccess = ProjectReadAccess.create(); return Optional.ofNullable( form.getAsString( PROJECT_READ_ACCESS_JSON_PROPERTY_NAME ) ). map( readAccessAsString -> { try { return new ObjectMapper(). readValue( readAccessAsString, ProjectReadAccessJson.class ); } catch ( IOException e ) { <START> LOG.error( "Cannot parse project read access.", e ); <END> return null; } } ). map( ProjectReadAccessJson::getProjectReadAccess ). orElseGet( readAccess::build ); }</code><technical_language>@vbradnitski I guess throw UncheckedIOException</technical_language>

Target:
private ProjectReadAccess getReadAccessFromForm( final MultipartForm form ) { final ProjectReadAccess.Builder readAccess = ProjectReadAccess.create(); return Optional.ofNullable( form.getAsString( PROJECT_READ_ACCESS_JSON_PROPERTY_NAME ) ). map( readAccessAsString -> { try { return new ObjectMapper(). readValue( readAccessAsString, ProjectReadAccessJson.class ); } catch ( IOException e ) { throw new UncheckedIOException( e ); } } ). map( ProjectReadAccessJson::getProjectReadAccess ). orElseGet( readAccess::build ); }
Source:
<code>public <T> T convert(Object source, Class<T> target) throws Exception { int arrLength = Array.getLength(source); Class<?> elementType = target.getComponentType(); Object result = Array.newInstance(elementType, arrLength); for (int count = 0; count < arrLength; count++) { <START> Array.set(result, count, Converters.convert(Array.get(source, count), elementType)); <END> } return (T) result; }</code><technical_language>This great, is worth checking for null (returned converters conversion) do want ride</technical_language>

Target:
public <T> T convert(Object source, Class<T> target) throws Exception { int arrLength = Array.getLength(source); Class<?> elementType = target.getComponentType(); Object result = Array.newInstance(elementType, arrLength); for (int count = 0; count < arrLength; count++) { Object sourceElement = Array.get(source, count); Object converted = Converters.convert(sourceElement, elementType); if (sourceElement != null && converted == null) { return null; } Array.set(result, count, converted); } return (T) result; }
Source:
<code>public Response add(User entity) throws SQLException { if (!Context.getPermissionsManager().isAdmin(getUserId())) { Context.getPermissionsManager().checkRegistration(getUserId()); Context.getPermissionsManager().checkUserUpdate(getUserId(), new User(), entity); <START> Config config = Context.getConfig(); <END> int deviceLimit = config.getInteger("default.deviceLimit"); int expirationDuration = config.getInteger("default.expirationDuration"); if (deviceLimit > 0) { entity.setDeviceLimit(deviceLimit); } if (expirationDuration > 0) { Calendar cal = Calendar.getInstance(); cal.add(Calendar.DATE, expirationDuration); Date expirationTime = cal.getTime(); entity.setExpirationTime(expirationTime); } } Context.getPermissionsManager().addUser(entity); if (Context.getNotificationManager() != null) { Context.getNotificationManager().refresh(); } return Response.ok(entity).build(); }</code><technical_language>Variable for config is needed</technical_language>

Target:
public Response add(User entity) throws SQLException { if (!Context.getPermissionsManager().isAdmin(getUserId())) { Context.getPermissionsManager().checkRegistration(getUserId()); Context.getPermissionsManager().checkUserUpdate(getUserId(), new User(), entity); entity.setDeviceLimit(Context.getConfig().getInteger("users.defaultDeviceLimit")); int expirationDays = Context.getConfig().getInteger("users.defaultExpirationDays"); if (expirationDays > 0) { entity.setExpirationTime( new Date(System.currentTimeMillis() + (long) expirationDays * 24 * 3600 * 1000)); } } Context.getPermissionsManager().addUser(entity); if (Context.getNotificationManager() != null) { Context.getNotificationManager().refresh(); } return Response.ok(entity).build(); }
Source:
<code><START> static String[] getFileExtensions(String fileName) { <END> List<String> extensions = new ArrayList<String>(); while (fileName.length() > 0) { extensions.add(fileName); if (fileName.indexOf('.') == -1) { break; } fileName = fileName.substring(fileName.indexOf('.') + 1, fileName.length()); } Collections.reverse(extensions); return extensions.toArray(new String[extensions.size()]); }</code><technical_language>A List<String> simpler return</technical_language>

Target:
static List<String> getFileExtensions(String fileName) { List<String> extensions = new ArrayList<String>(); while (fileName.length() > 0) { extensions.add(fileName); if (fileName.indexOf('.') == -1) { break; } fileName = fileName.substring(fileName.indexOf('.') + 1, fileName.length()); } Collections.reverse(extensions); return extensions; }
Source:
<code>public void setup() { databaseHelper.addObject("" + "person: Jaap Veldhuis\n" + "nic-hdl: JAAP-TEST\n" + "source: TEST"); databaseHelper.addObject("" + "mntner: TEST-MNT\n" + "descr: Test Maintainer\n" + "admin-c: JAAP-TEST\n" + "auth: SSO person@net.net\n" + "auth: MD5-PW $1$d9fKeTr2$Si7YudNf4rUGmR71n/cqk/ #test\n" + "mnt-by: TEST-MNT\n" + "source: TEST"); databaseHelper.addObject("" + <START> "mntner: XS4ALL-MNT\n" + <END> "descr: XS4ALL Maintainer\n" + "admin-c: JAAP-TEST\n" + "auth: SSO person@net.net\n" + "auth: MD5-PW $1$Y8rG1Ste$QzFB.VSD5mDy7nlb/BJix/ #XS4ALL-MNT\n" + "mnt-by: TEST-MNT\n" + "source: TEST"); databaseHelper.updateObject("" + "person: Jaap Veldhuis\n" + "e-mail: jaapx@ripe.net\n" + "address: Hoofdstraat 1\n" + "phone: +31 6 12345678\n" + "nic-hdl: JAAP-TEST\n" + "mnt-by: TEST-MNT\n" + "mnt-by: XS4ALL-MNT\n" + "source: TEST" ); }</code><technical_language>anonymous name for maintainer? production</technical_language>

Target:
public void setup() { databaseHelper.addObject("" + "person: Jaap Knasterhuis\n" + "nic-hdl: JAAP-TEST\n" + "source: TEST"); databaseHelper.addObject("" + "mntner: TEST-MNT\n" + "descr: Test Maintainer\n" + "admin-c: JAAP-TEST\n" + "auth: SSO person@net.net\n" + "auth: MD5-PW $1$d9fKeTr2$Si7YudNf4rUGmR71n/cqk/ #test\n" + "mnt-by: TEST-MNT\n" + "source: TEST"); databaseHelper.addObject("" + "mntner: TEST2-MNT\n" + "descr: XS4ALL Maintainer\n" + "admin-c: JAAP-TEST\n" + "auth: SSO person@net.net\n" + "auth: MD5-PW $1$Y8rG1Ste$QzFB.VSD5mDy7nlb/BJix/ #TEST2-MNT\n" + "mnt-by: TEST-MNT\n" + "source: TEST"); databaseHelper.updateObject("" + "person: Jaap Veldhuis\n" + "e-mail: jaapx@ripe.net\n" + "address: Hoofdstraat 1\n" + "phone: +31 6 12345678\n" + "nic-hdl: JAAP-TEST\n" + "mnt-by: TEST-MNT\n" + "mnt-by: TEST2-MNT\n" + "source: TEST" ); }
Source:
<code>public static Map<String, String> getProjectSettings(IJavaProject javaProject) { Map<String, String> options= new HashMap<>(javaProject.getOptions(true)); ProfileVersioner versioner= new ProfileVersioner(); int profileVersion= new ProjectScope(javaProject.getProject()) <START> .getNode(JavaUI.ID_PLUGIN) <END> .getInt(FORMATTER_SETTINGS_VERSION, versioner.getCurrentVersion()); if (profileVersion == versioner.getCurrentVersion()) return options; CustomProfile profile= new CustomProfile(null, options, profileVersion, null); versioner.update(profile); return profile.getSettings(); }</code><technical_language>A null check added for return value</technical_language>

Target:
public static Map<String, String> getProjectSettings(IJavaProject javaProject) { Map<String, String> options= new HashMap<>(javaProject.getOptions(true)); ProfileVersioner versioner= new ProfileVersioner(); IEclipsePreferences prefs= new ProjectScope(javaProject.getProject()).getNode(JavaUI.ID_PLUGIN); if (prefs == null) return options; int profileVersion= prefs.getInt(FORMATTER_SETTINGS_VERSION, versioner.getCurrentVersion()); if (profileVersion == versioner.getCurrentVersion()) return options; CustomProfile profile= new CustomProfile(null, options, profileVersion, null); versioner.update(profile); return profile.getSettings(); }
Source:
<code>public void ThrottleOnOverTestWithQuota() throws Exception { ApiRateLimitChecker.setEntropy(entropy); ApiRateLimitChecker.setExpirationWaitMillis(1); ApiRateLimitChecker.setNotificationWaitMillis(1); List<JsonRateLimit> scenarios = new ArrayList<>(); int limit = 5000; scenarios.add(new JsonRateLimit(limit, limit, soon)); setupStubs(scenarios); for (int i = 0; i < 100; i++) { apiRateLimitCheckerThrottleOnOver.checkApiRateLimit(listener, github); } <START> assertEquals(0, handler.getView().stream().map(LogRecord::getMessage).filter(m -> m.contains("Sleeping")).count()); <END> }</code><technical_language>Turn this more helper methods. simplest do returns List<String> Iterable<String>. standard Hamcrest matchers assertThat list expected outputs. Alternatively, higher level helpers assertSleepCount(expectedNumThrottles) on. assertCount("Sleeping", 0) okay. for more complex scenarios, need check order count of messages. call specifics, need a easier read</technical_language>

Target:
public void ThrottleOnOverTestWithQuota() throws Exception { List<RateLimit> scenarios = new ArrayList<>(); int limit = 5000; scenarios.add(new RateLimit(limit, limit, soon)); setupStubs(scenarios); for (int i = 0; i < 100; i++) { ApiRateLimitChecker.ThrottleOnOver.checkApiRateLimit(listener, github); } assertEquals(0, countOfOutputLinesContaining("Sleeping")); }
Source:
<code>public List<String> handlePlayerNameTabComplete(CommonSender sender, String[] args) { ArrayList<String> mostLike = new ArrayList<>(); if(args.length == 1) { if (isValidNameDelimiter(args[0])) { String[] names = splitNameDelimiter(args[0]); String lookup = names[names.length - 1]; if (plugin.getConfig().isOfflineAutoComplete()) { for (CharSequence charSequence : plugin.getPlayerStorage().getAutoCompleteTree().getKeysStartingWith(lookup)) { mostLike.add(args[0] + charSequence.toString().substring(lookup.length())); } } } else if (plugin.getConfig().isOfflineAutoComplete()) { for (CharSequence charSequence : plugin.getPlayerStorage().getAutoCompleteTree().getKeysStartingWith(args[0])) { mostLike.add(charSequence.toString()); } } else { CommonPlayer senderPlayer = sender instanceof CommonPlayer ? (CommonPlayer) sender : null; String lower = args[0].toLowerCase(); for (CommonPlayer player : plugin.getServer().getOnlinePlayers()) { if ((senderPlayer == null || senderPlayer.canSee(player)) && player.getName().toLowerCase().startsWith(lower)) { mostLike.add(player.getName()); } } } } <START> if(args.length == 2) { <END> String lookup = args[1]; if(lookup.startsWith("#")) { return plugin.getReasonsConfig().getReasons().keySet().stream().map(k -> "#" + k) .filter(k -> k.startsWith(lookup)).collect(Collectors.toList()); } } if (mostLike.size() > 100) return mostLike.subList(0, 99); return mostLike; }</code><technical_language>this > 1? multiple reasons, i.e. /ban confuser #test #hello</technical_language>

Target:
public List<String> handlePlayerNameTabComplete(CommonSender sender, String[] args) { ArrayList<String> mostLike = new ArrayList<>(); if(args.length == 1) { if (isValidNameDelimiter(args[0])) { String[] names = splitNameDelimiter(args[0]); String lookup = names[names.length - 1]; if (plugin.getConfig().isOfflineAutoComplete()) { for (CharSequence charSequence : plugin.getPlayerStorage().getAutoCompleteTree().getKeysStartingWith(lookup)) { mostLike.add(args[0] + charSequence.toString().substring(lookup.length())); } } } else if (plugin.getConfig().isOfflineAutoComplete()) { for (CharSequence charSequence : plugin.getPlayerStorage().getAutoCompleteTree().getKeysStartingWith(args[0])) { mostLike.add(charSequence.toString()); } } else { CommonPlayer senderPlayer = sender instanceof CommonPlayer ? (CommonPlayer) sender : null; String lower = args[0].toLowerCase(); for (CommonPlayer player : plugin.getServer().getOnlinePlayers()) { if ((senderPlayer == null || senderPlayer.canSee(player)) && player.getName().toLowerCase().startsWith(lower)) { mostLike.add(player.getName()); } } } } if(args.length > 1) { String lookup = args[1]; if(lookup.startsWith("#")) { return plugin.getReasonsConfig().getReasons().keySet().stream().map(k -> "#" + k) .filter(k -> k.startsWith(lookup)).collect(Collectors.toList()); } } if (mostLike.size() > 100) return mostLike.subList(0, 99); return mostLike; }
Source:
<code>public void update() { <START> System.out.println("update :" + this.getClass().getSimpleName()); <END> }</code><technical_language>logging framework instead of printing stdout</technical_language>

Target:
public void update() { LOGGER.info("update AI component"); }