auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public List<String> getZipsOlderThan(int daysAgo) throws Exception { List<String> out = new ArrayList<String>(); <START> List<Long> hourKeysListL = new ArrayList<Long>(); <END> List<String> dirComps = new ArrayList<String>(); String lbLogSplitDir = StaticFileUtils.mergePathString(HadoopLogsConfigs.getMapreduceOutputPrefix(), LB_LOGS_SPLIT); FileStatus[] dateDirsStats = getFileSystem().listStatus(new Path(lbLogSplitDir)); DateTime now = StaticDateTimeUtils.nowDateTime(true); Long daysAgoLong = StaticDateTimeUtils.dateTimeToHourLong( StaticDateTimeUtils.nowDateTime( true).minusDays(daysAgo)); for (FileStatus fileStatus : dateDirsStats) { Long hourLong; String pathStr; try { pathStr = HdfsUtils.pathTailString(fileStatus); hourLong = Long.parseLong(pathStr); if (hourLong < daysAgoLong) { hourKeysListL.add(hourLong); } } catch (Exception ex) { continue; } } Collections.sort(hourKeysListL); for (Long hourLong : hourKeysListL) { dirComps.clear(); dirComps.add(HadoopLogsConfigs.getMapreduceOutputPrefix()); dirComps.add(LB_LOGS_SPLIT); dirComps.add(hourLong.toString()); String pathStr = StaticFileUtils.splitPathToString(StaticFileUtils.joinPath(dirComps)); out.add(pathStr); } return out; }</code><technical_language>Nit: I 'L' is a typo for this variable. :)</technical_language>

Target:
public List<String> getZipsOlderThan(int daysAgo) throws Exception { List<String> out = new ArrayList<String>(); List<Long> hourKeysList = new ArrayList<Long>(); List<String> dirComps = new ArrayList<String>(); String lbLogSplitDir = StaticFileUtils.mergePathString(HadoopLogsConfigs.getMapreduceOutputPrefix(), LB_LOGS_SPLIT); FileStatus[] dateDirsStats = getFileSystem().listStatus(new Path(lbLogSplitDir)); DateTime now = StaticDateTimeUtils.nowDateTime(true); Long daysAgoLong = StaticDateTimeUtils.dateTimeToHourLong( StaticDateTimeUtils.nowDateTime( true).minusDays(daysAgo)); for (FileStatus fileStatus : dateDirsStats) { Long hourLong; String pathStr; try { pathStr = HdfsUtils.pathTailString(fileStatus); hourLong = Long.parseLong(pathStr); if (hourLong < daysAgoLong) { hourKeysList.add(hourLong); } } catch (NumberFormatException ex) { continue; } } Collections.sort(hourKeysList); for (Long hourLong : hourKeysList) { dirComps.clear(); dirComps.add(HadoopLogsConfigs.getMapreduceOutputPrefix()); dirComps.add(LB_LOGS_SPLIT); dirComps.add(hourLong.toString()); String pathStr = StaticFileUtils.splitPathToString(StaticFileUtils.joinPath(dirComps)); out.add(pathStr); } return out; }
Source:
<code>public String getPattern() { <START> return "Publishing build information...\\s+" + PatternUtils.WEB_URL_PATTERN; <END> }</code><technical_language>match dots</technical_language>

Target:
public String getPattern() { return "Publishing build information.*\\s+" + PatternUtils.WEB_URL_PATTERN; }
Source:
<code>public void clearReferers() { for (WordsObject referringObject : referers.keySet()) { for (Property property : referers.get(referringObject)) { property.type = PropertyType.NOTHING; property.objProperty = null; } <START> referers.remove(referringObject); <END> } }</code><technical_language>that. specification, keySet a copy, backed original map, changes map iteration result in undefined behavior: <LINK_0></technical_language>

Target:
public void clearReferers() { for (Iterator<ArrayList<Property>> it = referers.values().iterator(); it.hasNext();) { ArrayList<Property> properties = it.next(); for (Property property : properties) { property.type = PropertyType.NOTHING; property.objProperty = null; } it.remove(); } }
Source:
<code>private static ImmutableList<PropertyDefinition> pluginProperties() { return ImmutableList.of( PropertyDefinition.builder(HtmlConstants.FILE_EXTENSIONS_PROP_KEY) .name("HTML File suffixes") .description("List of file suffixes that will be scanned.") .category(CATEGORY) .defaultValue(HtmlConstants.FILE_EXTENSIONS_DEF_VALUE) .deprecatedKey("sonar.web.file.suffixes") .onQualifiers(Qualifiers.PROJECT) .multiValues(true) .build(), PropertyDefinition.builder(HtmlConstants.JSP_FILE_EXTENSIONS_PROP_KEY) .name("JSP File suffixes") <START> .description("List of file suffixes that will be scanned.") <END> .category(CATEGORY) .defaultValue(HtmlConstants.JSP_FILE_EXTENSIONS_DEF_VALUE) .onQualifiers(Qualifiers.PROJECT) .multiValues(true) .build() ); }</code><technical_language>This description is identical "HTML File suffixes" property: I different</technical_language>

Target:
private static ImmutableList<PropertyDefinition> pluginProperties() { return ImmutableList.of( PropertyDefinition.builder(HtmlConstants.FILE_EXTENSIONS_PROP_KEY) .name("HTML File suffixes") .description("List of file suffixes that will be scanned.") .category(CATEGORY) .defaultValue(HtmlConstants.FILE_EXTENSIONS_DEF_VALUE) .deprecatedKey("sonar.web.file.suffixes") .onQualifiers(Qualifiers.PROJECT) .multiValues(true) .build(), PropertyDefinition.builder(HtmlConstants.JSP_FILE_EXTENSIONS_PROP_KEY) .name("JSP File suffixes") .description("List of JSP file suffixes that will be scanned.") .category(CATEGORY) .defaultValue(HtmlConstants.JSP_FILE_EXTENSIONS_DEF_VALUE) .onQualifiers(Qualifiers.PROJECT) .multiValues(true) .build() ); }
Source:
<code>public Object executeWithSubject() throws Exception { SolrClient solrClient = clientFactory.newClient(OfflineGazetteerPlugin.STANDALONE_GAZETTEER_CORE_NAME); Failsafe.with(retryPolicy).get(() -> solrClient.ping()); Iterable<Result> iterable = ResultIterable.resultIterable(catalogFramework, getGazetteerFilter()); session.getConsole().println("Starting sync..."); long counter = 0; Instant start = Instant.now(); for (List<Result> results : Iterables.partition(iterable, PARTITION_SIZE)) { if (Thread.interrupted()) { LOGGER.info("Catalog sync interrupted early, exiting"); session.getConsole().println("Catalog sync interrupted, exiting"); Thread.currentThread().interrupt(); throw new InterruptedException(); } try { solrClient.add( results .stream() .map(Result::getMetacard) .map(OfflineGazetteerPlugin::convert) <START> .collect(Collectors.toList())); <END> } catch (SolrServerException | IOException e) { LOGGER.info("error while adding items to solr", e); session.getConsole().printf("An error occured while syncing: %s", e.getMessage()); throw e; } counter += results.size(); } session .getConsole() .printf( "%nComplete. Processed %d items in %s%n", counter, Duration.between(start, Instant.now()).toString()); return null; }</code><technical_language>Yes. Absolutely</technical_language>

Target:
public Object executeWithSubject() throws Exception { SolrClient solrClient = clientFactory.newClient(COLLECTION_NAME); Boolean response = Failsafe.with( new RetryPolicy() .retryWhen(false) .withMaxDuration(5, TimeUnit.SECONDS) .withBackoff(50, 1_000, TimeUnit.MILLISECONDS)) .get(() -> solrClient.isAvailable()); if (response == null || !response) { LOGGER.error("Could not contact solr to remove all"); session.getConsole().println("Could not contact solr to remove all, exiting."); return null; } Iterable<Result> iterable = ResultIterable.resultIterable(catalogFramework, getGazetteerFilter()); session.getConsole().println("Starting sync..."); long counter = 0; Instant start = Instant.now(); for (List<Result> results : Iterables.partition(iterable, PARTITION_SIZE)) { if (Thread.interrupted()) { LOGGER.info("Catalog sync interrupted early, exiting"); session.getConsole().println("Catalog sync interrupted, exiting"); Thread.currentThread().interrupt(); throw new InterruptedException(); } try { solrClient.add( results .stream() .map(Result::getMetacard) .map(CatalogGazetteerForwardingPlugin::convert) .collect(Collectors.toList())); } catch (SolrServerException | IOException e) { LOGGER.info("error during syncing while adding items to solr", e); session.getConsole().printf("An error occured while syncing: %s", e.getMessage()); throw e; } counter += results.size(); } session .getConsole() .printf( "%nComplete. Processed %d items in %s%n", counter, Duration.between(start, Instant.now()).toString()); return null; }
Source:
<code>public static void writeMetadata(ByteBuf buf, List<Entry> entries) throws IOException { for (Entry entry : entries) { MetadataIndex index = entry.index; Object value = entry.value; if (value == null) continue; int type = index.getType().getId(); int id = index.getIndex(); buf.writeByte(id); buf.writeByte(type); switch (index.getType()) { case BYTE: buf.writeByte((Byte) value); break; case INT: ByteBufUtils.writeVarInt(buf, (Integer) value); break; case FLOAT: buf.writeFloat((Float) value); break; case STRING: ByteBufUtils.writeUTF8(buf, (String) value); break; case CHAT: writeChat(buf, (TextMessage) value); break; case ITEM: writeSlot(buf, (ItemStack) value); break; case BOOLEAN: buf.writeBoolean((Boolean) value); break; case VECTOR: EulerAngle angle = (EulerAngle) value; buf.writeFloat((float) Math.toDegrees(angle.getX())); buf.writeFloat((float) Math.toDegrees(angle.getY())); buf.writeFloat((float) Math.toDegrees(angle.getZ())); break; case POSITION: <START> { <END> BlockVector vector = (BlockVector) value; buf.writeLong(Position.getPosition(vector)); } break; case OPTPOSITION: if (value != null) { BlockVector vector = (BlockVector) value; buf.writeLong(Position.getPosition(vector)); } break; case DIRECTION: ByteBufUtils.writeVarInt(buf, (Integer) value); break; case OPTUUID: buf.writeBoolean(value != null); if (value != null) { writeUuid(buf, (UUID) value); } break; case BLOCKID: ByteBufUtils.writeVarInt(buf, (Integer) value); break; } } buf.writeByte(0xff); }</code><technical_language>is purpose of braces</technical_language>

Target:
public static void writeMetadata(ByteBuf buf, List<Entry> entries) throws IOException { for (Entry entry : entries) { MetadataIndex index = entry.index; Object value = entry.value; int type = index.getType().getId(); int id = index.getIndex(); buf.writeByte(id); buf.writeByte(type); if (!index.getType().isOptional() && value == null) { continue; } if (index.getType().isOptional()) { buf.writeBoolean(value != null); if (value == null) { continue; } } switch (index.getType()) { case BYTE: buf.writeByte((Byte) value); break; case INT: ByteBufUtils.writeVarInt(buf, (Integer) value); break; case FLOAT: buf.writeFloat((Float) value); break; case STRING: ByteBufUtils.writeUTF8(buf, (String) value); break; case CHAT: writeChat(buf, (TextMessage) value); break; case ITEM: writeSlot(buf, (ItemStack) value); break; case BOOLEAN: buf.writeBoolean((Boolean) value); break; case VECTOR: EulerAngle angle = (EulerAngle) value; buf.writeFloat((float) Math.toDegrees(angle.getX())); buf.writeFloat((float) Math.toDegrees(angle.getY())); buf.writeFloat((float) Math.toDegrees(angle.getZ())); break; case POSITION: case OPTPOSITION: BlockVector vector = (BlockVector) value; buf.writeLong(Position.getPosition(vector)); break; case DIRECTION: ByteBufUtils.writeVarInt(buf, (Integer) value); break; case OPTUUID: writeUuid(buf, (UUID) value); break; case BLOCKID: ByteBufUtils.writeVarInt(buf, (Integer) value); break; } } buf.writeByte(0xff); }
Source:
<code>public int getContainerMemoryMb() { <START> if (getBoolean(JobConfig.JOB_AUTOSIZING_ENABLED, false) && containsKey(JobConfig.JOB_AUTOSIZING_CONTAINER_MEMORY_MB)) { <END> return getInt(JobConfig.JOB_AUTOSIZING_CONTAINER_MEMORY_MB); } else if (containsKey(CLUSTER_MANAGER_MEMORY_MB)) { return getInt(CLUSTER_MANAGER_MEMORY_MB); } else if (containsKey(CONTAINER_MAX_MEMORY_MB)) { log.info("Configuration is deprecated. Please use {}", CONTAINER_MAX_MEMORY_MB, CLUSTER_MANAGER_MEMORY_MB); return getInt(CONTAINER_MAX_MEMORY_MB); } else { return DEFAULT_CONTAINER_MEM; } }</code><technical_language>getAutosizingEnabled</technical_language>

Target:
public int getContainerMemoryMb() { if (new JobConfig(this).getAutosizingEnabled() && containsKey(JobConfig.JOB_AUTOSIZING_CONTAINER_MEMORY_MB)) { return getInt(JobConfig.JOB_AUTOSIZING_CONTAINER_MEMORY_MB); } else if (containsKey(CLUSTER_MANAGER_MEMORY_MB)) { return getInt(CLUSTER_MANAGER_MEMORY_MB); } else if (containsKey(CONTAINER_MAX_MEMORY_MB)) { log.info("Configuration is deprecated. Please use {}", CONTAINER_MAX_MEMORY_MB, CLUSTER_MANAGER_MEMORY_MB); return getInt(CONTAINER_MAX_MEMORY_MB); } else { return DEFAULT_CONTAINER_MEM; } }
Source:
<code>void init(final JBrowserDriverServer driver, final Context context) { if (initialized.compareAndSet(false, true)) { this.context.set(context); SettingsManager.register(stage, view); engine.set(view.get().getEngine()); try { window.set(new WindowServer(stage, context.statusCode)); context.alert.get().listen(this); } catch (RemoteException e) { Util.handleException(e); } final ContextItem thisObject = this; AppThread.exec(context.statusCode, () -> { <START> Settings settings = SettingsManager.settings(); <END> engine.get().setJavaScriptEnabled(settings.javascript()); File userDataDirectory = settings.userDataDirectory(); if (userDataDirectory == null) { try { userDataDirectory = Files.createTempDirectory("userdata").toFile(); } catch (IOException e) { Util.handleException(e); } } if (userDataDirectory != null) { engine.get().setUserDataDirectory(userDataDirectory); } httpListener.set(new HttpListener(thisObject, context.statusCode, context.timeouts.get().getPageLoadTimeoutObjMS())); Accessor.getPageFor(view.get().getEngine()).addLoadListenerClient(httpListener.get()); engine.get().setCreatePopupHandler(new PopupHandler(driver, context)); return null; }); } }</code><technical_language>ContextItem essentially corresponds a browser window, shares cookies/etc. I user data shared ContextItems. move of this Context constructor, set userDataDir WebEngine. in Context#reset delete files dir if a custom dir user. FileUtils.cleanDirectory( useful for that</technical_language>

Target:
void init(final JBrowserDriverServer driver, final Context context) { if (initialized.compareAndSet(false, true)) { this.context.set(context); SettingsManager.register(stage, view); engine.set(view.get().getEngine()); try { window.set(new WindowServer(stage, context.statusCode)); context.alert.get().listen(this); } catch (RemoteException e) { Util.handleException(e); } final ContextItem thisObject = this; AppThread.exec(context.statusCode, () -> { Settings settings = SettingsManager.settings(); engine.get().setJavaScriptEnabled(settings.javascript()); engine.get().setUserDataDirectory(context.userDataDirectory.get()); httpListener.set(new HttpListener(thisObject, context.statusCode, context.timeouts.get().getPageLoadTimeoutObjMS())); Accessor.getPageFor(view.get().getEngine()).addLoadListenerClient(httpListener.get()); engine.get().setCreatePopupHandler(new PopupHandler(driver, context)); return null; }); } }
Source:
<code>JobHistoryFileParserHadoop2() { <START> for (CounterTypes ct : CounterTypes.values()) { <END> COUNTER_NAMES.add(ct.toString()); } }</code><technical_language>is a static variable populated in constructor? Move this a static block instead</technical_language>

Target:
JobHistoryFileParserHadoop2() { }
Source:
<code>public void initialize(FileExists ignored) { <START> verify(ignored.message().isEmpty(), "annotation.message is not empty"); <END> }</code><technical_language>suggestion verify(ignored.message().isEmpty(), "FileExists.message specified");</technical_language>

Target:
public void initialize(FileExists ignored) { verify(ignored.message().isEmpty(), "FileExists.message cannot be specified"); }
Source:
<code>public static <I> void checkEverythingImplemented(Class<I> interfaceClass, Class<? extends I> implementationClass) throws ReflectiveOperationException <START> { <END> for (Method interfaceMethod : interfaceClass.getMethods()) { Method implementationMethod = implementationClass.getMethod(interfaceMethod.getName(), interfaceMethod.getParameterTypes()); if (interfaceMethod.equals(implementationMethod) && interfaceMethod.getAnnotation(Deprecated.class) == null) { throw new AssertionError(format( "Method should be overridden in %s: %s", implementationClass, interfaceMethod)); } } }</code><technical_language>this is public, add checkArgument(interfaceClass.isAssignableFrom(implementationClass)); (to implementations)</technical_language>

Target:
public static <I> void checkEverythingImplemented(Class<I> interfaceClass, Class<? extends I> implementationClass) throws ReflectiveOperationException { checkArgument(interfaceClass.isAssignableFrom(implementationClass)); for (Method interfaceMethod : interfaceClass.getMethods()) { Method implementationMethod = implementationClass.getMethod(interfaceMethod.getName(), interfaceMethod.getParameterTypes()); if (interfaceMethod.equals(implementationMethod) && interfaceMethod.getAnnotation(Deprecated.class) == null) { throw new AssertionError(format( "Method should be overridden in %s: %s", implementationClass, interfaceMethod)); } } }
Source:
<code>public static synchronized AbstractStereotypeInstanceEditDialog make(String stereotypeName, Shell shell, IStereotypeInstance instance, IStereotypeCapable artifact, Boolean isEditable) throws TigerstripeException { if (dialogHash == null) { getRegisteredAuditors(); } IConfigurationElement element = dialogHash.get(stereotypeName); if (element != null) { try { Bundle bundle = Platform.getBundle(element.getContributor().getName()); String className = element.getAttribute(DIALOG_CLASS); Class<?> extensionClass = bundle.loadClass(className); for (Constructor<?> constructor : extensionClass.getDeclaredConstructors()) { Class<?>[] paramTypes = constructor.getParameterTypes(); if (paramTypes.length >= <START> 3 && <END> paramTypes[0].isAssignableFrom(Shell.class) && paramTypes[1].isAssignableFrom(IStereotypeInstance.class) && paramTypes[2].isAssignableFrom(IStereotypeCapable.class)) { if (paramTypes.length == 4 && paramTypes[3].isAssignableFrom(Boolean.class)) { return (AbstractStereotypeInstanceEditDialog) constructor.newInstance(shell, instance, artifact, isEditable); } else { return (AbstractStereotypeInstanceEditDialog) constructor.newInstance(shell, instance, artifact); } } } return null; } catch (Exception e) { e.printStackTrace(); } } throw new TigerstripeException("Couldn't instantiate dialog for " + stereotypeName); }</code><technical_language>[minor] magic constant</technical_language>

Target:
public static synchronized AbstractStereotypeInstanceEditDialog make(String stereotypeName, Shell shell, IStereotypeInstance instance, IStereotypeCapable artifact, Boolean isEditable) throws TigerstripeException { if (dialogHash == null) { getRegisteredAuditors(); } IConfigurationElement element = dialogHash.get(stereotypeName); if (element != null) { try { Bundle bundle = Platform.getBundle(element.getContributor().getName()); String className = element.getAttribute(DIALOG_CLASS); Class<?> extensionClass = bundle.loadClass(className); for (Constructor<?> constructor : extensionClass.getDeclaredConstructors()) { Class<?>[] paramTypes = constructor.getParameterTypes(); if (paramTypes.length >= CUSTOM_DLG_OLD_CTOR_PARAMS_COUNT && paramTypes[0].isAssignableFrom(Shell.class) && paramTypes[1].isAssignableFrom(IStereotypeInstance.class) && paramTypes[2].isAssignableFrom(IStereotypeCapable.class)) { if (paramTypes.length == CUSTOM_DLG_CTOR_PARAMS_COUNT && paramTypes[3].isAssignableFrom(Boolean.class)) { return (AbstractStereotypeInstanceEditDialog) constructor.newInstance(shell, instance, artifact, isEditable); } else { return (AbstractStereotypeInstanceEditDialog) constructor.newInstance(shell, instance, artifact); } } } return null; } catch (Exception e) { e.printStackTrace(); } } throw new TigerstripeException("Couldn't instantiate dialog for " + stereotypeName); }
Source:
<code>private void scheduleNextAttempt(Throwable throwable) { assert executor.inEventLoop(); state = State.SCHEDULED; if (reconnectionSchedule == null) { reconnectionSchedule = scheduleSupplier.get(); } Optional<Duration> nextInterval = reconnectionSchedule.nextDelay(Optional.ofNullable(throwable)); if (nextInterval.isPresent()) { LOG.debug("[{}] Scheduling next reconnection in {}", logPrefix, nextInterval); nextAttempt = executor.schedule(reconnectionTask, nextInterval.get().toNanos(), TimeUnit.NANOSECONDS); nextAttempt.addListener( (Future<CompletionStage<Boolean>> f) -> { if (f.isSuccess()) { onNextAttemptStarted(f.getNow()); } else if (!f.isCancelled()) { Loggers.warnWithException( LOG, "[{}] Uncaught error while starting reconnection attempt", logPrefix, f.cause()); scheduleNextAttempt(throwable); } }); } else { Loggers.warnWithException( <START> LOG, "Reconnection attempt aborted, at discretion of reconnection policy", logPrefix); <END> onFail.accept(throwable); } }</code><technical_language>This a debug log. If aborting policy decided to, is working expected, need alert ops. If people want a message a level, issue policy</technical_language>

Target:
private void scheduleNextAttempt(Throwable throwable) { assert executor.inEventLoop(); state = State.SCHEDULED; if (reconnectionSchedule == null) { reconnectionSchedule = scheduleSupplier.get(); } Optional<Duration> nextInterval = reconnectionSchedule.nextDelay(Optional.ofNullable(throwable)); if (nextInterval.isPresent()) { LOG.debug("[{}] Scheduling next reconnection in {}", logPrefix, nextInterval); nextAttempt = executor.schedule(reconnectionTask, nextInterval.get().toNanos(), TimeUnit.NANOSECONDS); nextAttempt.addListener( (Future<CompletionStage<Void>> f) -> { if (f.isSuccess()) { onNextAttemptStarted(f.getNow()); } else if (!f.isCancelled()) { Loggers.warnWithException( LOG, "[{}] Uncaught error while starting reconnection attempt", logPrefix, f.cause()); scheduleNextAttempt(throwable); } }); } else { LOG.debug("Reconnection attempt aborted, at discretion of reconnection policy"); onAbort.accept(throwable); } }
Source:
<code>public boolean containsExpectedPageContents() { if (isElementPresent(By.className("modal-content"))) { <START> return waitForElementPresence(By.tagName("h2")).getText().contains("Uh oh! Something went wrong."); <END> } return waitForElementPresence(By.tagName("h3")).getText().contains("Confirm your Google account"); }</code><technical_language>This is specific join page,</technical_language>

Target:
public boolean containsExpectedPageContents() { return waitForElementPresence(By.tagName("h3")).getText().contains("Confirm your Google account"); }
Source:
<code>public GitIndex getIndex() throws IOException { if (isBare()) <START> throw new IOException( <END> JGitText.get().bareRepositoryNoWorkdirAndIndex); if (index == null) { index = new GitIndex(this); index.read(); } else { index.rereadIfNecessary(); } return index; }</code><technical_language>do throw IOException IllegalStateException in getIndexFile()? throw type consistently</technical_language>

Target:
public GitIndex getIndex() throws IOException, IllegalStateException { if (isBare()) throw new IOException( JGitText.get().bareRepositoryNoWorkdirAndIndex); if (index == null) { index = new GitIndex(this); index.read(); } else { index.rereadIfNecessary(); } return index; }
Source:
<code>public String doExport(DataTransferExportModel exportModel) throws java.io.IOException { String zipLocation = new StringBuilder().append(TMP_DIR) .append(File.separator) .append(FILE_PATH) .append(File.separator) .append(EXPORT_FILE_NAME) .toString(); Predicate<Path> readmeFilter = p -> p.toString().toLowerCase().endsWith("readme.md"); Predicate<Path> datasetsFilter = def -> true; Predicate<Path> pagesFilter = page -> true; boolean exportNavigation = true; if (!exportModel.isExportAll()) { datasetsFilter = filterDatasets(exportModel.getDatasetDefinitions()); <START> pagesFilter = filterPages(exportModel.getPages()); <END> exportNavigation = exportModel.isExportNavigation(); } new File(zipLocation).getParentFile().mkdirs(); FileOutputStream fos = new FileOutputStream(zipLocation); ZipOutputStream zos = new ZipOutputStream(fos); zipFileSystem(datasetsFS, zos, readmeFilter.or(datasetsFilter)); zipFileSystem(perspectivesFS, zos, readmeFilter.or(pagesFilter)); if (exportNavigation) { zipFileSystem(navigationFS, zos, p -> true); } else { zipFileSystem(navigationFS, zos, readmeFilter); } zipFile(createVersionFile(), "VERSION", zos); zos.close(); fos.close(); moveZipToFileSystem(zipLocation, systemFS); return new StringBuilder().append(SpacesAPI.Scheme.GIT) .append("://") .append(systemFS.getName()) .append(File.separator) .append(FILE_PATH) .append(File.separator) .append(EXPORT_FILE_NAME) .toString(); }</code><technical_language>is isExportNavigation() relevant? navigation is exported in custom export</technical_language>

Target:
public String doExport(DataTransferExportModel exportModel) throws java.io.IOException { String zipLocation = new StringBuilder().append(System.getProperty("java.io.tmpdir")) .append(File.separator) .append(FILE_PATH) .append(File.separator) .append(EXPORT_FILE_NAME) .toString(); Predicate<Path> readmeFilter = p -> p.toString().toLowerCase().endsWith("readme.md"); Predicate<Path> datasetsFilter = def -> true; Predicate<Path> pagesFilter = page -> true; boolean exportNavigation = true; if (!exportModel.isExportAll()) { datasetsFilter = filterDatasets(exportModel.getDatasetDefinitions()); pagesFilter = filterPages(exportModel.getPages()); exportNavigation = exportModel.isExportNavigation(); } new File(zipLocation).getParentFile().mkdirs(); FileOutputStream fos = new FileOutputStream(zipLocation); ZipOutputStream zos = new ZipOutputStream(fos); zipFileSystem(datasetsFS, zos, readmeFilter.or(datasetsFilter)); zipFileSystem(perspectivesFS, zos, readmeFilter.or(pagesFilter)); if (exportNavigation) { zipFileSystem(navigationFS, zos, p -> true); } else { zipFileSystem(navigationFS, zos, readmeFilter); } zipFile(createVersionFile(), "VERSION", zos); zos.close(); fos.close(); moveZipToFileSystem(zipLocation, systemFS); return new StringBuilder().append(SpacesAPI.Scheme.GIT) .append("://") .append(systemFS.getName()) .append(File.separator) .append(FILE_PATH) .append(File.separator) .append(EXPORT_FILE_NAME) .toString(); }
Source:
<code>public long fetchUnzipToTemp(ClientBlobStore store) throws IOException, KeyNotFoundException, AuthorizationException { String key = getKey(); ReadableBlobMeta meta = store.getBlobMeta(key); if (!ServerUtils.canUserReadBlob(meta, user, conf)) { throw new WrappedAuthorizationException(user + " does not have READ access to " + key); } DownloadMeta downloadMeta = fetch(store, key, v -> { Path path = shouldUncompress ? tmpOutputLocation() : constructBlobWithVersionFileName(baseDir, getKey(), v); Path parent = path.getParent(); if (!Files.exists(parent)) { try { Files.createDirectories(parent); } catch (FileAlreadyExistsException e) { <START> } catch (Exception e) { <END> LOG.error("Failed to create parent directory {}", parent, e); throw e; } } return path; }, FileOutputStream::new ); Path finalLocation = downloadMeta.getDownloadPath(); if (shouldUncompress) { Path downloadFile = finalLocation; finalLocation = constructBlobWithVersionFileName(baseDir, getKey(), downloadMeta.getVersion()); ServerUtils.unpack(downloadFile.toFile(), finalLocation.toFile(), symLinksDisabled); LOG.debug("Uncompressed to: {}", downloadFile, finalLocation); } setBlobPermissions(conf, user, finalLocation); return downloadMeta.getVersion(); }</code><technical_language>catch IOException here. Files.createDirectories(parent) throws IOException</technical_language>

Target:
public long fetchUnzipToTemp(ClientBlobStore store) throws IOException, KeyNotFoundException, AuthorizationException { String key = getKey(); ReadableBlobMeta meta = store.getBlobMeta(key); if (!ServerUtils.canUserReadBlob(meta, user, conf)) { throw new WrappedAuthorizationException(user + " does not have READ access to " + key); } DownloadMeta downloadMeta = fetch(store, key, v -> { Path path = shouldUncompress ? tmpOutputLocation() : constructBlobWithVersionFileName(baseDir, getKey(), v); Path parent = path.getParent(); if (!Files.exists(parent)) { try { Files.createDirectories(parent); } catch (FileAlreadyExistsException e) { } catch (IOException e) { LOG.error("Failed to create parent directory {}", parent, e); throw e; } } return path; }, FileOutputStream::new ); Path finalLocation = downloadMeta.getDownloadPath(); if (shouldUncompress) { Path downloadFile = finalLocation; finalLocation = constructBlobWithVersionFileName(baseDir, getKey(), downloadMeta.getVersion()); ServerUtils.unpack(downloadFile.toFile(), finalLocation.toFile(), symLinksDisabled); LOG.debug("Uncompressed to: {}", downloadFile, finalLocation); } setBlobPermissions(conf, user, finalLocation); return downloadMeta.getVersion(); }
Source:
<code>public static void setup(RequestContext ctx, MeterRegistry registry, String metricName) { if (ctx.attr(PROMETHEUS_METRICS_SET) == null) { return; } ctx.setAttr(PROMETHEUS_METRICS_SET, true); ctx.log().whenComplete().thenAccept(log -> getTimeBuilder(log, metricName).register(registry) <START> .record(log.totalDurationNanos(), TimeUnit.NANOSECONDS)); <END> }</code><technical_language>main is Prometheus stable folks grafana dont wake graphs broken. I carefully</technical_language>

Target:
public static void setup(RequestContext ctx, MeterRegistry registry, String metricName) { if (ctx.setAttrIfAbsent(PROMETHEUS_METRICS_SET, true) != null) { return; } ctx.log().whenComplete().thenAccept(log -> getTimeBuilder(log, metricName).register(registry) .record(log.totalDurationNanos(), TimeUnit.NANOSECONDS)); }
Source:
<code>private Set<TimeDimensionProjection> resolveTimeDimensions() { <START> Set<TimeDimensionProjection> timeDims = new LinkedHashSet<>(); <END> entityProjection.getAttributes().stream().forEach((attribute -> { TimeDimensionColumn timeDim = schema.getTimeDimension(attribute.getName()); if (timeDim == null) { return; } Argument timeGrainArgument = attribute.getArguments().stream() .filter(attr -> attr.getName().equals("grain")) .findAny() .orElse(null); TimeGrainDefinition requestedGrainDefinition; if (timeGrainArgument == null) { requestedGrainDefinition = timeDim.getSupportedGrains().iterator().next(); } else { String requestedGrainName = timeGrainArgument.getValue().toString().toUpperCase(Locale.ENGLISH); TimeGrain requestedGrain; try { requestedGrain = TimeGrain.valueOf(requestedGrainName); } catch (IllegalArgumentException e) { throw new InvalidOperationException(String.format("Invalid grain %s", requestedGrainName)); } requestedGrainDefinition = timeDim.getSupportedGrains().stream() .filter(supportedGrainDef -> supportedGrainDef.grain().equals(requestedGrain)) .findAny() .orElseThrow(() -> new InvalidOperationException( String.format("Requested grain %s, not supported on %s", requestedGrainName, attribute.getName()))); } timeDims.add(timeDim.toProjectedDimension(requestedGrainDefinition)); })); return timeDims; }</code><technical_language>This method is reverted</technical_language>

Target:
private Set<TimeDimensionProjection> resolveTimeDimensions() { return entityProjection.getAttributes().stream() .filter(attribute -> schema.getTimeDimension(attribute.getName()) != null) .map(attribute -> { TimeDimensionColumn timeDim = schema.getTimeDimension(attribute.getName()); Argument timeGrainArgument = attribute.getArguments().stream() .filter(attr -> attr.getName().equals("grain")) .findAny() .orElse(null); TimeGrainDefinition requestedGrainDefinition; if (timeGrainArgument == null) { requestedGrainDefinition = timeDim.getSupportedGrains().stream() .findFirst() .orElseThrow(() -> new IllegalStateException( String.format("Requested default grain, no grain defined on %s", attribute.getName()))); } else { String requestedGrainName = timeGrainArgument.getValue().toString().toUpperCase(Locale.ENGLISH); TimeGrain requestedGrain; try { requestedGrain = TimeGrain.valueOf(requestedGrainName); } catch (IllegalArgumentException e) { throw new InvalidOperationException(String.format("Invalid grain %s", requestedGrainName)); } requestedGrainDefinition = timeDim.getSupportedGrains().stream() .filter(supportedGrainDef -> supportedGrainDef.grain().equals(requestedGrain)) .findAny() .orElseThrow(() -> new InvalidOperationException( String.format("Requested grain %s, not supported on %s", requestedGrainName, attribute.getName()))); } return timeDim.toProjectedDimension(requestedGrainDefinition); }) .collect(Collectors.toCollection(LinkedHashSet::new)); }
Source:
<code><START> public final int numberOfHosts() { <END> Preconditions.checkState(thriftHosts().size() == cqlHosts().size()); return thriftHosts().size(); }</code><technical_language>derived</technical_language>

Target:
public int numberOfHosts() { return Math.max(thriftHosts().size(), cqlHosts().size()); }
Source:
<code><START> private void validate(Schema inputSchema) { <END> if (!Strings.isNullOrEmpty(featuresToExclude) && !Strings.isNullOrEmpty(featuresToInclude)) { throw new IllegalArgumentException("Cannot specify values for both featuresToInclude and featuresToExclude. " + "Please specify fields for one"); } List<String> fields = getFeatureList(inputSchema); for (String field : fields) { Schema.Field inputField = inputSchema.getField(field); Schema schema = inputField.getSchema(); Schema.Type features = schema.isNullableSimple() ? schema.getNonNullable().getType() : schema.getType(); Preconditions.checkArgument(features.isSimpleType(), "Field to be used for training must be of type number: " + "int, long, float, double but was of type %s for field %s ", features, field); if (features.equals(Schema.Type.BYTES) || features.equals(Schema.Type.STRING) || features.equals(Schema.Type.BOOLEAN)) { throw new IllegalArgumentException(String.format("Field to be used for training must be of type : int," + " double, float, long but was of type %s for field %s ", features, field)); } Preconditions.checkArgument(!features.equals(Schema.Type.NULL), "Field to classify must not be of type null"); } Schema.Field prediction = inputSchema.getField(labelField); if (labelField == null) { throw new IllegalArgumentException(String.format("Prediction field %s does not exists in the input schema", labelField)); } Schema predictionSchema = prediction.getSchema(); Schema.Type predictionFieldType = predictionSchema.isNullableSimple() ? predictionSchema.getNonNullable().getType() : predictionSchema.getType(); if (predictionFieldType != Schema.Type.DOUBLE) { throw new IllegalArgumentException(String.format("Prediction field must be of type Double, but was %s.", predictionFieldType)); } }</code><technical_language>a lot of this logic is for trainer predictor. is create a DecisionTreeConfig, a FeatureConfig, configs extend. logic for ML trainer predictor plugins</technical_language>

Target:
public void validate(Schema inputSchema) { SparkUtils.validateConfigParameters(inputSchema, featuresToInclude, featuresToExclude, labelField, cardinalityMapping); SparkUtils.validateLabelFieldForTrainer(inputSchema, labelField); }
Source:
<code>public void shutdown() { paxosResources.leadershipComponents().shutdown(); sqliteDataSource.close(); <START> timestampStorage.timestampCreator().close(); <END> }</code><technical_language>nit: TimestampStorage closeable</technical_language>

Target:
public void shutdown() { paxosResources.leadershipComponents().shutdown(); sqliteDataSource.close(); timestampStorage.close(); }
Source:
<code>} catch (Exception e) { throw new <START> RuntimeException("Failed <END> to obtain okhttp HostnameVerifier", e); }</code><technical_language>Possibly AssertionError instead, breaks a fundamental assumption making presence of OkHostnameVerifier</technical_language>

Target:
} catch (Exception e) { throw new AssertionError("Failed to obtain okhttp HostnameVerifier", e); }
Source:
<code>public synchronized void close() throws LibraryIOException { if (!closed) { OutputStream propertiesOS = null; GenericOutputVFS goVFS = null; try { goVFS = new GenericOutputVFS(vfs); OutputVFile libraryPropertiesOut = goVFS.getRootOutputVDir().createOutputVFile(LIBRARY_PROPERTIES_VPATH); propertiesOS = libraryPropertiesOut.getOutputStream(); libraryProperties.store(propertiesOS, "Library properties"); <START> propertiesOS.close(); <END> try { for (InputOutputVFS intputOutputVFS : sectionVFS.values()) { intputOutputVFS.close(); } } catch (IOException e) { throw new LibraryIOException(getLocation(), e); } } catch (CannotCreateFileException e) { throw new LibraryIOException(getLocation(), e); } catch (IOException e) { throw new LibraryIOException(getLocation(), e); } finally { try { if (propertiesOS != null) { propertiesOS.close(); } if (goVFS != null) { goVFS.close(); } } catch (IOException e) { throw new LibraryIOException(getLocation(), e); } } closed = true; } }</code><technical_language>finally</technical_language>

Target:
public synchronized void close() throws LibraryIOException { if (!closed) { GenericOutputVFS goVFS = null; try { goVFS = new GenericOutputVFS(vfs); OutputVFile libraryPropertiesOut = goVFS.getRootOutputVDir().createOutputVFile(LIBRARY_PROPERTIES_VPATH); OutputStream propertiesOS = null; try { propertiesOS = libraryPropertiesOut.getOutputStream(); libraryProperties.store(propertiesOS, "Library properties"); } finally { if (propertiesOS != null) { propertiesOS.close(); } } try { for (InputOutputVFS intputOutputVFS : sectionVFS.values()) { intputOutputVFS.close(); } } catch (IOException e) { throw new LibraryIOException(getLocation(), e); } } catch (CannotCreateFileException e) { throw new LibraryIOException(getLocation(), e); } catch (IOException e) { throw new LibraryIOException(getLocation(), e); } finally { try { if (goVFS != null) { goVFS.close(); } } catch (IOException e) { throw new LibraryIOException(getLocation(), e); } } closed = true; } }
Source:
<code>public void write(final ChannelHandlerContext context, final Object message, final ChannelPromise promise) { this.traceOperation(context, "write", message); if (message.getClass() == RntbdRequestRecord.class) { final RntbdRequestRecord record = (RntbdRequestRecord) message; this.timestamps.channelWriteAttempted(); <START> context.writeAndFlush(this.addPendingRequestRecord(context, record), promise).addListener(completed -> { <END> record.stage(RntbdRequestRecord.Stage.SENT); if (completed.isSuccess()) { this.timestamps.channelWriteCompleted(); } }); return; } if (message == RntbdHealthCheckRequest.MESSAGE) { context.writeAndFlush(RntbdHealthCheckRequest.MESSAGE, promise).addListener(completed -> { if (completed.isSuccess()) { this.timestamps.channelPingCompleted(); } }); return; } final IllegalStateException error = new IllegalStateException(lenientFormat("message of %s: %s", message.getClass(), message)); reportIssue(context, "", error); this.exceptionCaught(context, error); }</code><technical_language>This I asked told is needed. please expand is needed is related ConnectionStateListener</technical_language>

Target:
public void write(final ChannelHandlerContext context, final Object message, final ChannelPromise promise) { this.traceOperation(context, "write", message); if (message.getClass() == RntbdRequestRecord.class) { final RntbdRequestRecord record = (RntbdRequestRecord) message; this.timestamps.channelWriteAttempted(); context.write(this.addPendingRequestRecord(context, record), promise).addListener(completed -> { record.stage(RntbdRequestRecord.Stage.SENT); if (completed.isSuccess()) { this.timestamps.channelWriteCompleted(); } }); return; } if (message == RntbdHealthCheckRequest.MESSAGE) { context.writeAndFlush(RntbdHealthCheckRequest.MESSAGE, promise).addListener(completed -> { if (completed.isSuccess()) { this.timestamps.channelPingCompleted(); } }); return; } final IllegalStateException error = new IllegalStateException(lenientFormat("message of %s: %s", message.getClass(), message)); reportIssue(context, "", error); this.exceptionCaught(context, error); }
Source:
<code>public void toJSON(OutputWriter extensionWriter, PluginInfo extension) { super.toJSON(extensionWriter, extension); ConfigRepoPluginInfo configRepoPluginInfo = (ConfigRepoPluginInfo) extension; <START> if (configRepoPluginInfo.getCapabilities() != null) { <END> extensionWriter.addChild("capabilities", capabilitiesWriter -> capabilitiesWriter.add("supports_pipeline_export", configRepoPluginInfo.getCapabilities().isSupportsPipelineExport()) .add("supports_parse_content", configRepoPluginInfo.getCapabilities().isSupportsParseContent())); } }</code><technical_language>need add null check. ask plugin send capabilities. In absence of capabilities, fail earlier while building plugin info</technical_language>

Target:
public void toJSON(OutputWriter extensionWriter, PluginInfo extension) { super.toJSON(extensionWriter, extension); ConfigRepoPluginInfo configRepoPluginInfo = (ConfigRepoPluginInfo) extension; extensionWriter.addChild("capabilities", capabilitiesWriter -> capabilitiesWriter.add("supports_pipeline_export", configRepoPluginInfo.getCapabilities().isSupportsPipelineExport()) .add("supports_parse_content", configRepoPluginInfo.getCapabilities().isSupportsParseContent())); }
Source:
<code>public RabbitMQProducer(RabbitMQStore store) { if (store == null) { <START> log.error("Cannot initialize."); <END> return; } this.store = store; isInitialized = true; }</code><technical_language>consumer. If parameters null throw exceptions deployment fails required message</technical_language>

Target:
public RabbitMQProducer(RabbitMQStore store) { if (store == null) { log.error("Cannot initialize producer: " + getId()); return; } this.store = store; isInitialized = true; }
Source:
<code>public void configureCloud() throws Exception { cloud = setupCloud(); createSecret(cloud.connect()); cloud.getTemplates().clear(); cloud.addTemplate(buildBusyboxTemplate("busybox")); URL url = r.getURL(); String hostAddress = System.getProperty("jenkins.host.address"); if (hostAddress == null) { hostAddress = InetAddress.getLocalHost().getHostAddress(); } URL nonLocalhostUrl = new URL(url.getProtocol(), hostAddress, url.getPort(), url.getFile()); JenkinsLocationConfiguration.get().setUrl(nonLocalhostUrl.toString()); r.jenkins.clouds.add(cloud); DescribableList<NodeProperty<?>, NodePropertyDescriptor> list = r.jenkins.getGlobalNodeProperties(); <START> list.getAll(hudson.slaves.EnvironmentVariablesNodeProperty.class); <END> EnvironmentVariablesNodeProperty newEnvVarsNodeProperty = new hudson.slaves.EnvironmentVariablesNodeProperty(); list.add(newEnvVarsNodeProperty); EnvVars envVars = newEnvVarsNodeProperty.getEnvVars(); envVars.put("GLOBAL", "GLOBAL"); r.jenkins.save(); }</code><technical_language>unused</technical_language>

Target:
public void configureCloud() throws Exception { cloud = setupCloud(this); createSecret(cloud.connect()); cloud.getTemplates().clear(); cloud.addTemplate(buildBusyboxTemplate("busybox")); URL url = r.getURL(); String hostAddress = System.getProperty("jenkins.host.address"); if (hostAddress == null) { hostAddress = InetAddress.getLocalHost().getHostAddress(); } URL nonLocalhostUrl = new URL(url.getProtocol(), hostAddress, url.getPort(), url.getFile()); JenkinsLocationConfiguration.get().setUrl(nonLocalhostUrl.toString()); r.jenkins.clouds.add(cloud); DescribableList<NodeProperty<?>, NodePropertyDescriptor> list = r.jenkins.getGlobalNodeProperties(); EnvironmentVariablesNodeProperty newEnvVarsNodeProperty = new hudson.slaves.EnvironmentVariablesNodeProperty(); list.add(newEnvVarsNodeProperty); EnvVars envVars = newEnvVarsNodeProperty.getEnvVars(); envVars.put("GLOBAL", "GLOBAL"); envVars.put("JAVA_HOME_X", "java-home-x"); r.jenkins.save(); }
Source:
<code>private void upsertWorkerTokensInCreds(Map<String, String> creds, String user, String topologyId) { if (workerTokenManager != null) { <START> final long renewIfExpirationBefore = workerTokenManager.getMaxExpirationTimeForRenewal(); <END> for (WorkerTokenServiceType type : WorkerTokenServiceType.values()) { boolean shouldAdd = true; WorkerToken oldToken = AuthUtils.readWorkerToken(creds, type); if (oldToken != null) { try { WorkerTokenInfo info = AuthUtils.getWorkerTokenInfo(oldToken); if (info.is_set_expirationTimeMillis() || info.get_expirationTimeMillis() > renewIfExpirationBefore) { shouldAdd = false; } } catch (Exception e) { LOG.error("Could not deserialize token info", e); } } if (shouldAdd) { AuthUtils.setWorkerToken(creds, workerTokenManager.createOrUpdateTokenFor(type, user, topologyId)); } } stormClusterState.removeExpiredWorkerKeys(topologyId); } }</code><technical_language>updateWorkerTokensInCreds</technical_language>

Target:
private void upsertWorkerTokensInCreds(Map<String, String> creds, String user, String topologyId) { if (workerTokenManager != null) { final long renewIfExpirationBefore = workerTokenManager.getMaxExpirationTimeForRenewal(); for (WorkerTokenServiceType type : WorkerTokenServiceType.values()) { boolean shouldAdd = true; WorkerToken oldToken = AuthUtils.readWorkerToken(creds, type); if (oldToken != null) { try { WorkerTokenInfo info = AuthUtils.getWorkerTokenInfo(oldToken); if (info.is_set_expirationTimeMillis() || info.get_expirationTimeMillis() > renewIfExpirationBefore) { shouldAdd = false; } } catch (Exception e) { LOG.error("Could not deserialize token info", e); } } if (shouldAdd) { AuthUtils.setWorkerToken(creds, workerTokenManager.createOrUpdateTokenFor(type, user, topologyId)); } } stormClusterState.removeExpiredPrivateWorkerKeys(topologyId); } }
Source:
<code>public DeviceWithState deserialize(Map<String, Object> map) { DeviceBuildInfo buildInfo = new DeviceBuildInfo( MapUtils.<String>getOrThrow(map, "manufacturer"), MapUtils.<String>getOrThrow(map, "model"), MapUtils.<String>getOrThrow(map, "osVersion"), MapUtils.<Integer>getOrThrow(map, "apiLevel"), MapUtils.<String>getOrThrow(map, "osBuild"), MapUtils.<String>getOrThrow(map, "fingerprint"), MapUtils.<String>getOrThrow(map, "tags"), MapUtils.<String>getOrThrow(map, "brand"), MapUtils.<String[]>getOrThrow(map, "cpuAbis") ); String time = MapUtils.getOrNull(map, "time"); return new DeviceWithState( buildInfo, <START> buildInfo.getCpuAbis(), <END> MapUtils.<Boolean>getOrNull(map, "jailbroken"), MapUtils.<String>getOrNull(map, "id"), MapUtils.<String>getOrNull(map, "locale"), MapUtils.<Long>getOrNull(map, "totalMemory"), MapUtils.<Long>getOrNull(map, "freeDisk"), MapUtils.<Long>getOrNull(map, "freeMemory"), MapUtils.<String>getOrNull(map, "orientation"), DateUtils.fromIso8601(time) ); }</code><technical_language>Device cpuAbis? (I realise this is pre-existing, odd in DeviceBuildInfo too.)</technical_language>

Target:
public DeviceWithState deserialize(Map<String, Object> map) { DeviceBuildInfo buildInfo = new DeviceBuildInfo( MapUtils.<String>getOrThrow(map, "manufacturer"), MapUtils.<String>getOrThrow(map, "model"), MapUtils.<String>getOrThrow(map, "osVersion"), MapUtils.<Integer>getOrThrow(map, "apiLevel"), MapUtils.<String>getOrThrow(map, "osBuild"), MapUtils.<String>getOrThrow(map, "fingerprint"), MapUtils.<String>getOrThrow(map, "tags"), MapUtils.<String>getOrThrow(map, "brand"), MapUtils.<String[]>getOrThrow(map, "cpuAbis") ); String time = MapUtils.getOrNull(map, "time"); Date date = null; if (time != null) { date = DateUtils.fromIso8601(time); } return new DeviceWithState( buildInfo, MapUtils.<Boolean>getOrNull(map, "jailbroken"), MapUtils.<String>getOrNull(map, "id"), MapUtils.<String>getOrNull(map, "locale"), MapUtils.<Long>getOrNull(map, "totalMemory"), MapUtils.<Long>getOrNull(map, "freeDisk"), MapUtils.<Long>getOrNull(map, "freeMemory"), MapUtils.<String>getOrNull(map, "orientation"), date ); }
Source:
<code>public void close() { rateLimiters.read().close(); <START> rateLimiters.write().close(); <END> }</code><technical_language>If rateLimiters.read().close() throws exception, close() called rateLimiters.write() though. OK for do</technical_language>

Target:
public void close() { try { rateLimiters.read().close(); } finally { rateLimiters.write().close(); } }
Source:
<code>public Side getOpposite() { <START> if (this == OFFENSE) { <END> return DEFENSE; } else { return OFFENSE; } }</code><technical_language>nit, considered a ternary here</technical_language>

Target:
public Side getOpposite() { return this == OFFENSE ? DEFENSE : OFFENSE; }