auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void scanFile(JavaFileScannerContext context) { super.context = context; if (isRegularExpression) { try { <START> searchPattern = Pattern.compile(headerFormat, Pattern.DOTALL); <END> } catch (RuntimeException e) { throw new IllegalArgumentException("[" + getClass().getSimpleName() + "] Unable to compile the regular expression: " + headerFormat, e); } } else { expectedLines = headerFormat.split("(?:\r)?\n|\r"); } visitFile(context.getFile()); }</code><technical_language>need recompile RegExp for file</technical_language>

Target:
public void scanFile(JavaFileScannerContext context) { super.context = context; if (isRegularExpression) { if (searchPattern == null) { try { searchPattern = Pattern.compile(headerFormat, Pattern.DOTALL); } catch (IllegalArgumentException e) { throw new IllegalArgumentException("[" + getClass().getSimpleName() + "] Unable to compile the regular expression: " + headerFormat, e); } } } else { expectedLines = headerFormat.split("(?:\r)?\n|\r"); } visitFile(context.getFile()); }
Source:
<code>public void testCreateQueryObservesDelete() { getMockContentResolver().insert(TABLE, values("key1", "val1")); subscription = db.createQuery(TABLE, null, null, null, null, false).subscribe(o); o.assertCursor().hasRow("key1", "val1").isExhausted(); <START> getMockContentResolver().delete(TABLE, null, null); <END> o.assertCursor().isExhausted(); }</code><technical_language>put getMockContentResolver() in a field? referenced more times in test</technical_language>

Target:
public void testCreateQueryObservesDelete() { contentResolver.insert(TABLE, values("key1", "val1")); subscription = db.createQuery(TABLE, null, null, null, null, false).subscribe(o); o.assertCursor().hasRow("key1", "val1").isExhausted(); contentResolver.delete(TABLE, null, null); o.assertCursor().isExhausted(); }
Source:
<code>public SourceDto buildDevfileSource(GithubUrl githubUrl) { <START> return newDto(SourceDto.class) <END> .withLocation(githubUrl.repositoryLocation()) .withType("github") .withBranch(githubUrl.getBranch()); }</code><technical_language>I assume this TODO is implement behavior WorkpaceConfig. a lines above: java if (!Strings.isNullOrEmpty(githubUrl.getSubfolder())) { parameters.put("keepDir", githubUrl.getSubfolder()); }</technical_language>

Target:
public SourceDto buildDevfileSource(GithubUrl githubUrl) { return newDto(SourceDto.class) .withLocation(githubUrl.repositoryLocation()) .withType("github") .withBranch(githubUrl.getBranch()) .withSparseCheckoutDir(githubUrl.getSubfolder()); }
Source:
<code>public void shutdown() { if (mode == LaunchMode.LOCAL) { ((LocalMode.Controller)this.appIdentifier).shutdown(); } else { try { YarnClient yarnClient = YarnClient.createYarnClient(); yarnClient.init(app.getConf()); yarnClient.start(); <START> <END> yarnClient.killApplication((ApplicationId)this.appIdentifier); yarnClient.stop(); } catch (YarnException e) { e.printStackTrace(); LOG.error("FAILED TO SHUTDOWN PYTHON STREAMING APPLICATION "); LOG.error("Encountered Exception " + e.getMessage()); } catch (IOException e) { LOG.error("FAILED TO SHUTDOWN PYTHON STREAMING APPLICATION "); LOG.error("Encountered Exception " + e.getMessage()); } } }</code><technical_language>log entire exception object, message. e. logger log message stacktrace</technical_language>

Target:
public void shutdown() { if (mode == LaunchMode.LOCAL) { ((LocalMode.Controller)this.appIdentifier).shutdown(); } else { try { YarnClient yarnClient = YarnClient.createYarnClient(); yarnClient.init(app.getConf()); yarnClient.start(); yarnClient.killApplication((ApplicationId)this.appIdentifier); yarnClient.stop(); } catch (YarnException e) { e.printStackTrace(); LOG.error("FAILED TO SHUTDOWN PYTHON STREAMING APPLICATION "); LOG.error("Encountered Exception {}" + e.getMessage()); } catch (IOException e) { LOG.error("FAILED TO SHUTDOWN PYTHON STREAMING APPLICATION "); LOG.error("Encountered Exception " + e.getMessage()); } } }
Source:
<code>private String replaceWildCardLikeChars(String operand) { <START> return operand.replace("%",""); <END> }</code><technical_language>this replace .*? else is removing % symbol</technical_language>

Target:
private String replaceWildCardLikeChars(String operand) { return operand.replaceAll("%", ".*"); }
Source:
<code>public @NonNull ArrayList<Object[]> getAdjustedTemplateChanges() { ArrayList<Object[]> changes = getTemplateChanges(); ArrayList<Object[]> adjustedChanges = new ArrayList<>(); for (int i = 0; i < changes.size(); i++) { Object[] change = changes.get(i); Object[] adjustedChange = {change[0], change[1]}; switch ((ChangeType)adjustedChange[1]) { case ADD: <START> adjustedChange[0] = TemporaryModel.isChangePendingAdd(this, i); <END> Timber.d("getAdjustedTemplateChanges() change %s ordinal adjusted from %s to %s", i, change[0], adjustedChange[0]); break; case DELETE: default: } adjustedChanges.add(adjustedChange); } return adjustedChanges; }</code><technical_language>(implementer's choice) - check for -1 here, ideal encode this in type system</technical_language>

Target:
public @NonNull ArrayList<Object[]> getAdjustedTemplateChanges() { ArrayList<Object[]> changes = getTemplateChanges(); ArrayList<Object[]> adjustedChanges = new ArrayList<>(); for (int i = 0; i < changes.size(); i++) { Object[] change = changes.get(i); Object[] adjustedChange = {change[0], change[1]}; switch ((ChangeType)adjustedChange[1]) { case ADD: adjustedChange[0] = TemporaryModel.getAdjustedAddOrdinalAtChangeIndex(this, i); Timber.d("getAdjustedTemplateChanges() change %s ordinal adjusted from %s to %s", i, change[0], adjustedChange[0]); break; case DELETE: default: } adjustedChanges.add(adjustedChange); } return adjustedChanges; }
Source:
<code>protected void onStop() { <START> super.onStop(); <END> lifecycleSubject.onNext(LifecycleEvent.STOP); }</code><technical_language>super.onXX() call</technical_language>

Target:
protected void onStop() { lifecycleSubject.onNext(LifecycleEvent.STOP); super.onStop(); }
Source:
<code>public WebServer(String serviceName, InetSocketAddress address) { Preconditions.checkNotNull(serviceName, "Service name cannot be null"); Preconditions.checkNotNull(address, "Server address cannot be null"); mAddress = address; mServiceName = serviceName; QueuedThreadPool threadPool = new QueuedThreadPool(); int webThreadCount = ServerConfiguration.getInt(PropertyKey.WEB_THREADS); threadPool.setMinThreads(webThreadCount * 2 + 1); threadPool.setMaxThreads(webThreadCount * 2 + 100); mServer = new Server(threadPool); mServerConnector = new ServerConnector(mServer); mServerConnector.setPort(mAddress.getPort()); mServerConnector.setHost(mAddress.getAddress().getHostAddress()); mServerConnector.setReuseAddress(true); mServer.addConnector(mServerConnector); try { mServerConnector.open(); } catch (IOException e) { throw new RuntimeException( String.format("Failed to listen on address %s for web server %s", mAddress, mServiceName), e); } System.setProperty("org.apache.jasper.compiler.disablejsr199", "false"); <START> mServletContextHandler = new ServletContextHandler(ServletContextHandler.SECURITY); <END> mServletContextHandler.setContextPath(AlluxioURI.SEPARATOR); mSecurityHandler = (ConstraintSecurityHandler) mServletContextHandler.getSecurityHandler(); for (String s :DISABLED_METHODS.split(",")) { disableHandler(s); } HandlerList handlers = new HandlerList(); handlers.setHandlers(new Handler[] {mServletContextHandler, new DefaultHandler()}); mServer.setHandler(handlers); }</code><technical_language>I want session handler created</technical_language>

Target:
public WebServer(String serviceName, InetSocketAddress address) { Preconditions.checkNotNull(serviceName, "Service name cannot be null"); Preconditions.checkNotNull(address, "Server address cannot be null"); mAddress = address; mServiceName = serviceName; QueuedThreadPool threadPool = new QueuedThreadPool(); int webThreadCount = ServerConfiguration.getInt(PropertyKey.WEB_THREADS); threadPool.setMinThreads(webThreadCount * 2 + 1); threadPool.setMaxThreads(webThreadCount * 2 + 100); mServer = new Server(threadPool); mServerConnector = new ServerConnector(mServer); mServerConnector.setPort(mAddress.getPort()); mServerConnector.setHost(mAddress.getAddress().getHostAddress()); mServerConnector.setReuseAddress(true); mServer.addConnector(mServerConnector); try { mServerConnector.open(); } catch (IOException e) { throw new RuntimeException( String.format("Failed to listen on address %s for web server %s", mAddress, mServiceName), e); } System.setProperty("org.apache.jasper.compiler.disablejsr199", "false"); mServletContextHandler = new ServletContextHandler(ServletContextHandler.SECURITY | ServletContextHandler.NO_SESSIONS); mServletContextHandler.setContextPath(AlluxioURI.SEPARATOR); mSecurityHandler = (ConstraintSecurityHandler) mServletContextHandler.getSecurityHandler(); for (String s : DISABLED_METHODS.split(",")) { disableMethod(s); } HandlerList handlers = new HandlerList(); handlers.setHandlers(new Handler[] {mServletContextHandler, new DefaultHandler()}); mServer.setHandler(handlers); }
Source:
<code>public static Collection<Object[]> data() throws IOException { MiniDFSTest.setupFS(); Object[][] data = new Object[][] { { Formats.AVRO, getDFS(), CompressionFormat.Snappy }, { Formats.AVRO, getDFS(), CompressionFormat.Deflate}, { Formats.AVRO, getDFS(), CompressionFormat.Bzip2}, { Formats.AVRO, getFS(), CompressionFormat.Snappy}, { Formats.AVRO, getFS(), CompressionFormat.Deflate}, { Formats.AVRO, getFS(), CompressionFormat.Bzip2}, { Formats.PARQUET, getDFS(), CompressionFormat.Snappy }, { Formats.PARQUET, getDFS(), CompressionFormat.Deflate }, { Formats.PARQUET, getFS(), CompressionFormat.Snappy }, <START> { Formats.PARQUET, getFS(), CompressionFormat.Deflate } }; <END> return Arrays.asList(data); }</code><technical_language>LZO listed if is supported</technical_language>

Target:
public static Collection<Object[]> data() throws IOException { MiniDFSTest.setupFS(); Object[][] data = new Object[][] { { Formats.AVRO, getDFS(), CompressionType.Snappy }, { Formats.AVRO, getDFS(), CompressionType.Deflate}, { Formats.AVRO, getDFS(), CompressionType.Bzip2}, { Formats.AVRO, getFS(), CompressionType.Snappy}, { Formats.AVRO, getFS(), CompressionType.Deflate}, { Formats.AVRO, getFS(), CompressionType.Bzip2}, { Formats.PARQUET, getDFS(), CompressionType.Snappy }, { Formats.PARQUET, getDFS(), CompressionType.Deflate }, { Formats.PARQUET, getFS(), CompressionType.Snappy }, { Formats.PARQUET, getFS(), CompressionType.Deflate } }; return Arrays.asList(data); }
Source:
<code>private Payload getNextPayload() { <START> try { <END> if (offset >= input.size()) { return null; } ByteSource byteSource = input.slice(offset, readLen); long byteSourceSize = byteSource.size(); Payload nextPayload = new ByteSourcePayload(byteSource); ContentMetadata cm = metaData.toBuilder() .contentLength(byteSourceSize) .contentMD5((HashCode) null) .build(); nextPayload.setContentMetadata(BaseMutableContentMetadata.fromContentMetadata(cm)); offset += byteSourceSize; return nextPayload; } catch (IOException e) { throw Throwables.propagate(e); } }</code><technical_language>[minor] try need enclose much</technical_language>

Target:
private Payload getNextPayload() { ByteSource byteSource; long byteSourceSize; try { if (offset >= input.size()) { return null; } byteSource = input.slice(offset, readLen); byteSourceSize = byteSource.size(); } catch (IOException e) { throw Throwables.propagate(e); } Payload nextPayload = new ByteSourcePayload(byteSource); ContentMetadata cm = metaData.toBuilder() .contentLength(byteSourceSize) .contentMD5((HashCode) null) .build(); nextPayload.setContentMetadata(BaseMutableContentMetadata.fromContentMetadata(cm)); offset += byteSourceSize; return nextPayload; }
Source:
<code>public static LiteralExpression newConstant(Object value, PDataType type, Integer maxLength, Integer scale, ColumnModifier columnModifier) throws SQLException { if (value == null) { if (type == null) { return NULL_EXPRESSION; } return TYPED_NULL_EXPRESSIONS[type.ordinal()]; } PDataType actualType = PDataType.fromLiteral(value); if (!actualType.isCoercibleTo(type, value)) { throw new TypeMismatchException(type, actualType, value.toString()); } value = type.toObject(value, actualType); try { byte[] b = type.toBytes(value, columnModifier); if (type == PDataType.CHAR && maxLength != null && b.length < maxLength) { <START> b = Arrays.copyOf(b, maxLength); <END> } if (b.length == 0) { return TYPED_NULL_EXPRESSIONS[type.ordinal()]; } return new LiteralExpression(value, type, b, maxLength, scale, columnModifier); } catch (IllegalDataException e) { throw new SQLExceptionInfo.Builder(SQLExceptionCode.ILLEGAL_DATA).setRootCause(e).build().buildException(); } }</code><technical_language>Please change calls Array.copyOf a new SchemaUtil function SchemaUtil.padChar(byte[] value, int maxLength). option pad other a null byte if need to</technical_language>

Target:
public static LiteralExpression newConstant(Object value, PDataType type, Integer maxLength, Integer scale, ColumnModifier columnModifier) throws SQLException { if (value == null) { if (type == null) { return NULL_EXPRESSION; } return TYPED_NULL_EXPRESSIONS[type.ordinal()]; } PDataType actualType = PDataType.fromLiteral(value); if (!actualType.isCoercibleTo(type, value)) { throw new TypeMismatchException(type, actualType, value.toString()); } value = type.toObject(value, actualType); try { byte[] b = type.toBytes(value, columnModifier); if (type == PDataType.CHAR && maxLength != null && b.length != maxLength) { b = SchemaUtil.padChar(b, maxLength); } if (b.length == 0) { return TYPED_NULL_EXPRESSIONS[type.ordinal()]; } return new LiteralExpression(value, type, b, maxLength, scale, columnModifier); } catch (IllegalDataException e) { throw new SQLExceptionInfo.Builder(SQLExceptionCode.ILLEGAL_DATA).setRootCause(e).build().buildException(); } }
Source:
<code>public EncryptedURL encryptURL(String url) { <START> while (url.length() % 50 != 0) <END> url = url + " "; byte[] nonce = rootKey.createNonce(); byte[] cipherText = rootKey.encrypt(url.getBytes(), nonce); Base64.Encoder encoder = Base64.getEncoder(); return new EncryptedURL(encoder.encodeToString(nonce), encoder.encodeToString(cipherText)); }</code><technical_language>static constant for 50 please</technical_language>

Target:
public EncryptedURL encryptURL(String url) { while (url.length() % EncryptedURL.PAD_TO_SIZE != 0) url = url + " "; byte[] nonce = rootKey.createNonce(); byte[] cipherText = rootKey.encrypt(url.getBytes(), nonce); Base64.Encoder encoder = Base64.getEncoder(); return new EncryptedURL(encoder.encodeToString(nonce), encoder.encodeToString(cipherText)); }
Source:
<code>private void initProjectOptions() { projectOptionsPanel = new VerticalPanel(); projectOptionsPanel.add(new SmallHeading(Util.C.headingProjectOptions())); submitType = new ListBox(); for (final Project.SubmitType type : Project.SubmitType.values()) { submitType.addItem(Util.toLongString(type), type.name()); } <START> submitType.addChangeHandler(new ChangeHandler() { <END> @Override public void onChange(ChangeEvent event) { if (SubmitType.FAST_FORWARD_ONLY.equals(Project.SubmitType .valueOf(submitType.getValue(submitType.getSelectedIndex())))) { useContentMerge.setEnabled(false); useContentMerge.setValue(false); } else { useContentMerge.setEnabled(true); } } }); saveEnabler.listenTo(submitType); projectOptionsPanel.add(submitType); useContentMerge = new CheckBox(Util.C.useContentMerge(), true); saveEnabler.listenTo(useContentMerge); projectOptionsPanel.add(useContentMerge); requireChangeID = new CheckBox(Util.C.requireChangeID(), true); saveEnabler.listenTo(requireChangeID); projectOptionsPanel.add(requireChangeID); add(projectOptionsPanel); }</code><technical_language>This called is set programmatically. means useContentMerge button is enabled page loads submit type is FAST_FORWARD_ONLY. solution works partially. is a good idea</technical_language>

Target:
private void initProjectOptions() { projectOptionsPanel = new VerticalPanel(); projectOptionsPanel.add(new SmallHeading(Util.C.headingProjectOptions())); submitType = new ListBox(); for (final Project.SubmitType type : Project.SubmitType.values()) { submitType.addItem(Util.toLongString(type), type.name()); } submitType.addChangeHandler(new ChangeHandler() { @Override public void onChange(ChangeEvent event) { setEnableForUseContentMerge(); } }); saveEnabler.listenTo(submitType); projectOptionsPanel.add(submitType); useContentMerge = new CheckBox(Util.C.useContentMerge(), true); saveEnabler.listenTo(useContentMerge); projectOptionsPanel.add(useContentMerge); requireChangeID = new CheckBox(Util.C.requireChangeID(), true); saveEnabler.listenTo(requireChangeID); projectOptionsPanel.add(requireChangeID); add(projectOptionsPanel); }
Source:
<code>long skipToNextSegmentIfBigger(long maxBytes) throws IOException { synchronized (PersistentBinaryDeque.this) { if (m_cursorClosed) { throw new IOException("PBD.ReadCursor.skipToNextSegmentIfBigger(): " + m_cursorId + " - Reader has been closed"); } long readerSize = sizeInBytes(); moveToValidSegment(); long segmentSize = m_segment.size(); long lastSegmentId = peekLastSegment().segmentIndex(); if (m_segment.segmentIndex() == lastSegmentId) { long needed = maxBytes - segmentSize; return (needed == 0) ? 1 : needed; } <START> long diff = readerSize - segmentSize; <END> if (diff < maxBytes) { return maxBytes - diff; } skipToNextSegment(); return 0; } }</code><technical_language>guard needed < 0 here</technical_language>

Target:
long skipToNextSegmentIfBigger(long maxBytes) throws IOException { synchronized (PersistentBinaryDeque.this) { if (m_cursorClosed) { throw new IOException("PBD.ReadCursor.skipToNextSegmentIfBigger(): " + m_cursorId + " - Reader has been closed"); } moveToValidSegment(); long segmentSize = m_segment.getFileSize(); long lastSegmentId = peekLastSegment().segmentIndex(); if (m_segment.segmentIndex() == lastSegmentId) { long needed = maxBytes - segmentSize; return (needed == 0) ? 1 : needed; } long readerSize = readerFizeSize(); long diff = readerSize - segmentSize; if (diff < maxBytes) { return maxBytes - diff; } skipToNextSegment(); return 0; } }
Source:
<code>private ComponentDto loadComponent(DbSession dbSession, ComponentWsRequest request) { String componentKey = request.getComponent(); <START> String componentId = request.getComponentId(); <END> String branch = request.getBranch(); checkArgument(componentId == null || branch == null, "'%s' and '%s' parameters cannot be used at the same time", DEPRECATED_PARAM_COMPONENT_ID, PARAM_BRANCH); return branch == null ? componentFinder.getByUuidOrKey(dbSession, componentId, componentKey, COMPONENT_ID_AND_KEY) : componentFinder.getByKeyAndBranch(dbSession, componentKey, branch); }</code><technical_language>![MINOR](<LINK_2> 'Severity: MINOR') Remove this of "getComponentId"; is deprecated. [![rule](<LINK_1>](<LINK_0></technical_language>

Target:
private ComponentDto loadComponent(DbSession dbSession, ComponentWsRequest request) { String componentKey = request.getComponent(); String componentId = request.getComponentId(); String branch = request.getBranch(); checkArgument(componentId == null || branch == null, "'%s' and '%s' parameters cannot be used at the same time", DEPRECATED_PARAM_COMPONENT_ID, PARAM_BRANCH); return branch == null ? componentFinder.getByUuidOrKey(dbSession, componentId, componentKey, COMPONENT_ID_AND_COMPONENT) : componentFinder.getByKeyAndBranch(dbSession, componentKey, branch); }
Source:
<code>protected void configure() { ConfigBinder.of(binder()).bind(GraphiteConfig.class); <START> bind(GraphiteReporterConfiguration.class); <END> }</code><technical_language>This needs .asEagerSingleton() pruned (nobody depend it, a leaf)</technical_language>

Target:
protected void configure() { ConfigBinder.of(binder()).bind(GraphiteConfig.class); bind(GraphiteReporter.class).asEagerSingleton(); }
Source:
<code><START> public OutputStream readFile(String path) <END> { ByteArrayOutputStream output = new ByteArrayOutputStream(); try { S3Object object = client.getObject(new GetObjectRequest(bucketName, path)); IOUtils.copy(object.getObjectContent(), output); } catch (IOException exception) { throw new RuntimeException("Could not read file " + path + " from S3", exception); } logger.debug("Loaded file from S3", path); return output; }</code><technical_language>I misguided here. return InputStream, OutputStream read file's data in code calls readFile. is I suggested return object.getObjectContent(). If want read file's content method some array do return output method. new ByteArrayInputStream(output.toByteArray[]). I convinced is needed though</technical_language>

Target:
public InputStream readFile(String path) { return client.getObject(new GetObjectRequest(bucketName, path)) .getObjectContent(); }
Source:
<code><START> public CreateDataCenterRequestBinder() { <END> super("dataCenter"); this.requestBuilder = new StringBuilder(128); }</code><technical_language>This constructor called Guice injector. package private removing public modifier</technical_language>

Target:
CreateDataCenterRequestBinder() { super("dataCenter"); this.requestBuilder = new StringBuilder(128); }
Source:
<code>public Map<String, String> genLinks(Workspace workspace, ServiceContext serviceContext) throws ServerException { final UriBuilder uriBuilder = serviceContext.getServiceUriBuilder(); final LinkedHashMap<String, String> links = new LinkedHashMap<>(); links.put( LINK_REL_SELF, uriBuilder .clone() .path(WorkspaceService.class) .path(WorkspaceService.class, "getByKey") .build(workspace.getId()) .toString()); links.put( LINK_REL_IDE_URL, uriBuilder .clone() .replacePath("") .path(workspace.getNamespace()) .path(workspace.getConfig().getName()) .build() .toString()); if (workspace.getStatus() != WorkspaceStatus.STOPPED) { <START> addRuntimeLinks(links, workspace.getId(), uriBuilder.clone().build().getHost()); <END> } return links; }</code><technical_language>do need clone builder if change it</technical_language>

Target:
public Map<String, String> genLinks(Workspace workspace, ServiceContext serviceContext) throws ServerException { final UriBuilder uriBuilder = serviceContext.getServiceUriBuilder(); final LinkedHashMap<String, String> links = new LinkedHashMap<>(); links.put( LINK_REL_SELF, uriBuilder .clone() .path(WorkspaceService.class) .path(WorkspaceService.class, "getByKey") .build(workspace.getId()) .toString()); links.put( LINK_REL_IDE_URL, uriBuilder .clone() .replacePath("") .path(workspace.getNamespace()) .path(workspace.getConfig().getName()) .build() .toString()); if (workspace.getStatus() != WorkspaceStatus.STOPPED) { addRuntimeLinks(links, workspace.getId(), serviceContext); } return links; }
Source:
<code><START> public void saveEntityShouldWork() <END> throws Exception { ArtifactEntry artifactEntry = new ArtifactEntry(); artifactEntry.setStorageId(storageId); artifactEntry.setRepositoryId(repositoryId); artifactEntry.setArtifactCoordinates(new NullArtifactCoordinates(String.format("%s/%s/%s/%s", groupId, artifactId + "123", "1.2.3", "jar"))); ArtifactEntry savedArtifactEntry = artifactEntryService.save(artifactEntry); assertThat(savedArtifactEntry.getCreated(), CoreMatchers.notNullValue()); }</code><technical_language>please write more test confirming created date change update</technical_language>

Target:
public void saveEntityShouldWork() throws Exception { ArtifactEntry artifactEntry = new ArtifactEntry(); artifactEntry.setStorageId(storageId); artifactEntry.setRepositoryId(repositoryId); artifactEntry.setArtifactCoordinates(new NullArtifactCoordinates(String.format("%s/%s/%s/%s", groupId, artifactId + "123", "1.2.3", "jar"))); assertThat(artifactEntry.getCreated(), CoreMatchers.nullValue()); artifactEntry = artifactEntryService.save(artifactEntry); assertThat(artifactEntry.getCreated(), CoreMatchers.notNullValue()); Date creationDate = artifactEntry.getCreated(); artifactEntry.setDownloadCount(1); artifactEntry = artifactEntryService.save(artifactEntry); assertEquals(artifactEntry.getCreated(), creationDate); }
Source:
<code>void collectMetrics() { <START> if (enabled()) { <END> for (Map.Entry<String, LlapManagementProtocolClientImpl> entry : llapClients.entrySet()) { String identity = entry.getKey(); LlapManagementProtocolClientImpl client = entry.getValue(); try { LlapDaemonProtocolProtos.GetDaemonMetricsResponseProto metrics = client.getDaemonMetrics(null, LlapDaemonProtocolProtos.GetDaemonMetricsRequestProto.newBuilder().build()); instanceStatisticsMap.put(identity, new LlapMetrics(metrics)); } catch (ServiceException ex) { LOG.error(ex.getMessage(), ex); } } } }</code><technical_language>Unnecessary check: thread, calling collectMetrics is created if ms <= 0</technical_language>

Target:
void collectMetrics() { for (Map.Entry<String, LlapManagementProtocolClientImpl> entry : llapClients.entrySet()) { String identity = entry.getKey(); LlapManagementProtocolClientImpl client = entry.getValue(); try { LlapDaemonProtocolProtos.GetDaemonMetricsResponseProto metrics = client.getDaemonMetrics(null, LlapDaemonProtocolProtos.GetDaemonMetricsRequestProto.newBuilder().build()); instanceStatisticsMap.put(identity, new LlapMetrics(metrics)); } catch (ServiceException ex) { LOG.error(ex.getMessage(), ex); instanceStatisticsMap.remove(identity); } } }
Source:
<code>LocalDiskRepositoryManager(SitePaths site, @GerritServerConfig Config cfg, NotesMigration notesMigration, RepositoryConfig repositoryCfg) { basePath = site.resolve(cfg.getString("gerrit", null, "basePath")); if (basePath == null) { throw new IllegalStateException("gerrit.basePath must be configured"); } if (notesMigration.enabled()) { noteDbPath = site.resolve(MoreObjects.firstNonNull( cfg.getString("gerrit", null, "noteDbPath"), "notedb")); } else { noteDbPath = null; } this.repositoryCfg = repositoryCfg; for (String alternateBasePath : repositoryCfg.getAllBasePaths()) { if (!new File(alternateBasePath).isAbsolute()) { throw new IllegalStateException( <START> "repository.<name>.basePath must be absolute path"); <END> } } namesUpdateLock = new ReentrantLock(true ); names = list(); }</code><technical_language>Include offending path in this message</technical_language>

Target:
LocalDiskRepositoryManager(SitePaths site, @GerritServerConfig Config cfg, NotesMigration notesMigration, RepositoryConfig repositoryCfg) { basePath = site.resolve(cfg.getString("gerrit", null, "basePath")); if (basePath == null) { throw new IllegalStateException("gerrit.basePath must be configured"); } if (notesMigration.enabled()) { noteDbPath = site.resolve(MoreObjects.firstNonNull( cfg.getString("gerrit", null, "noteDbPath"), "notedb")); } else { noteDbPath = null; } this.repositoryCfg = repositoryCfg; for (String alternateBasePath : repositoryCfg.getAllBasePaths()) { if(!new File(alternateBasePath).isAbsolute()){ throw new IllegalStateException("repository.<name>.basePath must be " + "absolute path, change the following path: " + alternateBasePath); } } namesUpdateLock = new ReentrantLock(true ); names = list(); }
Source:
<code>public void setUp() throws Exception { Script script = BrickTestUtils.createProjectAndGetStartScript("LegoSensorPortConfigDialogTest"); script.addBrick(new ChangeSizeByNBrick(0)); legoNXTBrickSetting = getNXTBrickSetting(); setNXTBrickSetting(true); sensorMapping = SettingsFragment.getLegoNXTSensorMapping(InstrumentationRegistry.getTargetContext()); SettingsFragment.setLegoMindstormsNXTSensorMapping(InstrumentationRegistry.getTargetContext(), new NXTSensor.Sensor[] {NXTSensor.Sensor.NO_SENSOR, NXTSensor.Sensor.NO_SENSOR, NXTSensor.Sensor.NO_SENSOR, NXTSensor.Sensor.NO_SENSOR}); baseActivityTestRule.launchActivity(); onBrickAtPosition(1).onChildView(withId(R.id.brick_change_size_by_edit_text)).perform(click()); <START> String formulaEditorSensorString = UiTestUtils.getResourcesString(R.string.formula_editor_sensor_lego_nxt_touch); <END> onFormulaEditor().performOpenCategory(FormulaEditorWrapper.Category.DEVICE); onRecyclerView().performOnItemWithText(formulaEditorSensorString, click()); }</code><technical_language>Lines 86-88 103-105 extracted a separate function</technical_language>

Target:
public void setUp() throws Exception { Script script = BrickTestUtils.createProjectAndGetStartScript("LegoSensorPortConfigDialogTest"); script.addBrick(new ChangeSizeByNBrick(0)); legoNXTBrickSetting = getNXTBrickSetting(); setNXTBrickSetting(true); sensorMapping = SettingsFragment.getLegoNXTSensorMapping(InstrumentationRegistry.getTargetContext()); SettingsFragment.setLegoMindstormsNXTSensorMapping(InstrumentationRegistry.getTargetContext(), new NXTSensor.Sensor[] {NXTSensor.Sensor.NO_SENSOR, NXTSensor.Sensor.NO_SENSOR, NXTSensor.Sensor.NO_SENSOR, NXTSensor.Sensor.NO_SENSOR}); baseActivityTestRule.launchActivity(); }
Source:
<code>public void testRemoveFromNonOwner() { <START> for (Cache<Object, String> c : caches) assert c.isEmpty(); <END> Object retval = getFirstNonOwner("k1").put("k1", "value"); asyncWait("k1", PutKeyValueCommand.class); if (testRetVals) assert retval == null; retval = getOwners("k1")[0].remove("k1"); asyncWait("k1", RemoveCommand.class); if (testRetVals) assert "value".equals(retval); assertRemovedOnAllCaches("k1"); }</code><technical_language>I this is purpose of PR, this test unnecessary is, depends DistSyncFuncTest instead of BaseDistFunctionalTest</technical_language>

Target:
public void testRemoveFromNonOwner() { Object retval = getFirstNonOwner("k1").put("k1", "value"); asyncWait("k1", PutKeyValueCommand.class); if (testRetVals) assert retval == null; retval = getOwners("k1")[0].remove("k1"); asyncWait("k1", RemoveCommand.class); if (testRetVals) assert "value".equals(retval); assertRemovedOnAllCaches("k1"); }
Source:
<code>protected IContributionItem[] getContributionItems() { List<IContributionItem> result = new ArrayList<>(); ISelection selection = serviceLocator .getService(ISelectionService.class).getSelection(); final List<File> selectedRepoDirectories = getDirectoriesOfSelectedRepositoryNodes( selection); if (!selectedRepoDirectories.isEmpty()) { final RepositoryGroups groupsUtil = RepositoryGroups.getInstance(); addStaticItems(groupsUtil, selectedRepoDirectories, result); <START> List<RepositoryGroup> groups = groupsUtil.getGroups(); <END> Collections.sort(groups, (g1, g2) -> CommonUtils.STRING_ASCENDING_COMPARATOR .compare(g1.getName(), g2.getName())); if (!groups.isEmpty()) { result.add(new Separator()); for (RepositoryGroup group : groups) { result.add(getAssignGroupItem(groupsUtil, group, selectedRepoDirectories)); } } } return result.toArray(new IContributionItem[0]); }</code><technical_language>If selected repos group, group excluded here. if I select a repo group "Foo" menu show "Move 'Foo'". if existing group</technical_language>

Target:
protected IContributionItem[] getContributionItems() { List<IContributionItem> result = new ArrayList<>(); ISelection selection = serviceLocator .getService(ISelectionService.class).getSelection(); List<RepositoryNode> selectedRepoNodes = getRepositoryNodes(selection); final List<File> selectedRepoDirectories = selectedRepoNodes.stream() .map(node -> node.getRepository().getDirectory()) .collect(Collectors.toList()); if (!selectedRepoDirectories.isEmpty()) { final RepositoryGroups groupsUtil = RepositoryGroups.getInstance(); addStaticItems(groupsUtil, selectedRepoDirectories, result); List<RepositoryGroup> groups = getMoveTargetGroups(groupsUtil, selectedRepoNodes); if (!groups.isEmpty()) { result.add(new Separator()); for (RepositoryGroup group : groups) { result.add(getAssignGroupItem(groupsUtil, group, selectedRepoDirectories)); } } } return result.toArray(new IContributionItem[0]); }
Source:
<code>private static List<Attribute> parseAttributes(String attributesLine) { ArrayList<Attribute> result = new ArrayList<Attribute>(); <START> for (String attribute : attributesLine.split(" ")) { END> attribute = attribute.trim(); if (attribute.length() == 0) continue; if (attribute.startsWith("-")) { result.add(new Attribute(attribute.substring(1), State.UNSET)); continue; } final int equalsIndex = attribute.indexOf("="); if (equalsIndex == -1) result.add(new Attribute(attribute, State.SET)); else result.add(new Attribute(attribute.substring(0, equalsIndex), attribute.substring(equalsIndex + 1))); } return result; }</code><technical_language>I this is [ \t\r] regex tabs allowed C implementation oddly enough allows \r attributes too</technical_language>

Target:
private static List<Attribute> parseAttributes(String attributesLine) { ArrayList<Attribute> result = new ArrayList<Attribute>(); for (String attribute : attributesLine.split(ATTRIBUTES_SPLIT_REGEX)) { attribute = attribute.trim(); if (attribute.length() == 0) continue; if (attribute.startsWith("-")) { result.add(new Attribute(attribute.substring(1), State.UNSET)); continue; } final int equalsIndex = attribute.indexOf("="); if (equalsIndex == -1) result.add(new Attribute(attribute, State.SET)); else result.add(new Attribute(attribute.substring(0, equalsIndex), attribute.substring(equalsIndex + 1))); } return result; }
Source:
<code>private Iterable<Resource> processSearchExpression(String expression, ResourceCriteria criteria, CriteriaQueryExecutor<Resource, ResourceCriteria> queryExecutor, PropertyOptionsSource.ExpressionScope expressionScope, Predicate<Resource> baseResourcePredicate) { Iterable<Resource> foundResources; criteria.setSearchExpression(expression); <START> foundResources = new CriteriaQuery<Resource, ResourceCriteria>(criteria, queryExecutor); <END> if (expressionScope == PropertyOptionsSource.ExpressionScope.BASE_RESOURCE && baseResourcePredicate != null) { foundResources = Iterables.filter(foundResources, baseResourcePredicate); } return foundResources; }</code><technical_language>Merge definition here</technical_language>

Target:
private Iterable<Resource> processSearchExpression(String expression, ResourceCriteria criteria, CriteriaQueryExecutor<Resource, ResourceCriteria> queryExecutor, PropertyOptionsSource.ExpressionScope expressionScope, Predicate<Resource> baseResourcePredicate) { criteria.setSearchExpression(expression); Iterable<Resource> foundResources = new CriteriaQuery<Resource, ResourceCriteria>(criteria, queryExecutor); if (expressionScope == PropertyOptionsSource.ExpressionScope.BASE_RESOURCE && baseResourcePredicate != null) { foundResources = Iterables.filter(foundResources, baseResourcePredicate); } return foundResources; }
Source:
<code>public void rejectsInvalidCaseConversionFlags() throws Exception { SimpleAuthorityMapper mapper = new SimpleAuthorityMapper(); mapper.setConvertToLowerCase(true); mapper.setConvertToUpperCase(true); <START> assertThatIllegalArgumentException().isThrownBy(mapper::afterPropertiesSet); <END> }</code><technical_language>this method longer throws Exception, cleaned up? other methods this clean need applying</technical_language>

Target:
public void rejectsInvalidCaseConversionFlags() { SimpleAuthorityMapper mapper = new SimpleAuthorityMapper(); mapper.setConvertToLowerCase(true); mapper.setConvertToUpperCase(true); assertThatIllegalArgumentException().isThrownBy(mapper::afterPropertiesSet); }
Source:
<code>getQuestionResponseMapByRecipientTeam() { LinkedHashMap<String, Map<FeedbackQuestionAttributes, List<FeedbackResponseAttributes>>> sortedMap = new LinkedHashMap<>(); Collections.sort(responses, compareByTeamQuestionRecipientTeamGiver); for (FeedbackResponseAttributes response : responses) { String recipientTeam = getTeamNameForEmail(response.recipient); if (recipientTeam.isEmpty()) { recipientTeam = getNameForEmail(response.recipient); } sortedMap.putIfAbsent(recipientTeam, new LinkedHashMap<FeedbackQuestionAttributes, List<FeedbackResponseAttributes>>()); Map<FeedbackQuestionAttributes, List<FeedbackResponseAttributes>> responsesForOneRecipient = <START> sortedMap.get(recipientTeam); <END> FeedbackQuestionAttributes question = questions.get(response.feedbackQuestionId); responsesForOneRecipient.putIfAbsent(question, new ArrayList<FeedbackResponseAttributes>()); List<FeedbackResponseAttributes> responsesForOneRecipientOneQuestion = responsesForOneRecipient.get(question); responsesForOneRecipientOneQuestion.add(response); } return sortedMap; }</code><technical_language>statements conveniently combined to: java Map<FeedbackQuestionAttributes, List<FeedbackResponseAttributes>> responsesForOneRecipient = sortedMap.computeIfAbsent(recipientTeam, -> new LinkedHashMap<>());</technical_language>

Target:
getQuestionResponseMapByRecipientTeam() { LinkedHashMap<String, Map<FeedbackQuestionAttributes, List<FeedbackResponseAttributes>>> sortedMap = new LinkedHashMap<>(); responses.sort(compareByTeamQuestionRecipientTeamGiver); for (FeedbackResponseAttributes response : responses) { String recipientTeam = getTeamNameForEmail(response.recipient); if (recipientTeam.isEmpty()) { recipientTeam = getNameForEmail(response.recipient); } Map<FeedbackQuestionAttributes, List<FeedbackResponseAttributes>> responsesForOneRecipient = sortedMap.computeIfAbsent(recipientTeam, key -> new LinkedHashMap<>()); FeedbackQuestionAttributes question = questions.get(response.feedbackQuestionId); List<FeedbackResponseAttributes> responsesForOneRecipientOneQuestion = responsesForOneRecipient.computeIfAbsent(question, key -> new ArrayList<>()); responsesForOneRecipientOneQuestion.add(response); } return sortedMap; }
Source:
<code>private static void setupPortMargins(final NodeContext nodeContext, final PortSide portSide) { Collection<PortContext> portContexts = nodeContext.portContexts.get(portSide); <START> boolean portLabelsOutside = nodeContext.portLabelsPlacement.contains(PortLabelPlacement.OUTSIDE); boolean spaceEfficientPortLabels = nodeContext.portLabelsPlacement.contains(PortLabelPlacement.SPACE_EFFICIENT) <END> || portContexts.size() == 2; boolean uniformPortSpacing = nodeContext.sizeOptions.contains(SizeOptions.UNIFORM_PORT_SPACING); computeHorizontalPortMargins(nodeContext, portSide, portLabelsOutside); PortContext leftmostPortContext = null; PortContext rightmostPortContext = null; if (portLabelsOutside) { Iterator<PortContext> portContextIterator = portContexts.iterator(); leftmostPortContext = portContextIterator.next(); rightmostPortContext = leftmostPortContext; while (portContextIterator.hasNext()) { rightmostPortContext = portContextIterator.next(); } leftmostPortContext.portMargin.left = 0; rightmostPortContext.portMargin.right = 0; if (spaceEfficientPortLabels && !leftmostPortContext.labelsNextToPort) { leftmostPortContext.portMargin.right = 0; } } if (uniformPortSpacing) { unifyPortMargins(portContexts); if (portLabelsOutside) { leftmostPortContext.portMargin.left = 0; rightmostPortContext.portMargin.right = 0; } } }</code><technical_language>some sort of compatibility for option long deprecated, there? (applies other pieces of code well)</technical_language>

Target:
private static void setupPortMargins(final NodeContext nodeContext, final PortSide portSide) { Collection<PortContext> portContexts = nodeContext.portContexts.get(portSide); boolean portLabelsOutside = nodeContext.portLabelsPlacement.contains(PortLabelPlacement.OUTSIDE); boolean alwaysSameSide = nodeContext.portLabelsPlacement.contains(PortLabelPlacement.ALWAYS_SAME_SIDE); boolean spaceEfficient = nodeContext.portLabelsPlacement.contains(PortLabelPlacement.SPACE_EFFICIENT); boolean uniformPortSpacing = nodeContext.sizeOptions.contains(SizeOptions.UNIFORM_PORT_SPACING); boolean spaceEfficientPortLabels = !alwaysSameSide && (spaceEfficient || portContexts.size() == 2); computeHorizontalPortMargins(nodeContext, portSide, portLabelsOutside); PortContext leftmostPortContext = null; PortContext rightmostPortContext = null; if (portLabelsOutside) { Iterator<PortContext> portContextIterator = portContexts.iterator(); leftmostPortContext = portContextIterator.next(); rightmostPortContext = leftmostPortContext; while (portContextIterator.hasNext()) { rightmostPortContext = portContextIterator.next(); } leftmostPortContext.portMargin.left = 0; rightmostPortContext.portMargin.right = 0; if (spaceEfficientPortLabels && !leftmostPortContext.labelsNextToPort) { leftmostPortContext.portMargin.right = 0; } } if (uniformPortSpacing) { unifyPortMargins(portContexts); if (portLabelsOutside) { leftmostPortContext.portMargin.left = 0; rightmostPortContext.portMargin.right = 0; } } }
Source:
<code>private Rectangle computeShellBounds() { Rectangle result = new Rectangle( 0, 0, 0, 0 ); Point preferredSize = shell.computeSize( SWT.DEFAULT, SWT.DEFAULT ); <START> Rectangle parentSize = parent.getDisplay().getBounds(); <END> result.x = ( parentSize.width - preferredSize.x ) / 2 + parentSize.x; result.y = ( parentSize.height - preferredSize.y ) / 2 + parentSize.y; result.width = Math.min( preferredSize.x, MAX_WIDTH ); result.height = preferredSize.y; return result; }</code><technical_language>Rename displaySize similar FileDialog</technical_language>

Target:
private Rectangle computeShellBounds() { Rectangle result = new Rectangle( 0, 0, 0, 0 ); Point preferredSize = shell.computeSize( SWT.DEFAULT, SWT.DEFAULT ); Rectangle displaySize = parent.getDisplay().getBounds(); result.x = ( displaySize.width - preferredSize.x ) / 2 + displaySize.x; result.y = ( displaySize.height - preferredSize.y ) / 2 + displaySize.y; result.width = Math.min( preferredSize.x, MAX_WIDTH ); result.height = preferredSize.y; return result; }
Source:
<code>public boolean enableWagedRebalance(String clusterName, List<String> resourceNames) { if (clusterName == null || clusterName.isEmpty()) { throw new HelixException("Cluster name is invalid!"); } if (resourceNames == null || resourceNames.isEmpty()) { throw new HelixException("Resource name list is invalid!"); } HelixDataAccessor accessor = new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor<>(_zkClient)); PropertyKey.Builder keyBuilder = accessor.keyBuilder(); List<IdealState> idealStates = new ArrayList<>(); List<PropertyKey> idealStateKeys = new ArrayList<>(); <START> List<String> nullIdealStates = new ArrayList<>(); <END> for (String resourceName : resourceNames) { PropertyKey key = keyBuilder.idealStates(resourceName); IdealState idealState = accessor.getProperty(key); if (idealState == null) { nullIdealStates.add(resourceName); } else { idealState.setRebalancerClassName(WagedRebalancer.class.getName()); idealState.setRebalanceMode(RebalanceMode.FULL_AUTO); idealStates.add(idealState); idealStateKeys.add(key); } } if (!nullIdealStates.isEmpty()) { throw new HelixException( String.format("Not all IdealStates exist in the cluster: %s", nullIdealStates)); } boolean[] success = accessor.setChildren(idealStateKeys, idealStates); for (boolean s : success) { if (!s) { return false; } } return true; }</code><technical_language>I need this list, throw exception null IS</technical_language>

Target:
public boolean enableWagedRebalance(String clusterName, List<String> resourceNames) { if (clusterName == null || clusterName.isEmpty()) { throw new HelixException("Cluster name is invalid!"); } if (resourceNames == null || resourceNames.isEmpty()) { throw new HelixException("Resource name list is invalid!"); } HelixDataAccessor accessor = new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor<>(_zkClient)); PropertyKey.Builder keyBuilder = accessor.keyBuilder(); List<IdealState> enabledIdealStates = new ArrayList<>(); List<PropertyKey> enabledIdealStateKeys = new ArrayList<>(); Set<String> enabledResourceNames = new HashSet<>(); List<IdealState> idealStates = accessor.getChildValues(keyBuilder.idealStates(), true); for (IdealState idealState : idealStates) { if (idealState != null && resourceNames.contains(idealState.getResourceName())) { idealState.setRebalancerClassName(WagedRebalancer.class.getName()); idealState.setRebalanceMode(RebalanceMode.FULL_AUTO); enabledIdealStates.add(idealState); enabledIdealStateKeys.add(keyBuilder.idealStates(idealState.getResourceName())); enabledResourceNames.add(idealState.getResourceName()); } } List<String> resourcesNotFound = resourceNames.stream().filter(resourceName -> !enabledResourceNames.contains(resourceName)) .collect(Collectors.toList()); if (!resourcesNotFound.isEmpty()) { throw new HelixException( String.format("Some resources do not have IdealStates: %s", resourcesNotFound)); } boolean[] success = accessor.setChildren(enabledIdealStateKeys, enabledIdealStates); for (boolean s : success) { if (!s) { return false; } } return true; }
Source:
<code>public void onClose(int statusCode, String reason) { session = null; connected = false; logger.debug("Closing a WebSocket due to {}", reason); <START> scheduler.submit(new Runnable() { <END> @Override public void run() { try { eventHandler.onConnectionClosed(); } catch (Exception e) { logger.error("Error handling onConnectionClosed()", e); } } }); }</code><technical_language>lambda syntax</technical_language>

Target:
public void onClose(int statusCode, String reason) { session = null; connected = false; logger.debug("Closing a WebSocket due to {}", reason); scheduler.submit(() -> { try { eventHandler.onConnectionClosed(); } catch (Exception e) { logger.error("Error handling onConnectionClosed()", e); } }); }
Source:
<code>protected ModelAndView generateRevocationResponse(final String token, final String clientId, final HttpServletResponse response) { val registryToken = getOAuthConfigurationContext().getTicketRegistry().getTicket(token, OAuth20Token.class); if (registryToken == null) { LOGGER.error("Provided token has not been found in the ticket registry", token); } else if (isRefreshToken(registryToken) || isAccessToken(registryToken)) { if (!StringUtils.equals(clientId, registryToken.getClientId())) { <START> LOGGER.error("Provided token has not been issued for the service [{}]", token, clientId); <END> return OAuth20Utils.writeError(response, OAuth20Constants.INVALID_REQUEST); } if (isRefreshToken(registryToken)) { revokeToken((OAuth20RefreshToken) registryToken); } else { revokeToken(registryToken.getId()); } } else { LOGGER.error("Provided token is either not a refresh token or not an access token", token); return OAuth20Utils.writeError(response, OAuth20Constants.INVALID_REQUEST); } val mv = new ModelAndView(new MappingJackson2JsonView()); mv.setStatus(HttpStatus.OK); return mv; }</code><technical_language>This a warn</technical_language>

Target:
protected ModelAndView generateRevocationResponse(final String token, final String clientId, final HttpServletResponse response) { val registryToken = getOAuthConfigurationContext().getTicketRegistry().getTicket(token, OAuth20Token.class); if (registryToken == null) { LOGGER.error("Provided token has not been found in the ticket registry", token); } else if (isRefreshToken(registryToken) || isAccessToken(registryToken)) { if (!StringUtils.equals(clientId, registryToken.getClientId())) { LOGGER.warn("Provided token has not been issued for the service [{}]", token, clientId); return OAuth20Utils.writeError(response, OAuth20Constants.INVALID_REQUEST); } if (isRefreshToken(registryToken)) { revokeToken((OAuth20RefreshToken) registryToken); } else { revokeToken(registryToken.getId()); } } else { LOGGER.error("Provided token is either not a refresh token or not an access token", token); return OAuth20Utils.writeError(response, OAuth20Constants.INVALID_REQUEST); } val mv = new ModelAndView(new MappingJackson2JsonView()); mv.setStatus(HttpStatus.OK); return mv; }