auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public ImmutableValue unpackValue() throws IOException { MessageFormat mf = getNextFormat(); switch(mf.getValueType()) { case NIL: unpackNil(); return ValueFactory.newNilValue(); case BOOLEAN: return ValueFactory.newBooleanValue(unpackBoolean()); case INTEGER: switch (mf) { case UINT64: return ValueFactory.newIntegerValue(unpackBigInteger()); default: return ValueFactory.newIntegerValue(unpackLong()); } case FLOAT: <START> return ValueFactory.newFloatValue(unpackDouble()); <END> case STRING: { int length = unpackRawStringHeader(); return ValueFactory.newStringValue(readPayload(length)); } case BINARY: { int length = unpackBinaryHeader(); return ValueFactory.newBinaryValue(readPayload(length)); } case ARRAY: { int size = unpackArrayHeader(); Value[] array = new Value[size]; for (int i=0; i < size; i++) { array[i] = unpackValue(); } return ValueFactory.newArrayValue(array); } case MAP: { int size = unpackMapHeader(); Value[] kvs = new Value[size * 2]; for (int i=0; i < size * 2; ) { kvs[i] = unpackValue(); i++; kvs[i] = unpackValue(); i++; } return ValueFactory.newMapValue(kvs); } case EXTENDED: { ExtendedTypeHeader extHeader = unpackExtendedTypeHeader(); return ValueFactory.newExtendedValue(extHeader.getType(), readPayload(extHeader.getLength())); } default: throw new MessageFormatException("Unknown value type"); } }</code><technical_language>I remembered FloatHolder necessary. reading a float double, add some fractions. For example: scala> 0.1341f.toDouble res5: Double = 0.13410000503063202 If user wants print this float String, 0.13410000503063202 shown. This is unexpected behavior for user. Another example: 0.1f 0.10000000149011612 string if double 0.1fs internal representation. fix this in another pull request</technical_language>

Target:
public ImmutableValue unpackValue() throws IOException { MessageFormat mf = getNextFormat(); switch(mf.getValueType()) { case NIL: unpackNil(); return ValueFactory.newNil(); case BOOLEAN: return ValueFactory.newBoolean(unpackBoolean()); case INTEGER: switch (mf) { case UINT64: return ValueFactory.newInteger(unpackBigInteger()); default: return ValueFactory.newInteger(unpackLong()); } case FLOAT: return ValueFactory.newFloat(unpackDouble()); case STRING: { int length = unpackRawStringHeader(); return ValueFactory.newString(readPayload(length)); } case BINARY: { int length = unpackBinaryHeader(); return ValueFactory.newBinary(readPayload(length)); } case ARRAY: { int size = unpackArrayHeader(); Value[] array = new Value[size]; for (int i=0; i < size; i++) { array[i] = unpackValue(); } return ValueFactory.newArray(array); } case MAP: { int size = unpackMapHeader(); Value[] kvs = new Value[size * 2]; for (int i=0; i < size * 2; ) { kvs[i] = unpackValue(); i++; kvs[i] = unpackValue(); i++; } return ValueFactory.newMap(kvs); } case EXTENSION: { ExtensionTypeHeader extHeader = unpackExtensionTypeHeader(); return ValueFactory.newExtension(extHeader.getType(), readPayload(extHeader.getLength())); } default: throw new MessageFormatException("Unknown value type"); } }
Source:
<code><START> public RegistryEvent(Type type, ServiceReference serviceReference) { <END> this.serviceReference = serviceReference; this.type = type; }</code><technical_language>a shortcut factory methods: createAdded() createRemoved() , sort of. neccessarly names</technical_language>

Target:
private RegistryEvent(Type type, ServiceReference serviceReference) { this.serviceReference = serviceReference; this.type = type; }
Source:
<code>public static long getTxnLowWatermark(Store store) throws IOException { long lowTxnWatermark = TransactionsWatcher.getLowWatermarkTransaction(); Long minRetentionPeriod = SpliceCompactionUtils.minRetentionPeriod(store); if(minRetentionPeriod == null || minRetentionPeriod == 0L) { return lowTxnWatermark; } long minRetentionTs = System.currentTimeMillis() - minRetentionPeriod * 1000; long minRetentionTxnId = SIDriver.driver().getTxnStore().getTxnAt(minRetentionTs); if(minRetentionTxnId == -1) { return lowTxnWatermark; } <START> return Math.min(lowTxnWatermark, minRetentionTxnId); <END> }</code><technical_language>I picture: this account for time zone differences is necessary</technical_language>

Target:
public static long getTxnLowWatermark(Store store) throws IOException { if(SIDriver.driver() == null || !SIDriver.driver().isEngineStarted()) { return SIConstants.OLDEST_TIME_TRAVEL_TX; } long lowTxnWatermark = TransactionsWatcher.getLowWatermarkTransaction(); Long minRetentionPeriod = SpliceCompactionUtils.minRetentionPeriod(store); if(minRetentionPeriod == null || minRetentionPeriod == 0L) { return lowTxnWatermark; } long minRetentionTs = System.currentTimeMillis() - minRetentionPeriod * 1000; long minRetentionTxnId = SIDriver.driver().getTxnStore().getTxnAt(minRetentionTs); if(minRetentionTxnId == -1) { return SIConstants.OLDEST_TIME_TRAVEL_TX; } return Math.min(lowTxnWatermark, minRetentionTxnId); }
Source:
<code>public void show(final Object o) { final UserInterface defaultUI = getDefaultUI(); <START> if (defaultUI == null) { <END> return; } defaultUI.show(o); }</code><technical_language>Please more compact one-line syntax: java if (defaultUI == null) return; for consistency other blocks of code in parts</technical_language>

Target:
public void show(final Object o) { getDefaultUI().show(o); }
Source:
<code>private LocalDateTime toDateTime(Integer v) { <START> v = (v > 0 ? v : -v) % 10000; <END> return LocalDateTime.now().plusNanos(v).plusSeconds(v); }</code><technical_language>10000 a wrong digit</technical_language>

Target:
private LocalDateTime toDateTime(Integer v) { v = (v > 0 ? v : -v) % 1000; return LocalDateTime.now().plusNanos(v).plusSeconds(v); }
Source:
<code>public static Path getConfigurationFileLocation(String filename) { <START> return Paths.get(org.wso2.carbon.kernel.utils.Utils.getCarbonConfigHome().toString(), <END> filename); }</code><technical_language>Utils.getCarbonConfigHome() retuns a Path, Utils.getCarbonConfigHome().resolve(filename) instead</technical_language>

Target:
public static Path getConfigurationFileLocation(String filename) { return org.wso2.carbon.kernel.utils.Utils.getCarbonConfigHome().resolve(filename); }
Source:
<code>public static SegmentIdentifierParts valueOf(String dataSource, String identifier) { if (!identifier.startsWith(String.format("%s_", dataSource))) { LOGGER.info("Invalid identifier %s", identifier); return null; } String remaining = identifier.substring(dataSource.length() + 1); String[] splits = remaining.split(DataSegment.delimiter); if (splits.length < 3) { LOGGER.info("Invalid identifier %s", identifier); return null; } DateTimeFormatter formatter = ISODateTimeFormat.dateTime(); try { DateTime start = formatter.parseDateTime(splits[0]); DateTime end = formatter.parseDateTime(splits[1]); String version = splits[2]; String trail = splits.length > 3 ? join(splits, DataSegment.delimiter, 3, splits.length) : null; return new SegmentIdentifierParts( dataSource, new Interval(start.getMillis(), end.getMillis()), version, trail ); } catch (IllegalArgumentException e) { <START> LOGGER.warn(e, "Failed to parse identifier [%s]", identifier); <END> return null; } }</code><technical_language>I include this LOGGER.warn, a select union datasource spam logs scary warnings</technical_language>

Target:
public static SegmentIdentifierParts valueOf(String dataSource, String identifier) { if (!identifier.startsWith(String.format("%s_", dataSource))) { return null; } String remaining = identifier.substring(dataSource.length() + 1); String[] splits = remaining.split(DataSegment.delimiter); if (splits.length < 3) { return null; } DateTimeFormatter formatter = ISODateTimeFormat.dateTime(); try { DateTime start = formatter.parseDateTime(splits[0]); DateTime end = formatter.parseDateTime(splits[1]); String version = splits[2]; String trail = splits.length > 3 ? join(splits, DataSegment.delimiter, 3, splits.length) : null; return new SegmentIdentifierParts( dataSource, new Interval(start.getMillis(), end.getMillis()), version, trail ); } catch (IllegalArgumentException e) { return null; } }
Source:
<code>public void programmaticTimeout(TimerConfig config) { Guid glusterJobId = Guid.createGuidFromString(config.getInfo().toString()); GlusterJobDetails job = scheduleDao.getGlusterJobById(glusterJobId); List<GlusterJobParams> params = jobParamsDao.getJobParamsById(glusterJobId); List<Class<?>> parameterTypes = new ArrayList<>(); List<Object> parameterValues = new ArrayList<>(); Method methodToRun = null; Class clazz = null; try { for (GlusterJobParams param : params) { <START> Class paramsclazz = Class.forName(param.getParamsClassName()); parameterTypes.add(clazz); <END> parameterValues.add(param.getParamsClassValue()); } clazz = Class.forName(job.getJobClassName()); methodToRun = clazz.getDeclaredMethod(job.getJobName(), (Class[]) parameterTypes.toArray()); if(methodToRun == null) { log.error("could not find the required method '{}' on instance of {}", job.getJobName(), clazz.getClass().getSimpleName()); return; } log.info("Preparing to run method: of Class: {}", methodToRun.getName(), clazz.getSimpleName()); methodToRun.invoke(clazz.newInstance(), parameterValues); } catch (Throwable t) { log.error("Exception in performing Job: {}", clazz.getClass().getSimpleName(), ExceptionUtils.getRootCauseMessage(t)); log.debug("Exception", t); } }</code><technical_language>paramsClazz added paramsTypes instead of clazz is a null</technical_language>

Target:
public void programmaticTimeout(TimerConfig config) { Guid glusterJobId = (Guid) config.getInfo(); GlusterJobDetails job = scheduleDao.getGlusterJobById(glusterJobId); List<GlusterJobParams> params = jobParamsDao.getJobParamsById(glusterJobId); List<Class<?>> parameterTypes = new ArrayList<>(); List<Object> parameterValues = new ArrayList<>(); Method methodToRun = null; Class clazz = null; try { for (GlusterJobParams param : params) { Class paramsclazz = Class.forName(param.getParamsClassName()); parameterTypes.add(paramsclazz); parameterValues.add(param.getParamsClassValue()); } clazz = Class.forName(job.getJobClassName()); methodToRun = clazz.getDeclaredMethod(job.getJobName(), (Class[]) parameterTypes.toArray()); if(methodToRun == null) { log.error("could not find the required method '{}' on instance of {}", job.getJobName(), clazz.getClass().getSimpleName()); return; } log.info("Preparing to run method: of Class: {}", methodToRun.getName(), clazz.getSimpleName()); methodToRun.invoke(clazz.getDeclaredConstructor().newInstance(), parameterValues); } catch (Throwable t) { log.error("Exception in performing Job: {}", clazz.getClass().getSimpleName(), ExceptionUtils.getRootCauseMessage(t)); log.debug("Exception", t); } }
Source:
<code>protected final OperatorFactory createHashProjectOperator(int operatorId, PlanNodeId planNodeId, List<Type> types) { ImmutableMap.Builder<Symbol, Type> symbolTypes = ImmutableMap.builder(); ImmutableMap.Builder<Symbol, Integer> symbolToInputMapping = ImmutableMap.builder(); ImmutableList.Builder<PageProjection> projections = ImmutableList.builder(); for (int channel = 0; channel < types.size(); channel++) { Symbol symbol = new Symbol("h" + channel); symbolTypes.put(symbol, types.get(channel)); symbolToInputMapping.put(symbol, channel); projections.add(new InputPageProjection(channel, types.get(channel))); } Optional<Expression> hashExpression = HashGenerationOptimizer.getHashExpression(ImmutableList.copyOf(symbolTypes.build().keySet())); verify(hashExpression.isPresent()); projections.add(new InterpretedPageProjection( hashExpression.get(), <START> TypeProvider.from(symbolTypes.build()), <END> symbolToInputMapping.build(), localQueryRunner.getMetadata(), localQueryRunner.getSqlParser(), session)); return new FilterAndProjectOperator.FilterAndProjectOperatorFactory( operatorId, planNodeId, () -> new PageProcessor(Optional.empty(), projections.build()), ImmutableList.copyOf(Iterables.concat(types, ImmutableList.of(BIGINT))), getFilterAndProjectMinOutputPageSize(session), getFilterAndProjectMinOutputPageRowCount(session)); }</code><technical_language>s/from/of</technical_language>

Target:
protected final OperatorFactory createHashProjectOperator(int operatorId, PlanNodeId planNodeId, List<Type> types) { ImmutableMap.Builder<Symbol, Type> symbolTypes = ImmutableMap.builder(); ImmutableMap.Builder<Symbol, Integer> symbolToInputMapping = ImmutableMap.builder(); ImmutableList.Builder<PageProjection> projections = ImmutableList.builder(); for (int channel = 0; channel < types.size(); channel++) { Symbol symbol = new Symbol("h" + channel); symbolTypes.put(symbol, types.get(channel)); symbolToInputMapping.put(symbol, channel); projections.add(new InputPageProjection(channel, types.get(channel))); } Optional<Expression> hashExpression = HashGenerationOptimizer.getHashExpression(ImmutableList.copyOf(symbolTypes.build().keySet())); verify(hashExpression.isPresent()); projections.add(new InterpretedPageProjection( hashExpression.get(), TypeProvider.copyOf(symbolTypes.build()), symbolToInputMapping.build(), localQueryRunner.getMetadata(), localQueryRunner.getSqlParser(), session)); return new FilterAndProjectOperator.FilterAndProjectOperatorFactory( operatorId, planNodeId, () -> new PageProcessor(Optional.empty(), projections.build()), ImmutableList.copyOf(Iterables.concat(types, ImmutableList.of(BIGINT))), getFilterAndProjectMinOutputPageSize(session), getFilterAndProjectMinOutputPageRowCount(session)); }
Source:
<code>public void use_AnalysisWarningsWrapper_before_SQ_7_4_and_sonarlint() { SonarRuntime runtime = SonarRuntimeImpl.forSonarQube(Version.create(7, 3), SonarQubeSide.SCANNER); Plugin.Context context = new Plugin.Context(runtime); javaPlugin.define(context); assertThat(context.getExtensions()).doesNotContain(AnalysisWarningsWrapper.class); <START> runtime = SonarRuntimeImpl.forSonarQube(ANALYSIS_WARNINGS_MIN_SUPPORTED_SQ_VERSION, SonarQubeSide.SCANNER); <END> context = new Plugin.Context(runtime); javaPlugin.define(context); assertThat(context.getExtensions()).contains(AnalysisWarningsWrapper.class); runtime = SonarRuntimeImpl.forSonarLint(ANALYSIS_WARNINGS_MIN_SUPPORTED_SQ_VERSION); context = new Plugin.Context(runtime); javaPlugin.define(context); assertThat(context.getExtensions()).doesNotContain(AnalysisWarningsWrapper.class); }</code><technical_language>I for testing this constant configure version VERSION_7_4 constant ANALYSIS_... a private static final variable in java plugin encapsulate things</technical_language>

Target:
public void use_AnalysisWarningsWrapper_before_SQ_7_4_and_sonarlint() { Version unsupportedVersion = Version.create(7, 3); Version minSupportedVersion = Version.create(7, 4); SonarRuntime runtime = SonarRuntimeImpl.forSonarQube(unsupportedVersion, SonarQubeSide.SCANNER); Plugin.Context context = new Plugin.Context(runtime); javaPlugin.define(context); assertThat(context.getExtensions()).doesNotContain(AnalysisWarningsWrapper.class); runtime = SonarRuntimeImpl.forSonarQube(minSupportedVersion, SonarQubeSide.SCANNER); context = new Plugin.Context(runtime); javaPlugin.define(context); assertThat(context.getExtensions()).contains(AnalysisWarningsWrapper.class); runtime = SonarRuntimeImpl.forSonarLint(minSupportedVersion); context = new Plugin.Context(runtime); javaPlugin.define(context); assertThat(context.getExtensions()).doesNotContain(AnalysisWarningsWrapper.class); }
Source:
<code>private void resolveErrorTypes(SpringComponentModel componentModel, Set<String> syntheticErrorNamespaces) { List<ComponentModel> innerComponents = componentModel.getInnerComponents(); if (!innerComponents.isEmpty()) { for (ComponentModel innerComponent : innerComponents) { processRaiseError(innerComponent, syntheticErrorNamespaces); resolveErrorTypes((SpringComponentModel) innerComponent, syntheticErrorNamespaces); } } <START> componentBuildingDefinitionRegistry.getBuildingDefinition(componentModel.getIdentifier()) <END> .ifPresent(componentBuildingDefinition -> { List<ComponentModel> errorMappingComponents = componentModel.getInnerComponents().stream() .filter(innerComponent -> ERROR_MAPPING_IDENTIFIER.equals(innerComponent.getIdentifier())).collect(toList()); if (!errorMappingComponents.isEmpty()) { addAnnotation(ANNOTATION_ERROR_MAPPINGS, errorMappingComponents.stream().map(innerComponent -> { Map<String, String> parameters = innerComponent.getRawParameters(); ComponentIdentifier source = parameters.containsKey(SOURCE_TYPE) ? buildFromStringRepresentation(parameters.get(SOURCE_TYPE)) : ANY; ErrorType errorType = muleContext.getErrorTypeRepository() .lookupErrorType(source) .orElseThrow(() -> new MuleRuntimeException(createStaticMessage("Could not find error '%s'.", source))); ErrorTypeMatcher errorTypeMatcher = new SingleErrorTypeMatcher(errorType); ErrorType targetValue = resolveErrorType(parameters.get(TARGET_TYPE), syntheticErrorNamespaces); return new ErrorMapping(errorTypeMatcher, targetValue); }).collect(toList()), componentModel); } }); }</code><technical_language>extract this a method more concise</technical_language>

Target:
private void resolveErrorTypes(SpringComponentModel componentModel, Set<String> syntheticErrorNamespaces) { List<ComponentModel> innerComponents = componentModel.getInnerComponents(); if (!innerComponents.isEmpty()) { for (ComponentModel innerComponent : innerComponents) { processRaiseError(innerComponent, syntheticErrorNamespaces); resolveErrorTypes((SpringComponentModel) innerComponent, syntheticErrorNamespaces); } } componentBuildingDefinitionRegistry.getBuildingDefinition(componentModel.getIdentifier()) .ifPresent(componentBuildingDefinition -> registerErrorMappings(componentModel, syntheticErrorNamespaces)); }
Source:
<code>protected PollingResult compareRemoteRevisionWith(AbstractProject<?, ?> project, Launcher launcher, FilePath workspace, TaskListener listener, SCMRevisionState _baseline) throws IOException, InterruptedException { MercurialTagAction baseline = (MercurialTagAction)_baseline; PrintStream output = listener.getLogger(); Set<String> changedFileNames = new HashSet<String>(); FilePath tmpFile = workspace.createTextTempFile("tmp", "style", FILES_STYLE); try { ByteArrayOutputStream baos = new ByteArrayOutputStream(); AbstractProject<?,?> _project = project; Node node = _project.getLastBuiltOn(); ArgumentListBuilder cmd = findHgExe(node, listener, false); cmd.add(forest ? "fincoming" : "incoming", "--style", tmpFile.getRemote()); cmd.add("--no-merges"); <START> cmd.add("--branch", getBranch()); <END> cmd.add("--newest-first"); String cachedSource = cachedSource(node, launcher, listener, true); if (cachedSource != null) { cmd.add(cachedSource); } joinWithPossibleTimeout( launch(launcher).cmds(cmd).stdout(new ForkOutputStream(baos, output)).pwd(workspace2Repo(workspace)), true, listener); MercurialTagAction cur = parseIncomingOutput(baos, baseline, changedFileNames); return new PollingResult(baseline,cur,computeDegreeOfChanges(changedFileNames,output)); } finally { tmpFile.delete(); } }</code><technical_language>-branch is in Hg 1.5+, nodes earlier client (see HgExe.Capability) --rev</technical_language>

Target:
protected PollingResult compareRemoteRevisionWith(AbstractProject<?, ?> project, Launcher launcher, FilePath workspace, TaskListener listener, SCMRevisionState _baseline) throws IOException, InterruptedException { MercurialTagAction baseline = (MercurialTagAction)_baseline; PrintStream output = listener.getLogger(); Set<String> changedFileNames = new HashSet<String>(); FilePath tmpFile = workspace.createTextTempFile("tmp", "style", FILES_STYLE); try { ByteArrayOutputStream baos = new ByteArrayOutputStream(); AbstractProject<?,?> _project = project; Node node = _project.getLastBuiltOn(); ArgumentListBuilder cmd = findHgExe(node, listener, false); cmd.add(forest ? "fincoming" : "incoming", "--style", tmpFile.getRemote()); cmd.add("--no-merges"); cmd.add("--rev", getBranch()); cmd.add("--newest-first"); String cachedSource = cachedSource(node, launcher, listener, true); if (cachedSource != null) { cmd.add(cachedSource); } joinWithPossibleTimeout( launch(launcher).cmds(cmd).stdout(new ForkOutputStream(baos, output)).pwd(workspace2Repo(workspace)), true, listener); MercurialTagAction cur = parseIncomingOutput(baos, baseline, changedFileNames); return new PollingResult(baseline,cur,computeDegreeOfChanges(changedFileNames,output)); } finally { tmpFile.delete(); } }
Source:
<code>public Secret inspectSecret(final String secretId) throws DockerException, InterruptedException { assertApiVersionIsAbove("1.25"); final WebTarget resource = resource().path("secrets").path(secretId); try { return request(GET, Secret.class, resource, resource.request(APPLICATION_JSON_TYPE)); } catch (final DockerRequestException ex) { switch (ex.status()) { case 404: throw new NotFoundException("Secret " + secretId + " not found.", ex); case 406: <START> throw new DockerException("Server not part of swarm.", ex); <END> default: throw ex; } } }</code><technical_language>this a new Exception class</technical_language>

Target:
public Secret inspectSecret(final String secretId) throws DockerException, InterruptedException { assertApiVersionIsAbove("1.25"); final WebTarget resource = resource().path("secrets").path(secretId); try { return request(GET, Secret.class, resource, resource.request(APPLICATION_JSON_TYPE)); } catch (final DockerRequestException ex) { switch (ex.status()) { case 404: throw new NotFoundException("Secret " + secretId + " not found.", ex); case 406: throw new NonSwarmNodeException("Server not part of swarm.", ex); default: throw ex; } } }
Source:
<code>public void setUp() throws Exception { super.setUp(); IProject iProject = project.project; if (!gitDir.exists()) new FileRepository(gitDir).create(); <START> new ConnectProviderOperation(iProject, gitDir).execute(null); <END> testRepo = new TestRepository(gitDir); testRepo.connect(iProject); repo = RepositoryMapping.getMapping(iProject).getRepository(); GitSynchronizeData data = new GitSynchronizeData(repo, "", "", true); GitSynchronizeDataSet dataSet = new GitSynchronizeDataSet(data); comparator = new GitResourceVariantComparator(dataSet); }</code><technical_language>I get error next statement: java.lang.IllegalStateException: Repository exists new TestRepository(Repository repository) instead? created instance of FileRepository before</technical_language>

Target:
public void setUp() throws Exception { super.setUp(); iProject = project.project; testRepo = new TestRepository(gitDir); testRepo.connect(iProject); repo = RepositoryMapping.getMapping(iProject).getRepository(); GitSynchronizeData data = new GitSynchronizeData(repo, "", "", true); GitSynchronizeDataSet dataSet = new GitSynchronizeDataSet(data); comparator = new GitResourceVariantComparator(dataSet); }
Source:
<code>public void initialize() { super.initialize(); <START> nameField.setAttribute("placeHolder", <END> translationService.getTranslation(StunnerWidgetsConstants.NameEditBoxWidgetViewImp_name)); }</code><technical_language>this logic set presenter</technical_language>

Target:
public void initialize() { super.initialize(); nameField.setAttribute("data-text", translationService.getTranslation(StunnerWidgetsConstants.NameEditBoxWidgetViewImp_name)); nameField.addEventListener("input", event -> onInputChange()); }
Source:
<code>public Response activate(Action action) { validateParameters(action, "bricks"); validateBrickNames(action); GlusterVolumeEntity volume = getEntity(GlusterVolumeEntity.class, VdcQueryType.GetGlusterVolumeById, new IdQueryParameters(asGuid(getVolumeId())), ""); if (volume.getAsyncTask() != null && volume.getAsyncTask().getType() == GlusterTaskType.REMOVE_BRICK && volume.getAsyncTask().getStatus() == JobExecutionStatus.FINISHED) { return stopMigrate(action); } else { Fault fault = new Fault(); <START> fault.setReason(localize(Messages.INVALID_ENUM_DETAIL)); <END> throw new WebApplicationException(Response.status(Response.Status.BAD_REQUEST) .entity(fault) .build()); } }</code><technical_language>reason incorrect. reason brick activated migration is complete</technical_language>

Target:
public Response activate(Action action) { validateParameters(action, "bricks"); validateBrickNames(action); GlusterVolumeEntity volume = getEntity(GlusterVolumeEntity.class, VdcQueryType.GetGlusterVolumeById, new IdQueryParameters(asGuid(getVolumeId())), ""); if (volume.getAsyncTask() != null && volume.getAsyncTask().getType() == GlusterTaskType.REMOVE_BRICK && volume.getAsyncTask().getStatus() == JobExecutionStatus.FINISHED) { return stopMigrate(action); } else { Fault fault = new Fault(); fault.setReason(localize(Messages.CANNOT_ACTIVATE_UNLESS_MIGRATION_COMPLETED)); throw new WebApplicationException(Response.status(Response.Status.BAD_REQUEST) .entity(fault) .build()); } }
Source:
<code>public String toString() { StringBuilder builder = new StringBuilder(); builder.append("MarkerCategory [name="); builder.append(name); builder.append(", severity="); builder.append(severity); builder.append(", start="); builder.append(start); builder.append(", end="); builder.append(end); <START> builder.append("]"); <END> return builder.toString(); }</code><technical_language>PMD/Sonarqube: Avoid concatenating characters strings in StringBuffer.append</technical_language>

Target:
public String toString() { StringBuilder builder = new StringBuilder(); builder.append("MarkerCategory [name="); builder.append(name); builder.append(", severity="); builder.append(severity); builder.append(", start="); builder.append(start); builder.append(", end="); builder.append(end); builder.append(']'); return builder.toString(); }
Source:
<code>public void testRemoveValueNoStoreEntryEqualCacheWriterEntry() throws Exception { final MockStore realStore = new MockStore(Collections.<String, String>emptyMap()); this.store = spy(realStore); final MockCacheWriter realCache = new MockCacheWriter(Collections.singletonMap("key", "value")); final Ehcache<String, String> ehcache = this.getEhcache(realCache); assertFalse(ehcache.remove("key", "value")); verify(this.store).computeIfPresent(eq("key"), getAnyBiFunction()); verifyZeroInteractions(this.spiedResilienceStrategy); assertThat(realStore.getMap().containsKey("key"), is(false)); <START> assertThat(realCache.getEntries().containsKey("key"), is(true)); END> validateStats(ehcache, EnumSet.of(CacheOperationOutcomes.RemoveOutcome.FAILURE)); }</code><technical_language>This get sorted out a proper story for concurrent operations + writer/loader setup. feels wrong as-is</technical_language>

Target:
public void testRemoveValueNoStoreEntryEqualCacheWriterEntry() throws Exception { final FakeStore fakeStore = new FakeStore(Collections.<String, String>emptyMap()); this.store = spy(fakeStore); final FakeCacheWriter fakeWriter = new FakeCacheWriter(Collections.singletonMap("key", "value")); final Ehcache<String, String> ehcache = this.getEhcache(fakeWriter); assertFalse(ehcache.remove("key", "value")); verify(this.store).computeIfPresent(eq("key"), getAnyBiFunction()); verifyZeroInteractions(this.spiedResilienceStrategy); assertThat(fakeStore.getEntryMap().containsKey("key"), is(false)); assertThat(fakeWriter.getEntryMap().containsKey("key"), is(true)); validateStats(ehcache, EnumSet.of(CacheOperationOutcomes.RemoveOutcome.FAILURE)); }
Source:
<code>public Object answer(InvocationOnMock invocation) throws Throwable { if (MockUtil.isMock(throwable)) { throw throwable; } Throwable t = throwable.fillInStackTrace(); filter.filter(t); <START> throw throwable; <END> }</code><technical_language>I wrong. previous attempt correct. java if (t == null) { throw throwable; }</technical_language>

Target:
public Object answer(InvocationOnMock invocation) throws Throwable { if (MockUtil.isMock(throwable)) { throw throwable; } Throwable t = throwable.fillInStackTrace(); if (t == null) { throw throwable; } filter.filter(t); throw t; }
Source:
<code>CallField field(String name, String[] values) { <START> return new BufferedMultipleAtomicCallField(name, Stream.of(values)); <END> }</code><technical_language>Instead of converting array a stream convert array in BufferedMultipleAtomicCallField, BufferedMultipleAtomicCallField constructor takes array</technical_language>

Target:
CallField field(String name, String[] values) { return new BufferedMultipleAtomicCallField(name, values); }
Source:
<code>private void onLoginSuccess() { funnel.logSuccess(); hideSoftKeyboard(LoginActivity.this); setResult(RESULT_LOGIN_SUCCESS); Prefs.setReadingListSyncEnabled(true); Prefs.shouldShowReadingListSyncMergePrompt(true); Prefs.setReadingListPagesDeletedIds(Collections.emptySet()); Prefs.setReadingListsDeletedIds(Collections.emptySet()); ReadingListSyncAdapter.manualSyncWithForce(); <START> WikipediaApp.getInstance().getBus().post(new LoginLogoutEvent()); <END> finish(); }</code><technical_language>question. check implementation in #632 if works for you</technical_language>

Target:
private void onLoginSuccess() { funnel.logSuccess(); hideSoftKeyboard(LoginActivity.this); setResult(RESULT_LOGIN_SUCCESS); Prefs.setReadingListSyncEnabled(true); Prefs.shouldShowReadingListSyncMergePrompt(true); Prefs.setReadingListPagesDeletedIds(Collections.emptySet()); Prefs.setReadingListsDeletedIds(Collections.emptySet()); ReadingListSyncAdapter.manualSyncWithForce(); finish(); }
Source:
<code>public void testSetRotateM() { float[] matrix = new float[]{ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 }; float[] expected = new float[]{ 0.9998687f, 0.01299483f, -0.00968048f, 0, -0.012931813f, 0.999895f, 0.006544677f, 0, 0.009764502f, -0.006418644f, 0.99993175f, 0, 0, 0, 0, 1 }; Matrix.setRotateM(matrix, 0, 1, 2, 3, 4); <START> Assert.assertArrayEquals(expected, matrix, 0.001f); <END> }</code><technical_language>prefer assertj possible, this changed assertThat(matrix).containsSequence(expected, withPrecision(0.001f));</technical_language>

Target:
public void testSetRotateM() { float[] matrix = new float[]{ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 }; float[] expected = new float[]{ 0.9998687f, 0.01299483f, -0.00968048f, 0, -0.012931813f, 0.999895f, 0.006544677f, 0, 0.009764502f, -0.006418644f, 0.99993175f, 0, 0, 0, 0, 1 }; Matrix.setRotateM(matrix, 0, 1, 2, 3, 4); assertThat(matrix).containsSequence(expected, withPrecision(0.0001f)); }
Source:
<code>private Pattern wildcardToRegex(String filter) { String regex = <START> "(?i)\\Q" <END> + filter.trim().replaceAll("\\Q*\\E", Matcher.quoteReplacement("\\E.*?\\Q")) + "\\E"; regex = regex.replace("\\Q\\E", ""); return Pattern.compile(regex); }</code><technical_language>Learned new today... nevertheless, personally I find clearer Pattern.compile(regex, Pattern.CASE_INSENSITIVE) instead</technical_language>

Target:
private Pattern wildcardToRegex(String filter) { String trimmed = filter.trim(); if (trimmed.isEmpty()) { return null; } String regex = (trimmed.contains("*") ? "^" : "") + "\\Q" + trimmed.replaceAll("\\*", Matcher.quoteReplacement("\\E.*?\\Q")) + "\\E"; regex = regex.replaceAll(Pattern.quote("\\Q\\E"), ""); return Pattern.compile(regex, Pattern.CASE_INSENSITIVE); }
Source:
<code>public void create() { if (getSourceCidrList() != null) { for (String cidr : getSourceCidrList()) { if (!NetUtils.isValidIp4Cidr(cidr) && !NetUtils.isValidIp6Cidr(cidr)) { throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Source CIDRs formatting error " + cidr); } } } try { FirewallRule result = _firewallService.createIngressFirewallRule(this); if (result != null) { setEntityId(result.getId()); setEntityUuid(result.getUuid()); } } catch (NetworkRuleConflictException ex) { s_logger.trace("Network Rule Conflict: ", ex); <START> throw new ServerApiException(ApiErrorCode.NETWORK_RULE_CONFLICT_ERROR, ex.getMessage()); <END> } }</code><technical_language>question here</technical_language>

Target:
public void create() { if (getSourceCidrList() != null) { for (String cidr : getSourceCidrList()) { if (!NetUtils.isValidIp4Cidr(cidr) && !NetUtils.isValidIp6Cidr(cidr)) { throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Source CIDRs formatting error " + cidr); } } } try { FirewallRule result = _firewallService.createIngressFirewallRule(this); if (result != null) { setEntityId(result.getId()); setEntityUuid(result.getUuid()); } } catch (NetworkRuleConflictException ex) { s_logger.trace("Network Rule Conflict: ", ex); throw new ServerApiException(ApiErrorCode.NETWORK_RULE_CONFLICT_ERROR, ex.getMessage(), ex); } }
Source:
<code>public void contentDispositionShouldBeRecognized() throws IOException { new RqMtFake( new RqFake(), new RqWithHeader( new RqFake(new ListOf<>(""), ""), <START> contentDispositionHeader("form-data; name=\"field1\"") <END> ), new RqWithHeader( new RqFake("", "", "field2Value"), contentDispositionHeader("form-data; name=\"field2\"") ) ); }</code><technical_language>@Serranya Please, change this private method for "more OO", FormattedText</technical_language>

Target:
public void contentDispositionShouldBeRecognized() throws Exception { new RqMtFake( new RqFake(), new RqWithHeader( new RqFake(new ListOf<>(""), ""), new FormattedText( RqMtFakeTest.CONTENT_DISP, "name=\"field1\"" ).asString() ), new RqWithHeader( new RqFake("", "", "field2Value"), new FormattedText( RqMtFakeTest.CONTENT_DISP, "name=\"field2\"" ).asString() ) ); }
Source:
<code>private CompiledQuery sqlTableBackup(SqlExecutionContext executionContext) throws SqlException { ObjList<CharSequence> tableNames = new ObjList<>(); while (true) { CharSequence tok = SqlUtil.fetchNext(lexer); if (null == tok) { throw SqlException.position(lexer.getPosition()).put(" expected a table name"); } CharSequence tableName = GenericLexer.unquote(tok); int status = engine.getStatus(executionContext.getCairoSecurityContext(), path, tableName, 0, tableName.length()); if (status != TableUtils.TABLE_EXISTS) { throw SqlException.position(lexer.getPosition()).put(" '").put(tableName).put("' is not a valid table"); } tableNames.add(tableName); tok = SqlUtil.fetchNext(lexer); if (null == tok || Chars.equals(tok, ';')) { break; } if (!Chars.equals(tok, ',')) { throw SqlException.position(lexer.getPosition()).put(" expected ','"); } } for (int n=0; n<tableNames.size(); n++) { backupTable(tableNames.get(n), executionContext); } <START> return compiledQuery.ofRenameTable(); <END> }</code><technical_language>backup needs result</technical_language>

Target:
private CompiledQuery sqlTableBackup(SqlExecutionContext executionContext) throws SqlException { setupBackupRenamePath(); try { tableNames.clear(); while (true) { CharSequence tok = SqlUtil.fetchNext(lexer); if (null == tok) { throw SqlException.position(lexer.lastTokenPosition()).put(" expected a table name"); } CharSequence tableName = GenericLexer.unhack(GenericLexer.unquote(tok)); if (tableName == null) { throw SqlException.position(lexer.lastTokenPosition()).put(" expected a valid table name"); } int status = engine.getStatus(executionContext.getCairoSecurityContext(), path, tableName, 0, tableName.length()); if (status != TableUtils.TABLE_EXISTS) { throw SqlException.position(lexer.lastTokenPosition()).put(" '").put(tableName).put("' is not a valid table"); } tableNames.add(tableName); tok = SqlUtil.fetchNext(lexer); if (null == tok || Chars.equals(tok, ';')) { break; } if (!Chars.equals(tok, ',')) { throw SqlException.position(lexer.lastTokenPosition()).put(" expected ','"); } } for (int n = 0; n < tableNames.size(); n++) { backupTable(tableNames.get(n), executionContext); } return compiledQuery.ofBackupTable(); } finally { tableNames.clear(); } }
Source:
<code>public boolean sendCommandsToRouter(final VirtualRouter router, final Commands cmds) throws AgentUnavailableException, ResourceUnavailableException { if (!checkRouterVersion(router)) { s_logger.debug("Router requires upgrade. Unable to send command to router:" + router.getId() + ", router template version : " + router.getTemplateVersion() + ", minimal required version : " + NetworkOrchestrationService.MinVRVersion.valueIn(router.getDataCenterId())); throw new ResourceUnavailableException("Unable to send command. Router requires upgrade", VirtualRouter.class, router.getId()); } Answer[] answers = null; try { answers = _agentMgr.send(router.getHostId(), cmds); } catch (final OperationTimedoutException e) { s_logger.warn("Timed out", e); throw new AgentUnavailableException("Unable to send commands to virtual router ", router.getHostId(), e); <START> } catch (final OperationCancelledException e) { <END> s_logger.warn("Operation cancelled", e); } if (answers == null || answers.length != cmds.size()) { return false; } boolean result = true; for (final Answer answer : answers) { if (!answer.getResult()) { result = false; break; } } return result; }</code><technical_language>Cancelled exception is handled rethrow, issues chain</technical_language>

Target:
public boolean sendCommandsToRouter(final VirtualRouter router, final Commands cmds) throws AgentUnavailableException, ResourceUnavailableException { if (!checkRouterVersion(router)) { s_logger.debug("Router requires upgrade. Unable to send command to router:" + router.getId() + ", router template version : " + router.getTemplateVersion() + ", minimal required version : " + NetworkOrchestrationService.MinVRVersion.valueIn(router.getDataCenterId())); throw new ResourceUnavailableException("Unable to send command. Router requires upgrade", VirtualRouter.class, router.getId()); } Answer[] answers = null; try { answers = _agentMgr.send(router.getHostId(), cmds); } catch (final OperationTimedoutException e) { s_logger.warn("Timed out", e); throw new AgentUnavailableException("Unable to send commands to virtual router ", router.getHostId(), e); } catch (final OperationCancelledException e) { s_logger.warn("Operation cancelled", e); throw new AgentUnavailableException("Unable to send commands to virtual router ", router.getHostId(), e); } if (answers == null || answers.length != cmds.size()) { return false; } boolean result = true; for (final Answer answer : answers) { if (!answer.getResult()) { result = false; break; } } return result; }
Source:
<code>public void handle(Handshake handshake) throws Exception { Preconditions.checkState( thisState == State.HANDSHAKE, "Not expecting HANDSHAKE" ); this.handshake = handshake; ch.setVersion( handshake.getProtocolVersion() ); <START> if ( handshake.getRequestedProtocol() == 2 && BungeeCord.getInstance().getConnectionThrottle().throttle( ( ( InetSocketAddress ) ch.getHandle().remoteAddress() ).getAddress() ) ) <END> { if ( BungeeCord.getInstance().getConfig().isLogThrottled() ) { bungee.getLogger().log( Level.INFO, "{0} throttled", this ); } thisState = State.USERNAME; ch.setProtocol( Protocol.LOGIN ); disconnect( bungee.getTranslation( "join_throttle_kick", TimeUnit.MILLISECONDS.toSeconds( BungeeCord.getInstance().getConfig().getThrottle() ) ) ); return; } if ( handshake.getHost().contains( "\0" ) ) { String[] split = handshake.getHost().split( "\0", 2 ); handshake.setHost( split[0] ); extraDataInHandshake = "\0" + split[1]; } if ( handshake.getHost().endsWith( "." ) ) { handshake.setHost( handshake.getHost().substring( 0, handshake.getHost().length() - 1 ) ); } this.virtualHost = InetSocketAddress.createUnresolved( handshake.getHost(), handshake.getPort() ); bungee.getLogger().log( Level.INFO, "{0} has connected", this ); bungee.getPluginManager().callEvent( new PlayerHandshakeEvent( InitialHandler.this, handshake ) ); switch ( handshake.getRequestedProtocol() ) { case 1: thisState = State.STATUS; ch.setProtocol( Protocol.STATUS ); break; case 2: thisState = State.USERNAME; ch.setProtocol( Protocol.LOGIN ); break; default: throw new IllegalArgumentException( "Cannot request protocol " + handshake.getRequestedProtocol() ); } }</code><technical_language>Magic</technical_language>

Target:
public void handle(Handshake handshake) throws Exception { Preconditions.checkState( thisState == State.HANDSHAKE, "Not expecting HANDSHAKE" ); this.handshake = handshake; ch.setVersion( handshake.getProtocolVersion() ); if ( handshake.getHost().contains( "\0" ) ) { String[] split = handshake.getHost().split( "\0", 2 ); handshake.setHost( split[0] ); extraDataInHandshake = "\0" + split[1]; } if ( handshake.getHost().endsWith( "." ) ) { handshake.setHost( handshake.getHost().substring( 0, handshake.getHost().length() - 1 ) ); } this.virtualHost = InetSocketAddress.createUnresolved( handshake.getHost(), handshake.getPort() ); bungee.getLogger().log( Level.INFO, "{0} has connected", this ); bungee.getPluginManager().callEvent( new PlayerHandshakeEvent( InitialHandler.this, handshake ) ); switch ( handshake.getRequestedProtocol() ) { case 1: thisState = State.STATUS; ch.setProtocol( Protocol.STATUS ); break; case 2: thisState = State.USERNAME; ch.setProtocol( Protocol.LOGIN ); if ( BungeeCord.getInstance().getConnectionThrottle().throttle( ( ( InetSocketAddress ) ch.getHandle().remoteAddress() ).getAddress() ) ) { disconnect( bungee.getTranslation( "join_throttle_kick", TimeUnit.MILLISECONDS.toSeconds( BungeeCord.getInstance().getConfig().getThrottle() ) ) ); return; } break; default: throw new IllegalArgumentException( "Cannot request protocol " + handshake.getRequestedProtocol() ); } }
Source:
<code>private boolean registerArchiveFormat(String ext) { ArchiveCommand.Format<ArchiveOutputStream> format = archiveFormats.get(ext); if (format == null) { return false; } try { ArchiveCommand.registerFormat(ext, format); if ("zip".equals(ext)) { setupZipCompressionLevel(); } return true; <START> } catch (Exception e) { <END> return false; } }</code><technical_language>This is a bad event a programming error, logged in server log learn correct it</technical_language>

Target:
private boolean registerArchiveFormat(String ext) { ArchiveCommand.Format<ArchiveOutputStream> format = archiveFormats.get(ext); if (format != null) { try { ArchiveCommand.registerFormat(ext, format); if ("zip".equals(ext)) { setupZipCompressionLevel(); } return true; } catch (Exception e) { log.error("Error registering archive format: ", e); } } return false; }
Source:
<code>private static String getAnnotationAttributeAsString(List<AnnotationValue> values, String attributeName, String defaultValue) { <START> Optional<Object> propagation = values.stream() <END> .filter(annotationValue -> annotationValue.name().equals(attributeName)) .map(AnnotationValue::value) .findFirst(); if (!propagation.isPresent()) { return defaultValue; } if (propagation.get() instanceof MemberSelectExpressionTree) { return ((MemberSelectExpressionTree) propagation.get()).identifier().name(); } else if (propagation.get() instanceof IdentifierTree) { return ((IdentifierTree) propagation.get()).name(); } return defaultValue; }</code><technical_language>This rewritten a reduction of Optional a orElse</technical_language>

Target:
private static String getAnnotationAttributeAsString(List<AnnotationValue> values, String attributeName, String defaultValue) { return values.stream() .filter(annotationValue -> annotationValue.name().equals(attributeName)) .map(AnnotationValue::value) .filter(Tree.class::isInstance) .map(Tree.class::cast) .map(tree -> tree.is(Tree.Kind.MEMBER_SELECT) ? ((MemberSelectExpressionTree) tree).identifier() : tree) .filter(tree -> tree.is(Tree.Kind.IDENTIFIER)) .map(IdentifierTree.class::cast) .map(IdentifierTree::name) .findFirst() .orElse(defaultValue); }
Source:
<code>public synchronized void addOrUpdate(final LineBreakpoint bId) { Breakpoint bp = truffleBreakpoints.get(bId); if (bp == null) { WebDebugger.log("LineBreakpoint: " + bId); bp = Breakpoint.newBuilder(bId.getURI()). lineIs(bId.getLine()). <START> steppingLocation(SteppingLocation.BEFORE_STATEMENT). <END> build(); debuggerSession.install(bp); truffleBreakpoints.put(bId, bp); } bp.setEnabled(bId.isEnabled()); }</code><technical_language>necessary latest truffle changes. (same below, I believe)</technical_language>

Target:
public synchronized void addOrUpdate(final LineBreakpoint bId) { Breakpoint bp = truffleBreakpoints.get(bId); if (bp == null) { WebDebugger.log("LineBreakpoint: " + bId); bp = Breakpoint.newBuilder(bId.getURI()). lineIs(bId.getLine()). build(); debuggerSession.install(bp); truffleBreakpoints.put(bId, bp); } bp.setEnabled(bId.isEnabled()); }
Source:
<code>public <M extends Metric> Tagger<M> forMetric(M metric) { Metadata metadata = metaDataCollection.get(metric); if (metadata != null) { return new TaggerImpl<M>(metric, metadata); } synchronized (this) { <START> if (metaDataCollection.containsKey(metric)) { <END> return new TaggerImpl<M>(metric, metaDataCollection.get(metric)); } Metadata thisMetricsMetadata = new Metadata(); Metadata oldMetaData = metaDataCollection.put(metric, thisMetricsMetadata); Preconditions.checkArgument(oldMetaData == null, "Concurrency issue adding metadata"); return new TaggerImpl<M>(metric, thisMetricsMetadata); } }</code><technical_language>change this a get() avoid double hash lookup</technical_language>

Target:
public <M extends Metric> Tagger<M> forMetric(M metric) { Metadata metadata = metaDataCollection.get(metric); if (metadata == null) { synchronized (this) { metadata = metaDataCollection.get(metric); if (metadata == null) { metadata = new Metadata(); Metadata oldMetaData = metaDataCollection.put(metric, metadata); Preconditions.checkArgument(oldMetaData == null, "Concurrency issue adding metadata"); } } } return new TaggerImpl<M>(metric, metadata); }
Source:
<code><START> public void testParseDateFailed() { <END> try { CommonUtils.parseFromUtcTime("this is obviously not a date"); fail("Parsing date should never be successfull here"); } catch (ParseException e) { } }</code><technical_language>able simplify this test case JUnit4 annotations, @Expected</technical_language>

Target:
public void testParseDateFailed() throws ParseException { CommonUtils.parseFromUtcTime("this is obviously not a date"); }
Source:
<code>IStorageProvider getStorageProvider(IResource resource, DiffSide side) throws CoreException; boolean isInSync(IResource resource) throws CoreException; <START> <END> public Optional<IFile> getFileBeforeRename(IFile sourceOrRemoteFile, DiffSide side); public Optional<IFile> getFileAfterRename(IFile originFile, DiffSide side); public static enum DiffSide { SOURCE, REMOTE, ORIGIN; }</code><technical_language>Philip, allow Guava' types in EMF Compare public API. leads compatibility problems Guava's versions</technical_language>

Target:
IStorageProvider getStorageProvider(IResource resource, DiffSide side) throws CoreException; boolean isInSync(IResource resource) throws CoreException; public IFile getFileBeforeRename(IFile sourceOrRemoteFile, DiffSide side); public IFile getFileAfterRename(IFile originFile, DiffSide side); public static enum DiffSide { SOURCE, REMOTE, ORIGIN; }
Source:
<code>public Object getValueParameter() { <START> if (valueParameter == null) { <END> return null; } else { return valueParameter; } }</code><technical_language>This simplified just: >return valueParameter;</technical_language>

Target:
public Object getValueParameter() { return valueParameter; }
Source:
<code>public Token getCurrentToken() { Token token = new Token(); if (azureTokenUtils.findAndSetJWT()) { Token userToken = azureTokenUtils.getUserIdentityFromJWT(); if(userToken != null) { token.setUserIdentity(userToken.getUserIdentity()); <START> token.setUserType(userToken.getUserType()); <END> token.setId(userToken.getId()); } } return token; }</code><technical_language>implement entire getCurrentToken() in TokenCreator. TokenCreator is exact code. Instead add this logic a method retrieveCurrentToken() AbstractTokenUtil invoke method (azureTokenUtils.retrieveCurrentToken()) TokenCreator:: getCurrentToken()</technical_language>

Target:
public Token getCurrentToken() { return azureTokenUtils.retrieveCurrentToken(); }