auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void getResourcesFromADroolsPRJWithError() throws Exception { Path tmpRoot = Files.createTempDirectory("repo"); Path tmp = TestUtil.createAndCopyToDirectory(tmpRoot, "dummy", ResourcesConstants.KJAR_2_SINGLE_RESOURCES_WITH_ERROR); AFCompiler compiler = KieMavenCompilerFactory.getCompiler(KieDecorator.KIE_AFTER); WorkspaceCompilationInfo info = new WorkspaceCompilationInfo(Paths.get(tmp.toUri())); CompilationRequest req = new DefaultCompilationRequest(mavenRepo, info, new String[]{MavenCLIArgs.INSTALL}, Boolean.FALSE); KieCompilationResponse res = (KieCompilationResponse) compiler.compile(req); TestUtil.saveMavenLogIfCompilationResponseNotSuccessfull(tmp, res, this.getClass(), testName); if (!res.isSuccessful()) { List<String> msgs = res.getMavenOutput(); for (String msg : msgs) { logger.info(msg); } } assertThat(res.isSuccessful()).isTrue(); Optional<KieModuleMetaInfo> metaDataOptional = res.getKieModuleMetaInfo(); assertThat(metaDataOptional).isPresent(); KieModuleMetaInfo kieModuleMetaInfo = metaDataOptional.get(); assertThat(kieModuleMetaInfo).isNotNull(); Map<String, Set<String>> rulesBP = kieModuleMetaInfo.getRulesByPackage(); assertThat(rulesBP).hasSize(1); Optional<KieModule> kieModuleOptional = res.getKieModule(); assertThat(kieModuleOptional).isPresent(); List<String> classloaderOptional = CompilerClassloaderUtils.getStringFromTargets(tmpRoot); assertThat(classloaderOptional).hasSize(3); <START> TestUtil.rm(tmpRoot.toFile()); <END> }</code><technical_language>Please remove TestUtil.rm(tmpRoot.toFile()); tests in this class. This cleanup is present in @After method of this class</technical_language>

Target:
public void getResourcesFromADroolsPRJWithError() throws Exception { Path tmpRoot = Files.createTempDirectory("repo"); Path tmp = TestUtil.createAndCopyToDirectory(tmpRoot, "dummy", ResourcesConstants.KJAR_2_SINGLE_RESOURCES_WITH_ERROR); AFCompiler compiler = KieMavenCompilerFactory.getCompiler(KieDecorator.KIE_AFTER); WorkspaceCompilationInfo info = new WorkspaceCompilationInfo(Paths.get(tmp.toUri())); CompilationRequest req = new DefaultCompilationRequest(mavenRepo, info, new String[]{MavenCLIArgs.INSTALL}, Boolean.FALSE); KieCompilationResponse res = (KieCompilationResponse) compiler.compile(req); TestUtil.saveMavenLogIfCompilationResponseNotSuccessfull(tmp, res, this.getClass(), testName); if (!res.isSuccessful()) { List<String> msgs = res.getMavenOutput(); for (String msg : msgs) { logger.info(msg); } } assertThat(res.isSuccessful()).isTrue(); Optional<KieModuleMetaInfo> metaDataOptional = res.getKieModuleMetaInfo(); assertThat(metaDataOptional).isPresent(); KieModuleMetaInfo kieModuleMetaInfo = metaDataOptional.get(); assertThat(kieModuleMetaInfo).isNotNull(); Map<String, Set<String>> rulesBP = kieModuleMetaInfo.getRulesByPackage(); assertThat(rulesBP).hasSize(1); Optional<KieModule> kieModuleOptional = res.getKieModule(); assertThat(kieModuleOptional).isPresent(); List<String> classloaderOptional = CompilerClassloaderUtils.getStringFromTargets(tmpRoot); assertThat(classloaderOptional).hasSize(3); }
Source:
<code>public DecoratedCache(AdvancedCache<K, V> delegate, Flag... flags) { super(delegate); if (flags == null) throw new IllegalArgumentException("There is no point in using a DecoratedCache if neither a ClassLoader nor any Flags are set."); <START> if (flags == null || flags.length == 0) <END> this.flags = EnumUtil.EMPTY_BIT_SET; else { this.flags = EnumUtil.bitSetOf(flags); } cacheImplementation = (CacheImpl<K, V>) delegate; }</code><technical_language>need check for null again..</technical_language>

Target:
public DecoratedCache(AdvancedCache<K, V> delegate, Flag... flags) { super(delegate); if (flags == null) throw new IllegalArgumentException("There is no point in using a DecoratedCache if Flags are set."); if (flags.length == 0) this.flags = EnumUtil.EMPTY_BIT_SET; else { this.flags = EnumUtil.bitSetOf(flags); } cacheImplementation = (CacheImpl<K, V>) delegate; }
Source:
<code>protected void installFromArchive() throws Exception { InstallLibertyTask installTask = (InstallLibertyTask) ant.createTask("antlib:net/wasdev/wlp/ant:install-liberty"); if (installTask == null) { <START> throw new IllegalStateException("install-liberty task not found"); <END> } installTask.setBaseDir(assemblyInstallDirectory.getAbsolutePath()); installTask.setLicenseCode(install.getLicenseCode()); installTask.setVersion(install.getVersion()); installTask.setRuntimeUrl(install.getRuntimeUrl()); installTask.setVerbose(install.isVerbose()); installTask.setMaxDownloadTime(install.getMaxDownloadTime()); installTask.setType(install.getType()); installTask.setOffline(settings.isOffline()); String cacheDir = install.getCacheDirectory(); if (cacheDir == null) { File dir = new File(artifactRepository.getBasedir(), "wlp-cache"); installTask.setCacheDir(dir.getAbsolutePath()); } else { installTask.setCacheDir(cacheDir); } String serverId = install.getServerId(); if (serverId != null) { Server server = settings.getServer(serverId); if (server == null) { throw new MojoExecutionException("Server id not found: " + serverId); } installTask.setUsername(server.getUsername()); installTask.setPassword(server.getPassword()); } else { installTask.setUsername(install.getUsername()); installTask.setPassword(install.getPassword()); } installTask.execute(); }</code><technical_language>While here, this a bit more informative. about: Liberty install-liberty Ant task found. Verify required version of wlp-anttasks.jar is available</technical_language>

Target:
protected void installFromArchive() throws Exception { InstallLibertyTask installTask = (InstallLibertyTask) ant.createTask("antlib:net/wasdev/wlp/ant:install-liberty"); if (installTask == null) { throw new IllegalStateException(MessageFormat.format(messages.getString("error.dependencies.not.found"), "install-liberty")); } installTask.setBaseDir(assemblyInstallDirectory.getAbsolutePath()); installTask.setLicenseCode(install.getLicenseCode()); installTask.setVersion(install.getVersion()); installTask.setRuntimeUrl(install.getRuntimeUrl()); installTask.setVerbose(install.isVerbose()); installTask.setMaxDownloadTime(install.getMaxDownloadTime()); installTask.setType(install.getType()); installTask.setOffline(settings.isOffline()); String cacheDir = install.getCacheDirectory(); if (cacheDir == null) { File dir = new File(artifactRepository.getBasedir(), "wlp-cache"); installTask.setCacheDir(dir.getAbsolutePath()); } else { installTask.setCacheDir(cacheDir); } String serverId = install.getServerId(); if (serverId != null) { Server server = settings.getServer(serverId); if (server == null) { throw new MojoExecutionException("Server id not found: " + serverId); } installTask.setUsername(server.getUsername()); installTask.setPassword(server.getPassword()); } else { installTask.setUsername(install.getUsername()); installTask.setPassword(install.getPassword()); } installTask.execute(); }
Source:
<code>protected void bindComment(final int row, final int col, final PatchLineComment line, final boolean isLast, boolean expandComment) { if (line.getStatus() == PatchLineComment.Status.DRAFT) { final CommentEditorPanel plc = new CommentEditorPanel(line); plc.addFocusHandler(this); plc.addBlurHandler(this); table.setWidget(row, col, plc); styleLastCommentCell(row, col, false); } else { final AccountInfo author = accountCache.get(line.getAuthor()); final PublishedCommentPanel panel = new PublishedCommentPanel(author, line); panel.setOpen(expandComment); panel.addFocusHandler(this); panel.addBlurHandler(this); table.setWidget(row, col, panel); <START> styleLastCommentCell(row, col, line.getLine() == 0 ? true : false); <END> CommentList l = (CommentList) getRowItem(row); if (l == null) { l = new CommentList(); setRowItem(row, l); } l.comments.add(line); l.panels.add(panel); } styleCommentRow(row); }</code><technical_language>line.getLine() == 0 a boolean, ternary operator</technical_language>

Target:
protected void bindComment(final int row, final int col, final PatchLineComment line, final boolean isLast, boolean expandComment) { if (line.getStatus() == PatchLineComment.Status.DRAFT) { final CommentEditorPanel plc = new CommentEditorPanel(line); plc.addFocusHandler(this); plc.addBlurHandler(this); table.setWidget(row, col, plc); styleLastCommentCell(row, col, line.getLine() == FILE_COMMENT_ROW); } else { final AccountInfo author = accountCache.get(line.getAuthor()); final PublishedCommentPanel panel = new PublishedCommentPanel(author, line); panel.setOpen(expandComment); panel.addFocusHandler(this); panel.addBlurHandler(this); table.setWidget(row, col, panel); styleLastCommentCell(row, col, line.getLine() == FILE_COMMENT_ROW); CommentList l = (CommentList) getRowItem(row); if (l == null) { l = new CommentList(); setRowItem(row, l); } l.comments.add(line); l.panels.add(panel); } styleCommentRow(row); }
Source:
<code>private File copyEngineToTarget(File cachedEngineDir) throws MojoExecutionException { File targetEngine = getEngineDir(project); try { getLog().info("Parameter <testEngineLocation> is set to " + testEngineLocation + ", copying engine from: " + cachedEngineDir + " to " + targetEngine); FileUtils.copyDirectory(cachedEngineDir, targetEngine); return targetEngine; } catch (IOException ex) { <START> getLog().warn("Could not copy engine from: " + cachedEngineDir + " to " + targetEngine); <END> } return cachedEngineDir; }</code><technical_language>distribute ex logger</technical_language>

Target:
private File copyEngineToTarget(File cachedEngineDir) throws MojoExecutionException { File targetEngine = getEngineDir(project); try { getLog().info("Parameter <testEngineLocation> is set to " + testEngineLocation + ", copying engine from: " + cachedEngineDir + " to " + targetEngine); FileUtils.copyDirectory(cachedEngineDir, targetEngine); return targetEngine; } catch (IOException ex) { getLog().warn("Could not copy engine from: " + cachedEngineDir + " to " + targetEngine, ex); } return cachedEngineDir; }
Source:
<code>public void close() throws ResourceException { try { super.close(); } catch (Exception e) { <START> e.printStackTrace(); <END> } LogManager.logDetail(LogConstants.CTX_CONNECTOR, CassandraManagedConnectionFactory.UTIL.getString("shutting_down")); }</code><technical_language>Avoid printStackTrace. glance throw a ResourceException. avoid of this changing base close method - need throw Exception? need checked exception thrown - means need override in extending classes</technical_language>

Target:
public void close() { super.close(); LogManager.logDetail(LogConstants.CTX_CONNECTOR, CassandraManagedConnectionFactory.UTIL.getString("shutting_down")); }
Source:
<code>public void test_enqueuing_exceptional_yields2() { setUp(); BytecodeCFGBuilder.BytecodeCFG cfg = BytecodeCFGBuilder.buildCFG(TRY_WRONG_CATCH_SIGNATURE, squidClassLoader); BytecodeCFGBuilder.Block b2 = cfg.blocks().get(2); walker.programState = ProgramState.EMPTY_STATE.stackValue(new SymbolicValue()).stackValue(new SymbolicValue()); walker.programPosition = new ProgramPoint(b2).next().next(); walker.executeInstruction(b2.elements().get(3)); assertThat(walker.workList).hasSize(2); <START> assertThat(walker.workList.pop().programState.exitValue()).isNotNull().isInstanceOf(SymbolicValue.ExceptionalSymbolicValue.class); <END> assertThat(walker.workList.pop().programState.exitValue()).isNull(); }</code><technical_language>worth asserting exception type in case</technical_language>

Target:
public void test_enqueuing_exceptional_yields2() { initializeWalker(); BytecodeCFGBuilder.BytecodeCFG cfg = BytecodeCFGBuilder.buildCFG(TRY_WRONG_CATCH_SIGNATURE, squidClassLoader); BytecodeCFGBuilder.Block b2 = cfg.blocks().get(2); walker.programState = ProgramState.EMPTY_STATE.stackValue(new SymbolicValue()).stackValue(new SymbolicValue()); walker.programPosition = new ProgramPoint(b2).next().next(); walker.executeInstruction(b2.elements().get(3)); assertThat(walker.workList).hasSize(2); assertThat(walker.workList.pop().programState.exitValue()).isNotNull() .isInstanceOf(SymbolicValue.ExceptionalSymbolicValue.class) .extracting(sv -> ((SymbolicValue.ExceptionalSymbolicValue) sv).exceptionType().fullyQualifiedName()).containsExactly("java.lang.IllegalStateException"); assertThat(walker.workList.pop().programState.exitValue()).isNull(); }
Source:
<code>private static List<String> generateColors() { List<String> colors = new ArrayList<>(); final BigDecimal brightnessSteps = new BigDecimal(2); final BigDecimal saturationSteps = new BigDecimal(2); final BigDecimal hueSteps = new BigDecimal(15); final BigDecimal brightnessStep = new BigDecimal("0.5").divide(brightnessSteps, 2, RoundingMode.HALF_UP); final BigDecimal saturationStep = new BigDecimal("0.6").divide(saturationSteps, 2, RoundingMode.HALF_UP); final BigDecimal hueStep = ONE.divide(hueSteps, 8, RoundingMode.HALF_UP); <START> for (BigDecimal brightness = ONE; brightness.compareTo(new BigDecimal("0.5")) == 1; ) { <END> for (BigDecimal saturation = ONE; saturation.compareTo(new BigDecimal("0.4")) >= 0; ) { for (BigDecimal hue = ZERO; hue.compareTo(ONE) < 1; ) { Color hsbColor = Color.getHSBColor(hue.floatValue(), saturation.floatValue(), brightness.floatValue()); colors.add(getHexCodeOfColor(hsbColor)); hue = hue.add(hueStep); } saturation = saturation.subtract(saturationStep); } brightness = brightness.subtract(brightnessStep); } return colors; }</code><technical_language>BigDecimal cached</technical_language>

Target:
private static List<String> generateColors() { List<String> colors = new ArrayList<>(); final BigDecimal brightnessSteps = new BigDecimal(2); final BigDecimal saturationSteps = new BigDecimal(1); final BigDecimal hueSteps = new BigDecimal(15); final BigDecimal brightnessStep = new BigDecimal("0.5").divide(brightnessSteps, 2, RoundingMode.HALF_UP); final BigDecimal saturationStep = new BigDecimal("0.6").divide(saturationSteps, 2, RoundingMode.HALF_UP); final BigDecimal hueStep = ONE.divide(hueSteps, 8, RoundingMode.HALF_UP); final BigDecimal brightnessLimit = new BigDecimal("0.5"); final BigDecimal saturationLimit = new BigDecimal("0.4"); for (BigDecimal brightness = ONE; brightness.compareTo(brightnessLimit) == 1; ) { for (BigDecimal saturation = ONE; saturation.compareTo(saturationLimit) >= 0; ) { for (BigDecimal hue = ZERO; hue.compareTo(ONE) < 1; ) { Color hsbColor = Color.getHSBColor(hue.floatValue(), saturation.floatValue(), brightness.floatValue()); colors.add(getHexCodeOfColor(hsbColor)); hue = hue.add(hueStep); } saturation = saturation.subtract(saturationStep); } brightness = brightness.subtract(brightnessStep); } return shuffle(colors); }
Source:
<code>public String getUserName() { final UserCause userCause = getCause(UserCause.class); final String nameFromUserCause = userCause != null ? userCause.getUserName() : null; if (nameFromUserCause != null) { return nameFromUserCause; } final UserIdCause userIdCause = getCause(UserIdCause.class); final String nameFromUserIdCause = userIdCause != null ? userIdCause.getUserName() : null; if (nameFromUserIdCause != null) { return nameFromUserIdCause; } for (PromotionBadge badget : getStatus().getBadges()) { if (badget instanceof ManualCondition.Badge) { final String nameFromBadge = ((ManualCondition.Badge) badget).getUserName(); if (nameFromBadge != null) { return nameFromBadge; } } } <START> return "anonymous"; <END> }</code><technical_language>Jenkins.ANONYMOUS.getName()</technical_language>

Target:
public String getUserName() { final UserCause userCause = getCause(UserCause.class); final String nameFromUserCause = userCause != null ? userCause.getUserName() : null; if (nameFromUserCause != null) { return nameFromUserCause; } final UserIdCause userIdCause = getCause(UserIdCause.class); final String nameFromUserIdCause = userIdCause != null ? userIdCause.getUserName() : null; if (nameFromUserIdCause != null) { return nameFromUserIdCause; } for (PromotionBadge badget : getStatus().getBadges()) { if (badget instanceof ManualCondition.Badge) { final String nameFromBadge = ((ManualCondition.Badge) badget).getUserName(); if (nameFromBadge != null) { return nameFromBadge; } } } return Jenkins.ANONYMOUS.getName(); }
Source:
<code>public Map<String, Map<String, Object>> extractBrokerConfigurations(Dictionary<String, ?> properties) { Map<String, Map<String, Object>> configPerBroker = new TreeMap<String, Map<String, Object>>(); <START> Enumeration<String> keys = properties.keys(); <END> while (keys.hasMoreElements()) { String key = keys.nextElement(); String value = (String) properties.get(key); if (key.equals("service.pid")) { continue; } String[] subkeys = key.split("\\."); if (subkeys.length != 2 || StringUtils.isBlank(value)) { logger.debug("MQTT Broker property '{}={}' should have the format 'broker.propertykey=value'", key, value); continue; } String brokername = subkeys[0].toLowerCase(); Map<String, Object> brokerConfig = configPerBroker.get(brokername); if (brokerConfig == null) { brokerConfig = new TreeMap<>(); configPerBroker.put(brokername, brokerConfig); brokerConfig.put("name", brokername); } brokerConfig.put(subkeys[1], value); } return configPerBroker; }</code><technical_language>do TreeMap here? Do rely order of brokers</technical_language>

Target:
public Map<String, Map<String, String>> extractBrokerConfigurations(Dictionary<String, ?> properties) { Map<String, Map<String, String>> configPerBroker = new HashMap<String, Map<String, String>>(); Enumeration<String> keys = properties.keys(); while (keys.hasMoreElements()) { String key = keys.nextElement(); String value = (String) properties.get(key); if (key.equals("service.pid")) { continue; } String[] subkeys = key.split("\\."); if (subkeys.length != 2 || StringUtils.isBlank(value)) { logger.debug("MQTT Broker property '{}={}' should have the format 'broker.propertykey=value'", key, value); continue; } String brokername = subkeys[0].toLowerCase(); Map<String, String> brokerConfig = configPerBroker.get(brokername); if (brokerConfig == null) { brokerConfig = new HashMap<>(); configPerBroker.put(brokername, brokerConfig); brokerConfig.put(NAME_PROPERTY, brokername); } brokerConfig.put(subkeys[1], value); } return configPerBroker; }
Source:
<code>public V get(final K key) throws CacheLoaderException { getObserver.begin(); statusTransitioner.checkAvailable(); checkNonNull(key); final Function<K, V> mappingFunction = memoize( new Function<K, V>() { @Override public V apply(final K k) { V loaded = null; try { if (cacheLoader != null) { cacheLoaderObserver.begin(); loaded = cacheLoader.load(k); cacheLoaderObserver.end(CacheLoaderOutcome.SUCCESS); getObserver.end(loaded != null ? GetOutcome.HIT_WITH_LOADER : GetOutcome.MISS_WITH_LOADER); } } catch (Exception e) { cacheLoaderObserver.end(CacheLoaderOutcome.FAILURE); throw newCacheLoaderException(e); } return loaded; } }); try { final Store.ValueHolder<V> valueHolder = store.computeIfAbsent(key, mappingFunction); if (valueHolder == null) { if (cacheLoader == null) { getObserver.end(GetOutcome.MISS_NO_LOADER); } return null; } else { if (cacheLoader == null) { getObserver.end(GetOutcome.HIT_NO_LOADER); } return valueHolder.value(); } } catch (CacheAccessException e) { <START> try { <END> if (cacheLoader == null) { return resilienceStrategy.getFailure(key, e); } else { return resilienceStrategy.getFailure(key, mappingFunction.apply(key), e); } } finally { getObserver.end(GetOutcome.FAILURE); } } }</code><technical_language>resilience calls for a CacheLoaderException</technical_language>

Target:
public V get(final K key) throws CacheLoaderException { getObserver.begin(); statusTransitioner.checkAvailable(); checkNonNull(key); final Function<K, V> mappingFunction = memoize( new Function<K, V>() { @Override public V apply(final K k) { V loaded = null; try { if (cacheLoader != null) { cacheLoaderObserver.begin(); loaded = cacheLoader.load(k); cacheLoaderObserver.end(CacheLoaderOutcome.SUCCESS); getObserver.end(loaded != null ? GetOutcome.HIT_WITH_LOADER : GetOutcome.MISS_WITH_LOADER); } } catch (Exception e) { cacheLoaderObserver.end(CacheLoaderOutcome.FAILURE); throw newCacheLoaderException(e); } return loaded; } }); try { final Store.ValueHolder<V> valueHolder = store.computeIfAbsent(key, mappingFunction); if (valueHolder == null) { if (cacheLoader == null) { getObserver.end(GetOutcome.MISS_NO_LOADER); } return null; } else { if (cacheLoader == null) { getObserver.end(GetOutcome.HIT_NO_LOADER); } return valueHolder.value(); } } catch (CacheAccessException e) { try { if (cacheLoader == null) { return resilienceStrategy.getFailure(key, e); } else { V fromLoader; try { fromLoader = mappingFunction.apply(key); } catch (CacheLoaderException f) { return resilienceStrategy.getFailure(key, e, f); } return resilienceStrategy.getFailure(key, fromLoader, e); } } finally { getObserver.end(GetOutcome.FAILURE); } } }
Source:
<code>private static UpdaterConfiguration makeAmazonUnboxConfiguration() { ImmutableSet<Publisher> targetSources = ImmutableSet.of(AMAZON_UNBOX, PA); return UpdaterConfiguration.builder() .withSource(AMAZON_UNBOX) .withItemEquivalenceUpdater( VOD_ITEM, targetSources ) .withTopLevelContainerEquivalenceUpdater( VOD_CONTAINER, targetSources ) .withNonTopLevelContainerEquivalenceUpdater( STANDARD_SERIES, <START> targetSources <END> ) .build(); }</code><technical_language>need add RT targetSources well</technical_language>

Target:
private static UpdaterConfiguration makeAmazonUnboxConfiguration() { ImmutableSet<Publisher> targetSources = ImmutableSet.of(AMAZON_UNBOX, PA, RADIO_TIMES_UPCOMING); return UpdaterConfiguration.builder() .withSource(AMAZON_UNBOX) .withItemEquivalenceUpdater( VOD_ITEM, targetSources ) .withTopLevelContainerEquivalenceUpdater( VOD_CONTAINER, targetSources ) .withNonTopLevelContainerEquivalenceUpdater( STANDARD_SERIES, targetSources ) .build(); }
Source:
<code>public boolean equals(Object o) { <START> PageTitle other = (PageTitle)o; <END> return other.getPrefixedText().equals(getPrefixedText()) && other.getSite().equals(getSite()); }</code><technical_language>this throw a runtime exception if other object a PageTitle</technical_language>

Target:
public boolean equals(Object o) { if (!(o instanceof PageTitle)) { return false; } PageTitle other = (PageTitle)o; return other.getPrefixedText().equals(getPrefixedText()) && other.getSite().equals(getSite()); }
Source:
<code>public void testSetWifi() { ImsCall mTestImsCall = new ImsCall(mContext, mTestCallProfile); assertFalse(mTestImsCall.isWifiCall()); <START> assertFalse(mTestImsCall.getRadioTechnology() <END> == ServiceState.RIL_RADIO_TECHNOLOGY_LTE); mBundle.putString(ImsCallProfile.EXTRA_CALL_RAT_TYPE, ServiceState.RIL_RADIO_TECHNOLOGY_IWLAN + ""); assertTrue(mTestImsCall.isWifiCall()); assertFalse(mTestImsCall.getRadioTechnology() == ServiceState.RIL_RADIO_TECHNOLOGY_LTE); }</code><technical_language>assertNotEquals</technical_language>

Target:
public void testSetWifi() { ImsCall mTestImsCall = new ImsCall(mContext, mTestCallProfile); assertFalse(mTestImsCall.isWifiCall()); assertNotEquals(mTestImsCall.getRadioTechnology(), ServiceState.RIL_RADIO_TECHNOLOGY_LTE); mBundle.putString(ImsCallProfile.EXTRA_CALL_RAT_TYPE, ServiceState.RIL_RADIO_TECHNOLOGY_IWLAN + ""); assertTrue(mTestImsCall.isWifiCall()); assertNotEquals(mTestImsCall.getRadioTechnology(), ServiceState.RIL_RADIO_TECHNOLOGY_LTE); }
Source:
<code>private void validateSubscriptionResetCursors(final Subscription subscription, final List<NakadiCursor> cursors) throws ServiceUnavailableException, NoSuchSubscriptionException, UnableProcessException { validateCursorsBelongToSubscription(subscription, cursors); final Map<TopicRepository, List<NakadiCursor>> cursorsByRepo = cursors.stream() .collect(Collectors.groupingBy(c -> timelineService.getTopicRepository(c.getTimeline()))); for (final Map.Entry<TopicRepository, List<NakadiCursor>> repoEntry : cursorsByRepo.entrySet()) { final TopicRepository topicRepository = repoEntry.getKey(); final List<NakadiCursor> cursorsForRepo = repoEntry.getValue(); try { topicRepository.validateReadCursors(cursorsForRepo); } catch (final InvalidCursorException e) { <START> throw new UnableProcessException(e.getMessage(), e); <END> } } }</code><technical_language>want exception extends MyNakadiRuntimeException1</technical_language>

Target:
private void validateSubscriptionResetCursors(final Subscription subscription, final List<NakadiCursor> cursors) throws ServiceUnavailableException, CursorUnavailableException { validateCursorsBelongToSubscription(subscription, cursors); final Map<TopicRepository, List<NakadiCursor>> cursorsByRepo = cursors.stream() .collect(Collectors.groupingBy(c -> timelineService.getTopicRepository(c.getTimeline()))); for (final Map.Entry<TopicRepository, List<NakadiCursor>> repoEntry : cursorsByRepo.entrySet()) { final TopicRepository topicRepository = repoEntry.getKey(); final List<NakadiCursor> cursorsForRepo = repoEntry.getValue(); try { topicRepository.validateReadCursors(cursorsForRepo); } catch (final InvalidCursorException e) { throw new CursorUnavailableException(e.getMessage(), e); } } }
Source:
<code>public void delete(long deletableTxnId) { try { CountDownLatch latch = new CountDownLatch(1); final ProcedureCallback cb = new ProcedureCallback() { @Override public void clientCallback(ClientResponse resp) throws Exception { if (resp.getStatus() != ClientResponse.SUCCESS) { logger.warn(String.format("Fail to execute migrating delete on table: %s,status: %s", m_tableName, resp.getStatusString())); } latch.countDown(); } }; ExportManager.instance().invokeMigrateRowsDelete(m_partitionId, m_tableName, m_batchSize, deletableTxnId, cb); try { <START> latch.await(1, TimeUnit.MINUTES); <END> } catch (InterruptedException e) { logger.warn("Migrating delete was interrupted" + e.getMessage()); } } catch (Exception e) { logger.error("Error deleting migrated rows", e); } catch (Error e) { VoltDB.crashLocalVoltDB("Error deleting migrated rows", true, e); } }</code><technical_language>Another hard coded constant... configurable</technical_language>

Target:
public void delete(long deletableTxnId) { try { CountDownLatch latch = new CountDownLatch(1); final ProcedureCallback cb = new ProcedureCallback() { @Override public void clientCallback(ClientResponse resp) throws Exception { if (resp.getStatus() != ClientResponse.SUCCESS) { logger.warn(String.format("Fail to execute migrating delete on table: %s,status: %s", m_tableName, resp.getStatusString())); } latch.countDown(); } }; ExportManager.instance().invokeMigrateRowsDelete(m_partitionId, m_tableName, m_batchSize, deletableTxnId, cb); try { latch.await(TTLManager.NT_PROC_TIMEOUT, TimeUnit.SECONDS); } catch (InterruptedException e) { logger.warn("Migrating delete was interrupted" + e.getMessage()); } } catch (Exception e) { logger.error("Error deleting migrated rows", e); } catch (Error e) { VoltDB.crashLocalVoltDB("Error deleting migrated rows", true, e); } }
Source:
<code>protected Function<Feature, Optional<Feature>> getTransformingFunction( final SimpleFeatureType featureType) { Function<Feature, Optional<Feature>> function = (feature) -> { SimpleFeatureBuilder builder = new SimpleFeatureBuilder(featureType); for (Property property : feature.getProperties()) { if (property instanceof GeometryAttribute) { builder.set(featureType.getGeometryDescriptor().getName(), property.getValue()); } else { builder.set(property.getName().getLocalPart(), property.getValue()); } } Map<Object, Object> userData = feature.getUserData(); for (Entry<Object, Object> entry : userData.entrySet()) { builder.featureUserData(entry.getKey(), entry.getValue()); <START> } <END> long fidValue = nextId.incrementAndGet(); builder.featureUserData(Hints.PROVIDED_FID, Long.valueOf(fidValue)); fidMappings.put(Long.toString(fidValue), feature.getIdentifier().getID()); Feature modifiedFeature = builder.buildFeature(Long.toString(fidValue)); return Optional.fromNullable(modifiedFeature); }; return function; }</code><technical_language>lines 114 125 replaced builder.init((SimpleFeature)feature)</technical_language>

Target:
protected Function<Feature, Optional<Feature>> getTransformingFunction( final SimpleFeatureType featureType) { Function<Feature, Optional<Feature>> function = (feature) -> { SimpleFeatureBuilder builder = new SimpleFeatureBuilder(featureType); builder.init((SimpleFeature) feature); long fidValue = nextId.incrementAndGet(); builder.featureUserData(Hints.PROVIDED_FID, Long.valueOf(fidValue)); fidMappings.put(Long.toString(fidValue), feature.getIdentifier().getID()); Feature modifiedFeature = builder.buildFeature(Long.toString(fidValue)); return Optional.fromNullable(modifiedFeature); }; return function; }
Source:
<code>public IPaperWallet generateWallet(String cryptoCurrency, String oneTimePassword, String userLanguage) { final KeyPairService keyPairService = new KeyPairServiceFactory().getService(); MnemonicKeyPair master = null; BaseKeyPair credentials = null; try { <START> master = keyPairService.generateMasterMnemonicKeyPair(oneTimePassword); <END> credentials = EncodingUtils.createBaseKeyPair( keyPairService.generateDerivedKey(master, true).toRawKeyPair()); } catch (AException e) { e.printStackTrace(); } String privateKey = credentials.getPrivateKey(); String address = credentials.getPublicKey(); byte[] content = ctx.createPaperWallet7ZIP(privateKey, address, oneTimePassword, cryptoCurrency); String messageText = "New wallet " + address + " use your onetime password to open the attachment."; String messageTextLang = readTemplate("/batm/config/template_wallet_" + userLanguage + ".txt"); if (messageTextLang != null) { messageText = messageTextLang; }else{ String messageTextEN = readTemplate("/batm/config/template_wallet_en.txt"); if (messageTextEN != null) { messageText = messageTextEN; } } return new AeternityPaperWallet(cryptoCurrency, content, address, privateKey, messageText,"application/zip", "zip"); }</code><technical_language>This is weak time password letters. Please key generation stronger. time password a ZIP password. Preferably SecureRandom</technical_language>

Target:
public IPaperWallet generateWallet(String cryptoCurrency, String oneTimePassword, String userLanguage) { final KeyPairService keyPairService = new KeyPairServiceFactory().getService(); String mnemonicPassword = PasswordGenerator.generateRandomPassword(12); BaseKeyPair keyPair = null; MnemonicKeyPair master = null; try { master = keyPairService.generateMasterMnemonicKeyPair(mnemonicPassword); keyPair = EncodingUtils.createBaseKeyPair( keyPairService.generateDerivedKey(master, true).toRawKeyPair()); } catch (AException e) { e.printStackTrace(); } String privateKey = keyPair.getPrivateKey(); String address = keyPair.getPublicKey(); byte[] content = ctx.createPaperWallet7ZIP(privateKey, address, oneTimePassword, cryptoCurrency); String messageText = "New wallet " + address + " use your onetime password to open the attachment."; String messageTextLang = readTemplate("/batm/config/template_wallet_" + userLanguage + ".txt"); if (messageTextLang != null) { messageText = messageTextLang; }else{ String messageTextEN = readTemplate("/batm/config/template_wallet_en.txt"); if (messageTextEN != null) { messageText = messageTextEN; } } return new AeternityPaperWallet(cryptoCurrency, content, address, privateKey, messageText,"application/zip", "zip"); }
Source:
<code><START> protected void connectServiceUp() { <END> addEnricher(SensorTransformingEnricher.newInstanceTransforming(this, MANAGEMENT_URL_UP, Functions.<Boolean>identity(), SERVICE_UP)); }</code><technical_language>I a disconnectServiceUp(), called disconnectSensors(). For impl, a no-op subscriptions automatically closed entity unmanaged. Alternatively, store enricher a field, call removeEnricher if null (i.e. if connectServiceUp overridden)</technical_language>

Target:
protected void connectServiceUp() { serviceUpEnricher = SensorTransformingEnricher.newInstanceTransforming(this, MANAGEMENT_URL_UP, Functions.<Boolean>identity(), SERVICE_UP); addEnricher(serviceUpEnricher); }
Source:
<code>private void handleInstallMessage(@NonNull Object arg) { lock.lock(); try { if (installed.get()) { warn("Received duplicate setup message with arg: " + arg); <START> return; <END> } if (arg instanceof List) { @SuppressWarnings("unchecked") List<Object> values = (List<Object>)arg; if (values.size() > 0 && values.get(0) instanceof Configuration) { Configuration config = (Configuration)values.get(0); ByteBuffer anrBuffer = null; if (values.size() > 1 && values.get(1) instanceof ByteBuffer) { anrBuffer = (ByteBuffer)values.get(1); } String reportPath = reportDirectory + UUID.randomUUID().toString() + ".crash"; install(reportPath, config.getDetectNdkCrashes(), Build.VERSION.SDK_INT, is32bit(), anrBuffer); installed.set(true); } } else { warn("Received install message with incorrect arg: " + arg); } } finally { lock.unlock(); } }</code><technical_language>fix this separately - finally block needs run acquired a lock</technical_language>

Target:
private void handleInstallMessage(@NonNull Object arg) { lock.lock(); try { if (installed.get()) { warn("Received duplicate setup message with arg: " + arg); } else if (arg instanceof List) { @SuppressWarnings("unchecked") List<Object> values = (List<Object>)arg; if (values.size() > 0 && values.get(0) instanceof Configuration) { Configuration config = (Configuration)values.get(0); ByteBuffer anrBuffer = null; if (values.size() > 1 && values.get(1) instanceof ByteBuffer) { anrBuffer = (ByteBuffer)values.get(1); } String reportPath = reportDirectory + UUID.randomUUID().toString() + ".crash"; install(reportPath, config.getDetectNdkCrashes(), Build.VERSION.SDK_INT, is32bit(), anrBuffer); installed.set(true); } } else { warn("Received install message with incorrect arg: " + arg); } } finally { lock.unlock(); } }
Source:
<code>public RepositorySelectionPage(final boolean sourceSelection, final List<RemoteConfig> configuredRemotes, String presetUri) { super(RepositorySelectionPage.class.getName()); this.uri = new URIish(); this.sourceSelection = sourceSelection; String preset = presetUri; if (presetUri == null) { Clipboard clipboard = new Clipboard(Display.getCurrent()); String text = stripGitCloneCommand( <START> (String) clipboard.getContents(TextTransfer.getInstance())); <END> try { if (text != null) { text = text.trim(); int index = text.indexOf(' '); if (index > 0) text = text.substring(0, index); URIish u = new URIish(text); if (canHandleProtocol(u)) if (Protocol.GIT.handles(u) || Protocol.SSH.handles(u) || Protocol.HTTP.handles(u) || Protocol.HTTPS.handles(u) || text.endsWith(Constants.DOT_GIT_EXT)) preset = text; } } catch (URISyntaxException e) { } clipboard.dispose(); } this.presetUri = preset; this.configuredRemotes = getUsableConfigs(configuredRemotes); selection = RepositorySelection.INVALID_SELECTION; if (sourceSelection) { setTitle(UIText.RepositorySelectionPage_sourceSelectionTitle); setDescription(UIText.RepositorySelectionPage_sourceSelectionDescription); } else { setTitle(UIText.RepositorySelectionPage_destinationSelectionTitle); setDescription(UIText.RepositorySelectionPage_destinationSelectionDescription); } storeInSecureStore = getPreferenceStore().getBoolean( UIPreferences.CLONE_WIZARD_STORE_SECURESTORE); }</code><technical_language>early: get null here, stripGitCloneCommand passed null</technical_language>

Target:
public RepositorySelectionPage(final boolean sourceSelection, final List<RemoteConfig> configuredRemotes, String presetUri) { super(RepositorySelectionPage.class.getName()); this.uri = new URIish(); this.sourceSelection = sourceSelection; String preset = presetUri; if (presetUri == null) { Clipboard clipboard = new Clipboard(Display.getCurrent()); String text = (String) clipboard .getContents(TextTransfer.getInstance()); try { if (text != null) { text = stripGitCloneCommand(text); int index = text.indexOf(' '); if (index > 0) text = text.substring(0, index); URIish u = new URIish(text); if (canHandleProtocol(u)) if (Protocol.GIT.handles(u) || Protocol.SSH.handles(u) || Protocol.HTTP.handles(u) || Protocol.HTTPS.handles(u) || text.endsWith(Constants.DOT_GIT_EXT)) preset = text; } } catch (URISyntaxException e) { } clipboard.dispose(); } this.presetUri = preset; this.configuredRemotes = getUsableConfigs(configuredRemotes); selection = RepositorySelection.INVALID_SELECTION; if (sourceSelection) { setTitle(UIText.RepositorySelectionPage_sourceSelectionTitle); setDescription(UIText.RepositorySelectionPage_sourceSelectionDescription); } else { setTitle(UIText.RepositorySelectionPage_destinationSelectionTitle); setDescription(UIText.RepositorySelectionPage_destinationSelectionDescription); } storeInSecureStore = getPreferenceStore().getBoolean( UIPreferences.CLONE_WIZARD_STORE_SECURESTORE); }
Source:
<code>public boolean hasVariable(final String identifier) { <START> if (identifier == null || identifier.isEmpty()) <END> return false; return getVariable(identifier) != null; }</code><technical_language>remove unnecessary checks</technical_language>

Target:
public boolean hasVariable(final String identifier) { return getVariable(identifier) != null; }
Source:
<code>public void insertHeaderWithTimeValue() throws ParseException { final Map<String, Object> props = new HashMap<>(); props.put("header", "AAA"); <START> props.put("literal.value", "14\\:34\\:54.346Z"); <END> xform.configure(props); final SourceRecord record = new SourceRecord(null, null, "test", 0, null, null, null, null, null, null); final SourceRecord transformedRecord = xform.apply(record); SchemaAndValue schemaAndValue = new SchemaAndValue(Time.SCHEMA, new SimpleDateFormat("HH:mm:ss.SSS'Z'").parse("14:34:54.346Z")); Headers expected = new ConnectHeaders().add("AAA", schemaAndValue); assertEquals(1, transformedRecord.headers().size()); assertEquals(expected, transformedRecord.headers()); }</code><technical_language>escaping colon character here? following? suggestion props.put("literal.value", "14:34:54.346Z"); is true Properties.store() escape colons, enter Kafka reads property files. For example, bootstrap.servers property in of Kafka Java client configuration files : escaping</technical_language>

Target:
public void insertHeaderWithTimeValue() throws ParseException { final Map<String, Object> props = new HashMap<>(); props.put("header", "AAA"); props.put("literal.value", "14:34:54.346Z"); xform.configure(props); final SourceRecord record = new SourceRecord(null, null, "test", 0, null, null, null, null, null, null); final SourceRecord transformedRecord = xform.apply(record); SchemaAndValue schemaAndValue = new SchemaAndValue(Time.SCHEMA, new SimpleDateFormat("HH:mm:ss.SSS'Z'").parse("14:34:54.346Z")); Headers expected = new ConnectHeaders().add("AAA", schemaAndValue); assertEquals(1, transformedRecord.headers().size()); assertEquals(expected, transformedRecord.headers()); }
Source:
<code>public List<String> getRecipients() { <START> List<String> recipients = Lists.newArrayList(); <END> Boolean consentNotificationEmailVerified = getStudy().isConsentNotificationEmailVerified(); if (consentNotificationEmailVerified == null || consentNotificationEmailVerified) { Set<String> studyRecipients = BridgeUtils.commaListToOrderedSet(getStudy().getConsentNotificationEmail()); recipients.addAll( studyRecipients ); } if (userEmail != null) { recipients.add(userEmail); } return recipients; }</code><technical_language>Calculating this fly means end executing this twice. calculate this in constructor save a variable</technical_language>

Target:
public List<String> getRecipients() { return recipients; }
Source:
<code>public Set<SessionEntity> getSessions(Collection<String> sessionIds) { List<SessionDataDto> sessionDataDtoList = databaseService.getSessionInfoService().getBySessionIds(0, sessionIds.size(), new HashSet<String>(sessionIds)); if (sessionDataDtoList.isEmpty()) { return Collections.emptySet(); } Set<SessionEntity> entities = new TreeSet<>(new SessionEntity.IdComparator()); for (SessionDataDto sessionDataDto : sessionDataDtoList) { SessionEntity sessionEntity = new SessionEntity(); sessionEntity.setId(sessionDataDto.getSessionId()); sessionEntity.setStartDate(sessionDataDto.getStartDate()); sessionEntity.setEndDate(sessionDataDto.getEndDate()); sessionEntity.setKernels(sessionDataDto.getActiveKernelsCount()); sessionEntity.setComment(sessionDataDto.getComment()); <START> System.out.println(sessionEntity); <END> entities.add(sessionEntity); } return entities; }</code><technical_language>I appeared here)</technical_language>

Target:
public Set<SessionEntity> getSessions(Collection<String> sessionIds) { List<SessionDataDto> sessionDataDtoList = databaseService.getSessionInfoService().getBySessionIds(0, sessionIds.size(), new HashSet<String>(sessionIds)); if (sessionDataDtoList.isEmpty()) { return Collections.emptySet(); } Set<SessionEntity> entities = new TreeSet<>(new SessionEntity.IdComparator()); for (SessionDataDto sessionDataDto : sessionDataDtoList) { SessionEntity sessionEntity = new SessionEntity(); sessionEntity.setId(sessionDataDto.getSessionId()); sessionEntity.setStartDate(sessionDataDto.getStartDate()); sessionEntity.setEndDate(sessionDataDto.getEndDate()); sessionEntity.setKernels(sessionDataDto.getActiveKernelsCount()); sessionEntity.setComment(sessionDataDto.getComment()); entities.add(sessionEntity); } return entities; }
Source:
<code>public void testGetCellWhenEnumPresent() throws Exception { final String factType = "org.kiegroup.Car"; final String factField = "color"; <START> final String dataType = DataType.DataTypes.NUMERIC.name(); <END> doReturn(true).when(oracle).hasEnums(factType, factField); doReturn(factType).when(column).getFactType(); doReturn(factField).when(column).getFactField(); doReturn(dataType).when(column).getDataType(); testedFactory.getCell(column); verify(testedFactory).makeSingleSelectionEnumCell(factType, factField, dataType); }</code><technical_language>Technically color a STRING</technical_language>

Target:
public void testGetCellWhenEnumPresent() throws Exception { final String factType = "org.kiegroup.Car"; final String factField = "color"; final String dataType = DataType.DataTypes.STRING.name(); doReturn(true).when(oracle).hasEnums(factType, factField); doReturn(factType).when(column).getFactType(); doReturn(factField).when(column).getFactField(); doReturn(dataType).when(column).getDataType(); testedFactory.getCell(column); verify(testedFactory).makeSingleSelectionEnumCell(factType, factField, dataType); }
Source:
<code>public PerspectiveDefinition buildPerspective() { PerspectiveDefinition perspective = new PerspectiveDefinitionImpl(StaticWorkbenchPanelPresenter.class.getName()); final PlaceRequest place = new DefaultPlaceRequest(DashboardsListScreen.ID); PartDefinitionImpl dashboardScreen = new PartDefinitionImpl(place); perspective.getRoot().addPart(dashboardScreen); <START> perspective.setName("List Dashboards"); <END> return perspective; }</code><technical_language>Consider i18n for "List Dashboards"</technical_language>

Target:
public PerspectiveDefinition buildPerspective() { PerspectiveDefinition perspective = new PerspectiveDefinitionImpl(StaticWorkbenchPanelPresenter.class.getName()); final PlaceRequest place = new DefaultPlaceRequest(DashboardsListScreen.ID); PartDefinitionImpl dashboardScreen = new PartDefinitionImpl(place); perspective.getRoot().addPart(dashboardScreen); perspective.setName(i18n.listDashboardsScreenTitle()); return perspective; }
Source:
<code>private boolean evaluateVelocityTemplate(DocumentReference userReference, String templateContent) { try { if (StringUtils.isBlank(templateContent)) { return true; } Template customTemplate = new StringTemplate( templateContent, Syntax.XWIKI_2_1, Syntax.PLAIN_1_0, userReference); StringWriter writer = new StringWriter(); templateManager.render(customTemplate, writer); return writer.toString().trim().contains("true"); } catch (Exception e) { return false; <START> } <END> }</code><technical_language>contains equals</technical_language>

Target:
private boolean evaluateVelocityTemplate(DocumentReference userReference, String templateContent) { try { if (StringUtils.isBlank(templateContent)) { return true; } Template customTemplate = new StringTemplate( templateContent, Syntax.XWIKI_2_1, Syntax.PLAIN_1_0, userReference); XDOM templateXDOM = templateManager.execute(customTemplate); WikiPrinter printer = new DefaultWikiPrinter(); BlockRenderer renderer = this.componentManagerProvider.get().getInstance(BlockRenderer.class, "plain"); renderer.render(templateXDOM, printer); return printer.toString().trim().equals("true"); } catch (Exception e) { logger.warn(String.format( "Unable to render a notification validation template. Error : %s\nStack trace : %s", e.getMessage(), e.getStackTrace())); return false; } }
Source:
<code>private static List<Integer> trimTrailing(List<Integer> codePoints, int codePointToTrim) { List<Integer> trimmed = new ArrayList<>(codePoints); <START> while (!trimmed.isEmpty() && trimmed.get(trimmed.size() - 1) == codePointToTrim) { <END> trimmed.remove(trimmed.size() - 1); } return trimmed; }</code><technical_language>construct empty list. Compute length of prefix copied source list. perform copy instead adding elements removing suffix. I fine this approach too</technical_language>

Target:
private static List<Integer> trimTrailing(List<Integer> codePoints, int codePointToTrim) { int endIndex = codePoints.size(); while (endIndex > 0 && codePoints.get(endIndex - 1) == codePointToTrim) { endIndex--; } return ImmutableList.copyOf(codePoints.subList(0, endIndex)); }
Source:
<code><START> private static boolean validParameters(String methodAnnotation,Class[] parameterTypes) { <END> boolean flag = true; methodAnnotation = methodAnnotation.replace("@",""); List<Class> localMapping = mapping.get(methodAnnotation); if (localMapping == null) { return false; } for (Class parameterType : parameterTypes) { if (! localMapping.contains(parameterType)) { flag = false; break; } } return flag; }</code><technical_language>a blank space is missing</technical_language>

Target:
private static boolean validParameters(String methodAnnotation, Class[] parameterTypes) { methodAnnotation = methodAnnotation.replace("@", ""); List<Class<?>> localMapping = mapping.get(methodAnnotation); if (localMapping == null) { return false; } for (Class<?> parameterType : parameterTypes) { if (!localMapping.contains(parameterType)) { return false; } } return true; }
Source:
<code>public void doParse_unhandledFieldTypeRecursion() throws UnableToCompleteException { Set<? extends JClassType> ownerTypeParentFieldTypeSubField1TypeFlattenedSupertypeHierarchy = <START> new HashSet<>(Collections.singletonList(ownerTypeParentFieldTypeSubField1Type)); <END> doReturn(ownerTypeParentFieldTypeSubField1TypeFlattenedSupertypeHierarchy) .when(ownerTypeParentFieldTypeSubField1Type).getFlattenedSupertypeHierarchy(); when(ownerTypeParentFieldTypeSubField1Type.getFields()).thenReturn(new JField[] { ownerTypeParentField }); tested.doParse(ownerType, new ArrayList<JClassType>(), ".", "IdPrefix"); }</code><technical_language>please Collections.singleton(...)</technical_language>

Target:
public void doParse_unhandledFieldTypeRecursion() throws UnableToCompleteException { Set<? extends JClassType> ownerTypeParentFieldTypeSubField1TypeFlattenedSupertypeHierarchy = Collections.singleton(ownerTypeParentFieldTypeSubField1Type); doReturn(ownerTypeParentFieldTypeSubField1TypeFlattenedSupertypeHierarchy) .when(ownerTypeParentFieldTypeSubField1Type).getFlattenedSupertypeHierarchy(); when(ownerTypeParentFieldTypeSubField1Type.getFields()).thenReturn(new JField[] { ownerTypeParentField }); tested.doParse(ownerType, new ArrayList<JClassType>(), ".", "IdPrefix"); }
Source:
<code>public static String createHeader(String username, String password) { StringBuffer buf = new StringBuffer(username); buf.append(':').append(password); <START> return "Basic " + java.util.Base64.getEncoder().encodeToString(buf.toString().getBytes(StandardCharsets.UTF_8)); <END> }</code><technical_language>is need for FQDN Base64 is imported</technical_language>

Target:
public static String createHeader(String username, String password) { StringBuffer buf = new StringBuffer(username); buf.append(':').append(password); return "Basic " + Base64.getEncoder().encodeToString(buf.toString().getBytes(StandardCharsets.UTF_8)); }