auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private boolean hasSuspendedVms() { List<VM> vmList = vmDao.getAllForStoragePool(getOldStoragePool().getId()); String suspendedVms = vmList.stream() .filter(vm -> vm.getStatus().isSuspended() && getStoragePool().getCompatibilityVersion().greater(vm.getCustomCompatibilityVersion())) .map(VM::getName) <START> .collect(Collectors.joining(", <END> ")); if (!suspendedVms.isEmpty()) { addValidationMessage(EngineMessage.ERROR_CANNOT_UPDATE_STORAGE_POOL_SUSPENDED_VM_COMPATIBILITY_VERSION_NOT_SUPPORTED); addValidationMessageVariable("VmsList", suspendedVms); return true; } return false; }</code><technical_language>"\n" (and error message printing "VmsList" variable), receive a more readable error, VM name is printed line</technical_language>

Target:
private boolean hasSuspendedVms() { List<VM> vmList = vmDao.getAllForStoragePool(getOldStoragePool().getId()); String suspendedVms = vmList.stream() .filter(vm -> vm.getStatus().isSuspended() && getStoragePool().getCompatibilityVersion().greater(vm.getCustomCompatibilityVersion())) .map(VM::getName) .collect(Collectors.joining("\n")); if (!suspendedVms.isEmpty()) { addValidationMessage(EngineMessage.ERROR_CANNOT_UPDATE_STORAGE_POOL_SUSPENDED_VM_COMPATIBILITY_VERSION_NOT_SUPPORTED); addValidationMessageVariable("VmsList", suspendedVms); return true; } return false; }
Source:
<code>public static void prepare() throws FileNotFoundException { fileLoggerModule = FileLoggerModule.getSingleton(); consoleLoggerModule = ConsoleLoggerModule.getSingleton(); fileLoggerModule.prepare(); <START> consoleLoggerModule.prepare(); <END> }</code><technical_language>create object prepare line</technical_language>

Target:
public static void prepare() throws FileNotFoundException { fileLoggerModule = FileLoggerModule.getSingleton().prepare(); consoleLoggerModule = ConsoleLoggerModule.getSingleton().prepare(); }
Source:
<code><START> public void testCompactFormatProperty() throws IOException { <END> Configuration conf = new Configuration(false); assertEquals(conf.size(), 0); StringWriter writer = new StringWriter(); BufferedWriter out = new BufferedWriter(writer); out.write("<?xml version=\"1.0\"?>\n"); out.write("<configuration>\n"); out.write("<property name=\"key1\" value=\"val1\"/>"); out.write("</configuration>\n"); out.flush(); out.close(); InputStream is = new ByteArrayInputStream(writer.toString().getBytes()); conf = new Configuration(false); ConfigurationUtils.load(conf, is); assertEquals(conf.size(), 1); assertEquals(conf.get("key1"), "val1"); }</code><technical_language>a file cleaner putting string in code. said, I there</technical_language>

Target:
public void testCompactFormatProperty() throws IOException { final String testfile = "test-compact-format-property.xml"; Configuration conf = new Configuration(false); assertEquals(0, conf.size()); ConfigurationUtils.load(conf, Thread.currentThread() .getContextClassLoader().getResource(testfile).openStream()); assertEquals(2, conf.size()); assertEquals("val1", conf.get("key.1")); assertEquals("val2", conf.get("key.2")); }
Source:
<code>public void updateMapMarkersToController(List<NearbyBaseMarker> nearbyBaseMarkers) { NearbyController.markerExistsMap = new HashMap<>(); NearbyController.markerNeedPicMap = new HashMap<>(); NearbyController.markerLabelList.clear(); for (int i = 0; i < nearbyBaseMarkers.size(); i++) { NearbyBaseMarker nearbyBaseMarker = nearbyBaseMarkers.get(i); NearbyController.markerLabelList.add( new MarkerPlaceGroup(nearbyBaseMarker.getMarker(), bookmarkLocationDao.findBookmarkLocation(nearbyBaseMarker.getPlace()), nearbyBaseMarker.getPlace())); NearbyController.markerExistsMap.put((nearbyBaseMarkers.get(i).getPlace().hasWikidataLink()), nearbyBaseMarkers.get(i).getMarker()); NearbyController.markerNeedPicMap.put(((nearbyBaseMarkers.get(i).getPlace().pic == null) ? true : false), nearbyBaseMarkers.get(i).getMarker()); <START> Log.d("deneme5","pics:"+nearbyBaseMarkers.get(i).getPlace().pic); <END> if (!nearbyBaseMarkers.get(i).getPlace().pic.trim().isEmpty() && bookmarkLocationDao.findBookmarkLocation(nearbyBaseMarker.getPlace())) { Log.d("deneme5","pic not empty and bookmarked:"+nearbyBaseMarkers.get(i).getPlace().name); } } }</code><technical_language>do need logs</technical_language>

Target:
public void updateMapMarkersToController(List<NearbyBaseMarker> nearbyBaseMarkers) { NearbyController.markerExistsMap = new HashMap<>(); NearbyController.markerNeedPicMap = new HashMap<>(); NearbyController.markerLabelList.clear(); for (int i = 0; i < nearbyBaseMarkers.size(); i++) { NearbyBaseMarker nearbyBaseMarker = nearbyBaseMarkers.get(i); NearbyController.markerLabelList.add( new MarkerPlaceGroup(nearbyBaseMarker.getMarker(), bookmarkLocationDao.findBookmarkLocation(nearbyBaseMarker.getPlace()), nearbyBaseMarker.getPlace())); NearbyController.markerExistsMap.put((nearbyBaseMarkers.get(i).getPlace().hasWikidataLink()), nearbyBaseMarkers.get(i).getMarker()); NearbyController.markerNeedPicMap.put(((nearbyBaseMarkers.get(i).getPlace().pic == null) ? true : false), nearbyBaseMarkers.get(i).getMarker()); } }
Source:
<code>private double estimateOutlierProbability(final AlleleFractionData data) { <START> final Function<Double, Double> objective = outlierProbability -> <END> AlleleFractionLikelihoods.logLikelihood(parameters.copyWithNewOutlierProbability(outlierProbability), minorFractions, data); return OptimizationUtils.argmax(objective, 0.0, MAX_REASONABLE_OUTLIER_PROBABILITY, parameters.getOutlierProbability()); }</code><technical_language>advantage of breaking AlleleFractionState is avoid issue of shallow copies referring AlleleFractionState.MinorFractions list making proposal states</technical_language>

Target:
private double estimateOutlierProbability(final AlleleFractionData data) { final Function<Double, Double> objective = outlierProbability -> AlleleFractionLikelihoods.logLikelihood(globalParameters.copyWithNewOutlierProbability(outlierProbability), minorFractions, data); return OptimizationUtils.argmax(objective, 0.0, MAX_REASONABLE_OUTLIER_PROBABILITY, globalParameters.getOutlierProbability()); }
Source:
<code>void completePlayerSetup(boolean asked) { if (asked) { skinLayout = (OoyalaSkinLayout) findViewById(R.id.ooyalaSkin); <START> PlayerDomain domain1 = new PlayerDomain(domain); <END> Options options = new Options.Builder().setShowNativeLearnMoreButton(false).setShowPromoImage(false).setUseExoPlayer(true).build(); player = new OoyalaPlayer(pcode, domain1, options); JSONObject overrides = createSkinOverrides(); SkinOptions skinOptions = new SkinOptions.Builder().setSkinOverrides(overrides).build(); playerLayoutController = new OoyalaSkinLayoutController(getApplication(), skinLayout, player, skinOptions); playerLayoutController.addObserver(this); player.addObserver(this); if (player.setEmbedCode(embedCode)) { } else { Log.e(TAG, "Asset Failure"); } } }</code><technical_language>rename playerDomain</technical_language>

Target:
void completePlayerSetup(boolean asked) { if (asked) { skinLayout = (OoyalaSkinLayout) findViewById(R.id.ooyalaSkin); PlayerDomain playerDomain = new PlayerDomain(domain); Options options = new Options.Builder().setShowNativeLearnMoreButton(false).setShowPromoImage(false).setUseExoPlayer(true).build(); player = new OoyalaPlayer(pcode, playerDomain, options); JSONObject overrides = createSkinOverrides(); SkinOptions skinOptions = new SkinOptions.Builder().setSkinOverrides(overrides).build(); playerLayoutController = new OoyalaSkinLayoutController(getApplication(), skinLayout, player, skinOptions); playerLayoutController.addObserver(this); player.addObserver(this); if (player.setEmbedCode(embedCode)) { } else { Log.e(TAG, "Asset Failure"); } } }
Source:
<code>default void compute(final ImmutableList.Builder<ShardedResultGroup> groups, final AggregationOutput out, final long cadence) { final List<TdigestPoint> metrics = out.getMetrics().getDataAs(TdigestPoint.class); final Map<ComputeDistributionStat.Percentile, List<Point>> resMap = new HashMap<>(); <START> for (TdigestPoint tigestPoint : metrics) { <END> ComputeDistributionStat .Percentile .DEFAULT .forEach(p -> compute(tigestPoint, resMap, p)); } for (Map.Entry<ComputeDistributionStat.Percentile, List<Point>> entry : resMap.entrySet()) { Set<Series> newSet = new HashSet<>(); out.getSeries().forEach(s -> updateMetadata(s, entry.getKey(), newSet)); groups.add(new ShardedResultGroup(ImmutableMap.of(), out.getKey(), newSet, MetricCollection.points(entry.getValue()), cadence)); } }</code><technical_language>too: tdigestPoint</technical_language>

Target:
default void compute(final ImmutableList.Builder<ShardedResultGroup> groups, final AggregationOutput out, final long cadence) { final List<TdigestPoint> metrics = out.getMetrics().getDataAs(TdigestPoint.class); final Map<ComputeDistributionStat.Percentile, List<Point>> resMap = new HashMap<>(); for (TdigestPoint tdigestPoint : metrics) { ComputeDistributionStat .Percentile .DEFAULT .forEach(p -> compute(tdigestPoint, resMap, p)); } for (Map.Entry<ComputeDistributionStat.Percentile, List<Point>> entry : resMap.entrySet()) { Set<Series> newSet = new HashSet<>(); out.getSeries().forEach(s -> updateMetadata(s, entry.getKey(), newSet)); groups.add(new ShardedResultGroup(ImmutableMap.of(), out.getKey(), newSet, MetricCollection.points(entry.getValue()), cadence)); } }
Source:
<code>public JavaSymbol resolveAs(Tree tree, int kind, Resolve.Env resolveEnv, boolean associateReference) { if (tree.is(Tree.Kind.IDENTIFIER, Tree.Kind.MEMBER_SELECT)) { JavaSymbol resolvedSymbol; IdentifierTree identifierTree; if (tree.is(Tree.Kind.MEMBER_SELECT)) { MemberSelectExpressionTree mse = (MemberSelectExpressionTree) tree; if (JavaKeyword.CLASS.getValue().equals(mse.identifier().name())) { return resolveClassType(tree, resolveEnv, mse); } identifierTree = mse.identifier(); Resolve.Resolution res = getSymbolOfMemberSelectExpression(mse, kind, resolveEnv); resolvedSymbol = res.symbol(); <START> JavaType resolvedType = typeSubstitutionSolver.applySiteSubstitution(res.type(), getType(mse.expression())); <END> registerType(identifierTree, resolvedType); registerType(tree, resolvedType); } else { identifierTree = (IdentifierTree) tree; Resolve.Resolution resolution = resolve.findIdent(resolveEnv, identifierTree.name(), kind); resolvedSymbol = resolution.symbol(); registerType(tree, resolution.type()); } if(associateReference) { associateReference(identifierTree, resolvedSymbol); } return resolvedSymbol; } tree.accept(this); JavaType type = getType(tree); if (tree.is(Tree.Kind.INFERED_TYPE)) { type = Symbols.unknownType; registerType(tree, type); } if (type == null) { throw new IllegalStateException("Type not resolved " + tree); } return type.symbol; }</code><technical_language>This is place typeSubstitutionSolver is used. I tend this wrapped in Resolve in order remove dependendency TypeAndRefSolver TypeSubstitutionSolver (they "communicate" Resolve)</technical_language>

Target:
public JavaSymbol resolveAs(Tree tree, int kind, Resolve.Env resolveEnv, boolean associateReference) { if (tree.is(Tree.Kind.IDENTIFIER, Tree.Kind.MEMBER_SELECT)) { JavaSymbol resolvedSymbol; IdentifierTree identifierTree; if (tree.is(Tree.Kind.MEMBER_SELECT)) { MemberSelectExpressionTree mse = (MemberSelectExpressionTree) tree; if (JavaKeyword.CLASS.getValue().equals(mse.identifier().name())) { return resolveClassType(tree, resolveEnv, mse); } identifierTree = mse.identifier(); Resolve.Resolution res = getSymbolOfMemberSelectExpression(mse, kind, resolveEnv); resolvedSymbol = res.symbol(); JavaType resolvedType = resolve.resolveTypeSubstitution(res.type(), getType(mse.expression())); registerType(identifierTree, resolvedType); registerType(tree, resolvedType); } else { identifierTree = (IdentifierTree) tree; Resolve.Resolution resolution = resolve.findIdent(resolveEnv, identifierTree.name(), kind); resolvedSymbol = resolution.symbol(); registerType(tree, resolution.type()); } if(associateReference) { associateReference(identifierTree, resolvedSymbol); } return resolvedSymbol; } tree.accept(this); JavaType type = getType(tree); if (tree.is(Tree.Kind.INFERED_TYPE)) { type = Symbols.unknownType; registerType(tree, type); } if (type == null) { throw new IllegalStateException("Type not resolved " + tree); } return type.symbol; }
Source:
<code>public void setValue(List<T> value, boolean fireEvents) { List<T> selectedItems = getValue(); if (value == selectedItems || (selectedItems != null && <START> selectedItems.equals(value))) <END> { return; } clearAllSelections(); if(value == null){ return; } for (T currentvalue : value) { if (checkBoxes.containsKey(currentvalue)) { checkBoxes.get(currentvalue).setValue(true); } } if (fireEvents) { ValueChangeEvent.fire(this, value); } }</code><technical_language>equals work in this context, need ListUtils.listsEqual()</technical_language>

Target:
public void setValue(List<T> value, boolean fireEvents) { List<T> selectedItems = getValue(); if (value == selectedItems || (selectedItems != null && value != null && ListUtils.listsEqual(selectedItems, value))) { return; } clearAllSelections(); if(value == null){ return; } for (T currentvalue : value) { if (checkBoxes.containsKey(currentvalue)) { checkBoxes.get(currentvalue).setValue(true); } } if (fireEvents) { ValueChangeEvent.fire(this, value); } }
Source:
<code>public void testProjectUnresolvedAliasInFilter() { assertEquals("1:8: Unknown column [tni]", error("SELECT tni AS i FROM test WHERE i > 10 GROUP BY i")); <START> assertEquals("1:31: Unknown column [i]", error("SELECT i AS i FROM test WHERE i > 10 GROUP BY i")); <END> }</code><technical_language>Please extra this check in test method</technical_language>

Target:
public void testProjectUnresolvedAliasInFilter() { assertEquals("1:8: Unknown column [tni]", error("SELECT tni AS i FROM test WHERE i > 10 GROUP BY i")); }
Source:
<code>public <T> Maybe<Class<T>> tryResolveClass(String type, Iterable<String> bundleUrlsOrNameVersionString) { Map<String,Throwable> bundleProblems = MutableMap.of(); for (String bundleUrlOrNameVersionString: bundleUrlsOrNameVersionString) { try { String bundleNameVersion = bundleUrlToNameVersionString.get(bundleUrlOrNameVersionString); if (bundleNameVersion==null) { bundleNameVersion = bundleUrlOrNameVersionString; } Maybe<Bundle> bundle = Osgis.getBundle(framework, bundleNameVersion); if (bundle.isPresent()) { Bundle b = bundle.get(); Class<T> clazz; if (Osgis.isExtensionBundle(b)) { @SuppressWarnings("unchecked") Class<T> c = (Class<T>)Class.forName(type); clazz = c; } else { @SuppressWarnings("unchecked") Class<T> c = (Class<T>)b.loadClass(type); clazz = c; } return Maybe.of(clazz); } else { bundleProblems.put(bundleUrlOrNameVersionString, new IllegalStateException("Unable to find bundle "+bundleUrlOrNameVersionString)); } } catch (Exception e) { Exceptions.propagateIfFatal(e); bundleProblems.put(bundleUrlOrNameVersionString, e); Throwable cause = e.getCause(); if (cause != null && cause.getMessage().contains("Unresolved constraint in bundle")) { <START> log.warn("Unresolved constraint.", e); <END> } } } return Maybe.absent("Unable to resolve class "+type+": "+bundleProblems); }</code><technical_language>stack trace helpful, I log.warn("Unresolved constraint resolving OSGi bundle "+bundleUrlOrNameVersionString+" load "+type+": "+e); if (log.isDebugEnabled()) log.debug("Trace for OSGi resolution failure", e);</technical_language>

Target:
public <T> Maybe<Class<T>> tryResolveClass(String type, Iterable<String> bundleUrlsOrNameVersionString) { Map<String,Throwable> bundleProblems = MutableMap.of(); for (String bundleUrlOrNameVersionString: bundleUrlsOrNameVersionString) { try { String bundleNameVersion = bundleUrlToNameVersionString.get(bundleUrlOrNameVersionString); if (bundleNameVersion==null) { bundleNameVersion = bundleUrlOrNameVersionString; } Maybe<Bundle> bundle = Osgis.getBundle(framework, bundleNameVersion); if (bundle.isPresent()) { Bundle b = bundle.get(); Class<T> clazz; if (Osgis.isExtensionBundle(b)) { @SuppressWarnings("unchecked") Class<T> c = (Class<T>)Class.forName(type); clazz = c; } else { @SuppressWarnings("unchecked") Class<T> c = (Class<T>)b.loadClass(type); clazz = c; } return Maybe.of(clazz); } else { bundleProblems.put(bundleUrlOrNameVersionString, new IllegalStateException("Unable to find bundle "+bundleUrlOrNameVersionString)); } } catch (Exception e) { Exceptions.propagateIfFatal(e); bundleProblems.put(bundleUrlOrNameVersionString, e); Throwable cause = e.getCause(); if (cause != null && cause.getMessage().contains("Unresolved constraint in bundle")) { log.warn("Unresolved constraint resolving OSGi bundle "+bundleUrlOrNameVersionString+" to load "+type+": "+cause.getMessage()); if (log.isDebugEnabled()) log.debug("Trace for OSGi resolution failure", e); } } } return Maybe.absent("Unable to resolve class "+type+": "+bundleProblems); }
Source:
<code>public void transferDirectMessagesToAnonymousDestination(UUID userID) { UserDTO user = userService.getPrivateValidatedUser(userID); try { tryTransferDirectMessagesToAnonymousDestination(user); } catch (DataIntegrityViolationException e) { if (e.getCause() instanceof ConstraintViolationException) { logger.info( <START> "The direct log messages of user with mobile number '" + user.getMobileNumber() + "' and ID '" <END> + user.getID() + "' were apparently concurrently moved to the anonymous messages while handling another request.", e); } else { throw e; } } }</code><technical_language>"log messages" --> "messages"</technical_language>

Target:
public void transferDirectMessagesToAnonymousDestination(UUID userID) { UserDTO user = userService.getPrivateValidatedUser(userID); try { tryTransferDirectMessagesToAnonymousDestination(user); } catch (DataIntegrityViolationException e) { if (e.getCause() instanceof ConstraintViolationException) { logger.info( "The direct messages of user with mobile number '" + user.getMobileNumber() + "' and ID '" + user.getID() + "' were apparently concurrently moved to the anonymous messages while handling another request.", e); } else { throw e; } } }
Source:
<code>public static <T> Value pick(Values values, String qualifiers) { final int count = values.size(); if (count == 0) return null; BigInteger possibles = BigInteger.ZERO; for (int i = 0; i < count; i++) possibles = possibles.setBit(i); StringTokenizer st = new StringTokenizer(qualifiers, "-"); while (st.hasMoreTokens()) { String qualifier = st.nextToken(); String paddedQualifier = "-" + qualifier + "-"; BigInteger matches = BigInteger.ZERO; for (int i = 0; i < count; i++) { if (!possibles.testBit(i)) continue; if (values.get(i).qualifiers.contains(paddedQualifier)) { matches = matches.setBit(i); } } if (!matches.equals(BigInteger.ZERO)) { possibles = possibles.and(matches); } if (matches.bitCount() == 1) break; } int targetApiLevel = getVersionQualifierApiLevel(qualifiers); if (qualifiers.length() > 0 && targetApiLevel != -1) { Value bestMatch = null; int bestMatchDistance = Integer.MAX_VALUE; for (int i = 0; i < count; i++) { if (!possibles.testBit(i)) { continue; } Value value = values.get(i); int distance = getDistance(value, targetApiLevel); <START> if (distance < bestMatchDistance && distance >= 0) { <END> bestMatch = value; bestMatchDistance = distance; } } if (bestMatch != null) { return bestMatch; } } for (int i = 0; i < count; i++) { if (possibles.testBit(i)) return values.get(i); } throw new IllegalStateException("couldn't handle qualifiers \"" + qualifiers + "\""); }</code><technical_language>a bit more semantically clear if condition is reversed. reads: "if distance is positive current match."</technical_language>

Target:
public static <T> Value pick(Values values, String qualifiers) { final int count = values.size(); if (count == 0) return null; BigInteger possibles = BigInteger.ZERO; for (int i = 0; i < count; i++) possibles = possibles.setBit(i); StringTokenizer st = new StringTokenizer(qualifiers, "-"); while (st.hasMoreTokens()) { String qualifier = st.nextToken(); String paddedQualifier = "-" + qualifier + "-"; BigInteger matches = BigInteger.ZERO; for (int i = 0; i < count; i++) { if (!possibles.testBit(i)) continue; if (values.get(i).qualifiers.contains(paddedQualifier)) { matches = matches.setBit(i); } } if (!matches.equals(BigInteger.ZERO)) { possibles = possibles.and(matches); } if (matches.bitCount() == 1) break; } int targetApiLevel = getVersionQualifierApiLevel(qualifiers); if (qualifiers.length() > 0 && targetApiLevel != -1) { Value bestMatch = null; int bestMatchDistance = Integer.MAX_VALUE; for (int i = 0; i < count; i++) { if (!possibles.testBit(i)) { continue; } Value value = values.get(i); int distance = getDistance(value, targetApiLevel); if (distance >= 0 && distance < bestMatchDistance) { bestMatch = value; bestMatchDistance = distance; } } if (bestMatch != null) { return bestMatch; } } for (int i = 0; i < count; i++) { if (possibles.testBit(i)) return values.get(i); } throw new IllegalStateException("couldn't handle qualifiers \"" + qualifiers + "\""); }
Source:
<code>public void setBiome(Vector3i position, BiomeType biome) { <START> net.minecraft.world.chunk.Chunk chunk = this.getChunkFromBlockCoords(VecHelper.toBlockPos(position)); <END> byte[] biomeArray = chunk.getBiomeArray(); int i = position.getX() & 15; int j = position.getZ() & 15; biomeArray[j << 4 | i] = (byte) (((BiomeGenBase) biome).biomeID & 255); chunk.setBiomeArray(biomeArray); }</code><technical_language>This create/load a chunk if exist. more sense check if chunk exists attempting alter biome</technical_language>

Target:
public void setBiome(Vector3i position, BiomeType biome) { int x = position.getX() >> 4; int z = position.getZ() >> 4; IChunkProvider chunkProvider = this.getChunkProvider(); if (!chunkProvider.chunkExists(x, z)) { return; } net.minecraft.world.chunk.Chunk chunk = chunkProvider.provideChunk(x, z); byte[] biomeArray = chunk.getBiomeArray(); int i = position.getX() & 15; int j = position.getZ() & 15; biomeArray[j << 4 | i] = (byte) (((BiomeGenBase) biome).biomeID & 255); chunk.setBiomeArray(biomeArray); }
Source:
<code>public void registerJob(final String cronExpression, final QuartzJobDescription jobDescription) throws SchedulerException { requireNonNull(jobDescription, "jobDescription is null"); if(ifJobExist(jobDescription.getGroupName())) { throw new SchedulerException("can not register existing job " + jobDescription.getGroupName()); } if (!CronExpression.isValidExpression(cronExpression)) { throw new SchedulerException("The cron expression string <" + cronExpression + "> is not valid."); } final JobDetail job = JobBuilder.newJob(jobDescription.getJobClass()) <START> .withIdentity("job1", jobDescription.getGroupName()).build(); <END> job.getJobDataMap().putAll(jobDescription.getContextMap()); final Trigger trigger = TriggerBuilder .newTrigger() .withSchedule( CronScheduleBuilder.cronSchedule(cronExpression) .withMisfireHandlingInstructionFireAndProceed() ) .build(); this.scheduler.scheduleJob(job, trigger); logger.info("Quartz Schedule with jobDetail " + job.getDescription() + " is registered."); }</code><technical_language>job1 a constant? multiple occurrences</technical_language>

Target:
public void registerJob(final String cronExpression, final QuartzJobDescription jobDescription) throws SchedulerException { requireNonNull(jobDescription, "jobDescription is null"); if(ifJobExist(jobDescription.getGroupName())) { throw new SchedulerException("can not register existing job " + jobDescription.getGroupName()); } if (!CronExpression.isValidExpression(cronExpression)) { throw new SchedulerException("The cron expression string <" + cronExpression + "> is not valid."); } final JobDetail job = JobBuilder.newJob(jobDescription.getJobClass()) .withIdentity(DEFAULT_JOB_NAME, jobDescription.getGroupName()).build(); job.getJobDataMap().putAll(jobDescription.getContextMap()); final Trigger trigger = TriggerBuilder .newTrigger() .withSchedule( CronScheduleBuilder.cronSchedule(cronExpression) .withMisfireHandlingInstructionFireAndProceed() ) .build(); this.scheduler.scheduleJob(job, trigger); logger.info("Quartz Schedule with jobDetail " + job.getDescription() + " is registered."); }
Source:
<code>private void updateManagementServerHostUuid(Connection conn) { try (final PreparedStatement updateStatement = conn.prepareStatement("UPDATE cloud.mshost SET uuid=UUID()")) { updateStatement.executeUpdate(); } catch (SQLException e) { <START> LOG.error("Failed to set dynamic.apichecker.enabled to true, please run migrate-dynamicroles.py script to manually migrate to dynamic roles.", e); <END> } }</code><technical_language>This message a bit misleading, I mistaken</technical_language>

Target:
private void updateManagementServerHostUuid(Connection conn) { try (final PreparedStatement updateStatement = conn.prepareStatement("UPDATE cloud.mshost SET uuid=UUID()")) { updateStatement.executeUpdate(); } catch (SQLException e) { LOG.error("Failed to add an UUID to each management server.", e); } }
Source:
<code><START> public boolean matches(String prefix, Object actual, Object expected, <END> JSONCompareResult result) { if (comparator instanceof LocationAwareValueMatcher) { return ((LocationAwareValueMatcher<Object>)comparator).equal(prefix, actual, expected, result); } return comparator.equal(actual, expected); }</code><technical_language>remove a public method. Someone, is this</technical_language>

Target:
public boolean matches(String prefix, Object actual, Object expected, JSONCompareResult result) throws ValueMatcherException { if (comparator instanceof LocationAwareValueMatcher) { return ((LocationAwareValueMatcher<Object>)comparator).equal(prefix, actual, expected, result); } return comparator.equal(actual, expected); }
Source:
<code>public ActiveReviewManager() { <START> PlatformUI.getWorkbench().getActiveWorkbenchWindow().addPageListener(pageListener); <END> IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); if (activePage != null) { IWorkbenchPart activePart = activePage.getActivePart(); if (activePart != null) { editorPartListener.partActivated(activePart); } } }</code><technical_language>adding active window page</technical_language>

Target:
public ActiveReviewManager() { PlatformUI.getWorkbench().getActiveWorkbenchWindow().addPageListener(pageListener); PlatformUI.getWorkbench().addWindowListener(windowListener); windowListener.windowActivated(PlatformUI.getWorkbench().getActiveWorkbenchWindow()); }
Source:
<code>private void notifyUI() { if (!fUIControl.isDisposed()) fUIControl.getDisplay().asyncExec(new Runnable() { @Override public void run() { if (!fUIControl.isDisposed()) <START> fUIListener.update(); <END> } }); }</code><technical_language>Risk of NPE. check fUIListerner is null</technical_language>

Target:
private void notifyUI() { final Control c = fUIControl; if (c != null && !c.isDisposed()) c.getDisplay().asyncExec(new Runnable() { @Override public void run() { if (!c.isDisposed()) fUIListener.update(); } }); }
Source:
<code>private void updateState() { if (world.isSkyVisible(pos.up())) { this.setSunState(NIGHTGEN); if (!world.isRaining() && !world.isThundering() && world.isDay()) { this.setSunState(DAYGEN); } } else { this.setSunState(ZEROGEN); } if (prevState != this.getSunState()) { boolean isGenerating = false; <START> isGenerating = getSunState() == DAYGEN; <END> world.setBlockState(pos, world.getBlockState(pos).with(BlockMachineBase.ACTIVE, isGenerating)); prevState = this.getSunState(); } }</code><technical_language>this line? boolean isGenerating = getSunState() == DAYGEN</technical_language>

Target:
private void updateState() { if (world.isSkyVisible(pos.up())) { this.setSunState(NIGHTGEN); if (!world.isRaining() && !world.isThundering() && world.isDay()) { this.setSunState(DAYGEN); } } else { this.setSunState(ZEROGEN); } if (prevState != this.getSunState()) { boolean isGenerating = getSunState() == DAYGEN; world.setBlockState(pos, world.getBlockState(pos).with(BlockMachineBase.ACTIVE, isGenerating)); prevState = this.getSunState(); } }
Source:
<code>public String toString() { <START> return "CacheRefreshedEvent[]"; <END> }</code><technical_language>timestamp attribute, printed here</technical_language>

Target:
public String toString() { return "CacheRefreshedEvent[timestamp=" + getTimestamp() + "]"; }
Source:
<code>public String getLabel() { <START> return "Drop Association as CreateLinkAction"; <END> }</code><technical_language>Missing NLS</technical_language>

Target:
public String getLabel() { return Messages.AssociationToCreateLinkActionDropStrategy_Label; }
Source:
<code>public void release() { isInUse.set(false); <START> int anyVersion = -1; <END> try { zk.delete(absoluteLockPath, anyVersion); log.log( java.util.logging.Level.INFO, "Released lock " + absoluteLockPath); } catch (InterruptedException e) { log.log( java.util.logging.Level.INFO, "InterruptedException while trying to release lock " + absoluteLockPath, e); } catch (KeeperException e) { log.log( java.util.logging.Level.INFO, "KeeperException while trying to release lock " + absoluteLockPath, e); } }</code><technical_language>block. Declared more important. I need for OCD declaration of params compensate for ugly 3rd party APIs</technical_language>

Target:
public void release() { isInUse.set(false); try { final int anyVersion = -1; zk.delete(absoluteLockPath, anyVersion); log.log( java.util.logging.Level.INFO, "Released lock " + absoluteLockPath); } catch (InterruptedException e) { log.log( java.util.logging.Level.INFO, "InterruptedException while trying to release lock " + absoluteLockPath, e); } catch (KeeperException e) { log.log( java.util.logging.Level.INFO, "KeeperException while trying to release lock " + absoluteLockPath, e); } }
Source:
<code>private void addDefaultConfig(String clientNameParameter, Map<String, String> properties) { if (clientNameParameter.contains("SAML2Client")) { properties.put(PropertiesConfigFactory.SAML_KEYSTORE_PATH, keystoreService.getKeystorePath()); <START> char[] giksp = null; <END> try { giksp = aliasService.getGatewayIdentityKeystorePassword(); } catch (AliasServiceException e) { log.noKeystorePasswordProvisioned(e); } if (giksp == null) { giksp = masterService.getMasterSecret(); } properties.put(PropertiesConfigFactory.SAML_KEYSTORE_PASSWORD, new String(giksp)); char[] gip = null; try { gip = aliasService.getGatewayIdentityPassphrase(); } catch(AliasServiceException ase) { log.noPrivateKeyPasshraseProvisioned(ase); } if (gip == null) { gip = masterService.getMasterSecret(); } properties.put(PropertiesConfigFactory.SAML_PRIVATE_KEY_PASSWORD, new String(gip)); } }</code><technical_language>Is easier understand variable name (i.e gatewayIdentityKeystorePassword)</technical_language>

Target:
private void addDefaultConfig(String clientNameParameter, Map<String, String> properties) { if (clientNameParameter.contains(SAML2Client.class.getSimpleName())) { properties.put(PropertiesConfigFactory.SAML_KEYSTORE_PATH, keystoreService.getKeystorePath()); char[] giksp = null; try { giksp = aliasService.getGatewayIdentityKeystorePassword(); } catch (AliasServiceException e) { log.noKeystorePasswordProvisioned(e); } if (giksp == null) { giksp = masterService.getMasterSecret(); } properties.put(PropertiesConfigFactory.SAML_KEYSTORE_PASSWORD, new String(giksp)); char[] gip = null; try { gip = aliasService.getGatewayIdentityPassphrase(); } catch(AliasServiceException ase) { log.noPrivateKeyPasshraseProvisioned(ase); } if (gip == null) { gip = masterService.getMasterSecret(); } properties.put(PropertiesConfigFactory.SAML_PRIVATE_KEY_PASSWORD, new String(gip)); } }
Source:
<code>public PythonApp createApp(String name) { if (streamApp == null) { streamApp = new PythonApp(name); } return streamApp; <START> <END> }</code><technical_language>extra newline</technical_language>

Target:
public PythonApp createApp(String name) { if (streamApp == null) { streamApp = new PythonApp(name); if (this.mode != null) { streamApp.setMode(this.mode); } } return streamApp; }
Source:
<code>public void testIPV4EncodeProxyV1() { HAProxyMessageEncoder encoder = new HAProxyMessageEncoder(); EmbeddedChannel ch = new EmbeddedChannel(encoder); HAProxyMessage message = new HAProxyMessage( HAProxyProtocolVersion.V1, HAProxyCommand.PROXY, HAProxyProxiedProtocol.TCP4, "192.168.0.1", "192.168.0.11", 56324, 443); assertTrue(ch.writeOutbound(message)); ByteBuf byteBuf = ch.readOutbound(); assertEquals("PROXY TCP4 192.168.0.1 192.168.0.11 56324 443\r\n", <START> byteBuf.toString(CharsetUtil.US_ASCII)); <END> }</code><technical_language>call byteBuf.release(); add assertFalse(ch.finish());</technical_language>

Target:
public void testIPV4EncodeProxyV1() { EmbeddedChannel ch = new EmbeddedChannel(INSTANCE); HAProxyMessage message = new HAProxyMessage( HAProxyProtocolVersion.V1, HAProxyCommand.PROXY, HAProxyProxiedProtocol.TCP4, "192.168.0.1", "192.168.0.11", 56324, 443); assertTrue(ch.writeOutbound(message)); ByteBuf byteBuf = ch.readOutbound(); assertEquals("PROXY TCP4 192.168.0.1 192.168.0.11 56324 443\r\n", byteBuf.toString(CharsetUtil.US_ASCII)); byteBuf.release(); assertFalse(ch.finish()); }
Source:
<code>public Configuration(SQLTemplates templates) { this.templates = templates; for (Type<?> customType : templates.getCustomTypes()) { javaTypeMapping.register(customType); } for (Map.Entry<SchemaAndTable, SchemaAndTable> entry : templates.getTableOverrides().entrySet()) { <START> nameMapping.registerTableOverride(entry.getKey(), entry.getValue()); <END> } if (templates.isArraysSupported()) { List<Class<?>> classes = ImmutableList.<Class<?>>of(String.class, Long.class, Integer.class, Short.class, Byte.class, Boolean.class, java.sql.Date.class, java.sql.Timestamp.class, java.sql.Time.class, Double.class, Float.class); for (Class<?> cl : classes) { int code = jdbcTypeMapping.get(cl); String name = templates.getTypeNameForCode(code); Class<?> arrType = Array.newInstance(cl, 0).getClass(); javaTypeMapping.register(new ArrayType(arrType, name)); if (Primitives.isWrapperType(cl) && !cl.equals(Byte.class)) { cl = Primitives.unwrap(cl); arrType = Array.newInstance(cl, 0).getClass(); javaTypeMapping.register(new ArrayType(arrType, name)); } } } }</code><technical_language>I is delegate methods NameMapping, this registerTableOverride() method for consistency</technical_language>

Target:
public Configuration(SQLTemplates templates) { this.templates = templates; for (Type<?> customType : templates.getCustomTypes()) { javaTypeMapping.register(customType); } for (Map.Entry<SchemaAndTable, SchemaAndTable> entry : templates.getTableOverrides().entrySet()) { registerTableOverride(entry.getKey(), entry.getValue()); } if (templates.isArraysSupported()) { List<Class<?>> classes = ImmutableList.<Class<?>>of(String.class, Long.class, Integer.class, Short.class, Byte.class, Boolean.class, java.sql.Date.class, java.sql.Timestamp.class, java.sql.Time.class, Double.class, Float.class); for (Class<?> cl : classes) { int code = jdbcTypeMapping.get(cl); String name = templates.getTypeNameForCode(code); Class<?> arrType = Array.newInstance(cl, 0).getClass(); javaTypeMapping.register(new ArrayType(arrType, name)); if (Primitives.isWrapperType(cl) && !cl.equals(Byte.class)) { cl = Primitives.unwrap(cl); arrType = Array.newInstance(cl, 0).getClass(); javaTypeMapping.register(new ArrayType(arrType, name)); } } } }
Source:
<code>public static MultipartAttachmentWriter createMultipartWriter(BasicDocumentRevision revision, List<? extends Attachment> attachments, PushAttachmentsInline inlinePreference, int minRevPos) { MultipartAttachmentWriter mpw = null; for (Attachment att : attachments) { SavedAttachment savedAtt = (SavedAttachment) att; try { if (savedAtt.revpos > minRevPos && !savedAtt.shouldInline(inlinePreference)) { if (mpw == null) { mpw = new MultipartAttachmentWriter(); mpw.setBody(revision); } mpw.addAttachment(savedAtt, <START> savedAtt.encoding == Attachment.Encoding.Plain ? savedAtt.length : savedAtt.encodedLength); <END> } } catch (IOException ioe) { logger.log(Level.WARNING,"IOException caught when adding multiparts",ioe); } } if (mpw != null) { mpw.close(); } return mpw; }</code><technical_language>similar logic this in places. localise methods "dataLength" "onDiskLength" somewhere</technical_language>

Target:
public static MultipartAttachmentWriter createMultipartWriter(BasicDocumentRevision revision, List<? extends Attachment> attachments, PushAttachmentsInline inlinePreference, int minRevPos) { MultipartAttachmentWriter mpw = null; for (Attachment att : attachments) { SavedAttachment savedAtt = (SavedAttachment) att; try { if (savedAtt.revpos > minRevPos && !savedAtt.shouldInline(inlinePreference)) { if (mpw == null) { mpw = new MultipartAttachmentWriter(); mpw.setBody(revision); } mpw.addAttachment(savedAtt, savedAtt.onDiskLength()); } } catch (IOException ioe) { logger.log(Level.WARNING,"IOException caught when adding multiparts",ioe); } } if (mpw != null) { mpw.close(); } return mpw; }
Source:
<code>public static Checksum newCrc32C() { try { return Shell.isJava9OrAbove() ? (Checksum) NEW_CRC32C_MH.invoke() : new PureJavaCrc32C(); } catch (Throwable e) { <START> throw new RuntimeException(e); <END> } }</code><technical_language>RuntimeException wrapped; leave other Throwables alone. So: catch(RuntimeException e) { throw e;}, catch wrap Exception only,</technical_language>

Target:
static Checksum newCrc32C() { try { return useJava9Crc32C ? Java9Crc32CFactory.createChecksum() : new PureJavaCrc32C(); } catch (ExceptionInInitializerError | RuntimeException e) { LOG.error("CRC32C creation failed, switching to PureJavaCrc32C", e); useJava9Crc32C = false; return new PureJavaCrc32C(); } }
Source:
<code>static PipelineObject getEMRCluster(Region region) { String name = "EmrClusterForBackup"; String id = "EmrClusterForBackup"; return new PipelineObject().withName(name).withId(id).withFields( new Field().withKey("type").withStringValue("EmrCluster"), new Field().withKey("amiVersion").withStringValue("3.8.0"), new Field().withKey("masterInstanceType").withStringValue("m3.xlarge"), <START> new Field().withKey("coreInstanceType").withStringValue("m3.xlarge"), <END> new Field().withKey("coreInstanceCount").withStringValue("1"), new Field().withKey("region").withStringValue(region.getName()), new Field().withKey("terminateAfter").withStringValue("12 hours"), new Field().withKey("role").withStringValue("DataPipelineDefaultRole"), new Field().withKey("bootstrapAction").withStringValue("s3://elasticmapreduce" + "/bootstrap-actions/configure-hadoop, --yarn-key-value,yarn.nodemanager.resource" + ".memory-mb=11520," + "--yarn-key-value,yarn.scheduler.maximum-allocation-mb=11520," + "--yarn-key-value,yarn.scheduler.minimum-allocation-mb=1440," + "--yarn-key-value,yarn.app.mapreduce.am.resource.mb=2880," + "--mapred-key-value,mapreduce.map.memory.mb=5760," + "--mapred-key-value,mapreduce.map.java.opts=-Xmx4608M," + "--mapred-key-value,mapreduce.reduce.memory.mb=2880," + "--mapred-key-value,mapreduce.reduce.java.opts=-Xmx2304m," + "--mapred-key-value,mapreduce.map.speculative=false") ); }</code><technical_language>m3.xlarges incredibly expensive. CPU power bottleneck, DDB throughput. currently m1.mediums. If smaller that, better</technical_language>

Target:
static PipelineObject getEMRCluster(Region region) { String name = "EmrClusterForBackup"; String id = "EmrClusterForBackup"; return new PipelineObject().withName(name).withId(id).withFields( new Field().withKey("type").withStringValue("EmrCluster"), new Field().withKey("amiVersion").withStringValue("3.8.0"), new Field().withKey("masterInstanceType").withStringValue("m1.medium"), new Field().withKey("coreInstanceType").withStringValue("m1.medium"), new Field().withKey("coreInstanceCount").withStringValue("1"), new Field().withKey("region").withStringValue(region.getName()), new Field().withKey("terminateAfter").withStringValue("12 hours"), new Field().withKey("role").withStringValue("DataPipelineDefaultRole"), new Field().withKey("bootstrapAction").withStringValue("s3://elasticmapreduce" + "/bootstrap-actions/configure-hadoop, --yarn-key-value,yarn.nodemanager.resource" + ".memory-mb=11520," + "--yarn-key-value,yarn.scheduler.maximum-allocation-mb=11520," + "--yarn-key-value,yarn.scheduler.minimum-allocation-mb=1440," + "--yarn-key-value,yarn.app.mapreduce.am.resource.mb=2880," + "--mapred-key-value,mapreduce.map.memory.mb=5760," + "--mapred-key-value,mapreduce.map.java.opts=-Xmx4608M," + "--mapred-key-value,mapreduce.reduce.memory.mb=2880," + "--mapred-key-value,mapreduce.reduce.java.opts=-Xmx2304m," + "--mapred-key-value,mapreduce.map.speculative=false") ); }
Source:
<code>private AsyncTaskType internalGetTaskType() { if (hasTaskHandlers()) { System.out.println("has task handlers"); <START> System.out.println("getParameters().getExecutionReason() "+getParameters().getExecutionReason()); <END> if (getParameters().getExecutionReason() == CommandExecutionReason.REGULAR_FLOW) { return getCurrentTaskHandler().getTaskType(); } return getCurrentTaskHandler().getRevertTaskType(); } System.out.println("NO task handlers"); return getTaskType(); }</code><technical_language>log</technical_language>

Target:
private AsyncTaskType internalGetTaskType() { if (hasTaskHandlers()) { if (getParameters().<VdcActionParametersBase.CommandExecutionReason>get(CoreVdcParameters.COMMAND_EXECUTION_REASON) == CommandExecutionReason.REGULAR_FLOW) { return getCurrentTaskHandler().getTaskType(); } return getCurrentTaskHandler().getRevertTaskType(); } return getTaskType(); }
Source:
<code>Set<Integer> getInFlightCorrelationIds() { <START> return correlationIdToPutChunk.keySet(); <END> }</code><technical_language>reads/writes correlationIdToPutChunk done main loop? other threads touch PutOperation</technical_language>

Target:
Set<Integer> getInFlightCorrelationIds() { return Collections.unmodifiableSet(correlationIdToPutChunk.keySet()); }
Source:
<code>public int hashCode() { int result = connectorConfig.hashCode(); <START> result = 31 * result + table.hashCode(); <END> result = 31 * result + keyColumn.hashCode(); result = 31 * result + valueColumn.hashCode(); result = 31 * result + (filter != null ? filter.hashCode() : 0); result = 31 * result + (tsColumn != null ? tsColumn.hashCode() : 0); result = 31 * result + pollPeriod.hashCode(); return result; }</code><technical_language>Please migrate this hashCode() Objects.hash()</technical_language>

Target:
public int hashCode() { return Objects.hash( connectorConfig, table, filter, keyColumn, valueColumn, tsColumn, pollPeriod ); }
Source:
<code>private boolean switchToNewBuffer(final byte[] array, final int offset, final int size) { <START> if (datalist.isMemoryBlockAvailable() || datalist.canAllocateMemoryBlock()) { <END> final byte[] newBuffer = datalist.newBuffer(size); byteBuffer = ByteBuffer.wrap(newBuffer); if (array == null || array.length - offset == 0) { writeOffset = 0; } else { writeOffset = array.length - offset; System.arraycopy(buffer, offset, newBuffer, 0, writeOffset); byteBuffer.position(writeOffset); } buffer = newBuffer; readOffset = 0; datalist.addBuffer(buffer); return true; } return false; }</code><technical_language>consider if (storage != null && datalist.isMemoryBlockAvailable() || storage == null && !datalist.areSubscribersBehindByMax())</technical_language>

Target:
private boolean switchToNewBuffer(final byte[] array, final int offset, final int size) { if ((datalist.isMemoryBlockAvailable() || ((storage == null)) && !datalist.areSubscribersBehindByMax())) { final byte[] newBuffer = datalist.newBuffer(size); byteBuffer = ByteBuffer.wrap(newBuffer); if (array == null || array.length - offset == 0) { writeOffset = 0; } else { writeOffset = array.length - offset; System.arraycopy(buffer, offset, newBuffer, 0, writeOffset); byteBuffer.position(writeOffset); } buffer = newBuffer; readOffset = 0; datalist.addBuffer(buffer); return true; } return false; }
Source:
<code>public int hashCode() { <START> return Objects.hash(entity, type); <END> }</code><technical_language>IMPORTANT This is a pure refactor: entity's hashcode is instead of entity's identityHashCode. *Breaks equals contract* (and this this trouble): equals method entity semantics, hashcode entity equals semantics. For record, needs remain entity semantics (the more force users implement equals/hashcode want it, compatible other Java frameworks) PS: want a unit test proving this breaks equals contract fix - original code is missing test coverage :)</technical_language>

Target:
public int hashCode() { return Objects.hash(System.identityHashCode(entity), type); }
Source:
<code>protected List<AbstractPreferenceController> createPreferenceControllers(Context context) { final List<AbstractPreferenceController> controllers = new ArrayList<>(); mAdbDeviceDetailsController = <START> AdbDeviceDetailsController.newInstance( <END> mPairedDevice, context, this, getSettingsLifecycle()); controllers.add(mAdbDeviceDetailsController); return controllers; }</code><technical_language>fine creating newInstance() method. However, *new controller* in Settings code base. I hope consistent style here. :)</technical_language>

Target:
protected List<AbstractPreferenceController> createPreferenceControllers(Context context) { final List<AbstractPreferenceController> controllers = new ArrayList<>(); controllers.add(new AdbDeviceDetailsHeaderController(mPairedDevice, context, this)); controllers.add(new AdbDeviceDetailsActionController(mPairedDevice, context, this)); controllers.add(new AdbDeviceDetailsFingerprintController(mPairedDevice, context, this)); return controllers; }
Source:
<code><START> private UnwrapMode unwrapMode(Field field, boolean typeArgumentAnnotated) { <END> boolean notIterable = !ReflectionHelper.isIterable( ReflectionHelper.typeOf( field ) ); UnwrapValidatedValue unwrapValidatedValue = field.getAnnotation( UnwrapValidatedValue.class ); if ( unwrapValidatedValue == null && typeArgumentAnnotated && notIterable ) { return UnwrapMode.UNWRAP; } else if ( unwrapValidatedValue != null ) { return unwrapValidatedValue.value() ? UnwrapMode.UNWRAP : UnwrapMode.SKIP_UNWRAP; } return UnwrapMode.AUTOMATIC; }</code><technical_language>similar done for (getter-defined) properties method-level constraints</technical_language>

Target:
private UnwrapMode unwrapMode(Field field, boolean typeArgumentAnnotated) { boolean notIterable = !ReflectionHelper.isIterable( ReflectionHelper.typeOf( field ) ); UnwrapValidatedValue unwrapValidatedValue = field.getAnnotation( UnwrapValidatedValue.class ); return unwrapMode( typeArgumentAnnotated, notIterable, unwrapValidatedValue ); }
Source:
<code>public final <T> T build(Class<T> serviceClass, UserAgent userAgent) { ObjectMapper objectMapper = getObjectMapper(); ObjectMapper cborObjectMapper = getCborObjectMapper(); okhttp3.OkHttpClient okHttpClient = Optional.ofNullable(hostMetricsRegistry) .map(hostMetrics -> OkHttpClients.create(config, userAgent, hostMetrics, serviceClass)) <START> .orElse(OkHttpClients.create(config, userAgent, serviceClass)); <END> return Feign.builder() .contract(createContract()) .encoder( new InputStreamDelegateEncoder( new TextDelegateEncoder( new CborDelegateEncoder( cborObjectMapper, new JacksonEncoder(objectMapper))))) .decoder(createDecoder(objectMapper, cborObjectMapper)) .requestInterceptor(PathTemplateHeaderRewriter.INSTANCE) .client(new OkHttpClient(okHttpClient)) .options(createRequestOptions()) .logLevel(Logger.Level.NONE) .retryer(new Retryer.Default(0, 0, 1)) .target(serviceClass, primaryUri); }</code><technical_language>do orElseGet avoid unintended side-effects</technical_language>

Target:
public final <T> T build(Class<T> serviceClass, UserAgent userAgent) { ObjectMapper objectMapper = getObjectMapper(); ObjectMapper cborObjectMapper = getCborObjectMapper(); okhttp3.OkHttpClient okHttpClient = Optional.ofNullable(hostMetricsRegistry) .map(hostMetrics -> OkHttpClients.create(config, userAgent, hostMetrics, serviceClass)) .orElseGet(() -> OkHttpClients.create(config, userAgent, serviceClass)); return Feign.builder() .contract(createContract()) .encoder( new InputStreamDelegateEncoder( new TextDelegateEncoder( new CborDelegateEncoder( cborObjectMapper, new JacksonEncoder(objectMapper))))) .decoder(createDecoder(objectMapper, cborObjectMapper)) .requestInterceptor(PathTemplateHeaderRewriter.INSTANCE) .client(new OkHttpClient(okHttpClient)) .options(createRequestOptions()) .logLevel(Logger.Level.NONE) .retryer(new Retryer.Default(0, 0, 1)) .target(serviceClass, primaryUri); }