auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void testParseString(String input, String scheme, String host, Integer port, String path, String param, String query, String fragment) throws Exception { HttpURI httpUri = HttpURI.from(input); try { new URI(input); assertThat("[" + input + "] expected path (test case) cannot be null", path, notNullValue()); assertThat("[" + input + "] .scheme", httpUri.getScheme(), is(scheme)); assertThat("[" + input + "] .host", httpUri.getHost(), is(host)); assertThat("[" + input + "] .port", httpUri.getPort(), is(port == null ? -1 : port)); assertThat("[" + input + "] .path", httpUri.getPath(), is(path)); assertThat("[" + input + "] .param", httpUri.getParam(), is(param)); assertThat("[" + input + "] .query", httpUri.getQuery(), is(query)); if (input.indexOf('#') >= 0) <START> input = input.substring(0, input.indexOf('#')); <END> assertThat("[" + input + "] .toString", httpUri.toString(), is(input)); } catch (URISyntaxException e) { assertThat("[" + input + "] .scheme", httpUri.getScheme(), is(nullValue())); assertThat("[" + input + "] .host", httpUri.getHost(), is(nullValue())); assertThat("[" + input + "] .port", httpUri.getPort(), is(-1)); assertThat("[" + input + "] .path", httpUri.getPath(), is(nullValue())); assertThat("[" + input + "] .param", httpUri.getParam(), is(nullValue())); assertThat("[" + input + "] .query", httpUri.getQuery(), is(nullValue())); } }</code><technical_language>Revert reverted fragment</technical_language>

Target:
public void testParseString(String input, String scheme, String host, Integer port, String path, String param, String query, String fragment) throws Exception { HttpURI httpUri = HttpURI.from(input); try { new URI(input); assertThat("[" + input + "] expected path (test case) cannot be null", path, notNullValue()); assertThat("[" + input + "] .scheme", httpUri.getScheme(), is(scheme)); assertThat("[" + input + "] .host", httpUri.getHost(), is(host)); assertThat("[" + input + "] .port", httpUri.getPort(), is(port == null ? -1 : port)); assertThat("[" + input + "] .path", httpUri.getPath(), is(path)); assertThat("[" + input + "] .param", httpUri.getParam(), is(param)); assertThat("[" + input + "] .query", httpUri.getQuery(), is(query)); assertThat("[" + input + "] .fragment", httpUri.getFragment(), is(fragment)); assertThat("[" + input + "] .toString", httpUri.toString(), is(input)); } catch (URISyntaxException e) { assertThat("[" + input + "] .scheme", httpUri.getScheme(), is(nullValue())); assertThat("[" + input + "] .host", httpUri.getHost(), is(nullValue())); assertThat("[" + input + "] .port", httpUri.getPort(), is(-1)); assertThat("[" + input + "] .path", httpUri.getPath(), is(nullValue())); assertThat("[" + input + "] .param", httpUri.getParam(), is(nullValue())); assertThat("[" + input + "] .query", httpUri.getQuery(), is(nullValue())); assertThat("[" + input + "] .fragment", httpUri.getFragment(), is(nullValue())); } }
Source:
<code>public List<EmailWrapper> generateFeedbackSessionClosingEmails(FeedbackSessionAttributes session) { List<StudentAttributes> students = new ArrayList<>(); boolean isEmailNeeded = fsLogic.isFeedbackSessionForStudentsToAnswer(session); if (isEmailNeeded) { List<StudentAttributes> studentsForCourse = studentsLogic.getStudentsForCourse(session.getCourseId()); for (StudentAttributes student : studentsForCourse) { try { if (!fsLogic.isFeedbackSessionFullyCompletedByStudent(session.getFeedbackSessionName(), session.getCourseId(), student.email)) { students.add(student); } } catch (EntityDoesNotExistException e) { log.severe("Course " + session.getCourseId() + " does not exist or " + "session " + session.getFeedbackSessionName() + " does not exist"); break; } } } String template = EmailTemplates.USER_FEEDBACK_SESSION_CLOSING <START> .replace("${status}", "is closing soon"); <END> CourseAttributes course = coursesLogic.getCourse(session.getCourseId()); List<InstructorAttributes> instructors = isEmailNeeded ? instructorsLogic.getInstructorsForCourse(session.getCourseId()) : new ArrayList<InstructorAttributes>(); return generateFeedbackSessionEmailBases(course, session, students, instructors, template, EmailType.FEEDBACK_CLOSING.getSubject()); }</code><technical_language>Extract "is closing soon" a constant</technical_language>

Target:
public List<EmailWrapper> generateFeedbackSessionClosingEmails(FeedbackSessionAttributes session) { List<StudentAttributes> students = new ArrayList<>(); boolean isEmailNeeded = fsLogic.isFeedbackSessionForStudentsToAnswer(session); if (isEmailNeeded) { List<StudentAttributes> studentsForCourse = studentsLogic.getStudentsForCourse(session.getCourseId()); for (StudentAttributes student : studentsForCourse) { try { if (!fsLogic.isFeedbackSessionFullyCompletedByStudent(session.getFeedbackSessionName(), session.getCourseId(), student.email)) { students.add(student); } } catch (EntityDoesNotExistException e) { log.severe("Course " + session.getCourseId() + " does not exist or " + "session " + session.getFeedbackSessionName() + " does not exist"); break; } } } String template = EmailTemplates.USER_FEEDBACK_SESSION_CLOSING .replace("${status}", FEEDBACK_STATUS_SESSION_CLOSING); CourseAttributes course = coursesLogic.getCourse(session.getCourseId()); List<InstructorAttributes> instructors = isEmailNeeded ? instructorsLogic.getInstructorsForCourse(session.getCourseId()) : new ArrayList<InstructorAttributes>(); return generateFeedbackSessionEmailBases(course, session, students, instructors, template, EmailType.FEEDBACK_CLOSING.getSubject()); }
Source:
<code>public void addConverter(ConverterDescriptor desc) { List<String> sMts = desc.getSourceMimeTypes(); String dMt = desc.getDestinationMimeType(); <START> List<ConvertOption> dco = dstMappings.computeIfAbsent(dMt, (key) -> new ArrayList<>()); <END> for (String sMT : sMts) { List<ConvertOption> sco = srcMappings.computeIfAbsent(sMT, (key) -> new ArrayList<>()); sco.add(new ConvertOption(desc.getConverterName(), dMt)); dco.add(new ConvertOption(desc.getConverterName(), sMT)); } log.debug("Added converter to {}", desc::getSourceMimeTypes, desc::getDestinationMimeType); }</code><technical_language>parenthesis parameter in a Java lambda</technical_language>

Target:
public void addConverter(ConverterDescriptor desc) { List<String> sMts = desc.getSourceMimeTypes(); String dMt = desc.getDestinationMimeType(); List<ConvertOption> dco = dstMappings.computeIfAbsent(dMt, key -> new ArrayList<>()); for (String sMT : sMts) { List<ConvertOption> sco = srcMappings.computeIfAbsent(sMT, key -> new ArrayList<>()); sco.add(new ConvertOption(desc.getConverterName(), dMt)); dco.add(new ConvertOption(desc.getConverterName(), sMT)); } log.debug("Added converter to {}", desc::getSourceMimeTypes, desc::getDestinationMimeType); }
Source:
<code>public Map<Long, ILogData> read(Iterable<Long> addresses) { Map<Long, ILogData> addressesMap = new HashMap<>(); if (!runtime.getParameters().isCacheDisabled()) { try { Set<Long> addressesToLoadFetch = new HashSet(); for(Long address : addresses) { ILogData val = readCache.getIfPresent(address); if (val == null) { <START> addressesToLoadFetch.add(address); <END> } else { addressesMap.put(address, val); } } if (!addressesToLoadFetch.isEmpty()) { Map<Long, ILogData> fetchedAddresses = this.cacheFetch(addressesToLoadFetch); for (Map.Entry<Long, ILogData> entry : fetchedAddresses.entrySet()) { addressesMap.put(entry.getKey(), readCache.asMap().computeIfAbsent(entry.getKey(), (k) -> entry.getValue())); } } return addressesMap; } catch (UncheckedExecutionException e) { Throwable cause = e.getCause(); if (cause instanceof RuntimeException) { throw (RuntimeException) cause; } else { throw new RuntimeException(cause); } } } else { addressesMap = this.cacheFetch(addresses); } for (ILogData logData : addressesMap.values()) { if (logData.isTrimmed()) { throw new TrimmedException(); } } return addressesMap; }</code><technical_language>s/HashSet()/HashSet<>()</technical_language>

Target:
public Map<Long, ILogData> read(Iterable<Long> addresses) { if (!runtime.getParameters().isCacheDisabled()) { Map<Long, ILogData> result = new HashMap<>(); Set<Long> addressesToFetch = new HashSet<>(); for (Long address : addresses) { ILogData val = readCache.getIfPresent(address); if (val == null) { addressesToFetch.add(address); } else { result.put(address, val); } } if (!addressesToFetch.isEmpty()) { Map<Long, ILogData> fetchedAddresses = fetchAll(addressesToFetch); for (Map.Entry<Long, ILogData> entry : fetchedAddresses.entrySet()) { result.put(entry.getKey(), readCache.asMap() .computeIfAbsent(entry.getKey(), (k) -> entry.getValue())); } } return result; } else { return fetchAll(addresses); } }
Source:
<code>public void process(CommandLine cl, @SuppressWarnings("rawtypes") Map stormConf) throws Exception { String appName = cl.getOptionValue("appname", "Storm-on-Yarn"); String queue = cl.getOptionValue("queue", "default"); String schedulerAddr = cl.getOptionValue("schedulerAddr"); String yarnRMaddr_str = cl.getOptionValue("rmAddr"); InetSocketAddress yarnRMaddr = null; if (yarnRMaddr_str != null) yarnRMaddr = NetUtils.createSocketAddr(yarnRMaddr_str); String storm_zip_location = cl.getOptionValue("stormZip"); Integer amSize = (Integer) stormConf.get(Config.MASTER_SIZE_MB); if (amSize == null) { amSize = 4096; } StormOnYarn storm = null; try { LOG.debug("yarnRMaddr:"+yarnRMaddr); LOG.debug("appName:"+appName); storm = StormOnYarn.launchApplication(yarnRMaddr, schedulerAddr, appName, queue, amSize, stormConf, storm_zip_location); LOG.debug("Submitted application's ID:" + storm.getAppId()); String output = cl.getOptionValue("output"); PrintStream os = (output!=null? new PrintStream(output) : System.out); os.println(storm.getAppId()); <START> if (output != null) os.close(); <END> } finally { if (storm != null) { storm.stop(); } } }</code><technical_language>Closing System.out is a good idea. Java output exception stack traces bubble top of stack if System.out is closed. flush of written is out, worry closing it</technical_language>

Target:
public void process(CommandLine cl, @SuppressWarnings("rawtypes") Map stormConf) throws Exception { String appName = cl.getOptionValue("appname", "Storm-on-Yarn"); String queue = cl.getOptionValue("queue", "default"); String storm_zip_location = cl.getOptionValue("stormZip"); Integer amSize = (Integer) stormConf.get(Config.MASTER_SIZE_MB); if (amSize == null) { amSize = 4096; } StormOnYarn storm = null; try { storm = StormOnYarn.launchApplication(appName, queue, amSize, stormConf, storm_zip_location); LOG.debug("Submitted application's ID:" + storm.getAppId()); String output = cl.getOptionValue("output"); if (output == null) System.out.println(storm.getAppId()); else { PrintStream os = new PrintStream(output); os.println(storm.getAppId()); os.flush(); os.close(); } } finally { if (storm != null) { storm.stop(); } } }
Source:
<code>void closeSocket() { if (closeSocketAsync) { <START> new Thread(new Runnable() { <END> @Override public void run() { closeSock(); } }).start(); } else { closeSock(); } }</code><technical_language>giving a meaningful name thread making a daemon thread</technical_language>

Target:
void closeSocket() { if (sock != null) { if (sockBeingClosed.compareAndSet(false, true)) { if (closeSocketAsync) { final Thread closingThread = new Thread(() -> closeSockSync(), "CloseSocketThread(sid:" + zk.getServerId()); closingThread.setDaemon(true); closingThread.start(); } else { closeSockSync(); } } } }
Source:
<code>protected void onStart() throws PluginStartupException { try { <START> addPath(Info.PATHS.PATH_DEVICES_FOLDER + System.getProperty("file.separator") + "marytts/lib/" + VOICE_JAR_FILE); <END> System.setProperty("mary.base", Info.PATHS.PATH_DEVICES_FOLDER + System.getProperty("file.separator") + "marytts"); marytts = new LocalMaryInterface(); getInfo(); defaultVoice = Voice.getVoice("cmu-slt-hsmm"); } catch (MaryConfigurationException ex) { throw new PluginStartupException("Plugin can't start for " + ex.getMessage()); } catch (Exception ex) { LOG.log(Level.SEVERE, "Impossible to modify classpath for ''{0}''", Freedomotic.getStackTraceInfo(ex)); } }</code><technical_language>lib folder plugin classpath, is working? this work OS file.separator hardcode file separator in next piece of string "/". Pass a File instance build path</technical_language>

Target:
protected void onStart() throws PluginStartupException { try { addPath(Info.PATHS.PATH_DEVICES_FOLDER + System.getProperty("file.separator") + "marytts" + System.getProperty("file.separator") + "lib" + System.getProperty("file.separator") + VOICE_JAR_FILE); System.setProperty("mary.base", Info.PATHS.PATH_DEVICES_FOLDER + System.getProperty("file.separator") + "marytts"); marytts = new LocalMaryInterface(); LOG.log(Level.INFO, "Available voices: ''{0}''", marytts.getAvailableVoices()); LOG.log(Level.INFO, "Available languages: ''{0}''", marytts.getAvailableLocales()); defaultVoice = Voice.getVoice("cmu-slt-hsmm"); } catch (MaryConfigurationException ex) { throw new PluginStartupException("Plugin can't start for a configuration problem.", ex); } catch (Exception ex) { LOG.log(Level.SEVERE, "Impossible to modify classpath to add voice file ''{0}''", VOICE_JAR_FILE); } }
Source:
<code>protected RemoteOperationResult run(OwnCloudClient client) { RemoteOperationResult result = null; String path = mFile.getRemotePath(); if (mFile.isFolder()) { path = path.substring(0, path.length()-1); } OCShare share = getStorageManager().getShareByPath(path); if (share != null) { UnshareLinkRemoteOperation operation = new UnshareLinkRemoteOperation((int) share.getIdRemoteShared()); result = operation.execute(client); if (result.isSuccess()) { Log_OC.d(TAG, "Share id = " + share.getIdRemoteShared() + " deleted"); mFile.setShareByLink(false); mFile.setPublicLink(""); getStorageManager().saveFile(mFile); getStorageManager().removeShare(share); } } else { <START> result = new RemoteOperationResult(ResultCode.FILE_NOT_FOUND); <END> } return result; }</code><technical_language>a specific ResultCode for this one, SHARE_NOT_FOUND, LOCAL_SHARE_NOT_FOUND</technical_language>

Target:
protected RemoteOperationResult run(OwnCloudClient client) { RemoteOperationResult result = null; String path = mFile.getRemotePath(); if (mFile.isFolder()) { path = path.substring(0, path.length()-1); } OCShare share = getStorageManager().getShareByPath(path); if (share != null) { RemoveRemoteShareOperation operation = new RemoveRemoteShareOperation((int) share.getIdRemoteShared()); result = operation.execute(client); if (result.isSuccess() || result.getCode() == ResultCode.SHARE_NOT_FOUND) { Log_OC.d(TAG, "Share id = " + share.getIdRemoteShared() + " deleted"); mFile.setShareByLink(false); mFile.setPublicLink(""); getStorageManager().saveFile(mFile); getStorageManager().removeShare(share); if (result.getCode() == ResultCode.SHARE_NOT_FOUND) { if (existsFile(client, mFile.getRemotePath())) { result = new RemoteOperationResult(ResultCode.OK); } else { getStorageManager().removeFile(mFile, true, true); } } } } else { result = new RemoteOperationResult(ResultCode.SHARE_NOT_FOUND); } return result; }
Source:
<code>public void truncate(long index) { if (index >= getLastIndex()) { return; } lastEntry = null; try { this.index.truncate(index); if (index < segment.index()) { channel.position(JournalSegmentDescriptor.BYTES); memory.clear(); <START> for (int i = 0; i < memory.limit(); i++) { <END> memory.put(i, (byte) 0); } channel.write(memory); channel.position(JournalSegmentDescriptor.BYTES); } else { reset(index); long position = channel.position(); memory.clear(); for (int i = 0; i < memory.limit(); i++) { memory.put(i, (byte) 0); } channel.write(memory); channel.position(position); } } catch (IOException e) { throw new StorageException(e); } }</code><technical_language>utility method</technical_language>

Target:
public void truncate(long index) { if (index >= getLastIndex()) { return; } lastEntry = null; try { this.index.truncate(index); if (index < segment.index()) { channel.position(JournalSegmentDescriptor.BYTES); channel.write(zero()); channel.position(JournalSegmentDescriptor.BYTES); } else { reset(index); long position = channel.position(); channel.write(zero()); channel.position(position); } } catch (IOException e) { throw new StorageException(e); } }
Source:
<code>private static void addPamCrops() { if (!Loader.isModLoaded("harvestcraft")) return; try { ClassLoader loader = HarvestHandlerPlantable.class.getClassLoader(); String className = "com.pam.harvestcraft.blocks.CropRegistry"; Class<?> registry = ReflectionHelper.getClass(loader, className); Field names = ReflectionHelper.findField(registry, "cropNames"); Method getCrop = registry.getMethod("getCrop", String.class); for (String name : (String[])names.get(null)) { Block crop = (Block) getCrop.invoke(null, name); HarvestRegistry.registerStandardCrop(crop, 3); } } catch (NoSuchMethodException e) { <START> FMLLog.warning("HarvestCraft integration cancelled; unable to find crop name mapper"); <END> return; } catch (IllegalAccessException e) { FMLLog.warning("HarvestCraft integration cancelled; crop name lookup broke"); return; } catch (InvocationTargetException e) { FMLLog.warning("HarvestCraft integration cancelled; crop name lookup broke"); return; } catch (ReflectionHelper.UnableToFindClassException e) { FMLLog.warning("HarvestCraft integration cancelled; unable to find crop registry"); return; } catch (ReflectionHelper.UnableToFindFieldException e) { FMLLog.warning("HarvestCraft integration cancelled; unable to find crop names in registry"); return; } }</code><technical_language>I BloodMagic.instance.getLogger()</technical_language>

Target:
private static void addPamCrops() { if (!Loader.isModLoaded("harvestcraft")) return; try { ClassLoader loader = HarvestHandlerPlantable.class.getClassLoader(); String className = "com.pam.harvestcraft.blocks.CropRegistry"; Class<?> registry = ReflectionHelper.getClass(loader, className); Field names = ReflectionHelper.findField(registry, "cropNames"); Method getCrop = registry.getMethod("getCrop", String.class); for (String name : (String[])names.get(null)) { BlockCrops crop = (BlockCrops) getCrop.invoke(null, name); HarvestRegistry.registerStandardCrop(crop, crop.getMaxAge()); } } catch (NoSuchMethodException e) { BloodMagic.instance.getLogger().error("HarvestCraft integration cancelled; unable to find crop name mapper"); return; } catch (IllegalAccessException e) { BloodMagic.instance.getLogger().error("HarvestCraft integration cancelled; crop name lookup broke"); return; } catch (InvocationTargetException e) { BloodMagic.instance.getLogger().error("HarvestCraft integration cancelled; crop name lookup broke"); return; } catch (ReflectionHelper.UnableToFindClassException e) { BloodMagic.instance.getLogger().error("HarvestCraft integration cancelled; unable to find crop registry"); return; } catch (ReflectionHelper.UnableToFindFieldException e) { BloodMagic.instance.getLogger().error("HarvestCraft integration cancelled; unable to find crop names in registry"); return; } }
Source:
<code>private CacheConfiguration cacheConfiguration(int cacheIdx) { return new CacheConfiguration(CACHE_NAME + cacheIdx) .setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL) .setCacheMode(CacheMode.REPLICATED) .setBackups(0) <START> .setRebalanceDelay(Long.MAX_VALUE); <END> }</code><technical_language>RebalanceMode.None deprecated in Mvcc mode only. So, change in tests affect non-mvcc scenarios. If is set proper mode if MvccFeatureChecker.forceMvcc() == true? rewrite rebalance mode in MvccProcessor do for Transactional atomicity mode</technical_language>

Target:
private CacheConfiguration cacheConfiguration(int cacheIdx) { CacheConfiguration ccfg = new CacheConfiguration(CACHE_NAME + cacheIdx) .setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL) .setCacheMode(CacheMode.REPLICATED) .setBackups(0); if (MvccFeatureChecker.forcedMvcc()) ccfg.setRebalanceDelay(Long.MAX_VALUE); else ccfg.setRebalanceMode(CacheRebalanceMode.NONE); return ccfg; }
Source:
<code><START> public void setUuid(String Uuid) { <END> this.Uuid = Uuid; }</code><technical_language>adding a param constructor for this</technical_language>

Target:
public void setUuid(String Uuid) { this.uuid = Uuid; }
Source:
<code>private void delete(String projectName, OpenShiftClient osClient) throws InfrastructureException { try { osClient.projects().withName(projectName).delete(); } catch (KubernetesClientException e) { <START> if (e.getCode() == 404) { <END> LOG.warn( format( "Tried to delete project '%s' but it doesn't exist in the cluster.", projectName), e); } else { throw new KubernetesInfrastructureException(e); } } }</code><technical_language>OpenShift returns 404. I guess returns 403 project removing terminating</technical_language>

Target:
private void delete(String projectName, OpenShiftClient osClient) throws InfrastructureException { try { osClient.projects().withName(projectName).delete(); } catch (KubernetesClientException e) { if (e.getCode() == 404) { LOG.warn( format( "Tried to delete project '%s' but it doesn't exist in the cluster.", projectName), e); } else if (e.getCode() == 409) { LOG.info(format("The project '%s' is currently being deleted.", projectName), e); } else { throw new KubernetesInfrastructureException(e); } } }
Source:
<code>public CompletionStage<MemcacheStatus> set(String key, V value, int ttl, long cas) { checkNotNull(value); final byte[] valueBytes = valueTranscoder.encode(value); byte[] byteKey = encodeKey(key, charset, maxKeyLength); SetRequest request = SetRequest.casSet(byteKey, valueBytes, ttl, cas); CompletionStage<MemcacheStatus> future = rawMemcacheClient.send(request); metrics.measureSetFuture(future); <START> tracer.span("folsom.set", future, "set", key); <END> return future; }</code><technical_language>If need do explicit propagation this like... java public CompletionStage<MemcacheStatus> set(String key, V value, int ttl, long cas, Span span) { ... tracer.span("folsom.set", future, "set", key, span);</technical_language>

Target:
public CompletionStage<MemcacheStatus> set(String key, V value, int ttl, long cas) { checkNotNull(value); final byte[] valueBytes = valueTranscoder.encode(value); byte[] byteKey = encodeKey(key, charset, maxKeyLength); SetRequest request = SetRequest.casSet(byteKey, valueBytes, ttl, cas); CompletionStage<MemcacheStatus> future = rawMemcacheClient.send(request); metrics.measureSetFuture(future); tracer.span("folsom.set", future, "set", key, valueBytes); return future; }
Source:
<code>public static String[] getMyanmarMonthsArray(int myanmarYear) { if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { return MyanmarDateKernel .getMyanmarMonth(myanmarYear, 1) <START> .getMonthNameList(new LanguageCatalog(Language.MYANMAR)) <END> .toArray(new String[0]); } else { return MyanmarDateKernel .getMyanmarMonth(myanmarYear, 1) .getMonthNameList(new LanguageCatalog(Language.ENGLISH)) .toArray(new String[0]); } }</code><technical_language>this part depends os version (Language.MYANMAR Language.ENGLISH) I factor out a method return Language based os version call here</technical_language>

Target:
public static String[] getMyanmarMonthsArray(int myanmarYear) { return MyanmarDateKernel .getMyanmarMonth(myanmarYear, 1) .getMonthNameList(getLanguageCatalog()) .toArray(new String[0]); }
Source:
<code>protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Mapbox.getInstance(this, getString(R.string.access_token)); setContentView(R.layout.activity_snapshot_share); cameraFab = findViewById(R.id.camera_share_snapshot_image_fab); cameraFab.setImageResource(R.drawable.ic_camera); hasStartedSnapshotGeneration = false; mapView = findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); mapView.getMapAsync(new OnMapReadyCallback() { @Override public void onMapReady(@NonNull final MapboxMap mapboxMap) { mapboxMap.setStyle(Style.SATELLITE_STREETS, new Style.OnStyleLoaded() { @Override public void onStyleLoaded(@NonNull Style style) { <START> SnapshotShareActivity.this.mapboxMap = mapboxMap; <END> cameraFab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (!hasStartedSnapshotGeneration) { hasStartedSnapshotGeneration = true; Toast.makeText(SnapshotShareActivity.this, R.string.loading_snapshot_image, Toast.LENGTH_LONG).show(); startSnapShot( mapboxMap.getProjection().getVisibleRegion().latLngBounds, mapView.getMeasuredHeight(), mapView.getMeasuredWidth()); } } }); } }); StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder(); StrictMode.setVmPolicy(builder.build()); } }); }</code><technical_language>move this line onMapReady() calling mapboxMap.setStyle()</technical_language>

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Mapbox.getInstance(this, getString(R.string.access_token)); setContentView(R.layout.activity_snapshot_share); cameraFab = findViewById(R.id.camera_share_snapshot_image_fab); cameraFab.setImageResource(R.drawable.ic_camera); hasStartedSnapshotGeneration = false; mapView = findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); mapView.getMapAsync(new OnMapReadyCallback() { @Override public void onMapReady(@NonNull final MapboxMap mapboxMap) { SnapshotShareActivity.this.mapboxMap = mapboxMap; mapboxMap.setStyle(Style.SATELLITE_STREETS, new Style.OnStyleLoaded() { @Override public void onStyleLoaded(@NonNull Style style) { cameraFab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (!hasStartedSnapshotGeneration) { hasStartedSnapshotGeneration = true; Toast.makeText(SnapshotShareActivity.this, R.string.loading_snapshot_image, Toast.LENGTH_LONG).show(); startSnapShot( mapboxMap.getProjection().getVisibleRegion().latLngBounds, mapView.getMeasuredHeight(), mapView.getMeasuredWidth()); } } }); } }); StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder(); StrictMode.setVmPolicy(builder.build()); } }); }
Source:
<code>protected boolean doStatusCheck(ClouderaManagerPollerObject pollerObject, CommandsResourceApi commandsResourceApi) throws ApiException { ApiClient apiClient = pollerObject.getApiClient(); Stack stack = pollerObject.getStack(); ApiParcelList parcels = getClouderaManagerParcels(apiClient, stack.getName()); List<ApiParcel> existedParcels = getExistedParcels(parcelVersion, parcels); if (existedParcels.isEmpty()) { LOGGER.debug("Parcels are deleted succesfully."); return true; <START> } else { <END> LOGGER.debug("Some parcels are not yet deleted: [{}].", getJoinedParcelStages(existedParcels)); return false; } }</code><technical_language>upgrade stuck for checking deleted parcels Some parcels deleted: [(CDH 7.2.1-1.cdh7.2.1.p0.4763198 : AVAILABLE_REMOTELY)]. checking if empty, for me, shows AVAILABLE_REMOTELY UI. consider this deleted well</technical_language>

Target:
protected boolean doStatusCheck(ClouderaManagerPollerObject pollerObject, CommandsResourceApi commandsResourceApi) throws ApiException { ApiClient apiClient = pollerObject.getApiClient(); Stack stack = pollerObject.getStack(); ApiParcelList parcels = getClouderaManagerParcels(apiClient, stack.getName()); List<ApiParcel> existedParcels = collectExistingParcels(parcels); if (existedParcels.isEmpty()) { LOGGER.debug("Parcels are deleted succesfully."); return true; } else { LOGGER.debug("Some parcels are not yet deleted: [{}].", getJoinedParcelStages(existedParcels)); return false; } }
Source:
<code>public void testMultipleContainersAtTheSameTimeShouldNotThrowException() throws Exception { List<String> strings = new Container(); strings.add( "" ); Set<ConstraintViolation<Foo>> constraintViolations = validator.validate( new Foo( strings ) ); <START> assertNoViolations( constraintViolations ); <END> }</code><technical_language>I try in case violations. Otherwise, difficult if is working all</technical_language>

Target:
public void testMultipleContainersAtTheSameTimeShouldNotThrowException() throws Exception { List<String> strings = new Container(); strings.add( "" ); strings.add( null ); Set<ConstraintViolation<Foo>> constraintViolations = validator.validate( new Foo( strings ) ); assertThat( constraintViolations ).containsOnlyViolations( violationOf( NotNull.class ).withMessage( "must not be null" ) ); }
Source:
<code><START> public void testInsertTaskWithStartAndDueMovedForward() <END> { RowSnapshot<TaskLists> taskList = new VirtualRowSnapshot<>(new LocalTaskListsTable(mAuthority)); RowSnapshot<Tasks> task = new VirtualRowSnapshot<>(new TaskListScoped(taskList, new TasksTable(mAuthority))); DateTime start = DateTime.now(); DateTime due = start.addDuration(new Duration(1, 1, 0)); Duration duration = new Duration(1, 2, 0); DateTime startNew = start.addDuration(duration); DateTime dueNew = due.addDuration(duration); assertThat(new Seq<>( new Put<>(taskList, new EmptyRowData<TaskLists>()), new Put<>(task, new TimeData(start, due)), new Put<>(task, new TimeData(startNew, dueNew)) ), resultsIn(mClient, new Assert<>(task, new TimeData(startNew, dueNew)), new AssertRelated<>(new InstanceTable(mAuthority), Instances.TASK_ID, task, new AllOf( new EqArg(Instances.INSTANCE_START, startNew.getTimestamp()), new EqArg(Instances.INSTANCE_ORIGINAL_TIME, startNew.getTimestamp()), new EqArg(Instances.INSTANCE_DUE, dueNew.getTimestamp()), new EqArg(Instances.INSTANCE_START_SORTING, startNew.getInstance()), new EqArg(Instances.INSTANCE_DUE_SORTING, dueNew.getInstance()), new EqArg(Instances.INSTANCE_DURATION, dueNew.getTimestamp() - startNew.getTimestamp()), new EqArg(Tasks.TZ, start.isAllDay() ? "UTC" : start.getTimeZone().getID()) )) )); }</code><technical_language>2/3 of tests fail for me, including this one, with: java.lang.AssertionError: android.content.OperationApplicationException: wrong number of rows: 0 Do pass for you</technical_language>

Target:
public void testInsertTaskWithStartAndDueMovedForward() { RowSnapshot<TaskLists> taskList = new VirtualRowSnapshot<>(new LocalTaskListsTable(mAuthority)); RowSnapshot<Tasks> task = new VirtualRowSnapshot<>(new TaskListScoped(taskList, new TasksTable(mAuthority))); DateTime start = DateTime.now(); DateTime due = start.addDuration(new Duration(1, 1, 0)); Duration duration = new Duration(1, 2, 0); DateTime startNew = start.addDuration(duration); DateTime dueNew = due.addDuration(duration); assertThat(new Seq<>( new Put<>(taskList, new EmptyRowData<TaskLists>()), new Put<>(task, new TimeData(start, due)), new Put<>(task, new TimeData(startNew, dueNew)) ), resultsIn(mClient, new Assert<>(task, new TimeData(startNew, dueNew)), new AssertRelated<>(new InstanceTable(mAuthority), Instances.TASK_ID, task, new AllOf( new EqArg(Instances.INSTANCE_START, startNew.getTimestamp()), new EqArg(Instances.INSTANCE_ORIGINAL_TIME, startNew.getTimestamp()), new EqArg(Instances.INSTANCE_DUE, dueNew.getTimestamp()), new EqArg(Instances.INSTANCE_START_SORTING, startNew.shiftTimeZone(TimeZone.getDefault()).getInstance()), new EqArg(Instances.INSTANCE_DUE_SORTING, dueNew.shiftTimeZone(TimeZone.getDefault()).getInstance()), new EqArg(Instances.INSTANCE_DURATION, dueNew.getTimestamp() - startNew.getTimestamp()), new EqArg(Tasks.TZ, start.isAllDay() ? "UTC" : start.getTimeZone().getID()) )) )); }
Source:
<code>public void testUpdate() throws Exception { for (String regionId : regions) { UpdateCDNContainerOptions opts = new UpdateCDNContainerOptions(); opts.ttl(1234567); opts.logRetention(true); opts.enabled(false); assertTrue(api.cdnApiInRegion(regionId).update(name, opts)); CDNContainer container = api.cdnApiInRegion(regionId).get(name); assertEquals(container.getTtl(), 1234567); assertTrue(container.isLogRetentionEnabled()); <START> assertFalse(container.isEnabled()); <END> } }</code><technical_language>testing update verifying of values change? I guess intention, rename test</technical_language>

Target:
public void testUpdate() throws Exception { for (String regionId : regions) { assertNotNull(api.cdnApiInRegion(regionId).enable(name, 777777)); CDNContainer original = api.cdnApiInRegion(regionId).get(name); assertTrue(original.isEnabled()); assertCDNContainerNotNull(original); UpdateCDNContainerOptions opts = new UpdateCDNContainerOptions() .ttl(1234567) .logRetention(true) .enabled(false); assertTrue(api.cdnApiInRegion(regionId).update(name, opts)); CDNContainer updated = api.cdnApiInRegion(regionId).get(name); assertFalse(updated.isEnabled()); assertCDNContainerNotNull(updated); assertNotEquals(original.getTtl(), updated.getTtl()); assertTrue(updated.isLogRetentionEnabled()); } }
Source:
<code>public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == RC_CHOOSE_PHOTO) { <START> if (resultCode == ResultCodes.OK) { <END> Uri selectedImage = data.getData(); uploadPhoto(selectedImage); } else { Toast.makeText(this, "No image chosen", Toast.LENGTH_SHORT).show(); } } }</code><technical_language>This IntelliJ refactor bug, in this case I AuthUI I want if Camera returned Activity.RESULT_OK</technical_language>

Target:
public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == RC_CHOOSE_PHOTO) { if (resultCode == RESULT_OK) { Uri selectedImage = data.getData(); uploadPhoto(selectedImage); } else { Toast.makeText(this, "No image chosen", Toast.LENGTH_SHORT).show(); } } }
Source:
<code>public static Archive<?> deploy_charset() { WebArchive war = TestUtil.prepareArchive(DefaultCharsetTest.class.getSimpleName() + "_true"); war.addAsWebInfResource(DefaultCharsetTest.class.getPackage(), "DefaultCharsetTestWeb_true.xml", "web.xml"); <START> System.out.println(war.toString(true)); <END> return TestUtil.finishContainerPrepare(war, null, DefaultCharsetResource.class); }</code><technical_language>a major problem, get rid of System.out? :-)</technical_language>

Target:
public static Archive<?> deploy_charset() { WebArchive war = TestUtil.prepareArchive(DefaultCharsetTest.class.getSimpleName() + "_true"); war.addAsWebInfResource(DefaultCharsetTest.class.getPackage(), "DefaultCharsetTestWeb_true.xml", "web.xml"); return TestUtil.finishContainerPrepare(war, null, DefaultCharsetResource.class); }
Source:
<code>static void sendAllScheduled() { TIMER.cancel(); if (ENABLED) { for (Event event : QUEUE) { <START> send(event); <END> } QUEUE = new ArrayList<>(); } }</code><technical_language>IIRC new platform allows send multiple events in a batch. do way, instead of making 128 separate network calls</technical_language>

Target:
static synchronized void sendAllScheduled() { TIMER.cancel(); if (ENABLED) { send(QUEUE); QUEUE.clear(); } }
Source:
<code>public void sign(@NonNull CommitBuilder commit, String gpgSigningKey, @NonNull PersonIdent committer) { if (gpgSigningKey == null || gpgSigningKey.isEmpty()) { gpgSigningKey = committer.getEmailAddress(); } BouncyCastleGpgKeyLocator keyHelper = <START> END> new BouncyCastleGpgKeyLocator(gpgSigningKey); try { PGPSecretKey secretKey = keyHelper.findSecretKey(); CharArrayType passphrase = keyHelper.getCachedPassphrase(); PGPPrivateKey privateKey = secretKey .extractPrivateKey(new JcePBESecretKeyDecryptorBuilder() .setProvider(BouncyCastleProvider.PROVIDER_NAME) .build(passphrase.getValue())); PGPSignatureGenerator signatureGenerator = new PGPSignatureGenerator( new JcaPGPContentSignerBuilder( secretKey.getPublicKey().getAlgorithm(), HashAlgorithmTags.SHA256).setProvider( BouncyCastleProvider.PROVIDER_NAME)); signatureGenerator.init(PGPSignature.BINARY_DOCUMENT, privateKey); ByteArrayOutputStream buffer = new ByteArrayOutputStream(); try (ArmoredOutputStream aOut = new ArmoredOutputStream(buffer); BCPGOutputStream bOut = new BCPGOutputStream(aOut)) { signatureGenerator.update(commit.build()); signatureGenerator.generate().encode(bOut); } commit.setGpgSignature(new GpgSignature(buffer.toByteArray())); } catch (PGPException | IOException e) { throw new JGitInternalException(e.getMessage(), e); } finally { if (keyHelper.getCachedPassphrase() != null) { keyHelper.getCachedPassphrase().clear(); } } }</code><technical_language>avoid manual formatting</technical_language>

Target:
public void sign(@NonNull CommitBuilder commit, String gpgSigningKey, @NonNull PersonIdent committer) { if (gpgSigningKey == null || gpgSigningKey.isEmpty()) { gpgSigningKey = committer.getEmailAddress(); } BouncyCastleGpgKeyLocator keyHelper = new BouncyCastleGpgKeyLocator( gpgSigningKey); try { PGPSecretKey secretKey = keyHelper.findSecretKey(); CharArrayType passphrase = keyHelper.getCachedPassphrase(); PGPPrivateKey privateKey = secretKey .extractPrivateKey(new JcePBESecretKeyDecryptorBuilder() .setProvider(BouncyCastleProvider.PROVIDER_NAME) .build(passphrase.getValue())); PGPSignatureGenerator signatureGenerator = new PGPSignatureGenerator( new JcaPGPContentSignerBuilder( secretKey.getPublicKey().getAlgorithm(), HashAlgorithmTags.SHA256).setProvider( BouncyCastleProvider.PROVIDER_NAME)); signatureGenerator.init(PGPSignature.BINARY_DOCUMENT, privateKey); ByteArrayOutputStream buffer = new ByteArrayOutputStream(); try (BCPGOutputStream out = new BCPGOutputStream( new ArmoredOutputStream(buffer))) { signatureGenerator.update(commit.build()); signatureGenerator.generate().encode(out); } commit.setGpgSignature(new GpgSignature(buffer.toByteArray())); } catch (PGPException | IOException e) { throw new JGitInternalException(e.getMessage(), e); } finally { if (keyHelper.getCachedPassphrase() != null) { keyHelper.getCachedPassphrase().clear(); } } }
Source:
<code>default void check() { if (meshProxy().isPresent()) { <START> checkArgument(maxNumRetries() == 0, "If meshProxy is configured then maxNumRetries must be 0"); <END> } }</code><technical_language>I some constraints target URI? (e.g., one? one?)</technical_language>

Target:
default void check() { if (meshProxy().isPresent()) { checkArgument(maxNumRetries() == 0, "If meshProxy is configured then maxNumRetries must be 0"); checkArgument(uris().size() == 1, "If meshProxy is configured then uris must contain exactly 1 URI"); } }
Source:
<code>public static String toHex(byte[] byteArray) { <START> return StringUtil.byteArray2HexString(byteArray); <END> }</code><technical_language>A slightly behavior. a null parameter (byteArray) raises NPE, return null</technical_language>

Target:
public static String toHex(byte[] byteArray) { return StringUtil.byteArray2Hex(byteArray); }
Source:
<code>public void shutdown() throws InterruptedException { logger.debug("shutdown the fetcher " + getName()); <START> interrupt(); <END> shutdownLatch.await(5, TimeUnit.SECONDS); }</code><technical_language>client.shutdown()</technical_language>

Target:
public void shutdown() throws InterruptedException { logger.debug("shutdown the fetcher " + getName()); client.shutdown(); }
Source:
<code>public void testToJsonOnInstance() throws IOException { checkToJson(new Function<Statistics, String>() { @Override public String apply(Statistics t) { try { return t.toJson(); } catch (IOException e) { <START> e.printStackTrace(); <END> } return null; } }); }</code><technical_language>assert fail</technical_language>

Target:
public void testToJsonOnInstance() throws IOException { checkToJson(new Function<Statistics, String>() { @Override public String apply(Statistics t) { try { return t.toJson(); } catch (JsonProcessingException e) { Assert.fail(e.toString()); } return null; } }); }
Source:
<code>private boolean useProtocolV2() { <START> return Objects.equals(transferConfig.protocolVersion, <END> ProtocolVersion.V2) && clientRequestedV2; }</code><technical_language>Optional: written ProtocolVersion.V2.equals(transferConfig.protocolVersion), ProtocolVersion.V2 is null</technical_language>

Target:
private boolean useProtocolV2() { return ProtocolVersion.V2.equals(transferConfig.protocolVersion) && clientRequestedV2; }
Source:
<code>public boolean shouldCheckSpelling(DocDisplay dd, Range r) { String word = dd.getTextForRange(r); if (r.getEnd().getColumn() - r.getStart().getColumn() > 250) return false; Scope s = ((AceEditor)dd).getScopeAtPosition(r.getStart()); if (s.isYaml()) return false; String line = dd.getLine(r.getStart().getRow()); <START> Pattern p = Pattern.create("\\\\(?:documentclass|usepackage|newcounter|setcounter|addtocounter|value|arabic|stepcounter|newenvironment|renewenvironment|ref|vref|eqref|pageref|label|cite[a-zA-Z]*|tag|begin|end|bibitem).*{.*" + word + ".*}"); <END> if (p.test(line)) return false; return true; }</code><technical_language>Is a reasonable pull this pattern out of highlight rules instead of duplicating it? clear this keyword scope list applies -- this is for TeX (a) apply other modes (b) capture keywords in more common types Roxygen (e.g. \code)</technical_language>

Target:
public boolean shouldCheckSpelling(DocDisplay dd, Range r) { String word = dd.getTextForRange(r); if (r.getEnd().getColumn() - r.getStart().getColumn() > 250) return false; Scope s = ((AceEditor)dd).getScopeAtPosition(r.getStart()); if (s.isYaml()) return false; int start = r.getStart().getColumn(); int end = start + word.length(); String line = dd.getLine(r.getStart().getRow()); Pattern p = Pattern.create("\\{[^\\{\\}]*" + word + "[^\\{\\}]*\\}"); Match m = p.match(line, 0); while (m != null) { if (m.getIndex() < start && (m.getIndex() + m.getValue().length()) > end) return false; m = m.nextMatch(); } return true; }
Source:
<code>public void processRecord(ComputationContext context, String inputStreamName, Record record) { <START> System.out.println(metadata.name() + " GOT A RECORD: " + record); <END> context.produceRecord("o1", record); context.askForCheckpoint(); }</code><technical_language>replaced a log</technical_language>

Target:
public void processRecord(ComputationContext context, String inputStreamName, Record record) { log.warn(metadata.name() + " got record: " + record); context.produceRecord("o1", record); context.askForCheckpoint(); }
Source:
<code>public void run() { setPriority(Thread.NORM_PRIORITY); try { while ((currentJob = pool.startJob(this)) != null) { IStatus result = Status.OK_STATUS; try { if (CANCEL_CHECK_ACTIVATED) { CancelCheckMonitor pm = new CancelCheckMonitor(currentJob.getProgressMonitor()); currentJob.setProgressMonitor(pm); result = currentJob.run(pm.willStart()); pm.hasStopped(); <START> IStatus citizenshipStatus = checkCancel(currentJob, pm); <END> if (!citizenshipStatus.isOK()) { RuntimeLog.log(citizenshipStatus); } } else { result = currentJob.run(currentJob.getProgressMonitor()); } } catch (OperationCanceledException e) { result = Status.CANCEL_STATUS; } catch (Exception e) { result = handleException(currentJob, e); } catch (ThreadDeath e) { result = handleException(currentJob, e); throw e; } catch (Error e) { result = handleException(currentJob, e); } finally { Thread.interrupted(); if (result == null) result = handleException(currentJob, new NullPointerException()); pool.endJob(currentJob, result); currentJob = null; setPriority(Thread.NORM_PRIORITY); } } } catch (Throwable t) { RuntimeLog.log(new Status(IStatus.ERROR, JobManager.PI_JOBS, JobManager.PLUGIN_ERROR, "Unhandled error", t)); } finally { currentJob = null; pool.endWorker(this); } }</code><technical_language>citizenshipStatus? Do cancelStatus</technical_language>

Target:
public void run() { setPriority(Thread.NORM_PRIORITY); try { while ((currentJob = pool.startJob(this)) != null) { IStatus result = Status.OK_STATUS; try { if (CANCEL_CHECK_ACTIVATED) { CancelCheckMonitor pm = new CancelCheckMonitor(currentJob.getProgressMonitor()); currentJob.setProgressMonitor(pm); result = currentJob.run(pm.willStart()); pm.hasStopped(); IStatus cancelStatus = checkCancel(currentJob, pm); if (!cancelStatus.isOK()) { RuntimeLog.log(cancelStatus); } } else { result = currentJob.run(currentJob.getProgressMonitor()); } } catch (OperationCanceledException e) { result = Status.CANCEL_STATUS; } catch (Exception e) { result = handleException(currentJob, e); } catch (ThreadDeath e) { result = handleException(currentJob, e); throw e; } catch (Error e) { result = handleException(currentJob, e); } finally { Thread.interrupted(); if (result == null) result = handleException(currentJob, new NullPointerException()); pool.endJob(currentJob, result); currentJob = null; setPriority(Thread.NORM_PRIORITY); } } } catch (Throwable t) { RuntimeLog.log(new Status(IStatus.ERROR, JobManager.PI_JOBS, JobManager.PLUGIN_ERROR, "Unhandled error", t)); } finally { currentJob = null; pool.endWorker(this); } }
Source:
<code>private void deleteWorkingDirectory(ModelRunStatus modelRunStatus) { if (modelRunStatus.equals(ModelRunStatus.COMPLETED) && !dryRun) { try { FileUtils.deleteDirectory(workingDirectoryPath.toFile()); } catch (IOException e) { logger.error(String.format(LOG_COULD_NOT_DELETE_WORKSPACE_DIR, workingDirectoryPath.toAbsolutePath())); } } else if (dryRun) { <START> logger.info(String.format(LOG_NOT_DELETED_WORKSPACE_DIR_DRY_RUN, workingDirectoryPath.toAbsolutePath())); <END> } else { logger.warn(String.format(LOG_NOT_DELETED_WORKSPACE_DIR, workingDirectoryPath.toAbsolutePath())); } }</code><technical_language>get effect moving this if clause first. remove "&& !dryRun"</technical_language>

Target:
private void deleteWorkingDirectory(ModelRunStatus modelRunStatus) { if (dryRun) { logger.info(String.format(LOG_NOT_DELETED_WORKSPACE_DIR_DRY_RUN, workingDirectoryPath.toAbsolutePath())); } else if (!modelRunStatus.equals(ModelRunStatus.COMPLETED)) { logger.warn(String.format(LOG_NOT_DELETED_WORKSPACE_DIR, workingDirectoryPath.toAbsolutePath())); } else { try { FileUtils.deleteDirectory(workingDirectoryPath.toFile()); } catch (IOException e) { logger.error(String.format(LOG_COULD_NOT_DELETE_WORKSPACE_DIR, workingDirectoryPath.toAbsolutePath())); } } }
Source:
<code>private void createClient() { Client client = Clients.builder() .setOrgUrl("https://{yourOktaDomain}") <START> .setClientCredentials(new TokenClientCredentials("yourApiToken")) <END> .build(); }</code><technical_language>{apiToken} <LINK_1></technical_language>

Target:
private void createClient() { Client client = Clients.builder() .setOrgUrl("https://{yourOktaDomain}") .setClientCredentials(new TokenClientCredentials("{apiToken}")) .build(); }
Source:
<code>private void storeConfigInCoordinatorStream() { MetadataStore metadataStore = null; try { createCoordinatorStream(); MetadataStoreFactory metadataStoreFactory = Util.getObj(new JobConfig(config).getMetadataStoreFactory(), MetadataStoreFactory.class); <START> metadataStore = metadataStoreFactory.getMetadataStore(CONFIG_TYPE, config, new MetricsRegistryMap()); <END> metadataStore.init(); CoordinatorStreamValueSerde jsonSerde = new CoordinatorStreamValueSerde(CONFIG_TYPE); for (Map.Entry<String, String> entry : config.entrySet()) { byte[] serializedValue = jsonSerde.toBytes(entry.getValue()); metadataStore.put(entry.getKey(), serializedValue); } } finally { if (metadataStore != null) { LOG.info("Stopping the coordinator system producer."); metadataStore.close(); } } }</code><technical_language>pass a valid MetricsRegistry</technical_language>

Target:
private void storeConfigInCoordinatorStream() { MetadataStore metadataStore = null; try { createCoordinatorStream(); MetadataStoreFactory metadataStoreFactory = Util.getObj(new JobConfig(config).getMetadataStoreFactory(), MetadataStoreFactory.class); metadataStore = metadataStoreFactory.getMetadataStore(SetConfig.TYPE, config, metrics.getMetricsRegistry()); metadataStore.init(); CoordinatorStreamValueSerde jsonSerde = new CoordinatorStreamValueSerde(SetConfig.TYPE); for (Map.Entry<String, String> entry : config.entrySet()) { byte[] serializedValue = jsonSerde.toBytes(entry.getValue()); metadataStore.put(entry.getKey(), serializedValue); } } finally { if (metadataStore != null) { LOG.info("Stopping the coordinator system producer."); metadataStore.close(); } } }