auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void diffAssignmentNodes(Map<String, List<DatastreamTask>> assignmentsByInstance, Map<String, Set<String>> nodesToRemove, Map<String, Set<String>> nodesToAdd) { for (String instance : assignmentsByInstance.keySet()) { Set<String> assignmentsNames = assignmentsByInstance.get(instance) .stream() .map(DatastreamTask::getDatastreamTaskName) .collect(Collectors.toSet()); Set<String> oldAssignmentNames = new HashSet<>(getInstanceAssignment(instance)); Set<String> removed = new HashSet<>(oldAssignmentNames); removed.removeAll(assignmentsNames); nodesToRemove.put(instance, removed); Set<String> added = new HashSet<>(assignmentsNames); added.removeAll(oldAssignmentNames); nodesToAdd.put(instance, added); } }

Target:
private void diffAssignmentNodes(Map<String, List<DatastreamTask>> assignmentsByInstance, Map<String, Set<String>> nodesToRemove, Map<String, Set<String>> nodesToAdd) { for (String instance : assignmentsByInstance.keySet()) { Set<String> assignmentsNames = assignmentsByInstance.get(instance) .stream() .map(DatastreamTask::getDatastreamTaskName) .collect(Collectors.toSet()); List<String> oldAssignmentNames = getInstanceAssignment(instance); Set<String> removed = new HashSet<>(oldAssignmentNames); removed.removeAll(assignmentsNames); nodesToRemove.put(instance, removed); Set<String> added = new HashSet<>(assignmentsNames); added.removeAll(oldAssignmentNames); nodesToAdd.put(instance, added); } }
Source:
protected void executeQueryCommand() { List<GlusterServerService> serviceList = null; if(getParameters().getServiceType() == null) { serviceList = getGlusterServerServiceDao().getByClusterId(getParameters().getId()); } else { serviceList = getGlusterServerServiceDao().getByClusterIdAndServiceType(getParameters().getId(), getParameters().getServiceType()); } if(serviceList != null && serviceList.size() > 0) { getQueryReturnValue().setReturnValue(serviceList); } }

Target:
protected void executeQueryCommand() { List<GlusterServerService> serviceList = null; if(getParameters().getServiceType() == null) { serviceList = getGlusterServerServiceDao().getByClusterId(getParameters().getId()); } else { serviceList = getGlusterServerServiceDao().getByClusterIdAndServiceType(getParameters().getId(), getParameters().getServiceType()); } getQueryReturnValue().setReturnValue(serviceList); }
Source:
public void testInvalidatingSessionDestroysAllLongRunningConversations() throws Exception { WebClient client = new WebClient(); client.getPage(getPath("/resetSequence", null)); TextPage firstConversation = client.getPage(getPath("/begin", null)); String content = firstConversation.getContent(); String firstCid = getCid(content); assertTrue(content.contains("message: Hello") && content.contains("transient: false")); TextPage secondConversation = client.getPage(getPath("/begin", null)); content = secondConversation.getContent(); assertTrue(content.contains("message: Hello") && content.contains("transient: false")); String secondCid = getCid(content); assertFalse(firstCid.equals(secondCid)); client.getPage(getPath("/invalidateSession", secondCid)); TextPage sequence = client.getPage(getPath("/getSequence", null)); String result = sequence.getContent().trim(); ActionSequence.reset(); ActionSequence.addAction("conversationCreated"); ActionSequence.addAction("conversationCreated"); ActionSequence.addAction("beforeInvalidate"); ActionSequence.addAction("afterInvalidate"); ActionSequence.addAction("conversationDestroyed"); ActionSequence.addAction("conversationDestroyed"); assertEquals(result, ActionSequence.getSequence().dataToCsv()); }

Target:
public void testInvalidatingSessionDestroysAllLongRunningConversations() throws Exception { WebClient client = new WebClient(); String firstCid = beginConversation(client, true); String secondCid = beginConversation(client, false); assertFalse(firstCid.equals(secondCid)); client.getPage(getPath("/invalidateSession", secondCid)); TextPage sequence = client.getPage(getPath("/getSequence", null)); String result = sequence.getContent().trim(); ActionSequence.reset(); ActionSequence.addAction(CONVERSATION_CREATED); ActionSequence.addAction(CONVERSATION_CREATED); ActionSequence.addAction(BEFORE_INVALIDATE); ActionSequence.addAction(AFTER_INVALIDATE); ActionSequence.addAction(CONVERSATION_DESTROYED); ActionSequence.addAction(CONVERSATION_DESTROYED); assertEquals(result, ActionSequence.getSequence().dataToCsv()); }
Source:
LRESULT wmChar (long hwnd, long wParam, long lParam) { if (ignoreCharacter) return null; LRESULT result = super.wmChar (hwnd, wParam, lParam); if (result != null) return result; switch ((int) wParam) { case SWT.TAB: return LRESULT.ZERO; case SWT.CR: if (!ignoreDefaultSelection) sendSelectionEvent (SWT.DefaultSelection); ignoreDefaultSelection = false; if (getSelectionIndex() == -1) { if ((style & SWT.DROP_DOWN) != 0 && (style & SWT.READ_ONLY) == 0) { if (OS.SendMessage(handle, OS.CB_GETDROPPEDSTATE, 0, 0) != 0) { OS.SendMessage(handle, OS.CB_SHOWDROPDOWN, 0, 0); } return LRESULT.ZERO; } } case SWT.ESC: if ((style & SWT.DROP_DOWN) != 0) { if (OS.SendMessage (handle, OS.CB_GETDROPPEDSTATE, 0, 0) == 0) { return LRESULT.ZERO; } } case SWT.DEL: if (OS.GetKeyState (OS.VK_CONTROL) < 0) { if ((style & SWT.READ_ONLY) != 0) return LRESULT.ZERO; Point selection = getSelection (); long hwndText = OS.GetDlgItem (handle, CBID_EDIT); int x = selection.x; int y = selection.y; if (x == y) { String actText = getText ().substring (0, getCaretPosition ()); java.util.regex.Matcher m = Text.CTRL_BS_PATTERN.matcher (actText); if (m.find ()) { x = m.start (); y = m.end (); OS.SendMessage (hwndText, OS.EM_SETSEL, x, y); } } if (x < y) { OS.SendMessage (hwndText, OS.EM_REPLACESEL, 1, 0); } return LRESULT.ZERO; } } return result; }

Target:
LRESULT wmChar (long hwnd, long wParam, long lParam) { if (ignoreCharacter) return null; LRESULT result = super.wmChar (hwnd, wParam, lParam); if (result != null) return result; switch ((int) wParam) { case SWT.TAB: return LRESULT.ZERO; case SWT.CR: if (!ignoreDefaultSelection) sendSelectionEvent (SWT.DefaultSelection); ignoreDefaultSelection = false; if (getSelectionIndex() == -1) { if ((style & SWT.DROP_DOWN) != 0 && (style & SWT.READ_ONLY) == 0) { if (OS.SendMessage(handle, OS.CB_GETDROPPEDSTATE, 0, 0) != 0) { OS.SendMessage(handle, OS.CB_SHOWDROPDOWN, 0, 0); } return LRESULT.ZERO; } } case SWT.ESC: if ((style & SWT.DROP_DOWN) != 0) { if (OS.SendMessage (handle, OS.CB_GETDROPPEDSTATE, 0, 0) == 0) { return LRESULT.ZERO; } } case SWT.DEL: if (OS.GetKeyState (OS.VK_CONTROL) < 0) { if ((style & SWT.READ_ONLY) != 0) return LRESULT.ZERO; Point selection = getSelection (); long hwndText = OS.GetDlgItem (handle, CBID_EDIT); int x = selection.x; int y = selection.y; if (x == y) { String actText = getText ().substring (0, getCaretPosition ()); java.util.regex.Matcher m = CTRL_BS_PATTERN.matcher (actText); if (m.find ()) { x = m.start (); y = m.end (); OS.SendMessage (hwndText, OS.EM_SETSEL, x, y); } } if (x < y) { OS.SendMessage (hwndText, OS.EM_REPLACESEL, 1, 0); } return LRESULT.ZERO; } } return result; }
Source:
private @Nullable ITmfTrace put(String path, String name, String typeID) throws TmfTraceException, InstantiationException, IllegalAccessException, CoreException, FileNotFoundException, TmfTraceImportException { List<TraceTypeHelper> traceTypes = TmfTraceType.selectTraceType(path, typeID); if (traceTypes.isEmpty()) { throw new FileNotFoundException(); } IResource resource = getResource(path); TraceTypeHelper helper = traceTypes.get(0); ITmfTrace trace = helper.getTraceClass().newInstance(); trace.initTrace(resource, path, ITmfEvent.class, name, typeID); trace.indexTrace(false); TmfSignalManager.dispatchSignal(new TmfTraceOpenedSignal(this, trace, null)); return trace; }

Target:
private static ITmfTrace put(String path, String name, String typeID) throws TmfTraceException, InstantiationException, IllegalAccessException, CoreException, FileNotFoundException, TmfTraceImportException { List<TraceTypeHelper> traceTypes = TmfTraceType.selectTraceType(path, typeID); if (traceTypes.isEmpty()) { throw new FileNotFoundException(); } IResource resource = getResource(path); TraceTypeHelper helper = traceTypes.get(0); ITmfTrace trace = helper.getTraceClass().newInstance(); trace.initTrace(resource, path, ITmfEvent.class, name, typeID); return trace; }
Source:
private void assertInitialization() { if (initialized) { return; } LOG.log(Level.INFO, "Waiting for router to be initialized"); try { Thread.sleep(INITIALIZATION_TIMEOUT_MS); if (!initialized) { throw new RuntimeException("Fail to initialize the router"); } } catch (final InterruptedException e) { LOG.log(Level.WARNING, "Interrupted while waiting for router to be initialized", e); } }

Target:
private void assertInitialization() { if (initialized) { return; } LOG.log(Level.INFO, "Waiting {0} ms for router to be initialized", INITIALIZATION_TIMEOUT_MS); try { Thread.sleep(INITIALIZATION_TIMEOUT_MS); if (!initialized) { throw new RuntimeException("Fail to initialize the router"); } } catch (final InterruptedException e) { LOG.log(Level.WARNING, "Interrupted while waiting for router to be initialized", e); } }
Source:
private static Tracer createTracer(OxdServerConfiguration configuration, String componentName) { String tracerName = configuration.getTracer(); Tracer tracer = null; if (!configuration.getEnableTracing() || Strings.isNullOrEmpty(tracerName)) { tracer = NoopTracerFactory.create(); } else if ("jaeger".equals(tracerName)) { Configuration.SamplerConfiguration samplerConfig = new Configuration.SamplerConfiguration() .withType(ConstSampler.TYPE) .withParam(1); Configuration.SenderConfiguration senderConfig = new Configuration.SenderConfiguration() .withAgentHost(configuration.getTracerHost()) .withAgentPort(configuration.getTracerPort()); Configuration.ReporterConfiguration reporterConfig = new Configuration.ReporterConfiguration() .withLogSpans(true) .withFlushInterval(1000) .withMaxQueueSize(10000) .withSender(senderConfig); tracer = new Configuration(componentName) .withSampler(samplerConfig) .withReporter(reporterConfig) .getTracer(); } else if ("zipkin".equals(tracerName)) { OkHttpSender sender = OkHttpSender.create( "http://" + configuration.getTracerHost() + ":" + configuration.getTracerPort() + "/api/v1/spans"); Reporter<Span> reporter = AsyncReporter.builder(sender).build(); tracer = BraveTracer.create(Tracing.newBuilder() .localServiceName(componentName) .spanReporter(reporter) .build()); } else { tracer = NoopTracerFactory.create(); } return tracer; }

Target:
private static Tracer createTracer(OxdServerConfiguration configuration, String componentName) { String tracerName = configuration.getTracer(); if (!configuration.getEnableTracing() || Strings.isNullOrEmpty(tracerName)) { return NoopTracerFactory.create(); } else if ("jaeger".equals(tracerName)) { Configuration.SamplerConfiguration samplerConfig = new Configuration.SamplerConfiguration() .withType(ConstSampler.TYPE) .withParam(1); Configuration.SenderConfiguration senderConfig = new Configuration.SenderConfiguration() .withAgentHost(configuration.getTracerHost()) .withAgentPort(configuration.getTracerPort()); Configuration.ReporterConfiguration reporterConfig = new Configuration.ReporterConfiguration() .withLogSpans(true) .withFlushInterval(1000) .withMaxQueueSize(10000) .withSender(senderConfig); return new Configuration(componentName) .withSampler(samplerConfig) .withReporter(reporterConfig) .getTracer(); } else if ("zipkin".equals(tracerName)) { OkHttpSender sender = OkHttpSender.create( "http://" + configuration.getTracerHost() + ":" + configuration.getTracerPort() + "/api/v1/spans"); Reporter<Span> reporter = AsyncReporter.builder(sender).build(); return BraveTracer.create(Tracing.newBuilder() .localServiceName(componentName) .spanReporter(reporter) .build()); } else { return NoopTracerFactory.create(); } }
Source:
EmbeddedElasticsearchNode() { try { elasticsearchDirectory = File.createTempFile("elasticsearch-test", Long.toString(System.nanoTime())); elasticsearchDirectory.delete(); elasticsearchDirectory.mkdir(); } catch (IOException e) { throw new UncheckedIOException(e); } String clusterName = "test"; Settings setting = Settings.builder() .put("cluster.name", clusterName) .put("path.home", elasticsearchDirectory.getPath()) .put("path.data", new File(elasticsearchDirectory, "data").getAbsolutePath()) .put("path.logs", new File(elasticsearchDirectory, "logs").getAbsolutePath()) .put("transport.type.default", "local") .put("transport.type", "netty4") .put("http.type", "netty4") .put("http.enabled", "true") .put("path.home", "elasticsearch-test-data") .build(); node = new ElasticsearchNode(setting, Arrays.asList(Netty4Plugin.class)); }

Target:
EmbeddedElasticsearchNode() { try { elasticsearchDirectory = File.createTempFile("elasticsearch", "test"); elasticsearchDirectory.delete(); elasticsearchDirectory.mkdir(); } catch (IOException e) { throw new UncheckedIOException(e); } Settings setting = Settings.builder() .put("cluster.name", "test") .put("path.home", elasticsearchDirectory.getPath()) .put("path.data", new File(elasticsearchDirectory, "data").getAbsolutePath()) .put("path.logs", new File(elasticsearchDirectory, "logs").getAbsolutePath()) .put("transport.type.default", "local") .put("transport.type", "netty4") .put("http.type", "netty4") .put("http.enabled", "true") .put("path.home", "elasticsearch-test-data") .build(); node = new ElasticsearchNode(setting, ImmutableList.of(Netty4Plugin.class)); }
Source:
public static List<String> propertyToList(String propertyName) { String name = System.getProperty(propertyName); if (name == null) { return null; } return Arrays.asList(name.split(",")); }

Target:
public static Optional<List<String>> propertyToList(String propertyName) { String name = System.getProperty(propertyName); if (name == null) { return Optional.empty(); } else if (name.isEmpty()) { return Optional.of(emptyList()); } return Optional.of(Arrays.asList(name.trim().split("\\s*,\\s*"))); }
Source:
public void testCompute() { MagicKey key = new MagicKey(cache(0, cacheName)); cache(1, cacheName).put(key, "a"); cache(2, cacheName).compute(key, (k, v) -> v + "b"); InternalCacheEntry<Object, Object> ice = cache(2, cacheName).getAdvancedCache().getDataContainer().get(key); assertNotNull(ice); assertEquals("ab", ice.getValue()); assertOwnershipAndNonOwnership(key, false); }

Target:
public void testCompute() { MagicKey key = new MagicKey(cache(0, cacheName)); cache(1, cacheName).put(key, "a"); assertEquals("ab", cache(2, cacheName).compute(key, (k, v) -> v + "b")); assertLocalValue(0, key, "ab"); assertLocalValue(1, key, "a"); assertLocalValue(2, key, "ab"); assertOwnershipAndNonOwnership(key, false); assertEquals("abc", cache(0, cacheName).compute(key, (k, v) -> v + "c")); assertLocalValue(0, key, "abc"); assertOwnershipAndNonOwnership(key, false); assertEquals(null, cache(1, cacheName).compute(key, (k, v) -> "abc".equals(v) ? null : "unexpected")); assertLocalValue(0, key, null); assertLocalValue(1, key, null); assertLocalValue(2, key, "ab"); assertOwnershipAndNonOwnership(key, false); MagicKey otherKey = new MagicKey(cache(0, cacheName)); assertEquals("x", cache(1, cacheName).compute(otherKey, (k, v) -> v == null ? "x" : "unexpected")); assertLocalValue(0, otherKey, "x"); assertLocalValue(1, otherKey, "x"); assertNoLocalValue(2, otherKey); assertOwnershipAndNonOwnership(otherKey, false); assertEquals(null, cache(0, cacheName).compute(otherKey, (k, v) -> "x".equals(v) ? null : "unexpected")); assertLocalValue(0, otherKey, null); assertLocalValue(1, otherKey, null); assertNoLocalValue(2, otherKey); assertOwnershipAndNonOwnership(otherKey, false); assertEquals("y", cache(0, cacheName).compute(otherKey, (k, v) -> v == null ? "y" : "unexpected")); assertLocalValue(0, otherKey, "y"); assertOwnershipAndNonOwnership(otherKey, false); }
Source:
public void setUp() throws IOException { conf = new Configuration(); conf.setInt("tfile.fs.input.buffer.size", tconf.fsInputBufferSize); conf.setInt("tfile.fs.output.buffer.size", tconf.fsOutputBufferSize); path = new Path(ROOT, "/tmp/dtfile"); fs = path.getFileSystem(conf); timer = new NanoTimer(false); rng = new Random(); keyLenGen = new RandomDistribution.Zipf(new Random(rng.nextLong()), tconf.minKeyLen, tconf.maxKeyLen, 1.2); RandomDistribution.DiscreteRNG valLenGen = new RandomDistribution.Flat(new Random(rng.nextLong()), tconf.minValLength, tconf.maxValLength); RandomDistribution.DiscreteRNG wordLenGen = new RandomDistribution.Flat(new Random(rng.nextLong()), tconf.minWordLen, tconf.maxWordLen); kvGen = new KVGenerator(rng, true, keyLenGen, valLenGen, wordLenGen, tconf.dictSize); }

Target:
public void setUp() throws IOException { conf = new Configuration(); conf.setInt("tfile.fs.input.buffer.size", tconf.fsInputBufferSize); conf.setInt("tfile.fs.output.buffer.size", tconf.fsOutputBufferSize); path = new Path(ROOT, "dtfile"); fs = path.getFileSystem(conf); timer = new NanoTimer(false); rng = new Random(); keyLenGen = new RandomDistribution.Zipf(new Random(rng.nextLong()), tconf.minKeyLen, tconf.maxKeyLen, 1.2); RandomDistribution.DiscreteRNG valLenGen = new RandomDistribution.Flat(new Random(rng.nextLong()), tconf.minValLength, tconf.maxValLength); RandomDistribution.DiscreteRNG wordLenGen = new RandomDistribution.Flat(new Random(rng.nextLong()), tconf.minWordLen, tconf.maxWordLen); kvGen = new KVGenerator(rng, true, keyLenGen, valLenGen, wordLenGen, tconf.dictSize); }
Source:
private static void printEnvironment() { if (fPrintedEnvironment) { return; } Rectangle bounds = Display.getDefault().getBounds(); System.out.println("Display size: " + bounds.width + "x" + bounds.height); String osVersion = System.getProperty("os.version"); if (osVersion != null) { System.out.println("OS version=" + osVersion); } String gtkVersion = System.getProperty("org.eclipse.swt.internal.gtk.version"); if (osVersion != null) { System.out.println("GTK version=" + gtkVersion); String overlayScrollbar = System.getenv("LIBOVERLAY_SCROLLBAR"); if (overlayScrollbar != null) { System.out.println("LIBOVERLAY_SCROLLBAR=" + overlayScrollbar); } String ubuntuMenuProxy = System.getenv("UBUNTU_MENUPROXY"); if (overlayScrollbar != null) { System.out.println("UBUNTU_MENUPROXY=" + ubuntuMenuProxy); } } fPrintedEnvironment = true; }

Target:
private static void printEnvironment() { if (fPrintedEnvironment) { return; } Rectangle bounds = Display.getDefault().getBounds(); System.out.println("Display size: " + bounds.width + "x" + bounds.height); String osVersion = System.getProperty("os.version"); if (osVersion != null) { System.out.println("OS version=" + osVersion); } String gtkVersion = System.getProperty("org.eclipse.swt.internal.gtk.version"); if (gtkVersion != null) { System.out.println("GTK version=" + gtkVersion); String overlayScrollbar = System.getenv("LIBOVERLAY_SCROLLBAR"); if (overlayScrollbar != null) { System.out.println("LIBOVERLAY_SCROLLBAR=" + overlayScrollbar); } String ubuntuMenuProxy = System.getenv("UBUNTU_MENUPROXY"); if (overlayScrollbar != null) { System.out.println("UBUNTU_MENUPROXY=" + ubuntuMenuProxy); } } fPrintedEnvironment = true; }
Source:
public void verifyLightboxImage() { waitForElementByElement(imageContainer); PageObjectLogging.log("verifyLightboxImage", "Verify lightbox image appeared", true); }

Target:
public void verifyLightboxImage() { waitForElementByElement(imageContainer); PageObjectLogging.log("verifyLightboxImage", "Lightbox image appeared", true); }
Source:
public int getLogLevel() { return Integer.parseInt(allowedLogLevelVariables[0]); }

Target:
public int getLogLevel() { return numericValue; }
Source:
public Include(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { super(stack); this.req = req; this.res = res; defaultEncoding = "UTF-8"; usePageEncoding = false; }

Target:
public Include(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { super(stack); this.req = req; this.res = res; useResponseEncoding = false; }
Source:
public void onActivityResult(int requestCode, int resultCode, final Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == ACTIVITY_REQUEST_DESCRIPTION_EDIT && resultCode == RESULT_OK) { if (!Prefs.shouldShowSuggestedEditsSurvey()) { FeedbackUtil.showMessage(this, getString(R.string.description_edit_success_saved_image_caption_in_lang_snackbar, app.language().getAppLanguageLocalizedName(StringUtils.defaultString(targetLanguageCode, app.language().getAppLanguageCode())))); } layOutGalleryDescription(); setResult(ACTIVITY_RESULT_IMAGE_CAPTION_ADDED); } }

Target:
public void onActivityResult(int requestCode, int resultCode, final Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == ACTIVITY_REQUEST_DESCRIPTION_EDIT && resultCode == RESULT_OK) { FeedbackUtil.showMessage(this, getString(R.string.description_edit_success_saved_image_caption_in_lang_snackbar, app.language().getAppLanguageLocalizedName(StringUtils.defaultString(targetLanguageCode, app.language().getAppLanguageCode())))); layOutGalleryDescription(); setResult(ACTIVITY_RESULT_IMAGE_CAPTION_ADDED); } }
Source:
protected void onHandleIntent(Intent intent) { if(isNetworkAvailable()) { List<Patient> patientList = new PatientDAO().getAllPatients(); final ListIterator<Patient> it = patientList.listIterator(); while (it.hasNext()) { final Patient patient=it.next(); if(patient.getUuid()==null || patient.getUuid().equals(" ")) { syncPatient(patient); } } } else { notifier.notify("No internet connection. Patient Registration data is saved locally " + "and will sync when internet connection is restored. "); } }

Target:
protected void onHandleIntent(Intent intent) { if(isNetworkAvailable()) { List<Patient> patientList = new PatientDAO().getAllPatients(); final ListIterator<Patient> it = patientList.listIterator(); while (it.hasNext()) { final Patient patient=it.next(); if(!patient.isSynced()) { syncPatient(patient); } } } else { notifier.notify("No internet connection. Patient Registration data is saved locally " + "and will sync when internet connection is restored. "); } }
Source:
public AddressSpaceView(@Nonnull final CorfuRuntime runtime) { super(runtime); CacheBuilder cacheBuilder = CacheBuilder.newBuilder(); if (runtime.getParameters().getMaxCacheEntries() != 0) { cacheBuilder.maximumSize(runtime.getParameters().getMaxCacheEntries()); } if (runtime.getParameters().getMaxCacheWeight() != 0) { cacheBuilder.maximumWeight(runtime.getParameters().getMaxCacheWeight()); cacheBuilder.weigher((k, v) -> (int) (MetricsUtils.sizeOf.deepSizeOf(k) + MetricsUtils.sizeOf.deepSizeOf(v))); } readCache = cacheBuilder.expireAfterAccess(runtime.getParameters().getCacheExpiryTime(), TimeUnit.SECONDS) .expireAfterWrite(runtime.getParameters().getCacheExpiryTime(), TimeUnit.SECONDS) .removalListener(this::handleEviction) .recordStats() .build(); MetricRegistry metrics = CorfuRuntime.getDefaultMetrics(); final String pfx = String.format("%s0x%x.cache.", CorfuComponent.ADDRESS_SPACE_VIEW.toString(), this.hashCode()); metrics.register(pfx + "cache-size", (Gauge<Long>) readCache::size); metrics.register(pfx + "evictions", (Gauge<Long>) () -> readCache.stats().evictionCount()); metrics.register(pfx + "hit-rate", (Gauge<Double>) () -> readCache.stats().hitRate()); metrics.register(pfx + "hits", (Gauge<Long>) () -> readCache.stats().hitCount()); metrics.register(pfx + "misses", (Gauge<Long>) () -> readCache.stats().missCount()); }

Target:
public AddressSpaceView(@Nonnull final CorfuRuntime runtime) { super(runtime); CacheBuilder cacheBuilder = CacheBuilder.newBuilder(); long maxCacheEntries = runtime.getParameters().getMaxCacheEntries(); long maxCacheWeight = runtime.getParameters().getMaxCacheWeight(); if (maxCacheEntries != 0) { cacheBuilder.maximumSize(runtime.getParameters().getMaxCacheEntries()); } if (maxCacheWeight != 0) { cacheBuilder.maximumWeight(runtime.getParameters().getMaxCacheWeight()); cacheBuilder.weigher((k, v) -> (int) (cacheKeySize + MetricsUtils.sizeOf.deepSizeOf(v))); } if (maxCacheEntries == 0 && maxCacheWeight == 0) { cacheBuilder.maximumSize(defaultMaxCacheEntries); } readCache = cacheBuilder.expireAfterAccess(runtime.getParameters().getCacheExpiryTime(), TimeUnit.SECONDS) .expireAfterWrite(runtime.getParameters().getCacheExpiryTime(), TimeUnit.SECONDS) .removalListener(this::handleEviction) .recordStats() .build(); MetricRegistry metrics = CorfuRuntime.getDefaultMetrics(); final String pfx = String.format("%s0x%x.cache.", CorfuComponent.ADDRESS_SPACE_VIEW.toString(), this.hashCode()); metrics.register(pfx + "cache-size", (Gauge<Long>) readCache::size); metrics.register(pfx + "evictions", (Gauge<Long>) () -> readCache.stats().evictionCount()); metrics.register(pfx + "hit-rate", (Gauge<Double>) () -> readCache.stats().hitRate()); metrics.register(pfx + "hits", (Gauge<Long>) () -> readCache.stats().hitCount()); metrics.register(pfx + "misses", (Gauge<Long>) () -> readCache.stats().missCount()); }
Source:
void resetButtons() { for (int i = 0; i < fieldSize; i++) for (int j = 0; j < fieldSize; j++) arrayOfButtons[i][j].setGraphic(new ImageView(imageEmpty)); field.resetLogic(); }

Target:
void resetButtons() { for (int i = 0; i < fieldSize; i++) for (int j = 0; j < fieldSize; j++) { arrayOfButtons[i][j].setGraphic(new ImageView(imageEmpty)); } field.resetLogic(); }
Source:
public Menus buildMenuBar() { return MenuFactory .newTopLevelMenu(translationService.getTranslation(LibraryConstants.AssetSearch)).position(MenuPosition.RIGHT).respondsWith(() -> placeManager.goTo("FindForm")) .endMenu() .build(); }

Target:
public Menus buildMenuBar() { return MenuFactory .newTopLevelMenu(translationService.getTranslation(LibraryConstants.AssetSearch)) .position(MenuPosition.RIGHT) .respondsWith(() -> { final PlaceRequest placeRequest = new DefaultPlaceRequest(LibraryPlaces.ASSET_SEARCH); final PartDefinition part = new PartDefinitionImpl(placeRequest); part.setSelectable(false); placeManager.goTo(part, getRootPanel()); }) .endMenu() .build(); }
Source:
@Override public int hashCode() { int result = (value != +0.0f ? Float.floatToIntBits(value) : 0); result = 31 * result + type.hashCode(); result = 31 * result + publisher.hashCode(); return result; }

Target:
public int hashCode() { return Objects.hash(value, type, publisher); }
Source:
protected URIExtensionIV createInlineIV(URI uri) { if (namespaceIV == null) { return null; } for (String prefix : normalizedPrefixes) { if (uri.stringValue().startsWith(prefix)) { AbstractLiteralIV localNameIv = next.createInlineIV(uri.stringValue().substring( CommonValues.VIAF_HTTP.length())); if (localNameIv == null) { return null; } return new URIExtensionIV(localNameIv, namespaceIV); } } return next.createInlineIV(uri); }

Target:
protected URIExtensionIV createInlineIV(URI uri) { if (namespaceIV == null) { return null; } for (String prefix : normalizedPrefixes) { if (uri.stringValue().startsWith(prefix)) { AbstractLiteralIV localNameIv = next.createInlineIV(uri.stringValue().substring(prefix.length())); if (localNameIv == null) { return null; } return new URIExtensionIV(localNameIv, namespaceIV); } } return next.createInlineIV(uri); }
Source:
public void setAwake(Registration reg) { if (reg.usesQueueMode()) { PresenceStatus status = new PresenceStatus(awakeTimeInfo.usedClientAwakeTime(reg)); PresenceStatus previous = clientStatusList.putIfAbsent(reg.getEndpoint(), status); if (previous != null) { status = previous; } boolean stateChanged = false; synchronized (status) { status.setClientAwakeTime(awakeTimeInfo.usedClientAwakeTime(reg)); stateChanged = status.setAwake(); startClientAwakeTimer(reg, status); } if (stateChanged) { for (PresenceListener listener : listeners) { listener.onAwake(reg); } } } }

Target:
public void setAwake(Registration reg) { if (reg.usesQueueMode()) { PresenceStatus status = new PresenceStatus(); PresenceStatus previous = clientStatusList.putIfAbsent(reg.getEndpoint(), status); if (previous != null) { status = previous; } boolean stateChanged = false; synchronized (status) { stateChanged = status.setAwake(); startClientAwakeTimer(reg, status, awakeTimeProvider.getClientAwakeTime(reg)); } if (stateChanged) { for (PresenceListener listener : listeners) { listener.onAwake(reg); } } } }
Source:
public void writeBehindCache() throws ClassNotFoundException { CacheManager cacheManager = CacheManagerBuilder.newCacheManagerBuilder().build(true); Class<CacheLoaderWriter<?, ?>> klazz = (Class<CacheLoaderWriter<?, ?>>) (Class) (SampleLoaderWriter.class); final Cache<Long, String> writeBehindCache = cacheManager.createCache("writeBehindCache", CacheConfigurationBuilder.newCacheConfigurationBuilder() .withLoaderWriter((SampleLoaderWriter) new SampleLoaderWriter<Long, String>(singletonMap(41L, "zero"))) .add(WriteBehindConfigurationBuilder .newBatchedWriteBehindConfiguration(1, TimeUnit.SECONDS, 3) .queueSize(3) .concurrencyLevel(1) .enableCoalescing()) .buildConfig(Long.class, String.class)); assertThat(writeBehindCache.get(41L), is("zero")); writeBehindCache.put(42L, "one"); writeBehindCache.put(43L, "two"); writeBehindCache.put(42L, "This goes for the record"); assertThat(writeBehindCache.get(42L), equalTo("This goes for the record")); cacheManager.close(); }

Target:
public void writeBehindCache() throws ClassNotFoundException { CacheManager cacheManager = CacheManagerBuilder.newCacheManagerBuilder().build(true); final Cache<Long, String> writeBehindCache = cacheManager.createCache("writeBehindCache", CacheConfigurationBuilder.newCacheConfigurationBuilder() .withLoaderWriter((SampleLoaderWriter) new SampleLoaderWriter<Long, String>(singletonMap(41L, "zero"))) .add(WriteBehindConfigurationBuilder .newBatchedWriteBehindConfiguration(1, TimeUnit.SECONDS, 3) .queueSize(3) .concurrencyLevel(1) .enableCoalescing()) .buildConfig(Long.class, String.class)); assertThat(writeBehindCache.get(41L), is("zero")); writeBehindCache.put(42L, "one"); writeBehindCache.put(43L, "two"); writeBehindCache.put(42L, "This goes for the record"); assertThat(writeBehindCache.get(42L), equalTo("This goes for the record")); cacheManager.close(); }
Source:
public String toString() { return new StringBuilder() .append("Notification [") .append("reference=" + reference) .append(", transactionId=" + transactionId) .append(", status=" + status) .append(", gatewayEventDate=" + gatewayEventDate) .append("]") .toString(); }

Target:
public String toString() { return new StringBuilder() .append("Notification [") .append("reference=") .append(reference) .append(", transactionId=") .append(transactionId) .append(", status=") .append(status) .append(", gatewayEventDate=") .append(gatewayEventDate) .append("]") .toString(); }
Source:
public void liveReload() { Supplier<AtlasDbRuntimeConfig> runtimeConfigSupplier = mock(Supplier.class); when(runtimeConfigSupplier.get()) .thenReturn(createRuntimeConfig(TARGETED_SWEEP_ENABLED, BACKGROUND_SWEEP_UNSET)) .thenReturn(createRuntimeConfig(TARGETED_SWEEP_DISABLED, BACKGROUND_SWEEP_UNSET)) .thenReturn(createRuntimeConfig(TARGETED_SWEEP_ENABLED, BACKGROUND_SWEEP_ENABLED)); ShouldRunBackgroundSweepSupplier supplier = new ShouldRunBackgroundSweepSupplier( SWEEP_QUEUE_WRITES_ENABLED, runtimeConfigSupplier); assertThat(supplier.get()).isFalse(); assertThat(supplier.get()).isTrue(); assertThat(supplier.get()).isTrue(); }

Target:
public void liveReload() { Supplier<AtlasDbRuntimeConfig> runtimeConfigSupplier = mock(Supplier.class); when(runtimeConfigSupplier.get()) .thenReturn(createRuntimeConfig(TARGETED_SWEEP_ENABLED, BACKGROUND_SWEEP_UNSET)) .thenReturn(createRuntimeConfig(TARGETED_SWEEP_DISABLED, BACKGROUND_SWEEP_UNSET)) .thenReturn(createRuntimeConfig(TARGETED_SWEEP_ENABLED, BACKGROUND_SWEEP_ENABLED)); ShouldRunBackgroundSweepSupplier supplier = new ShouldRunBackgroundSweepSupplier( SWEEP_QUEUE_WRITES_ENABLED, runtimeConfigSupplier); assertThat(supplier.getAsBoolean()).as("TARGETED_SWEEP_ENABLED, BACKGROUND_SWEEP_UNSET").isFalse(); assertThat(supplier.getAsBoolean()).as("TARGETED_SWEEP_DISABLED, BACKGROUND_SWEEP_UNSET").isTrue(); assertThat(supplier.getAsBoolean()).as("TARGETED_SWEEP_ENABLED, BACKGROUND_SWEEP_ENABLED").isTrue(); }
Source:
public Future<Map<String, Object>> setupNetworks(Map networks, Map bonding, Map options, final boolean isPolicyReset) { final JsonRpcRequest request = new RequestBuilder("Host.setupNetworks").withParameter("networks", networks) .withParameter("bondings", bonding) .withParameter("options", options) .build(); final FutureCallable callable = new FutureCallable(() -> { if (isPolicyReset) { updateHeartbeatPolicy(client.getClientRetryPolicy().clone(), false); if (client.isClosed()) { waitUntilCheck(client -> client.isClosed(), "Waiting on loosing connection to {}", "Connection lost for {}"); } waitUntilCheck(client -> !client.isClosed(), "Waiting on opening connection for {}", "Done reconnecting for {}!"); } return new FutureMap(client, request).withResponseKey("status"); }); FutureTask<Map<String, Object>> future = new FutureTask<Map<String, Object>>(callable) { @Override public boolean isDone() { if (callable.isDone()) { if (isPolicyReset) { updateHeartbeatPolicy(client.getClientRetryPolicy(), true); } return true; } return false; } }; ThreadPoolUtil.execute(future); return future; }

Target:
public Future<Map<String, Object>> setupNetworks(Map networks, Map bonding, Map options, final boolean isPolicyReset) { final JsonRpcRequest request = new RequestBuilder("Host.setupNetworks").withParameter("networks", networks) .withParameter("bondings", bonding) .withParameter("options", options) .build(); final FutureCallable callable = new FutureCallable(() -> { if (isPolicyReset) { updateHeartbeatPolicy(client.getClientRetryPolicy().clone(), false); if (client.isClosed()) { waitUntilCheck(client -> client.isClosed(), "Waiting on losing connection to {}", "Connection lost for {}"); } waitUntilCheck(client -> !client.isClosed(), "Waiting on opening connection for {}", "Done reconnecting for {}!"); } return new FutureMap(client, request).withResponseKey("status"); }); FutureTask<Map<String, Object>> future = new FutureTask<Map<String, Object>>(callable) { @Override public boolean isDone() { if (callable.isDone()) { if (isPolicyReset) { updateHeartbeatPolicy(client.getClientRetryPolicy(), true); } return true; } return false; } }; ThreadPoolUtil.execute(future); return future; }
Source:
private NodeAddress getSenderNodeAddress(NetworkEnvelope networkEnvelope) { return getPeersNodeAddressOptional().isPresent() ? getPeersNodeAddressOptional().get() : networkEnvelope instanceof SendersNodeAddressMessage ? ((SendersNodeAddressMessage) networkEnvelope).getSenderNodeAddress() : null; }

Target:
private NodeAddress getSenderNodeAddress(NetworkEnvelope networkEnvelope) { return getPeersNodeAddressOptional().orElse( networkEnvelope instanceof SendersNodeAddressMessage ? ((SendersNodeAddressMessage) networkEnvelope).getSenderNodeAddress() : null); }
Source:
public String getSQL() { StringBuffer sb = new StringBuffer(); sb.append(OpTypes.aggregateName(opType)).append("("); for (Expression e : nodes) { sb.append(e.getSQL()); } sb.append(") ") .append(Tokens.T_OVER + " ("); if (m_partitionByList.size() > 0) { sb.append(Tokens.T_PARTITION + ' ' + Tokens.T_BY + ' '); for (int idx = 0; idx < m_partitionByList.size(); idx += 1) { Expression expr = m_partitionByList.get(idx); sb.append(expr.getSQL()); if (idx < m_partitionByList.size()-1) { sb.append(", "); } else { sb.append(" "); } } } if (m_sortAndSlice != null && m_sortAndSlice.getOrderLength() > 0) { sb.append(Tokens.T_ORDER + ' ' + Tokens.T_BY + ' '); for (int idx = 0; idx < m_sortAndSlice.getOrderLength(); idx += 1) { Expression obExpr = (Expression) m_sortAndSlice.exprList.get(idx); assert(obExpr instanceof ExpressionOrderBy); ExpressionOrderBy obOrderByExpression = (ExpressionOrderBy)obExpr; sb.append(obExpr.getSQL()) .append(' ') .append(obOrderByExpression.isDescending() ? Tokens.T_DESC : Tokens.T_ASC); if (idx < m_sortAndSlice.getOrderLength()-1) { sb.append(", "); } else { sb.append(" "); } } } sb.append(")"); return sb.toString(); }

Target:
public String getSQL() { StringBuffer sb = new StringBuffer(); sb.append(OpTypes.aggregateName(opType)).append("("); for (Expression e : nodes) { sb.append(e.getSQL()); } sb.append(") ") .append(Tokens.T_OVER + " ("); if (m_partitionByList.size() > 0) { sb.append(Tokens.T_PARTITION + ' ' + Tokens.T_BY + ' '); String sep = ""; for (int idx = 0; idx < m_partitionByList.size(); idx += 1) { Expression expr = m_partitionByList.get(idx); sb.append(sep) .append(expr.getSQL()); sep = ", "; } } if (m_sortAndSlice != null && m_sortAndSlice.getOrderLength() > 0) { sb.append(Tokens.T_ORDER + ' ' + Tokens.T_BY + ' '); for (int idx = 0; idx < m_sortAndSlice.getOrderLength(); idx += 1) { Expression obExpr = (Expression) m_sortAndSlice.exprList.get(idx); assert(obExpr instanceof ExpressionOrderBy); ExpressionOrderBy obOrderByExpression = (ExpressionOrderBy)obExpr; sb.append(obExpr.getSQL()) .append(' ') .append(obOrderByExpression.isDescending() ? Tokens.T_DESC : Tokens.T_ASC); } } sb.append(")"); return sb.toString(); }
Source:
private void cancel(boolean mayInterruptIfRunning) { synchronized (syncRoot) { if (readerFuture != null) { readerFuture.cancel(mayInterruptIfRunning); readerFuture = null; } } }

Target:
private void cancel(boolean mayInterruptIfRunning) { synchronized (syncRoot) { running.set(false); if (readerFuture != null) { readerFuture.cancel(mayInterruptIfRunning); readerFuture = null; } } }
Source:
public void requestSinglePulse(GlowBlock block, long tickDelay) { Location target = block.getLocation(); singleTickMap.put(target, worldAge + tickDelay); }

Target:
public void requestSinglePulse(GlowBlock block, long tickDelay) { Location target = block.getLocation(); if (tickDelay < 0) tickDelay = 0; singleTickMap.put(target, worldAge + tickDelay); }
Source:
private void updateScoreStatistics(PersonaInfo pi) { listScoreStatistics = scoreStatisticsFromJSON(pi); ContentValues contentValues = scoreStatisticsForDB(pi, mSelectedPersona); try { getContext().getContentResolver().insert(ScoreStatistics.URI, contentValues); } catch(SQLiteConstraintException ex) { getContext().getContentResolver().update( ScoreStatistics.URI, contentValues, ScoreStatistics.Columns.PERSONA_ID + "=?", new String[] { String.valueOf(pi.getPersonaId()) } ); } }

Target:
private void updateScoreStatistics(PersonaInfo pi) { listScoreStatistics = scoreStatisticsFromJSON(pi); ContentValues contentValues = scoreStatisticsForDB(pi, mSelectedPersona); getContext().getContentResolver().insert(ScoreStatistics.URI, contentValues); }
Source:
public ComboBoxModel doFillEnvironmentItems(@QueryParameter(value = "credential") @RelativePath(value = "..") String credential, @QueryParameter(value = "credential") String credential2, @AncestorInPath AbstractProject project) { String creds = !isNullOrEmpty(credential) ? credential : credential2; Credential overridingCredential = RepositoryUtils.retrieveOverridingCredentialFromProject(project); List<String> environments = new ArrayList<String>(); if (!isNullOrEmpty(creds)) { DeployitServer deployitServer = RepositoryUtils.getDeployitServer(creds, overridingCredential, project); environments = RepositoryUtils.environments(deployitServer); } return new ComboBoxModel(environments); }

Target:
public ComboBoxModel doFillEnvironmentItems(@QueryParameter(value = "credential") @RelativePath(value = "..") String credential, @QueryParameter(value = "credential") String credential2, @AncestorInPath AbstractProject project) { project.checkPermission(Jenkins.ADMINISTER); String creds = !isNullOrEmpty(credential) ? credential : credential2; Credential overridingCredential = RepositoryUtils.retrieveOverridingCredentialFromProject(project); List<String> environments = new ArrayList<String>(); if (!isNullOrEmpty(creds)) { DeployitServer deployitServer = RepositoryUtils.getDeployitServer(creds, overridingCredential, project); environments = RepositoryUtils.environments(deployitServer); } return new ComboBoxModel(environments); }
Source:
public void readConfiguration(File file) throws IOException, FileNotFoundException { setConfiguration(Configuration.read(file)); }

Target:
public void readConfiguration(File file) throws IOException { setConfiguration(Configuration.read(file)); }
Source:
protected void verifyNormalizedMimetype(String expectedNormalizedMimetype, String mimetype) { Optional<String> optional = mimetypeRegistryService.getNormalizedMimeType(mimetype); assertTrue(String.format("'%s' should have a normalized mime type", mimetype), optional.isPresent()); assertEquals( String.format("The normalized mime type for '%s' should be '%s'", mimetype, expectedNormalizedMimetype), expectedNormalizedMimetype, optional.get()); }

Target:
protected void verifyNormalizedMimetype(String expectedNormalizedMimetype, String mimetype) { mimetypeRegistryService.getNormalizedMimeType(mimetype) .ifPresentOrElse(r -> assertEquals(expectedNormalizedMimetype, r), () -> fail(String.format("'%s' should have a normalized mime type", mimetype))); }
Source:
public Key getNextKeyHint(Key k, Value v) { if (cso.minCf.getLength() > 0) { int minCfCmp = k.compareColumnFamily(cso.minCf); if (minCfCmp < 0) { Key hint = new Key(k.getRow(), cso.minCf); return cso.minInclusive ? hint : hint.followingKey(PartialKey.ROW_COLFAM); } } if (cso.minCq.getLength() > 0) { int minCqCmp = k.compareColumnQualifier(cso.minCq); if (minCqCmp < 0) { Key hint = new Key(k.getRow(), k.getColumnFamily(), cso.minCq); return cso.minInclusive ? hint : hint.followingKey(PartialKey.ROW_COLFAM_COLQUAL); } } return null; }

Target:
public Key getNextKeyHint(Key k, Value v) throws IllegalArgumentException { if (cso.minCf.getLength() > 0) { int minCfCmp = k.compareColumnFamily(cso.minCf); if (minCfCmp < 0) { Key hint = new Key(k.getRow(), cso.minCf); return cso.minInclusive ? hint : hint.followingKey(PartialKey.ROW_COLFAM); } } if (cso.minCq.getLength() > 0) { int minCqCmp = k.compareColumnQualifier(cso.minCq); if (minCqCmp < 0) { Key hint = new Key(k.getRow(), k.getColumnFamily(), cso.minCq); return cso.minInclusive ? hint : hint.followingKey(PartialKey.ROW_COLFAM_COLQUAL); } } throw new IllegalArgumentException("Don't know how to provide hint for key " + k); }
Source:
Options(String[] args) throws CmdLineException { CmdLineParser parser = new CmdLineParser(this); try { parser.parseArgument(args); if(arguments.isEmpty()) throw new CmdLineException(parser, "No files were given"); } catch (CmdLineException e) { System.err.println(e.getMessage()); System.err.println("Usage: cl2dts [options...] arguments..."); parser.printUsage(System.err); System.err.println(); throw e; } }

Target:
Options(String[] args) throws CmdLineException { CmdLineParser parser = new CmdLineParser(this); parser.parseArgument(args); if(arguments.isEmpty()) { throw new CmdLineException(parser, "No files were given"); } }
Source:
private Counter getSuccessCounter() { return registry.counter("pubsub.amazon.published", "name", getName(), "topic", getTopicName()); }

Target:
private Counter getSuccessCounter() { return successCounter; }
Source:
public KubernetesPluginsToolingApplier( @Named("che.workspace.sidecar.image_pull_policy") String sidecarImagePullPolicy, @Named("che.workspace.sidecar.default_memory_limit_mb") long defaultSidecarMemoryLimitMB, @Named("che.agents.auth_enabled") boolean isAuthEnabled) { this.defaultSidecarMemoryLimitBytes = String.valueOf(defaultSidecarMemoryLimitMB * 1024 * 1024); this.isAuthEnabled = isAuthEnabled; this.sidecarImagePullPolicy = stream(ImagePullPolicies.values()) .anyMatch(p -> p.getPolicy().equals(sidecarImagePullPolicy)) ? sidecarImagePullPolicy : null; }

Target:
public KubernetesPluginsToolingApplier( @Named("che.workspace.sidecar.image_pull_policy") String sidecarImagePullPolicy, @Named("che.workspace.sidecar.default_memory_limit_mb") long defaultSidecarMemoryLimitMB, @Named("che.agents.auth_enabled") boolean isAuthEnabled) { this.defaultSidecarMemoryLimitBytes = String.valueOf(defaultSidecarMemoryLimitMB * 1024 * 1024); this.isAuthEnabled = isAuthEnabled; this.sidecarImagePullPolicy = validImagePullPolicies.contains(sidecarImagePullPolicy) ? sidecarImagePullPolicy : null; }
Source:
private MamManager(XMPPConnection connection, Jid archiveAddress) { super(connection); this.archiveAddress = archiveAddress; serviceDiscoveryManager = ServiceDiscoveryManager.getInstanceFor(connection); this.adHocCommandManager = AdHocCommandManager.getAddHocCommandsManager(connection); }

Target:
private MamManager(XMPPConnection connection, Jid archiveAddress) { super(connection); this.archiveAddress = archiveAddress; serviceDiscoveryManager = ServiceDiscoveryManager.getInstanceFor(connection); adHocCommandManager = AdHocCommandManager.getAddHocCommandsManager(connection); }
Source:
public String classId() { String computedClassId = computeClassId(); boolean appendFormId = !getClass().isAnnotationPresent(ClassId.class); if (appendFormId) { String formClassId = getForm() != null ? ID_CONCAT_SYMBOL + getForm().classId() : ""; computedClassId = computedClassId + formClassId; } boolean duplicate = existsDuplicateClassId(); if (duplicate) { LOG.warn("Found a duplicate classid for {}, adding field index. Override classId for dynamically injected fields.", computedClassId); int fieldIndex = getParentField().getFieldIndex(this); computedClassId += ID_CONCAT_SYMBOL + fieldIndex; } return computedClassId; }

Target:
public String classId() { StringBuilder classId = new StringBuilder(computeClassId()); boolean appendFormId = !getClass().isAnnotationPresent(ClassId.class); if (appendFormId && getForm() != null) { classId.append(ID_CONCAT_SYMBOL).append(getForm().classId()); } boolean duplicate = existsDuplicateClassId(); if (duplicate) { LOG.warn("Found a duplicate classid for {}, adding field index. Override classId for dynamically injected fields.", classId); int fieldIndex = getParentField().getFieldIndex(this); classId.append(ID_CONCAT_SYMBOL).append(fieldIndex); } return classId.toString(); }
Source:
private Slave prepareAgentDocker() throws Exception { switch(platform) { case SLIM: case ALPINE: case CENTOS: case UBUNTU: return prepareDockerPlatforms(); case SIMPLE: return prepareAgentCommandLauncher(); default: fail("Unknown test platform: " + platform); return null; } }

Target:
private Slave prepareAgentDocker() throws Exception { switch(platform) { case SLIM: case ALPINE: case CENTOS: case UBUNTU: return prepareDockerPlatforms(); case NO_INIT: return new DumbSlave("docker", "/home/jenkins/agent", new SimpleCommandLauncher("docker run -i --rm jenkins/slave:3.29-2 java -jar /usr/share/jenkins/slave.jar")); default: fail("Unknown test platform: " + platform); return null; } }
Source:
private <E extends Element> DocumentResult index(Set<? extends DocSchema<E>> schemas, E element, boolean create) throws IOException { for(DocSchema<E> schema : schemas) { DocSchema.Document document = schema.toDocument(element); if (document != null) { if (create) { Get getRequest = new Get.Builder(document.getIndex(), document.getId()).build(); if (this.client.execute(getRequest).isSucceeded()) { throw new DocumentAlreadyExistsException( new ShardId(document.getIndex(), -1), document.getType(), document.getId()); } } Index index = new Index.Builder(Seq.seq(document.getFields())) .id(document.getId()) .index(document.getIndex()) .type(document.getType()) .refresh(true) .build(); return this.client.execute(index); } } return null; }

Target:
private <E extends Element> DocumentResult index(Set<? extends DocSchema<E>> schemas, E element, boolean create) { for (DocSchema<E> schema : schemas) { DocSchema.Document document = schema.toDocument(element); if (document != null) { if (create) { Get getRequest = new Get.Builder(document.getIndex(), document.getId()).build(); try { if (this.client.execute(getRequest).isSucceeded()) { throw new DocumentAlreadyExistsException( new ShardId(document.getIndex(), -1), document.getType(), document.getId()); } } catch (IOException e) { e.printStackTrace(); } } Index index = new Index.Builder(document.getFields()) .id(document.getId()) .index(document.getIndex()) .type(document.getType()) .refresh(true) .build(); try { return this.client.execute(index); } catch (IOException e) { e.printStackTrace(); } } } return null; }