auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public CompletableFuture<Void> joinGame(Game game, String password) { if (isRunning()) { log.debug("Game is running, ignoring join request"); return completedFuture(null); } <START> if (!preferencesService.isGamePathValid()) { CompletableFuture<Path> gameDirectoryFuture = new CompletableFuture<>(); eventBus.post(new GameDirectoryChooseEvent(gameDirectoryFuture)); return gameDirectoryFuture.thenCompose(path -> joinGame(game, password)); <END> } log.info("Joining game: '{}' ({})", game.getTitle(), game.getId()); stopSearchLadder1v1(); Map<String, Integer> featuredModVersions = game.getFeaturedModVersions(); Set<String> simModUIds = game.getSimMods().keySet(); return modService.getFeaturedMod(game.getFeaturedMod()) .thenCompose(featuredModBean -> updateGameIfNecessary(featuredModBean, null, featuredModVersions, simModUIds)) .thenAccept(aVoid -> { try { modService.enableSimMods(simModUIds); } catch (IOException e) { log.warn("SimMods could not be enabled", e); } }) .thenCompose(aVoid -> downloadMapIfNecessary(game.getMapFolderName())) .thenCompose(aVoid -> fafService.requestJoinGame(game.getId(), password)) .thenAccept(gameLaunchMessage -> { synchronized (currentGame) { game.setPassword(password); currentGame.set(game); } startGame(gameLaunchMessage, null, RatingMode.GLOBAL); }) .exceptionally(throwable -> { log.warn("Game could not be joined", throwable); notificationService.addImmediateErrorNotification(throwable, "games.couldNotJoin"); return null; }); }</code><technical_language>This code is duplicated 6 times, extract 2 lines a method returning gameDirectoryFuture. if (!preferencesService.isGamePathValid()) { return ensureGameDirectorySet().thenAccept(p -> joinGame()/hostGame/whatever); }</technical_language>

Target:
public CompletableFuture<Void> joinGame(Game game, String password) { if (isRunning()) { log.debug("Game is running, ignoring join request"); return completedFuture(null); } if (!preferencesService.isGamePathValid()) { CompletableFuture<Path> gameDirectoryFuture = postGameDirectoryChooseEvent(); return gameDirectoryFuture.thenCompose(path -> joinGame(game, password)); } log.info("Joining game: '{}' ({})", game.getTitle(), game.getId()); stopSearchLadder1v1(); Map<String, Integer> featuredModVersions = game.getFeaturedModVersions(); Set<String> simModUIds = game.getSimMods().keySet(); return modService.getFeaturedMod(game.getFeaturedMod()) .thenCompose(featuredModBean -> updateGameIfNecessary(featuredModBean, null, featuredModVersions, simModUIds)) .thenAccept(aVoid -> { try { modService.enableSimMods(simModUIds); } catch (IOException e) { log.warn("SimMods could not be enabled", e); } }) .thenCompose(aVoid -> downloadMapIfNecessary(game.getMapFolderName())) .thenCompose(aVoid -> fafService.requestJoinGame(game.getId(), password)) .thenAccept(gameLaunchMessage -> { synchronized (currentGame) { game.setPassword(password); currentGame.set(game); } startGame(gameLaunchMessage, null, RatingMode.GLOBAL); }) .exceptionally(throwable -> { log.warn("Game could not be joined", throwable); notificationService.addImmediateErrorNotification(throwable, "games.couldNotJoin"); return null; }); }
Source:
<code>public static List<VmDeviceUpdate> getVmDevicesFieldsToUpdateOnNextRun( Guid vmId, VMStatus vmStatus, Object objectWithEditableDeviceFields) { List<VmDeviceUpdate> fieldList = new ArrayList<>(); if (objectWithEditableDeviceFields == null) { return fieldList; } List<Pair<EditableDeviceOnVmStatusField , Field>> pairList = BaseHandler.extractAnnotatedFields( EditableDeviceOnVmStatusField.class, objectWithEditableDeviceFields.getClass()); for (Pair<EditableDeviceOnVmStatusField, Field> pair : pairList) { EditableDeviceOnVmStatusField annotation = pair.getFirst(); Field field = pair.getSecond(); field.setAccessible(true); if (VmHandler.isUpdateValidForVmDevice(field.getName(), vmStatus)) { continue; } try { Object value = field.get(objectWithEditableDeviceFields); if (value instanceof Boolean) { addDeviceUpdateOnNextRun(vmId, annotation, null, value, fieldList); } else if (value instanceof Map) { Map<?, ?> map = (Map<?, ?>) value; for (Map.Entry<?, ?> entry : map.entrySet()) { boolean success = addDeviceUpdateOnNextRun(vmId, annotation, entry.getKey(), entry.getValue(), fieldList); if (!success) break; } } else { <START> log.warn("VmHandler::getVmDevicesFieldsToUpdateOnNextRun: Unsupported field type: " + <END> value.getClass().getName()); } } catch (IllegalAccessException | ClassCastException e) { log.warn("VmHandler::getVmDevicesFieldsToUpdateOnNextRun: Reflection error"); log.debug("Original exception was:", e); } } return fieldList; }</code><technical_language>need write "VmHandler::" in log, logger write class name (also for other logging below)</technical_language>

Target:
public static List<VmDeviceUpdate> getVmDevicesFieldsToUpdateOnNextRun( Guid vmId, VMStatus vmStatus, Object objectWithEditableDeviceFields) { List<VmDeviceUpdate> fieldList = new ArrayList<>(); if (objectWithEditableDeviceFields == null) { return fieldList; } List<Pair<EditableDeviceOnVmStatusField , Field>> pairList = BaseHandler.extractAnnotatedFields( EditableDeviceOnVmStatusField.class, objectWithEditableDeviceFields.getClass()); for (Pair<EditableDeviceOnVmStatusField, Field> pair : pairList) { EditableDeviceOnVmStatusField annotation = pair.getFirst(); Field field = pair.getSecond(); field.setAccessible(true); if (VmHandler.isUpdateValidForVmDevice(field.getName(), vmStatus)) { continue; } try { Object value = field.get(objectWithEditableDeviceFields); if (value instanceof Boolean) { addDeviceUpdateOnNextRun(vmId, annotation, null, value, fieldList); } else if (value instanceof Map) { Map<?, ?> map = (Map<?, ?>) value; for (Map.Entry<?, ?> entry : map.entrySet()) { boolean success = addDeviceUpdateOnNextRun(vmId, annotation, entry.getKey(), entry.getValue(), fieldList); if (!success) break; } } else { log.warn("getVmDevicesFieldsToUpdateOnNextRun: Unsupported field type: " + value.getClass().getName()); } } catch (IllegalAccessException | ClassCastException e) { log.warn("getVmDevicesFieldsToUpdateOnNextRun: Reflection error"); log.debug("Original exception was:", e); } } return fieldList; }
Source:
<code>public void onResult(Bundle result) { Bundle.setDefusable(result, true); if (result != null && result.containsKey(AccountManager.KEY_BOOLEAN_RESULT) && !result.containsKey(AccountManager.KEY_INTENT)) { final boolean removalAllowed = result.getBoolean(AccountManager.KEY_BOOLEAN_RESULT); if (removalAllowed) { removeAccountInternal(mAccounts, mAccount, getCallingUid()); } IAccountManagerResponse response = getResponseAndClose(); if (response != null) { if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, getClass().getSimpleName() + " calling onResult() on response " + response); } try { response.onResult(result); } catch (RemoteException e) { <START> Log.w(TAG, <END> e.getMessage()); } } } super.onResult(result); }</code><technical_language>Slog.e(TAG, "Error calling onResult()", e ); AMS right inconsistently Log Slog, system log</technical_language>

Target:
public void onResult(Bundle result) { Bundle.setDefusable(result, true); if (result != null && result.containsKey(AccountManager.KEY_BOOLEAN_RESULT) && !result.containsKey(AccountManager.KEY_INTENT)) { final boolean removalAllowed = result.getBoolean(AccountManager.KEY_BOOLEAN_RESULT); if (removalAllowed) { removeAccountInternal(mAccounts, mAccount, getCallingUid()); } IAccountManagerResponse response = getResponseAndClose(); if (response != null) { if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, getClass().getSimpleName() + " calling onResult() on response " + response); } try { response.onResult(result); } catch (RemoteException e) { Slog.e(TAG, "Error calling onResult()", e); } } } super.onResult(result); }
Source:
<code>public void createContainer(String id, KieContainerInstance kieContainerInstance, Map<String, Object> parameters) { List<ContinuousPlanning> containerPlannings = loadPlannings(kieContainerInstance.getKieContainer().getClassLoader()); containerContinuousPlannings.put(id, containerPlannings); boolean found = solverServiceBase.boostrapContinuousPlanning(id, containerPlannings); if (!found) { <START> solverServiceBase.boostrapContinuousPlanning(id, globalContinuousPlannings); <END> } }</code><technical_language>global return true for accept method, right</technical_language>

Target:
public void createContainer(String id, KieContainerInstance kieContainerInstance, Map<String, Object> parameters) { List<RealtimePlanning> containerPlannings = loadPlannings(kieContainerInstance.getKieContainer().getClassLoader()); containerContinuousPlannings.put(id, containerPlannings); solverServiceBase.boostrapContinuousPlanning(id, containerPlannings); }
Source:
<code>public void testPostWithLessThanOnBoundedBy() throws Exception { GeoServer gs = getGeoServer(); WFSInfo wfs = gs.getService(WFSInfo.class); wfs.setCiteCompliant(true); gs.save(wfs); try { String xml = "<wfs:GetFeature service='WFS' version='2.0.0' " + "outputFormat='text/xml; subtype=gml/3.2' " + "xmlns:sf=\"<LINK_1>\" " + "xmlns:gml='" + GML.NAMESPACE + "' " + "xmlns:wfs='" + WFS.NAMESPACE + "' " + "xmlns:fes='" + FES.NAMESPACE + "'>" + "<wfs:Query typeNames='sf:PrimitiveGeoFeature'>" + "<fes:Filter>" + "<fes:PropertyIsLessThanOrEqualTo matchAction=\"Any\" matchCase=\"true\">\n" + " <fes:Literal>\n" + " <gml:Envelope xmlns:gml=\"<LINK_0>\"\n" + " srsName=\"urn:ogc:def:crs:EPSG::4326\">\n" + " <gml:lowerCorner>-90 -180</gml:lowerCorner>\n" + " <gml:upperCorner>90 180</gml:upperCorner>\n" + " </gml:Envelope>\n" + " </fes:Literal>\n" + " <fes:ValueReference>gml:boundedBy</fes:ValueReference>\n" + " </fes:PropertyIsLessThanOrEqualTo>" + "</fes:Filter>" + "</wfs:Query>" + "</wfs:GetFeature>"; MockHttpServletResponse response = postAsServletResponse("wfs", xml); <START> System.out.println(response.getContentAsString()); <END> assertEquals(500, response.getStatus()); Document doc = dom(new ByteArrayInputStream(response.getContentAsByteArray())); checkOws11Exception(doc, "2.0.0", WFSException.OPERATION_PROCESSING_FAILED, "GetFeature"); } finally { wfs.setCiteCompliant(false); gs.save(wfs); } }</code><technical_language>Left over</technical_language>

Target:
public void testPostWithLessThanOnBoundedBy() throws Exception { GeoServer gs = getGeoServer(); WFSInfo wfs = gs.getService(WFSInfo.class); wfs.setCiteCompliant(true); gs.save(wfs); try { String xml = "<wfs:GetFeature service='WFS' version='2.0.0' " + "outputFormat='text/xml; subtype=gml/3.2' " + "xmlns:sf=\"<LINK_1>\" " + "xmlns:gml='" + GML.NAMESPACE + "' " + "xmlns:wfs='" + WFS.NAMESPACE + "' " + "xmlns:fes='" + FES.NAMESPACE + "'>" + "<wfs:Query typeNames='sf:PrimitiveGeoFeature'>" + "<fes:Filter>" + "<fes:PropertyIsLessThanOrEqualTo matchAction=\"Any\" matchCase=\"true\">\n" + " <fes:Literal>\n" + " <gml:Envelope xmlns:gml=\"<LINK_0>\"\n" + " srsName=\"urn:ogc:def:crs:EPSG::4326\">\n" + " <gml:lowerCorner>-90 -180</gml:lowerCorner>\n" + " <gml:upperCorner>90 180</gml:upperCorner>\n" + " </gml:Envelope>\n" + " </fes:Literal>\n" + " <fes:ValueReference>gml:boundedBy</fes:ValueReference>\n" + " </fes:PropertyIsLessThanOrEqualTo>" + "</fes:Filter>" + "</wfs:Query>" + "</wfs:GetFeature>"; MockHttpServletResponse response = postAsServletResponse("wfs", xml); assertEquals(500, response.getStatus()); Document doc = dom(new ByteArrayInputStream(response.getContentAsByteArray())); checkOws11Exception(doc, "2.0.0", WFSException.OPERATION_PROCESSING_FAILED, "GetFeature"); } finally { wfs.setCiteCompliant(false); gs.save(wfs); } }
Source:
<code>public void debug(Object arg0, Throwable arg1) { <START> log.debug(addCorrelationIdToMessage(arg0), arg1); <END> }</code><technical_language>behaviour for format logs (debugFormat, infoFormat... )</technical_language>

Target:
public void debug(Object arg0, Throwable arg1) { log.debug(addPrefixToLogMessage(arg0), arg1); }
Source:
<code>public ServiceCachingPolicyBuilder withBlockWhenExhausted(boolean blockWhenExhausted) { <START> this._blockWhenExhausted = blockWhenExhausted; <END> return this; }</code><technical_language>drop this. portion</technical_language>

Target:
public ServiceCachingPolicyBuilder withBlockWhenExhausted(boolean blockWhenExhausted) { _blockWhenExhausted = blockWhenExhausted; return this; }
Source:
<code>public Map<Data, QueryableEntry> invoke(Map<Data, QueryableEntry> map) { if (isExpirable()) { <START> long now = Clock.currentTimeMillis(); <END> for (Map.Entry<Data, QueryableEntry> entry : map.entrySet()) { QueryableEntry queryableEntry = entry.getValue(); queryableEntry.getRecord().onAccessSafe(now); } } return map; }</code><technical_language>WDYT wrapping returned map a special access updating wrapper? In case avoid double iteration while sending results client, for instance</technical_language>

Target:
public Map<Data, QueryableEntry> invoke(Map<Data, QueryableEntry> map) { if (isExpirable()) { return new ExpirationAwareHashMapDelegate(map); } return map; }
Source:
<code><START> private synchronized void buildListener(AdvertisedDataSource ads) { <END> if (m_shutdown) return; final ExportDecoderBase edb = m_client.constructExportDecoder(ads); detectDecoder(m_client, edb); Pair<ExportDecoderBase, AdvertisedDataSource> pair = Pair.of(edb, ads); m_decoders.add(pair); final ListenableFuture<BBContainer> fut = m_source.poll(); addBlockListener(m_source, fut, edb); }</code><technical_language>synchronized, ExportRunner grabs GuestProcessor.this lock calls buildListener()</technical_language>

Target:
private void buildListener(AdvertisedDataSource ads) { if (m_shutdown) return; final ExportDecoderBase edb = m_client.constructExportDecoder(ads); detectDecoder(m_client, edb); Pair<ExportDecoderBase, AdvertisedDataSource> pair = Pair.of(edb, ads); m_decoders.add(pair); final ListenableFuture<BBContainer> fut = m_source.poll(); addBlockListener(m_source, fut, edb); }
Source:
<code>private EmbeddedCacheManager createCacheManager(String name1, JChannel ch1) { GlobalConfigurationBuilder gcb1 = new GlobalConfigurationBuilder(); <START> gcb1.transport().defaultTransport().nodeName(ch1.getName()).distributedSyncTimeout(10, SECONDS); <END> CustomChannelLookup.registerChannel(gcb1, ch1, name1, false); ConfigurationBuilder replCfg = new ConfigurationBuilder(); replCfg.clustering().cacheMode(CacheMode.REPL_SYNC); replCfg.clustering().stateTransfer().timeout(10, SECONDS); EmbeddedCacheManager cm1 = new DefaultCacheManager(gcb1.build(), replCfg.build(), false); registerCacheManager(cm1); cm1.defineConfiguration(CACHE_NAME, replCfg.build()); return cm1; }</code><technical_language>Is this a bug</technical_language>

Target:
private EmbeddedCacheManager createCacheManager(String name1, JChannel ch1) { GlobalConfigurationBuilder gcb1 = new GlobalConfigurationBuilder(); gcb1.transport().nodeName(ch1.getName()).distributedSyncTimeout(10, SECONDS); CustomChannelLookup.configureTransportWithChannel(gcb1, ch1, name1, false); ConfigurationBuilder replCfg = new ConfigurationBuilder(); replCfg.clustering().cacheMode(CacheMode.REPL_SYNC); replCfg.clustering().stateTransfer().timeout(10, SECONDS); EmbeddedCacheManager cm1 = new DefaultCacheManager(gcb1.build(), replCfg.build(), false); registerCacheManager(cm1); cm1.defineConfiguration(CACHE_NAME, replCfg.build()); return cm1; }
Source:
<code><START> public static OSTime getTime() { <END> return time; }</code><technical_language>Do want this public</technical_language>

Target:
static OSTime getTime() { return time; }
Source:
<code>protected Object getFieldValue(ITmfEvent event, String field) { Object value = null; if (ITmfEvent.EVENT_FIELD_CONTENT.equals(field)) { value = event.getContent().toString(); } else if (ITmfEvent.EVENT_FIELD_TYPE.equals(field)) { value = event.getType().getName(); } else if (ITmfEvent.EVENT_FIELD_TIMESTAMP.equals(field)) { value = event.getTimestamp().toString(); } else if (ITmfEvent.EVENT_FIELD_SOURCE.equals(field)) { value = event.getSource(); } else if (ITmfEvent.EVENT_FIELD_REFERENCE.equals(field)) { value = event.getReference(); } else { <START> ITmfEventField eventField; <END> if (!(field.startsWith("/"))) { eventField = event.getContent().getField(field); } else { String[] array = SUBFIELD_SPLIT_PATTERN.split(field.substring(1)); for (int i = 0; i < array.length; i++) { array[i] = SUBFIELD_SLASH_PATTERN.matcher(array[i]).replaceAll("/"); } eventField = event.getContent().getSubField(array); } if (eventField != null) { value = eventField.getValue(); } } return value; }</code><technical_language>READ FIRST!!! In terms of performance, filtering a char a string, code is 3-4x faster <code> StringBuilder sb = new StringBuilder(); List<String> l = new ArrayList<>(); for (int i = 1; i < field.length(); i++) { final char charAt = field.charAt(i); if (charAt == slash) { final boolean b = field.charAt(i - 1) != slash; if (((field.length() != i + 1) && (field.charAt(i + 1) != slash)) && b) { l.add(sb.toString()); sb = new StringBuilder(); } if (b) { continue; } } sb.append(charAt); } l.add(sb.toString());</code></technical_language>

Target:
protected Object getFieldValue(ITmfEvent event, String field) { Object value = null; if (ITmfEvent.EVENT_FIELD_CONTENT.equals(field)) { value = event.getContent().toString(); } else if (ITmfEvent.EVENT_FIELD_TYPE.equals(field)) { value = event.getType().getName(); } else if (ITmfEvent.EVENT_FIELD_TIMESTAMP.equals(field)) { value = event.getTimestamp().toString(); } else if (ITmfEvent.EVENT_FIELD_SOURCE.equals(field)) { value = event.getSource(); } else if (ITmfEvent.EVENT_FIELD_REFERENCE.equals(field)) { value = event.getReference(); } else { ITmfEventField eventField; if (!(field.startsWith(SLASH_STRING))) { eventField = event.getContent().getField(field); } else { List<String> list = getPathList(field); eventField = event.getContent().getSubField(list.toArray(new String[list.size()])); } if (eventField != null) { value = eventField.getValue(); } } return value; }
Source:
<code>private static byte[] encodeRowName(long startTimestamp) { long row = (startTimestamp / PARTITIONING_QUANTUM) * ROWS_PER_QUANTUM + (startTimestamp % PARTITIONING_QUANTUM) % ROWS_PER_QUANTUM; byte[] rowName = ValueType.VAR_LONG.convertFromJava(row); <START> EncodingUtils.reverseBits(rowName); <END> return rowName; }</code><technical_language>I minded a fixed long for this (since if in row key, show in index summary much) Long.reverse</technical_language>

Target:
private static byte[] encodeRowName(long startTimestamp) { long row = (startTimestamp / PARTITIONING_QUANTUM) * ROWS_PER_QUANTUM + (startTimestamp % PARTITIONING_QUANTUM) % ROWS_PER_QUANTUM; return PtBytes.toBytes(Long.reverse(row)); }
Source:
<code>public static MerlinsBeard from(Context context) { <START> return new MerlinsBeard(context); <END> }</code><technical_language>in this method needto protect nubs do content.getApplicationContext()</technical_language>

Target:
public static MerlinsBeard from(Context context) { ConnectivityManager connectivityManager = (ConnectivityManager) context.getApplicationContext().getSystemService(Context.CONNECTIVITY_SERVICE); return new MerlinsBeard(connectivityManager); }
Source:
<code>void beforeCreate() { <START> createdAt = Instant.now(); <END> }</code><technical_language>supposed a setLastUpdatedAt method here? I dirty tracking enhancement is triggered field access (and dirty tracking optimisation useless if fields dirty tracked of optimisation enabled)</technical_language>

Target:
void beforeCreate() { this.setCreatedAt(Instant.now()); }
Source:
<code>public ActionResult execute() throws EntityDoesNotExistException { new GateKeeper().verifyInstructorPrivileges(account); ArrayList<CourseDetailsBundle> allCourses = new ArrayList<CourseDetailsBundle>( logic.getCourseSummariesForInstructor(account.googleId).values()); InstructorCoursesPageData data = new InstructorCoursesPageData(account); <START> data.init(allCourses, "", ""); <END> if (allCourses.size() == 0 ){ statusToUser.add(Const.StatusMessages.COURSE_EMPTY); } statusToAdmin = "instructorCourse Page Load<br>" + "Total courses: " + allCourses.size(); ShowPageResult response = createShowPageResult(Const.ViewURIs.INSTRUCTOR_COURSES, data); return response; }</code><technical_language>overload init() instead? a multi-step initialisation involving multiple methods</technical_language>

Target:
public ActionResult execute() throws EntityDoesNotExistException { new GateKeeper().verifyInstructorPrivileges(account); List<CourseDetailsBundle> allCourses = new ArrayList<CourseDetailsBundle>( logic.getCourseSummariesForInstructor(account.googleId).values()); CourseDetailsBundle.sortDetailedCoursesByCourseId(allCourses); List<CourseDetailsBundle> activeCourses = logic.extractActiveCourses(allCourses, account.googleId); List<CourseDetailsBundle> archivedCourses = logic.extractArchivedCourses(allCourses, account.googleId); InstructorCoursesPageData data = new InstructorCoursesPageData(account); List<CourseAttributes> courseList = logic.getCoursesForInstructor(data.account.googleId); Map<String, InstructorAttributes> instructorsForCourses = new HashMap<String, InstructorAttributes>(); for (CourseAttributes course : courseList) { instructorsForCourses.put(course.id, logic.getInstructorForGoogleId(course.id, data.account.googleId)); } data.init(activeCourses, archivedCourses, instructorsForCourses); if (allCourses.size() == 0 ){ statusToUser.add(Const.StatusMessages.COURSE_EMPTY); } statusToAdmin = "instructorCourse Page Load<br>Total courses: " + allCourses.size(); ShowPageResult response = createShowPageResult(Const.ViewURIs.INSTRUCTOR_COURSES, data); return response; }
Source:
<code>public boolean contains(T item) { final Object itemIdentifier = getDataProvider().getId(item); Objects.requireNonNull(itemIdentifier, "Identity Provider should not return null"); <START> return getItems().anyMatch(i -> getDataProvider().getId(i) <END> .equals(itemIdentifier)); }</code><technical_language>getDataProvider() called in method? itemIdentifier.equals() null</technical_language>

Target:
public boolean contains(T item) { final ListDataProvider<T> dataProvider = getDataProvider(); final Object itemIdentifier = getIdentifier(item, dataProvider); return getItems().anyMatch(i -> itemIdentifier.equals( getIdentifier(i, dataProvider))); }
Source:
<code>public boolean equals(Object obj) { if (obj == null || obj.getClass() != P12CredentialOptions.class) { return false; } P12CredentialOptions other = (P12CredentialOptions) obj; <START> return Objects.equal(keyFile, other.keyFile); <END> }</code><technical_language>check serviceAccount</technical_language>

Target:
public boolean equals(Object obj) { if (obj == null || obj.getClass() != P12CredentialOptions.class) { return false; } P12CredentialOptions other = (P12CredentialOptions) obj; return Objects.equal(keyFile, other.keyFile) && Objects.equal(serviceAccount, other.serviceAccount); }
Source:
<code>public void put(long address, ILogData entry) { log.info("LogUnitServerCache.put: Cache write[{} : {}]", address, entry); if (entry instanceof LogData) { ((LogData)entry).serializeMetadata(); log.info("Size Estimate - " + entry.getSizeEstimate() + "Deep Size - " + sizeOf.deepSizeOf(entry)); } dataCache.put(address, entry); <START> log.info("Size Estimate After - " + entry.getSizeEstimate() + " Deep Size After - " + sizeOf.deepSizeOf(entry)); <END> }</code><technical_language>This trace level</technical_language>

Target:
public void put(long address, ILogData entry) { log.info("LogUnitServerCache.put: Cache write[{} : {}]", address, entry); if (entry instanceof LogData && !(streamLog instanceof InMemoryStreamLog)) { ((LogData)entry).serializeMetadata(); } dataCache.put(address, entry); }
Source:
<code>public Resource getResource(URI uri, boolean loadOnDemand) { checkNotDisposed(); final Resource cached = getURIResourceMap().get(uri); if (cached != null) { return cached; } final Resource resource; final IStorage storage = storageToURI.get(uri); if (loadOnDemand && storage != null) { resource = load(storage, uri, new NullProgressMonitor()); <START> } else if (loadingResourceSet) { <END> resource = super.getResource(uri, true); } else { ILoadOnDemandPolicy.Registry registry = EMFCompareRCPPlugin.getDefault() .getLoadOnDemandPolicyRegistry(); if (registry.hasAnyAuthorizingPolicy(uri)) { resource = super.getResource(uri, true); } else { resource = super.getResource(uri, false); } } return resource; }</code><technical_language>} else if (loadingResourceSet && loadOnDemand) {</technical_language>

Target:
public Resource getResource(URI uri, boolean loadOnDemand) { checkNotDisposed(); final Resource cached = getURIResourceMap().get(uri); if (cached != null) { return cached; } final Resource resource; final IStorage storage = storageToURI.get(uri); if (loadOnDemand && storage != null) { resource = load(storage, uri, new NullProgressMonitor()); } else if (allowResourceLoad) { resource = super.getResource(uri, true); } else { ILoadOnDemandPolicy.Registry registry = EMFCompareRCPPlugin.getDefault() .getLoadOnDemandPolicyRegistry(); if (registry.hasAnyAuthorizingPolicy(uri)) { resource = super.getResource(uri, true); } else { resource = super.getResource(uri, false); } } return resource; }
Source:
<code>private DatabaseClient(final String url) { MongoClient mongoClient = null; try { mongoClient = new MongoClient(url); } catch (UnknownHostException e) { LOG.info(LoggingConstants.EXCEPTION_MESSAGE, e); } if (mongoClient == null) { return; } database = mongoClient.getDB("submissions"); if (database == null) { <START> LOG.info("Db is null!"); <END> } else { setUpIndexes(); } }</code><technical_language>chnge error</technical_language>

Target:
private DatabaseClient(final String url) { MongoClient mongoClient = null; try { mongoClient = new MongoClient(url); } catch (UnknownHostException e) { LOG.error(LoggingConstants.EXCEPTION_MESSAGE, e); } if (mongoClient == null) { return; } database = mongoClient.getDB("submissions"); if (database == null) { LOG.error("Db is null!"); } else { setUpIndexes(); } }
Source:
<code>private boolean hostHasPpcArchitecture() { Cluster cluster = getModel().getSelectedCluster(); if (cluster == null) { return false; } ArchitectureType archType = cluster.getArchitecture(); <START> return ArchitectureType.ppc64.equals(archType) || ArchitectureType.ppc64le.equals(archType) || ArchitectureType.ppcle.equals(archType); <END> }</code><technical_language>compare archType.getFamily() enumerate types</technical_language>

Target:
private boolean hostHasPpcArchitecture() { Cluster cluster = getModel().getSelectedCluster(); return cluster != null && cluster.getArchitecture() != null && ArchitectureType.ppc.equals(cluster.getArchitecture().getFamily()); }
Source:
<code>private boolean isMetaDataElement(WikiParameters parameters) { if (parameters.getParameter(CLASS_ATTRIBUTE) != null) { return METADATA_CONTAINER_CLASS.equals(parameters.getParameter(CLASS_ATTRIBUTE).getValue()); } <START> return false; <END> }</code><technical_language>This written in a single line: return parameters.getParameter(CLASS_ATTRIBUTE) != null && METADATA_CONTAINER_CLASS.equals(parameters.getParameter(CLASS_ATTRIBUTE).getValue());</technical_language>

Target:
private boolean isMetaDataElement(WikiParameters parameters) { return parameters.getParameter(CLASS_ATTRIBUTE) != null && METADATA_CONTAINER_CLASS.equals(parameters.getParameter(CLASS_ATTRIBUTE).getValue()); }
Source:
<code>public void canProcessBatch() { Set<WithSeq<Client>> remoteRequest = ImmutableSet.of( WithSeq.of(CLIENT_1, 10), WithSeq.of(CLIENT_1, 12), WithSeq.of(CLIENT_2, 10), WithSeq.of(CLIENT_1, 15), WithSeq.of(CLIENT_2, 15)); PaxosValue paxosValue1 = paxosValue(10); PaxosValue paxosValue2 = paxosValue(12); SetMultimap<Client, WithSeq<Optional<PaxosValue>>> remoteResponse = ImmutableSetMultimap.<Client, WithSeq<Optional<PaxosValue>>>builder() .put(CLIENT_1, WithSeq.of(Optional.of(paxosValue1), 10)) .put(CLIENT_1, WithSeq.of(Optional.of(paxosValue2), 12)) .put(CLIENT_2, WithSeq.of(Optional.of(paxosValue1), 10)) .put(CLIENT_1, WithSeq.of(Optional.empty(), 15)) <START> .put(CLIENT_2, WithSeq.of(Optional.empty(), 15)) <END> .build(); when(remote.getLearnedValues(remoteRequest)) .thenReturn(remoteResponse); LearnedValuesCoalescingFunction function = new LearnedValuesCoalescingFunction(remote); Map<WithSeq<Client>, PaxosContainer<Optional<PaxosValue>>> results = function.apply(remoteRequest); assertThat(results) .containsEntry(WithSeq.of(CLIENT_1, 10), asResult(paxosValue1)) .containsEntry(WithSeq.of(CLIENT_1, 12), asResult(paxosValue2)) .containsEntry(WithSeq.of(CLIENT_1, 15), EMPTY_RESULT) .containsEntry(WithSeq.of(CLIENT_2, 10), asResult(paxosValue1)) .containsEntry(WithSeq.of(CLIENT_2, 15), EMPTY_RESULT); }</code><technical_language>nit: put CLIENT_1 CLIENT_2 in order (which do in assertion)</technical_language>

Target:
public void canProcessBatch() { Set<WithSeq<Client>> remoteRequest = ImmutableSet.of( WithSeq.of(CLIENT_1, 10), WithSeq.of(CLIENT_1, 12), WithSeq.of(CLIENT_1, 15), WithSeq.of(CLIENT_2, 10), WithSeq.of(CLIENT_2, 15)); PaxosValue paxosValue1 = paxosValue(10); PaxosValue paxosValue2 = paxosValue(12); SetMultimap<Client, PaxosValue> remoteResponse = ImmutableSetMultimap.<Client, PaxosValue>builder() .putAll(CLIENT_1, paxosValue1, paxosValue2) .put(CLIENT_2, paxosValue1) .build(); when(remote.getLearnedValues(remoteRequest)) .thenReturn(remoteResponse); LearnedValuesCoalescingFunction function = new LearnedValuesCoalescingFunction(remote); Map<WithSeq<Client>, PaxosContainer<Optional<PaxosValue>>> results = function.apply(remoteRequest); assertThat(results).containsOnly( entry(WithSeq.of(CLIENT_2, 10), asResult(paxosValue1)), entry(WithSeq.of(CLIENT_1, 12), asResult(paxosValue2)), entry(WithSeq.of(CLIENT_1, 10), asResult(paxosValue1)), entry(WithSeq.of(CLIENT_1, 15), EMPTY_RESULT), entry(WithSeq.of(CLIENT_2, 15), EMPTY_RESULT)); }
Source:
<code>private void deployArtifactsInGateway() { <START> long retryDuration = 10000; <END> double reconnectionProgressionFactor = 2.0; long maxReconnectDuration = 1000 * 60 * 60; while (true) { boolean isArtifactsDeployed = deployArtifactsAtStartup(); if (isArtifactsDeployed) { log.info("Synapse Artifacts deployed Successfully in the Gateway"); break; } else { retryDuration = (long) (retryDuration * reconnectionProgressionFactor); if (retryDuration > maxReconnectDuration) { retryDuration = maxReconnectDuration; } log.error("Unable to deploy synapse artifacts at gateway. Next retry in " + (retryDuration / 1000) + " seconds"); try { Thread.sleep(retryDuration); } catch (InterruptedException ignore) { } } } }</code><technical_language>bring config level</technical_language>

Target:
private void deployArtifactsInGateway() { long retryDuration = gatewayArtifactSynchronizerProperties.getRetryDuartion(); double reconnectionProgressionFactor = 2.0; long maxReconnectDuration = 1000 * 60 * 60; while (true) { boolean isArtifactsDeployed = deployArtifactsAtStartup(); if (isArtifactsDeployed) { log.info("Synapse Artifacts deployed Successfully in the Gateway"); break; } else { retryDuration = (long) (retryDuration * reconnectionProgressionFactor); if (retryDuration > maxReconnectDuration) { retryDuration = maxReconnectDuration; } log.error("Unable to deploy synapse artifacts at gateway. Next retry in " + (retryDuration / 1000) + " seconds"); try { Thread.sleep(retryDuration); } catch (InterruptedException ignore) { } } } }
Source:
<code>private void reportIssue(ExplodedGraph.Node node, ExceptionalCheckBasedYield yield, SECheck check) { MethodInvocationTree mit = (MethodInvocationTree) node.programPoint.syntaxTree(); ExpressionTree methodSelect = mit.methodSelect(); Set<List<JavaFileScannerContext.Location>> argumentsFlows = flowsForMethodArguments(node, mit); Set<List<JavaFileScannerContext.Location>> exceptionFlows = yield.exceptionFlows(); Set<List<JavaFileScannerContext.Location>> flows = new HashSet<>(); <START> for (List<JavaFileScannerContext.Location> argumentFlow : argumentsFlows) { <END> for (List<JavaFileScannerContext.Location> exceptionFlow : exceptionFlows) { List<JavaFileScannerContext.Location> combinedFlow = new ArrayList<>(argumentFlow.size() + exceptionFlow.size()); combinedFlow.addAll(argumentFlow); combinedFlow.addAll(exceptionFlow); flows.add(combinedFlow); } } Tree reportTree = methodSelect; if (methodSelect.is(Tree.Kind.MEMBER_SELECT)) { reportTree = ((MemberSelectExpressionTree) methodSelect).identifier(); } check.reportIssue(reportTree, String.format(message, mit.symbol().name()), flows); }</code><technical_language><LINK_0></technical_language>

Target:
private void reportIssue(ExplodedGraph.Node node, ExceptionalCheckBasedYield yield, SECheck check) { MethodInvocationTree mit = (MethodInvocationTree) node.programPoint.syntaxTree(); ExpressionTree methodSelect = mit.methodSelect(); Set<List<JavaFileScannerContext.Location>> argumentsFlows = flowsForMethodArguments(node, mit); Set<List<JavaFileScannerContext.Location>> exceptionFlows = yield.exceptionFlows(); Set<List<JavaFileScannerContext.Location>> flows = Sets.cartesianProduct(argumentsFlows, exceptionFlows).stream() .map(ExceptionalYieldChecker::concatLists) .collect(Collectors.toCollection(LinkedHashSet::new)); Tree reportTree = methodSelect; if (methodSelect.is(Tree.Kind.MEMBER_SELECT)) { reportTree = ((MemberSelectExpressionTree) methodSelect).identifier(); } check.reportIssue(reportTree, String.format(message, mit.symbol().name()), flows); }
Source:
<code>public Connection newConnection(Connector connector, EndPoint realEndPoint) { ReadAheadEndpoint aheadEndpoint = new ReadAheadEndpoint(realEndPoint, 1); byte[] bytes = aheadEndpoint.getBytes(); boolean isSSL; if (bytes == null || bytes.length == 0) { isSSL = true; } else { byte b = bytes[0]; isSSL = b >= 0x7F || (b < 0x20 && b != '\n' && b != '\r' && b != '\t'); } <START> LOG.debug("UnifiedConnectionFactory: newConnection() with SSL = " + isSSL); <END> EndPoint plainEndpoint; SslConnection sslConnection; if (isSSL) { SSLEngine engine = this.sslContextFactory.newSSLEngine(aheadEndpoint.getRemoteAddress()); engine.setUseClientMode(false); sslConnection = this.newSslConnection(connector, aheadEndpoint, engine); sslConnection.setRenegotiationAllowed(this.sslContextFactory.isRenegotiationAllowed()); this.configure(sslConnection, connector, aheadEndpoint); plainEndpoint = sslConnection.getDecryptedEndPoint(); } else { sslConnection = null; plainEndpoint = aheadEndpoint; } ConnectionFactory next = connector.getConnectionFactory(nextProtocol); Connection connection = next.newConnection(connector, plainEndpoint); plainEndpoint.setConnection(connection); return (sslConnection == null) ? connection : sslConnection; }</code><technical_language>Please version string formatter</technical_language>

Target:
public Connection newConnection(Connector connector, EndPoint realEndPoint) { ReadAheadEndpoint aheadEndpoint = new ReadAheadEndpoint(realEndPoint, 1); byte[] bytes = aheadEndpoint.getBytes(); boolean isSSL; if (bytes == null || bytes.length == 0) { isSSL = false; LOG.warn("Incoming connection has no data"); } else { byte b = bytes[0]; isSSL = b == 0x16; } LOG.debug(String.format("UnifiedConnectionFactory: newConnection() with SSL = %b", isSSL)); EndPoint plainEndpoint; SslConnection sslConnection; if (isSSL) { SSLEngine engine = this.sslContextFactory.newSSLEngine(aheadEndpoint.getRemoteAddress()); engine.setUseClientMode(false); sslConnection = this.newSslConnection(connector, aheadEndpoint, engine); sslConnection.setRenegotiationAllowed(this.sslContextFactory.isRenegotiationAllowed()); this.configure(sslConnection, connector, aheadEndpoint); plainEndpoint = sslConnection.getDecryptedEndPoint(); } else { sslConnection = null; plainEndpoint = aheadEndpoint; } ConnectionFactory next = connector.getConnectionFactory(nextProtocol); Connection connection = next.newConnection(connector, plainEndpoint); plainEndpoint.setConnection(connection); return (sslConnection == null) ? connection : sslConnection; }
Source:
<code>public void releaseStore(Store<?, ?> resource) { <START> if (!createdStores.containsKey(resource)) { <END> throw new IllegalArgumentException("Given store is not managed by this provider : " + resource); } List<Copier> copiers = createdStores.remove(resource); final OnHeapStore onHeapStore = (OnHeapStore)resource; close(onHeapStore); CopyProvider copyProvider = serviceProvider.getService(CopyProvider.class); for (Copier copier: copiers) { try { copyProvider.releaseCopier(copier); } catch (Exception e) { throw new IllegalStateException("Exception while releasing Copier instance.", e); } } }</code><technical_language>I this is lifecycle code performance sensitive, do remove a local var check for null throw</technical_language>

Target:
public void releaseStore(Store<?, ?> resource) { List<Copier> copiers = createdStores.remove(resource); if (copiers == null) { throw new IllegalArgumentException("Given store is not managed by this provider : " + resource); } final OnHeapStore onHeapStore = (OnHeapStore)resource; close(onHeapStore); CopyProvider copyProvider = serviceProvider.getService(CopyProvider.class); for (Copier copier: copiers) { try { copyProvider.releaseCopier(copier); } catch (Exception e) { throw new IllegalStateException("Exception while releasing Copier instance.", e); } } }
Source:
<code>public DocumentStoreConfiguration(Map<?, ?> configurationValues, int defaultPort) { ConfigurationPropertyReader propertyReader = new ConfigurationPropertyReader( configurationValues ); this.host = propertyReader.property( OgmProperties.HOST, String.class ) .withDefault( DEFAULT_HOST ) .getValue(); this.port = propertyReader.property( OgmProperties.PORT, int.class ) .withDefault( defaultPort ) .getValue(); <START> validatePort( port ); <END> this.databaseName = propertyReader.property( OgmProperties.DATABASE, String.class ) .required() .getValue(); this.username = propertyReader.property( OgmProperties.USERNAME, String.class ).getValue(); this.password = propertyReader.property( OgmProperties.PASSWORD, String.class ).getValue(); this.createDatabase = propertyReader.property( OgmProperties.CREATE_DATABASE, boolean.class ) .withDefault( false ) .getValue(); associationStorage = propertyReader.property( DocumentStoreProperties.ASSOCIATIONS_STORE, AssociationStorageType.class ) .withDefault( DEFAULT_ASSOCIATION_STORAGE ) .getValue(); }</code><technical_language>adding a validation method in property reader: this.port = propertyReader.property( OgmProperties.PORT, int.class ) .withDefault( defaultPort ) .validate( Validators.PORT ) .getValue();</technical_language>

Target:
public DocumentStoreConfiguration(Map<?, ?> configurationValues, int defaultPort) { ConfigurationPropertyReader propertyReader = new ConfigurationPropertyReader( configurationValues ); this.host = propertyReader.property( OgmProperties.HOST, String.class ) .withDefault( DEFAULT_HOST ) .getValue(); this.port = propertyReader.property( OgmProperties.PORT, int.class ) .withDefault( defaultPort ) .withValidator( Validators.PORT ) .getValue(); this.databaseName = propertyReader.property( OgmProperties.DATABASE, String.class ) .required() .getValue(); this.username = propertyReader.property( OgmProperties.USERNAME, String.class ).getValue(); this.password = propertyReader.property( OgmProperties.PASSWORD, String.class ).getValue(); this.createDatabase = propertyReader.property( OgmProperties.CREATE_DATABASE, boolean.class ) .withDefault( false ) .getValue(); associationStorage = propertyReader.property( DocumentStoreProperties.ASSOCIATIONS_STORE, AssociationStorageType.class ) .withDefault( DEFAULT_ASSOCIATION_STORAGE ) .getValue(); }
Source:
<code><START> private static String parseScheme(String challenge) throws ResourceAuthenticationChallengeException { <END> final int indexOfFirstSpace = challenge.indexOf(' '); final int indexOfFirstTab = challenge.indexOf('\t'); if (indexOfFirstSpace < 0 && indexOfFirstTab < 0) { return challenge; } if (indexOfFirstSpace > -1 && (indexOfFirstSpace < indexOfFirstTab || indexOfFirstTab < 0)) { return challenge.substring(0, indexOfFirstSpace); } if (indexOfFirstTab > -1 && (indexOfFirstTab < indexOfFirstSpace || indexOfFirstSpace < 0)) { return challenge.substring(0, indexOfFirstTab); } throw new ResourceAuthenticationChallengeException(AUTH_HEADER_INVALID_FORMAT); }</code><technical_language>accept kinds of scheme, right? "BEARER"</technical_language>

Target:
private static String parseScheme(String challenge) throws ResourceAuthenticationChallengeException { final String methodName = ":parseScheme"; if (StringExtensions.isNullOrBlank(challenge)) { Logger.w(TAG + methodName, "Cannot parse an empty/blank challenge"); throw new ResourceAuthenticationChallengeException(AUTH_HEADER_MISSING); } final int indexOfFirstSpace = challenge.indexOf(' '); final int indexOfFirstTab = challenge.indexOf('\t'); if (indexOfFirstSpace < 0 && indexOfFirstTab < 0) { Logger.w(TAG + methodName, "Couldn't locate space/tab char - returning input String"); return challenge; } Logger.v(TAG + methodName, "Parsing scheme with indices: indexOfFirstSpace[" + indexOfFirstSpace + "] indexOfFirstTab[" + indexOfFirstTab + "]"); if (indexOfFirstSpace > -1 && (indexOfFirstSpace < indexOfFirstTab || indexOfFirstTab < 0)) { return challenge.substring(0, indexOfFirstSpace); } if (indexOfFirstTab > -1 && (indexOfFirstTab < indexOfFirstSpace || indexOfFirstSpace < 0)) { return challenge.substring(0, indexOfFirstTab); } Logger.w(TAG + methodName, "Unexpected/malformed/missing scheme."); throw new ResourceAuthenticationChallengeException(AUTH_HEADER_INVALID_FORMAT); }
Source:
<code>public static void main(String[] args) { try { String authorizationCode = ""; String correlationId = ""; for (int i = 0; i < args.length; ++i) { if (args[i].startsWith("authorization_code")) { authorizationCode = args[i].split("=")[1]; } else if (args[i].startsWith("correlationId")) { correlationId = args[i].split("=")[1]; } } FuturePaymentSample fps = new FuturePaymentSample(); Payment payment = fps.create(correlationId, authorizationCode); } catch (Exception e) { <START> e.printStackTrace(); <END> System.out.println(Payment.getLastRequest()); System.out.println(Payment.getLastResponse()); } }</code><technical_language>this one</technical_language>

Target:
public static void main(String[] args) { try { String authorizationCode = ""; String correlationId = ""; for (int i = 0; i < args.length; ++i) { if (args[i].startsWith("authorization_code")) { authorizationCode = args[i].split("=")[1]; } else if (args[i].startsWith("correlationId")) { correlationId = args[i].split("=")[1]; } } FuturePaymentSample fps = new FuturePaymentSample(); Payment payment = fps.create(correlationId, authorizationCode); System.out.println(Payment.getLastResponse()); } catch (Exception e) { e.printStackTrace(); System.out.println(Payment.getLastRequest()); System.out.println(Payment.getLastResponse()); } }
Source:
<code>public void run() { <START> while (!isScanFinished.get() || filesDownloaded.intValue() != filesNeedDownload) { <END> try { Object downloadItem = downloadItemDeque.poll(1, TimeUnit.SECONDS); if (downloadItem != null) { if (downloadItem instanceof CloudBlob) { downloadBlob((CloudBlob) downloadItem); filesDownloaded.addAndGet(1); } else if (downloadItem instanceof CloudFile) { downloadSingleFile((CloudFile) downloadItem); filesDownloaded.addAndGet(1); } } } catch (InterruptedException | WAStorageException e) { final String message = Messages.AzureStorageBuilder_download_err( getServiceData().getStorageAccountInfo().getStorageAccName()) + ":" + e.getMessage(); e.printStackTrace(error(message)); println(message); setRunUnstable(); } } }</code><technical_language>loop exit wrong filesDownloaded.intValue() != filesNeedDownload true forever</technical_language>

Target:
public void run() { try { if (downloadItem instanceof CloudBlob) { downloadBlob((CloudBlob) downloadItem); } else { downloadSingleFile((CloudFile) downloadItem); } filesDownloaded.addAndGet(1); } catch (WAStorageException e) { final String message = Messages.AzureStorageBuilder_download_err( getServiceData().getStorageAccountInfo().getStorageAccName()) + ":" + e.getMessage(); e.printStackTrace(error(message)); println(message); setRunUnstable(); } }
Source:
<code>protected boolean needRetry(int rc) { try { if (KeeperException.Code.get(rc) == Code.CONNECTIONLOSS) { return true; } return false; <START> } catch (ClassCastException | NullPointerException ex) { <END> LOG.error("Session failed to handle unknown return code {}. Skip retrying. ex {}", _sessionId, rc, ex); return false; } }</code><technical_language>I NullPointerException is thrown? I KeeperException.Code.get(rc) returns null if rc is a valid KeeperException code. if returns null, I log unknot return code</technical_language>

Target:
protected boolean needRetry(int rc) { try { switch (KeeperException.Code.get(rc)) { case CONNECTIONLOSS: return true; default: return false; } } catch (ClassCastException | NullPointerException ex) { LOG.error("Session failed to handle unknown return code {}. Skip retrying. ex {}", _sessionId, rc, ex); return false; } }
Source:
<code>protected void ExecuteVdsBrokerCommand() { storage_pool storagePool = getStoragePoolDAO().get(getVds().getstorage_pool_id()); boolean filteringLUNsEnabled = Config.<Boolean> GetValue( ConfigValues.FilteringLUNsEnabled, storagePool.getcompatibility_version().getValue()); XmlRpcStruct options = new XmlRpcStruct(); <START> if (!filteringLUNsEnabled) { <END> options.add(VdsProperties.includePartitioned, "true"); } int storageType = (int) getParameters().getStorageType().getValue(); _result = getBroker().getDeviceList(storageType, options); ProceedProxyReturnValue(); setReturnValue(ParseLUNList(_result.lunList)); }</code><technical_language>Optional: Boolean.TRUE.toString()</technical_language>

Target:
protected void ExecuteVdsBrokerCommand() { boolean filteringLUNsEnabled = Config.<Boolean> GetValue( ConfigValues.FilteringLUNsEnabled, getParameters().getcompatibility_version().getValue()); XmlRpcStruct options = new XmlRpcStruct(); if (!filteringLUNsEnabled) { options.add(VdsProperties.includePartitioned, Boolean.TRUE.toString()); } int storageType = (int) getParameters().getStorageType().getValue(); _result = getBroker().getDeviceList(storageType, options); ProceedProxyReturnValue(); setReturnValue(ParseLUNList(_result.lunList)); }
Source:
<code>public Map<String, ? extends Property<?>> getProperties(BlockType blockType) { Map<String, FileRegistries.BlockProperty> properties = CLIWorldEdit.inst.getFileRegistries().getDataFile().blocks.get(blockType.getId()).properties; Map<String, Property<?>> worldEditProperties = new HashMap<>(); <START> properties.forEach((name, prop) -> worldEditProperties.put(name, createProperty(prop.type, name, prop.values))); <END> return worldEditProperties; }</code><technical_language>This a good candidate for ImmutableMap.of(Maps.transformEntries(...))</technical_language>

Target:
public Map<String, ? extends Property<?>> getProperties(BlockType blockType) { Map<String, FileRegistries.BlockProperty> properties = CLIWorldEdit.inst.getFileRegistries().getDataFile().blocks.get(blockType.getId()).properties; return ImmutableMap.copyOf(Maps.transformEntries(properties, (Maps.EntryTransformer<String, FileRegistries.BlockProperty, Property<?>>) (key, value) -> createProperty(value.type, key, value.values))); }
Source:
<code>public SqlStatementCustomizer createForParameter(Annotation annotation, Class<?> sqlObjectType, Method method, Parameter param, int index, Object arg) { <START> if (! (arg instanceof Type)) { <END> throw new UnsupportedOperationException("@MapTo must take a Type, got a " + arg.getClass().getName()); } return s -> { ResultReturner returner = ResultReturner.forMethod(sqlObjectType, method); s.getConfig(SqlObjectStatementConfiguration.class).setReturner( () -> returner.result(((ResultSetIterable) s).mapTo((Type) arg))); }; }</code><technical_language>nice if this allowed a GenericType too</technical_language>

Target:
public SqlStatementCustomizer createForParameter(Annotation annotation, Class<?> sqlObjectType, Method method, Parameter param, int index, Object arg) { final Type type; if (arg instanceof GenericType) { type = ((GenericType<?>) arg).getType(); } else if (! (arg instanceof Type)) { throw new UnsupportedOperationException("@MapTo must take a Type, got a " + arg.getClass().getName()); } else { type = (Type) arg; } return s -> { ResultReturner returner = ResultReturner.forMethod(sqlObjectType, method); s.getConfig(SqlObjectStatementConfiguration.class).setReturner( () -> returner.result(((ResultSetIterable) s).mapTo(type), s.getContext())); }; }