auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
@Subscribe public void on(CheckSyncStatusEvent event) { if (event.isSyncDisable() && Prefs.isReadingListSyncEnabled()) { ReadingListSyncBehaviorDialogs.detectedMultipleSyncSettingsDialog(BaseActivity.this, () -> Prefs.setReadingListSyncEnabled(false)); } else { ReadingListCheckSetupStatusTask checkSetupStatusTask = new ReadingListCheckSetupStatusTask() { @Override public void onFinish(@Nullable Void result) { Prefs.setReadingListSyncEnabled(true); if (event.getPreferenceOfSyncReadingLists() != null) { ((SwitchPreferenceCompat) event.getPreferenceOfSyncReadingLists()).setChecked(true); } } @Override public void onCatch(Throwable caught) { if (Prefs.isReadingListSyncEnabled()) { ReadingListSyncBehaviorDialogs.detectedMultipleSyncSettingsDialog(BaseActivity.this, () -> Prefs.setReadingListSyncEnabled(false)); } else { Prefs.setReadingListSyncEnabled(false); } if (event.getPreferenceOfSyncReadingLists() != null) { ((SwitchPreferenceCompat) event.getPreferenceOfSyncReadingLists()).setChecked(false); } } }; checkSetupStatusTask.execute(); } }

Target:
@Subscribe public void on(CheckSyncStatusEvent event) { if (event.isSyncDisable() && Prefs.isReadingListSyncEnabled()) { ReadingListSyncBehaviorDialogs.detectedMultipleSyncSettingsDialog(BaseActivity.this, () -> Prefs.setReadingListSyncEnabled(false)); } else { ReadingListCheckSetupStatusTask checkSetupStatusTask = new ReadingListCheckSetupStatusTask() { @Override public void onFinish(@Nullable Void result) { if (isDestroyed()) { return; } Prefs.setReadingListSyncEnabled(true); if (event.getPreferenceOfSyncReadingLists() != null) { ((SwitchPreferenceCompat) event.getPreferenceOfSyncReadingLists()).setChecked(true); } } @Override public void onCatch(Throwable caught) { if (isDestroyed()) { return; } if (Prefs.isReadingListSyncEnabled()) { ReadingListSyncBehaviorDialogs.detectedMultipleSyncSettingsDialog(BaseActivity.this, () -> Prefs.setReadingListSyncEnabled(false)); } else { Prefs.setReadingListSyncEnabled(false); } if (event.getPreferenceOfSyncReadingLists() != null) { ((SwitchPreferenceCompat) event.getPreferenceOfSyncReadingLists()).setChecked(false); } } }; checkSetupStatusTask.execute(); } }
Source:
public void close() { cacheManager.disposeCache(this); }

Target:
public void close() { cacheManager.disposeCache(this); log.debug("Closed %s", super.toString()); }
Source:
public byte[] getAPIData() { ByteArrayOutputStream os = new ByteArrayOutputStream(); try { os.write(frameID); os.write(command.getBytes()); if (parameter != null) os.write(parameter); } catch (IOException e) { e.printStackTrace(); } return os.toByteArray(); }

Target:
public byte[] getAPIData() { ByteArrayOutputStream os = new ByteArrayOutputStream(); try { os.write(frameID); os.write(command.getBytes()); if (parameter != null) os.write(parameter); } catch (IOException e) { } return os.toByteArray(); }
Source:
protected Rectangle getCurrentConstraintFor(GraphicalEditPart child) { IFigure fig = child.getFigure(); IFigure parent = fig.getParent(); LayoutManager parentLayoutManger = parent.getLayoutManager(); if (parentLayoutManger == null) { return null; } return (Rectangle) parentLayoutManger.getConstraint(fig); }

Target:
protected Rectangle getCurrentConstraintFor(GraphicalEditPart child) { if (child instanceof ConnectionEditPart && child.getParent() instanceof DiagramRootEditPart) { return null; } return super.getCurrentConstraintFor(child); }
Source:
protected void populateHiddenFields(EntityInfo ei, Map<String, String> fieldMap) throws IOException { LOGGER.debug("Starting population of hidden fields due to new or modified indexes."); MongoDataStore ds = (MongoDataStore) ei.getDataStore(); DB entityDB = dbResolver.get(ds); DBCollection coll = entityDB.getCollection(ds.getCollectionName()); DBCursor cursor = coll.find(); while (cursor.hasNext()) { DBObject doc = cursor.next(); for (String index : fieldMap.keySet()) { int arrIndex = index.indexOf("*"); if (arrIndex > -1) { doMultiArrayMap(doc, index, fieldMap.get(index), arrIndex); } else { Object dbObject = Translator.getDBObject(doc, new Path(index)); ObjectNode arrNode = JsonNodeFactory.instance.objectNode(); JsonDoc.modify(arrNode, new Path(fieldMap.get(index)), JsonNodeFactory.instance.textNode(dbObject.toString().toUpperCase()), true); ObjectMapper mapper = new ObjectMapper(); JsonNode merged = merge(mapper.readTree(doc.toString()), mapper.readTree(arrNode.toString())); DBObject obj = (DBObject) JSON.parse(merged.toString()); ((BasicDBObject) doc).clear(); ((BasicDBObject) doc).putAll(obj); } } coll.save(doc); } cursor.close(); LOGGER.debug("Finished population of hidden fields."); }

Target:
protected void populateHiddenFields(EntityInfo ei, Map<String, String> fieldMap) throws IOException { LOGGER.debug("Starting population of hidden fields due to new or modified indexes."); MongoDataStore ds = (MongoDataStore) ei.getDataStore(); DB entityDB = dbResolver.get(ds); DBCollection coll = entityDB.getCollection(ds.getCollectionName()); DBCursor cursor = coll.find(); while (cursor.hasNext()) { DBObject doc = cursor.next(); DBObject original = (DBObject) ((BasicDBObject) doc).copy(); for (String index : fieldMap.keySet()) { int arrIndex = index.indexOf("*"); if (arrIndex > -1) { populateHiddenArrayField(doc, index, fieldMap.get(index)); } else { Object dbObject = Translator.getDBObject(doc, new Path(index)); ObjectNode arrNode = JsonNodeFactory.instance.objectNode(); JsonDoc.modify(arrNode, new Path(fieldMap.get(index)), JsonNodeFactory.instance.textNode(dbObject.toString().toUpperCase()), true); ObjectMapper mapper = new ObjectMapper(); JsonNode merged = merge(mapper.readTree(doc.toString()), mapper.readTree(arrNode.toString())); DBObject obj = (DBObject) JSON.parse(merged.toString()); ((BasicDBObject) doc).clear(); ((BasicDBObject) doc).putAll(obj); } } if (!doc.equals(original)) { coll.save(doc); } } cursor.close(); LOGGER.debug("Finished population of hidden fields."); }
Source:
public void testInsertWithFailureDoesntLeaveBehindOrphanedTable() throws Exception { try (AutoCloseable table = withTable("tpch.test_cleanup", "(column_a INTEGER)")) { assertQuery("SHOW TABLES", "VALUES 'orders', 'test_cleanup'"); execute("ALTER TABLE tpch.test_cleanup ADD CHECK (column_a > 0)"); Exception thrown = null; try { assertUpdate("INSERT INTO tpch.test_cleanup(column_a) VALUES (0)", 1); } catch (Exception e) { thrown = e; assertQuery("SHOW TABLES", "VALUES 'orders', 'test_cleanup'"); } assertNotNull(thrown, "Expected exception to be thrown when attempting to insert"); } }

Target:
public void testInsertWithFailureDoesntLeaveBehindOrphanedTable() throws Exception { String schemaName = format("tmp_schema_%s", UUID.randomUUID().toString().replaceAll("-", "")); try (AutoCloseable schema = withSchema(schemaName); AutoCloseable table = withTable(format("%s.test_cleanup", schemaName), "(x INTEGER)")) { assertQuery(format("SELECT table_name FROM information_schema.tables WHERE table_schema = '%s'", schemaName), "VALUES 'test_cleanup'"); execute(format("ALTER TABLE %s.test_cleanup ADD CHECK (x > 0)", schemaName)); assertQueryFails(format("INSERT INTO %s.test_cleanup (x) VALUES (0)", schemaName), "ERROR: new row .* violates check constraint [\\s\\S]*"); assertQuery(format("SELECT table_name FROM information_schema.tables WHERE table_schema = '%s'", schemaName), "VALUES 'test_cleanup'"); } }
Source:
private void testGetBlob(BlobInfo blobInfo, ByteRange range) throws Exception { SecurityServiceCallback callback = new SecurityServiceCallback(); MockRestResponseChannel restResponseChannel = new MockRestResponseChannel(); JSONObject headers = null; if (range != null) { headers = new JSONObject(); switch (range.getType()) { case LAST_N_BYTES: headers.put(RestUtils.Headers.RANGE, "bytes=-" + range.getLastNBytes()); break; case FROM_START_OFFSET: headers.put(RestUtils.Headers.RANGE, "bytes=" + range.getStartOffset() + "-"); break; case OFFSET_RANGE: headers.put(RestUtils.Headers.RANGE, "bytes=" + range.getStartOffset() + "-" + range.getEndOffset()); break; } } RestRequest restRequest = createRestRequest(RestMethod.GET, "/", headers); securityService.processResponse(restRequest, restResponseChannel, blobInfo, callback).get(); Assert.assertTrue("Callback should have been invoked", callback.callbackLatch.await(1, TimeUnit.SECONDS)); Assert.assertNull("Exception should not have been thrown", callback.exception); Assert.assertEquals("Response should have been set", range == null ? ResponseStatus.Ok : ResponseStatus.PartialContent, restResponseChannel.getStatus()); verifyHeadersForGetBlob(blobInfo.getBlobProperties(), range, restResponseChannel); }

Target:
private void testGetBlob(BlobInfo blobInfo, ByteRange range) throws Exception { SecurityServiceCallback callback = new SecurityServiceCallback(); MockRestResponseChannel restResponseChannel = new MockRestResponseChannel(); JSONObject headers = range != null ? new JSONObject().put(RestUtils.Headers.RANGE, RestTestUtils.getRangeHeaderString(range)) : null; RestRequest restRequest = createRestRequest(RestMethod.GET, "/", headers); securityService.processResponse(restRequest, restResponseChannel, blobInfo, callback).get(); Assert.assertTrue("Callback should have been invoked", callback.callbackLatch.await(1, TimeUnit.SECONDS)); Assert.assertNull("Exception should not have been thrown", callback.exception); Assert.assertEquals("Response status should have been set", range == null ? ResponseStatus.Ok : ResponseStatus.PartialContent, restResponseChannel.getStatus()); verifyHeadersForGetBlob(blobInfo.getBlobProperties(), range, restResponseChannel); }
Source:
private List<StackImpl> loadStacks(String stackPath) throws ServerException { try (InputStream is = getResource(stackPath)) { return firstNonNull(GSON.fromJson(new InputStreamReader(is), new TypeToken<List<StackImpl>>() {}.getType()), emptyList()); } catch (IOException | JsonIOException | JsonSyntaxException e) { throw new ServerException("Failed to get stacks from specified path " + stackPath, e); } }

Target:
private List<DecoratedStackImpl> loadStacks(String stackPath) throws ServerException { try (InputStream is = getResource(stackPath)) { return firstNonNull(GSON.fromJson(new InputStreamReader(is), new TypeToken<List<DecoratedStackImpl>>() {}.getType()), emptyList()); } catch (IOException | JsonIOException | JsonSyntaxException e) { throw new ServerException("Failed to get stacks from specified path " + stackPath, e); } }
Source:
private void restoreWidgetValues() { IDialogSettings settings = getDialogSettings(); if (settings != null) { openType = settings.getBoolean(STORE_OPEN_TYPE_ID); replaceSource = settings.getBoolean(STORE_REPLACE_SOURCE_ID); } }

Target:
private void restoreWidgetValues() { IDialogSettings settings = getDialogSettings(); if (null != settings) { openType = settings.getBoolean(STORE_OPEN_TYPE_ID); replaceSource = settings.getBoolean(STORE_REPLACE_SOURCE_ID); } }
Source:
public static Systems getInstance() { if(systems == null) { systems = new Systems(); } if(!systems.initialized && !systems.initializing) { systems.initializing = true; systems.loader = new Thread(new Runnable() { @Override public void run() { systems.initialize(); } }, "Planet Loader"); systems.loader.setPriority(Thread.NORM_PRIORITY - 1); systems.loader.start(); } Systems temp_systems = systems; return systems; }

Target:
public static Systems getInstance() { if(systems == null) { systems = new Systems(); } if(!systems.initialized && !systems.initializing) { systems.initializing = true; systems.loader = new Thread(new Runnable() { @Override public void run() { systems.initialize(); } }, "Planet Loader"); systems.loader.setPriority(Thread.NORM_PRIORITY - 1); systems.loader.start(); } return systems; }
Source:
public void testMerge() { final Parameters params1 = new Parameters("foo", "bar"); final Parameters params2 = new Parameters("baz", "xyzzy"); assertThat(Parameters.merge(params1)).isSameAs(params1); assertThat(Parameters.merge(params1, null)).isSameAs(params1); assertThat(Parameters.merge(null, params1)).isSameAs(params1); assertThat(Parameters.merge(null, params1, null, params2, null)).isSameAs(params1); assertThat(params1).hasSize(4); assertThat(params2).hasSize(2); }

Target:
public void testMerge() { final Parameters params1 = new Parameters("foo", "bar"); final Parameters params2 = new Parameters("baz", "xyzzy"); assertThat(Parameters.merge(params1)).isSameAs(params1); assertThat(Parameters.merge(params1, null)).isSameAs(params1); assertThat(Parameters.merge(null, params1)).isSameAs(params1); assertThat(Parameters.merge(null, params1, null, params2, null)).isSameAs(params1); assertThat(params1).hasSize(2); assertThat(params2).hasSize(1); }
Source:
public static BigInteger decodeBigInteger(byte[] data, int index) { final byte[] valueBytes = decodeItemBytes(data, index); if (valueBytes.length == 0) { return BigInteger.ZERO; } else { BigInteger res = new BigInteger(1, valueBytes); if (res.compareTo(BigInteger.ZERO) < 0) throw new RuntimeException("not a valid number"); return res; } }

Target:
public static BigInteger decodeBigInteger(byte[] data, int index) { final byte[] valueBytes = decodeItemBytes(data, index); if (valueBytes.length == 0) { return BigInteger.ZERO; } else { BigInteger res = new BigInteger(1, valueBytes); return res; } }
Source:
public void shouldEncryptPluggablePublishArtifactPropertiesDuringSave() throws Exception { setupMetadataForPlugin(); ArtifactStore artifactStore = new ArtifactStore("dockerhub", "cd.go.artifact.docker.registry"); artifactStoreService.create(Username.ANONYMOUS, artifactStore, new HttpLocalizedOperationResult()); File configFile = new File(new SystemEnvironment().getCruiseConfigFile()); String config = IOUtils.toString(getClass().getResourceAsStream("/data/pluggable_artifacts_with_params.xml"), UTF_8); FileUtils.writeStringToFile(configFile, config, UTF_8); cachedGoConfig.forceReload(); Configuration ancestorPluggablePublishAftifactConfigAfterEncryption = goConfigDao.loadConfigHolder() .configForEdit.pipelineConfigByName(new CaseInsensitiveString("ancestor")) .getExternalArtifactConfigs().get(0).getConfiguration(); assertThat(ancestorPluggablePublishAftifactConfigAfterEncryption.getProperty("Image").getValue(), is("SECRET")); assertThat(ancestorPluggablePublishAftifactConfigAfterEncryption.getProperty("Image").getEncryptedValue(), startsWith("AES:")); assertThat(ancestorPluggablePublishAftifactConfigAfterEncryption.getProperty("Image").getConfigValue(), is(CoreMatchers.nullValue())); }

Target:
public void shouldEncryptPluggablePublishArtifactPropertiesDuringSave() throws Exception { resetCipher.setupAESCipherFile(); resetCipher.setupDESCipherFile(); setupMetadataForPlugin(); ArtifactStore artifactStore = new ArtifactStore("dockerhub", "cd.go.artifact.docker.registry"); artifactStoreService.create(Username.ANONYMOUS, artifactStore, new HttpLocalizedOperationResult()); File configFile = new File(new SystemEnvironment().getCruiseConfigFile()); String config = IOUtils.toString(getClass().getResourceAsStream("/data/pluggable_artifacts_with_params.xml"), UTF_8); FileUtils.writeStringToFile(configFile, config, UTF_8); cachedGoConfig.forceReload(); Configuration ancestorPluggablePublishAftifactConfigAfterEncryption = goConfigDao.loadConfigHolder() .configForEdit.pipelineConfigByName(new CaseInsensitiveString("ancestor")) .getExternalArtifactConfigs().get(0).getConfiguration(); assertThat(ancestorPluggablePublishAftifactConfigAfterEncryption.getProperty("Image").getValue(), is("SECRET")); assertThat(ancestorPluggablePublishAftifactConfigAfterEncryption.getProperty("Image").getEncryptedValue(), is(new GoCipher().encrypt("SECRET"))); assertThat(ancestorPluggablePublishAftifactConfigAfterEncryption.getProperty("Image").getConfigValue(), is(CoreMatchers.nullValue())); }
Source:
public void testIsWithinHour() { Calendar timeCalendar = Calendar.getInstance(TimeZone.getTimeZone("UTC")); ______TS("Time within past hour"); timeCalendar.add(Calendar.MINUTE, -10); assertTrue(TimeHelper.isWithinHour(timeCalendar.getTime(), Calendar.getInstance(TimeZone.getTimeZone("UTC")).getTime())); ______TS("End time not within past hour"); timeCalendar = Calendar.getInstance(TimeZone.getTimeZone("UTC")); timeCalendar.add(Calendar.MINUTE, -70); assertFalse(TimeHelper.isWithinHour(timeCalendar.getTime(), Calendar.getInstance(TimeZone.getTimeZone("UTC")).getTime())); timeCalendar = Calendar.getInstance(TimeZone.getTimeZone("UTC")); timeCalendar.add(Calendar.MINUTE, 10); assertFalse(TimeHelper.isWithinHour(timeCalendar.getTime(), Calendar.getInstance(TimeZone.getTimeZone("UTC")).getTime())); timeCalendar = Calendar.getInstance(TimeZone.getTimeZone("UTC")); timeCalendar.add(Calendar.MINUTE, 10); assertFalse(TimeHelper.isWithinHour(timeCalendar.getTime(), timeCalendar.getTime())); ______TS("Session ended but grace time left"); int gracePeriod = 15; timeCalendar = Calendar.getInstance(TimeZone.getTimeZone("UTC")); timeCalendar.add(Calendar.MINUTE, -10); assertFalse(TimeHelper.isWithinHour(new Date(timeCalendar.getTime().getTime() + gracePeriod * 60000), Calendar.getInstance(TimeZone.getTimeZone("UTC")).getTime())); }

Target:
public void testIsWithinHour() { Calendar timeCalendar = Calendar.getInstance(TimeZone.getTimeZone("UTC")); ______TS("Time within past hour"); timeCalendar.add(Calendar.MINUTE, -10); assertTrue(TimeHelper.isWithinPastHour(timeCalendar.getTime(), Calendar.getInstance(TimeZone.getTimeZone("UTC")).getTime())); ______TS("End time not within past hour"); timeCalendar = Calendar.getInstance(TimeZone.getTimeZone("UTC")); timeCalendar.add(Calendar.MINUTE, -70); assertFalse(TimeHelper.isWithinPastHour(timeCalendar.getTime(), Calendar.getInstance(TimeZone.getTimeZone("UTC")).getTime())); timeCalendar = Calendar.getInstance(TimeZone.getTimeZone("UTC")); timeCalendar.add(Calendar.MINUTE, 10); assertFalse(TimeHelper.isWithinPastHour(timeCalendar.getTime(), Calendar.getInstance(TimeZone.getTimeZone("UTC")).getTime())); timeCalendar = Calendar.getInstance(TimeZone.getTimeZone("UTC")); timeCalendar.add(Calendar.MINUTE, 10); assertFalse(TimeHelper.isWithinPastHour(timeCalendar.getTime(), timeCalendar.getTime())); ______TS("Session ended but grace time left"); int gracePeriod = 15; timeCalendar = Calendar.getInstance(TimeZone.getTimeZone("UTC")); timeCalendar.add(Calendar.MINUTE, -10); assertFalse(TimeHelper.isWithinPastHour(new Date(timeCalendar.getTime().getTime() + gracePeriod * 60000), Calendar.getInstance(TimeZone.getTimeZone("UTC")).getTime())); }
Source:
private static List<Rule> getRules(VElement renderable) { final List<Rule> rules = new ArrayList<Rule>(); for (final VAttachment attachment : renderable.getAttachments()) { if (Rule.class.isInstance(attachment)) { final Rule rule = (Rule) attachment; rules.add(rule); } } return rules; }

Target:
private static List<Rule> getRules(VElement renderable) { final HashMap<Class<? extends Rule>, Rule> rules = new HashMap<Class<? extends Rule>, Rule>(); for (final VAttachment attachment : renderable.getAttachments()) { if (Rule.class.isInstance(attachment)) { final Rule rule = (Rule) attachment; if (!rules.containsKey(rule.getClass())) { rules.put(rule.getClass(), rule); } } } return new ArrayList<Rule>(rules.values()); }
Source:
public boolean process(final HttpServletRequest request, final HttpServletResponse response) { if (isTokenRequest(request)) { recordSession(request); } else if (isBackChannelLogoutRequest(request)) { destroySession(request); return false; } else if (isFrontChannelLogoutRequest(request)) { destroySession(request); final String redirectionUrl = computeRedirectionToServer(request); if (redirectionUrl != null) { CommonUtils.sendRedirect(response, redirectionUrl); } return false; } else { logger.trace("Ignoring URI {}", request.getRequestURI()); } return true; }

Target:
public boolean process(final HttpServletRequest request, final HttpServletResponse response) { if (isTokenRequest(request)) { logger.trace("Received a token request"); recordSession(request); return true; } else if (isBackChannelLogoutRequest(request)) { logger.trace("Received a back channel logout request"); destroySession(request); return false; } else if (isFrontChannelLogoutRequest(request)) { logger.trace("Received a front channel logout request"); destroySession(request); final String redirectionUrl = computeRedirectionToServer(request); if (redirectionUrl != null) { CommonUtils.sendRedirect(response, redirectionUrl); } return false; } else { logger.trace("Ignoring URI for logout: {}", request.getRequestURI()); return true; } }
Source:
public boolean isIdenticalTo(final PlaylistInfo info) { boolean returnMe; if (!TextUtils.isEmpty(getUploader())) { returnMe = getServiceId() == info.getServiceId() && getName().equals(info.getName()) && getStreamCount() == info.getStreamCount() && getUrl().equals(info.getUrl()) && getThumbnailUrl().equals(info.getThumbnailUrl()) && getUploader().equals(info.getUploaderName()); } else { returnMe = getServiceId() == info.getServiceId() && getName().equals(info.getName()) && getStreamCount() == info.getStreamCount() && getUrl().equals(info.getUrl()) && getThumbnailUrl().equals(info.getThumbnailUrl()); } return returnMe; }

Target:
public boolean isIdenticalTo(final PlaylistInfo info) { return getServiceId() == info.getServiceId() && getStreamCount() == info.getStreamCount() && TextUtils.equals(getName(), info.getName()) && TextUtils.equals(getUrl(), info.getUrl()) && TextUtils.equals(getThumbnailUrl(), info.getThumbnailUrl()) && TextUtils.equals(getUploader(), info.getUploaderName()); }
Source:
private ConcurrentLinkedQueue<CacheEventWrapper> getEventQueue (K key) { long mapKeyForQueue = key.hashCode() % NUMBER_OF_EVENT_QUEUES; keyBasedEventQueueMap.putIfAbsent(mapKeyForQueue, new ConcurrentLinkedQueue<CacheEventWrapper>()); return keyBasedEventQueueMap.get(mapKeyForQueue); }

Target:
private ConcurrentLinkedQueue<CacheEventWrapper> getEventQueue (K key) { int mapKeyForQueue = Math.abs(key.hashCode() % eventQueueCount); return keyBasedEventQueueMap.get(mapKeyForQueue); }
Source:
public static void startUpgrade(final Context context) { final Intent intent = new Intent(context, UpgradeWalletService.class); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) context.startService(intent); else context.startForegroundService(intent); }

Target:
public static void startUpgrade(final Context context) { ContextCompat.startForegroundService(context, new Intent(context, UpgradeWalletService.class)); }
Source:
private void pathInForeground(final String path) throws Exception { RetryLoop.callWithRetry(client.getZookeeperClient(), new Callable<Void>() { @Override public Void call() throws Exception { ZooKeeper zkClient = client.getZooKeeper(); if(watcher == null) { zkClient.removeAllWatches(path, watcherType, local); } else { zkClient.removeWatches(path, watcher, watcherType, local); } return null; } }); }

Target:
private void pathInForeground(final String path) throws Exception { if(local) { ZooKeeper zkClient = client.getZooKeeper(); if(watcher == null) { zkClient.removeAllWatches(path, watcherType, local); } else { zkClient.removeWatches(path, watcher, watcherType, local); } } else { RetryLoop.callWithRetry(client.getZookeeperClient(), new Callable<Void>() { @Override public Void call() throws Exception { try { ZooKeeper zkClient = client.getZookeeperClient().getZooKeeper(); if(watcher == null) { zkClient.removeAllWatches(path, watcherType, local); } else { zkClient.removeWatches(path, watcher, watcherType, local); } } catch(Exception e) { if( RetryLoop.isRetryException(e) && guaranteed ) { client.getFailedRemoveWatcherManager().addFailedOperation(new FailedRemoveWatchManager.FailedRemoveWatchDetails(path, watcher)); throw e; } else if(e instanceof KeeperException.NoWatcherException && quietly) { } else { throw e; } } return null; } }); } }
Source:
private ArrayNode createTags(ILoggingEvent event) { ArrayNode node = null; final Marker marker = event.getMarker(); if (marker != null) { node = MAPPER.createArrayNode(); if (marker.getName() != "JSON") { node.add(marker.getName()); } if (marker.hasReferences()) { final Iterator<?> i = event.getMarker().iterator(); while (i.hasNext()) { Marker next = (Marker) i.next(); if (marker.getName() != "JSON") { node.add(next.getName()); } } } } return node; }

Target:
private ArrayNode createTags(ILoggingEvent event) { ArrayNode node = null; final Marker marker = event.getMarker(); if (marker != null) { node = MAPPER.createArrayNode(); if (!marker.getName().equals("JSON")) { node.add(marker.getName()); } if (marker.hasReferences()) { final Iterator<?> i = event.getMarker().iterator(); while (i.hasNext()) { Marker next = (Marker) i.next(); if (!marker.getName().equals("JSON")) { node.add(next.getName()); } } } } return node; }
Source:
public List<String> call(ApiCaller ac, Deserializer parms ) throws PerunException { return cz.metacentrum.perun.core.api.AuthzResolver.getGroupRoleNames(ac.getSession(), ac.getGroupById(parms.readInt("group"))); }

Target:
public List<String> call(ApiCaller ac, Deserializer parms) throws PerunException { return cz.metacentrum.perun.core.api.AuthzResolver.getPrincipalRoleNames(ac.getSession()); }
Source:
private void findRolesForUrl(BlackboardArtifact artifact, RoleProcessor roleProcessor) throws TskCoreException { BlackboardAttribute urlAttr = artifact.getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_URL)); if (urlAttr == null) { return; } BlackboardAttribute domainAttr = artifact.getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DOMAIN)); if (domainAttr == null) { return; } String url = urlAttr.getValueString(); String domain = domainAttr.getValueString(); findMyBbRole(url, domain, artifact, roleProcessor); findPhpBbRole(url, domain, artifact, roleProcessor); findJoomlaRole(url, domain, artifact, roleProcessor); findWordPressRole(url, domain, artifact, roleProcessor); }

Target:
private void findRolesForUrl(BlackboardArtifact artifact, RoleProcessor roleProcessor) throws TskCoreException { BlackboardAttribute urlAttr = artifact.getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_URL)); if (urlAttr == null) { return; } BlackboardAttribute domainAttr = artifact.getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DOMAIN)); if (domainAttr == null) { return; } String url = urlAttr.getValueString().toLowerCase(); String domain = domainAttr.getValueString().toLowerCase(); findMyBbRole(url, domain, artifact, roleProcessor); findPhpBbRole(url, domain, artifact, roleProcessor); findJoomlaRole(url, domain, artifact, roleProcessor); findWordPressRole(url, domain, artifact, roleProcessor); }
Source:
private Object transformValue(int sqlColumnType, Object original) throws SQLException { if (original != null) { switch (sqlColumnType) { case Types.SMALLINT: case Types.TINYINT: if (original.getClass() == Short.class) { return ((Short) original).intValue(); } else { break; } case Types.NUMERIC: case Types.DECIMAL: return ((BigDecimal) original).doubleValue(); case Types.DATE: return ((Date) original).getTime(); case Types.TIME: return ((Time) original).getTime(); case Types.TIMESTAMP: return ((Timestamp) original).getTime(); case Types.BLOB: Object toReturn; Blob blob = (Blob) original; try { toReturn = blob.getBytes(1, (int) blob.length()); } finally { blob.free(); } return toReturn; case Types.CLOB: String s; StringBuilder sbf = new StringBuilder(); Clob clob = (Clob) original; try { try (BufferedReader br = new BufferedReader(clob.getCharacterStream(1, (int) clob.length()))) { if ((s = br.readLine()) != null) { sbf.append(s); } while ((s = br.readLine()) != null) { sbf.append(System.getProperty("line.separator")); sbf.append(s); } } } catch (IOException e) { throw new SQLException(e); } finally { clob.free(); } return sbf.toString(); } } return original; }

Target:
private Object transformValue(int sqlColumnType, Object original) throws SQLException { if (original != null) { switch (sqlColumnType) { case Types.SMALLINT: case Types.TINYINT: return ((Number) original).intValue(); case Types.NUMERIC: case Types.DECIMAL: return ((BigDecimal) original).doubleValue(); case Types.DATE: return ((Date) original).getTime(); case Types.TIME: return ((Time) original).getTime(); case Types.TIMESTAMP: return ((Timestamp) original).getTime(); case Types.BLOB: Object toReturn; Blob blob = (Blob) original; try { toReturn = blob.getBytes(1, (int) blob.length()); } finally { blob.free(); } return toReturn; case Types.CLOB: String s; StringBuilder sbf = new StringBuilder(); Clob clob = (Clob) original; try { try (BufferedReader br = new BufferedReader(clob.getCharacterStream(1, (int) clob.length()))) { if ((s = br.readLine()) != null) { sbf.append(s); } while ((s = br.readLine()) != null) { sbf.append(System.getProperty("line.separator")); sbf.append(s); } } } catch (IOException e) { throw new SQLException(e); } finally { clob.free(); } return sbf.toString(); } } return original; }
Source:
public MembershipType receiveMembership(String loginName){ setMembershipStartDate(); if(Calendar.getInstance().getTime().getTime() < membershipStartDate.getTime()){ return MembershipType.NOT_TO_THE_TIME; } if(loginName == null || loginName.equals("")){ return MembershipType.NOT_TO_LOGIN; } String identityNumber = userMembershipMapper.findAccountIdentityNumberByLoginName(loginName); if(identityNumber == null || identityNumber.equals("0")){ return MembershipType.NOT_TO_REGISTER; } if(CollectionUtils.isNotEmpty(userMembershipMapper.findByLoginName(loginName))){ return MembershipType.ALREADY_RECEIVE; } long investAmount = userMembershipMapper.sumSuccessInvestAmountByLoginName(loginName); Date registerTime = userMembershipMapper.findAccountRegisterTimeByLoginName(loginName); if(registerTime != null && registerTime.getTime() < membershipStartDate.getTime() && investAmount < 1000){ return MembershipType.ALREADY_REGISTER_NOT_INVEST_1000; } if(registerTime != null && registerTime.getTime() < membershipStartDate.getTime() && investAmount >= 1000){ createUserMembershipModel(loginName, MembershipLevel.V5.getLevel()); return MembershipType.ALREADY_REGISTER_ALREADY_INVEST_1000; } return MembershipType.AFTER_START_ACTIVITY_REGISTER; }

Target:
public GivenMembership receiveMembership(String loginName){ if(DateTime.parse(heroRankingActivityPeriod.get(0),DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss")).toDate().after(DateTime.now().toDate())){ return GivenMembership.NO_TIME; } if(DateTime.parse(heroRankingActivityPeriod.get(1),DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss")).toDate().before(DateTime.now().toDate())){ return GivenMembership.END_TIME; } if(loginName == null || loginName.equals("")){ return GivenMembership.NO_LOGIN; } if(userMembershipMapper.findAccountIdentityNumberByLoginName(loginName) == 0){ return GivenMembership.NO_REGISTER; } if(userMembershipMapper.findByLoginNameByType(loginName,UserMembershipType.GIVEN) != null){ return GivenMembership.ALREADY_RECEIVED; } long investAmount = userMembershipMapper.sumSuccessInvestAmountByLoginName(loginName); Date registerTime = userMembershipMapper.findAccountRegisterTimeByLoginName(loginName); if(registerTime != null && DateTime.parse(heroRankingActivityPeriod.get(0),DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss")).toDate().after(registerTime) && investAmount < 100000){ return GivenMembership.ALREADY_REGISTER_NOT_INVEST_1000; } if(registerTime != null && DateTime.parse(heroRankingActivityPeriod.get(0),DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss")).toDate().after(registerTime) && investAmount >= 100000){ createUserMembershipModel(loginName, MembershipLevel.V5.getLevel()); return GivenMembership.ALREADY_REGISTER_ALREADY_INVEST_1000; } return GivenMembership.AFTER_START_ACTIVITY_REGISTER; }
Source:
private static HaxeGenericResolver findGenericResolverFromVariable(HaxeCallExpression expr) { PsiElement[] children = expr.getExpression().getChildren(); Optional<HaxeReference> first = Stream.of(children) .filter(c -> c instanceof HaxeReference) .map(c -> (HaxeReference)c) .findFirst(); if(first.isPresent()) { HaxeReference expression = first.get(); HaxeClassResolveResult resolveResult = expression.resolveHaxeClass(); SpecificHaxeClassReference reference = resolveResult.getSpecificClassReference(expression.getElement(), null); SpecificHaxeClassReference finalReference = getUnderlyingClassIfAbstractNull(reference); return finalReference.getGenericResolver(); } return null; }

Target:
private static HaxeGenericResolver findGenericResolverFromVariable(HaxeCallExpression expr) { HaxeReference[] type = UsefulPsiTreeUtil.getChildrenOfType(expr.getExpression(), HaxeReference.class, null); if(type!= null && type.length> 0) { HaxeReference expression = type[0]; HaxeClassResolveResult resolveResult = expression.resolveHaxeClass(); SpecificHaxeClassReference reference = resolveResult.getSpecificClassReference(expression.getElement(), null); SpecificHaxeClassReference finalReference = getUnderlyingClassIfAbstractNull(reference); return finalReference.getGenericResolver(); } return null; }
Source:
public static void showSpectraIdentificationDialog(final Scan scan, final SpectraPlot spectraPlot) { final SpectraIdentificationSpectralDatabaseParameters parameters = new SpectraIdentificationSpectralDatabaseParameters(); if (parameters.showSetupDialog(scan, MZmineCore.getDesktop().getMainWindow(), true) == ExitCode.OK) { MZmineCore.getTaskController().addTask(new SpectraIdentificationSpectralDatabaseTask( parameters.cloneParameterSet(), scan, spectraPlot)); } }

Target:
public static void showSpectraIdentificationDialog(final Scan scan, final SpectraPlot spectraPlot) { final SpectraIdentificationSpectralDatabaseParameters parameters = (SpectraIdentificationSpectralDatabaseParameters) MZmineCore.getConfiguration() .getModuleParameters(SpectraIdentificationSpectralDatabaseModule.class); if (parameters.showSetupDialog(scan, MZmineCore.getDesktop().getMainWindow(), true) == ExitCode.OK) { MZmineCore.getTaskController().addTask(new SpectraIdentificationSpectralDatabaseTask( parameters.cloneParameterSet(), scan, spectraPlot)); } }
Source:
public static String commaSeparatedNames(List<Field> fieldsToJoin, String prefix, boolean csvOutput) { return fieldsToJoin.stream() .map(f -> { String column = prefix != null ? prefix + f.name : f.name; if (csvOutput) { if (DoubleField.class.isInstance(f) && ((DoubleField) f).getOutputPrecision() > 0) { column = String.format( "round(%s::DECIMAL, %d) as %s", column, ((DoubleField) f).getOutputPrecision(), f.name ); } else if (TimeField.class.isInstance(f)) { column = String.format( "TO_CHAR((%s || ' second')::interval, 'HH24:MI:SS') as %s", column, f.name ); } } return column; }) .collect(Collectors.joining(", ")); }

Target:
public static String commaSeparatedNames(List<Field> fieldsToJoin, String prefix, boolean csvOutput) { return fieldsToJoin.stream() .map(f -> f.getColumnExpression(prefix, csvOutput)) .collect(Collectors.joining(", ")); }
Source:
public boolean validateAndSetClusterQuota(QuotaConsumptionParametersWrapper parameters) { List<QuotaVdsGroupConsumptionParameter> vdsGroupConsumptionParameters = filterQuotaVdsGroupConsumptionParameter(parameters.getParameters()); synchronized (storagePoolQuotaMap.get(parameters.getAuditLogable().getStoragePool().getId())) { for (QuotaVdsGroupConsumptionParameter parameter : vdsGroupConsumptionParameters) { Quota quota = parameter.getQuota(); QuotaVdsGroup quotaVdsGroup = null; if (quota.getGlobalQuotaVdsGroup() != null) { quotaVdsGroup = quota.getGlobalQuotaVdsGroup(); } else { for (QuotaVdsGroup vdsGroup : quota.getQuotaVdsGroups()) { if (vdsGroup.getVdsGroupId().equals(parameter.getVdsGroupId())) { quotaVdsGroup = vdsGroup; break; } } } if (quotaVdsGroup == null) { parameters.getCanDoActionMessages().add(VdcBllMessages.ACTION_TYPE_FAILED_QUOTA_IS_NOT_VALID.toString()); return false; } boolean success = checkQuotaClusterLimits(parameters.getAuditLogable().getStoragePool().getQuotaEnforcementType(), quota, quotaVdsGroup, parameter.getRequestedMemory(), parameter.getRequestedCpu(), parameters.getCanDoActionMessages(), parameters.getAuditLogable()); if (!success) { return false; } } } return true; }

Target:
public boolean validateAndSetClusterQuota(QuotaConsumptionParametersWrapper parameters) { List<QuotaVdsGroupConsumptionParameter> vdsGroupConsumptionParameters = filterQuotaVdsGroupConsumptionParameter(parameters.getParameters()); Pair<AuditLogType, AuditLogableBase> auditLogPair = new Pair<AuditLogType, AuditLogableBase>(); auditLogPair.setSecond(parameters.getAuditLogable()); lock.readLock().lock(); try { if (storagePoolQuotaMap.get(parameters.getStoragePoolId()) == null) { return false; } synchronized (storagePoolQuotaMap.get(parameters.getStoragePoolId())) { for (QuotaVdsGroupConsumptionParameter parameter : vdsGroupConsumptionParameters) { Quota quota = parameter.getQuota(); QuotaVdsGroup quotaVdsGroup = null; if (quota.getGlobalQuotaVdsGroup() != null) { quotaVdsGroup = quota.getGlobalQuotaVdsGroup(); } else { for (QuotaVdsGroup vdsGroup : quota.getQuotaVdsGroups()) { if (vdsGroup.getVdsGroupId().equals(parameter.getVdsGroupId())) { quotaVdsGroup = vdsGroup; break; } } } if (quotaVdsGroup == null) { parameters.getCanDoActionMessages() .add(VdcBllMessages.ACTION_TYPE_FAILED_QUOTA_IS_NOT_VALID.toString()); return false; } boolean success = checkQuotaClusterLimits(parameters.getAuditLogable() .getStoragePool() .getQuotaEnforcementType(), quota, quotaVdsGroup, parameter.getRequestedMemory(), parameter.getRequestedCpu(), parameters.getCanDoActionMessages(), auditLogPair); if (!success) { return false; } } } } finally { lock.readLock().unlock(); quotaManagerAuditLogger.auditLog(auditLogPair.getSecond(), auditLogPair.getFirst()); } return true; }
Source:
public void pressOKTest() { onLegoSensorPortConfigDialog().performClickOnOK(); onLegoSensorPortConfigDialog(); }

Target:
public void pressOKTest() { onBrickAtPosition(1).onChildView(withId(R.id.brick_change_size_by_edit_text)).perform(click()); openLegoSensorPortConfigDialog(); onLegoSensorPortConfigDialog(NXT_SENSOR_TOUCH) .checkDialogVisible() .performClickOnOK() .checkDialogVisible(); }
Source:
private void prepareParameters() { Map<Object, Integer> weights = new HashMap(); getParameters().setOperationsJobWeight(weights); int createWeight = Long.valueOf(Math.round(getParameters().getJobWeight() / 10d)).intValue(); weights.put(CopyStage.DEST_CREATION, createWeight); weights.put(CopyStage.DATA_COPY, getParameters().getJobWeight() - createWeight); }

Target:
private void prepareParameters() { Map<String, Integer> weights = new HashMap<>(); getParameters().setOperationsJobWeight(weights); if (getParameters().getJobWeight() != null) { int createWeight = Long.valueOf(Math.round(getParameters().getJobWeight() / 10d)).intValue(); weights.put(CopyStage.DEST_CREATION.name(), createWeight); weights.put(CopyStage.DATA_COPY.name(), getParameters().getJobWeight() - createWeight); } }
Source:
public void testAMeetingCannotBeCreatedWithoutSubject() { ExcelReader excelReader = new ExcelReader(EXCEL_INPUT_DATA); List<Map<String, String>> meetingData = excelReader.getMapValues("MeetingData"); String organizer = meetingData.get(0).get("Organizer"); String startTime = meetingData.get(0).get("Start time"); String endTime = meetingData.get(0).get("End time"); String attendee = meetingData.get(0).get("Attendee"); String body = meetingData.get(0).get("Body"); HomeTabletPage homeTabletPage = new HomeTabletPage(); SchedulePage schedulePage = homeTabletPage.clickScheduleBtn(); schedulePage.setOrganizerTxtBox(organizer) .setStartTimeDate(startTime) .setEndTimeDate(endTime) .setAttendeeTxtBoxPressingEnter(attendee) .setBodyTxtBox(body) .clickCreateBtn(); Assert.assertTrue(schedulePage.isErrorSubjectLblDisplayed()); }

Target:
public void testAMeetingCannotBeCreatedWithoutSubject() { ExcelReader excelReader = new ExcelReader(EXCEL_INPUT_DATA); List<Map<String, String>> meetingData = excelReader.getMapValues("MeetingData"); String organizer = meetingData.get(0).get("Organizer"); String attendee = meetingData.get(0).get("Attendee"); String body = meetingData.get(0).get("Body"); HomeTabletPage homeTabletPage = new HomeTabletPage(); SchedulePage schedulePage = homeTabletPage.clickScheduleBtn(); schedulePage.setOrganizerTxtBox(organizer) .setAttendeeTxtBoxPressingEnter(attendee) .setBodyTxtBox(body) .clickCreateBtn(); Assert.assertTrue(schedulePage.isErrorSubjectLblDisplayed()); }
Source:
public void appendsServerAddressTagIfClientLogIsPresent() { Span span = span("foo"); span.logEvent(Constants.CLIENT_RECV); Spans spans = new Spans(this.host, Collections.singletonList(span)); Iterator<zipkin.Span> result = new SamplingZipkinSpanIterator( Sampler.create(1.0f), spans); assertThat(result) .hasSize(1) .flatExtracting(input1 -> input1.binaryAnnotations) .filteredOn("key", Constants.SERVER_ADDR) .extracting(input -> input.value) .contains("myservice".getBytes(Charset.forName("UTF-8"))); }

Target:
public void appendsServerAddressTagIfClientLogIsPresent() { Span span = span("foo"); span.logEvent(Constants.CLIENT_SEND); Spans spans = new Spans(this.host, Collections.singletonList(span)); Iterator<zipkin.Span> result = new SamplingZipkinSpanIterator( Sampler.create(1.0f), spans); assertThat(result) .hasSize(1) .flatExtracting(input1 -> input1.binaryAnnotations) .filteredOn("key", Constants.SERVER_ADDR) .extracting(input -> input.endpoint.serviceName) .contains("myservice"); }
Source:
private void addCommonSchema() { if (!this.name.equals(SCIMConstants.COMMON)) { List<AttributeSchema> commonAttributeSchemas = SCIMSchemaDefinitions.SCIM_COMMON_SCHEMA.getAttributesList(); for (AttributeSchema commonAttributeSchema : commonAttributeSchemas) { this.attributeSchemas.add(commonAttributeSchema); } } }

Target:
private void addCommonSchema() { if (!(SCIMConstants.COMMON.equals(this.name))) { List<AttributeSchema> commonAttributeSchemas = SCIMSchemaDefinitions.SCIM_COMMON_SCHEMA.getAttributesList(); for (AttributeSchema commonAttributeSchema : commonAttributeSchemas) { this.attributeSchemas.add(commonAttributeSchema); } } }
Source:
private void UpdateOptionsNonLocalFS() { if (hosts == null || allHosts == null) { return; } if (getEntity() == null) { StopProgress(); return; } UICommand addHostAction = new UICommand("AddHost", this); if (hosts.size() > 1) { hosts.remove(0); } if (hosts.isEmpty()) { addHostAction.setTitle(ClusterConfigureHostsAction); getCompulsoryActions().add(addHostAction); } else { addHostAction.setTitle(ClusterAddAnotherHostAction); getOptionalActions().add(addHostAction); } if (getEntity().getStoragePoolId() == null) { addHostAction.getExecuteProhibitionReasons().add(ConstantsManager.getInstance() .getConstants() .theClusterIsntAttachedToADcClusterGuide()); addHostAction.setIsExecutionAllowed(false); return; } ArrayList<VDS> availableHosts = new ArrayList<VDS>(); for (VDS vds : allHosts) { if (!getEntity().getId().equals(vds.getVdsGroupId()) && (vds.getStatus() == VDSStatus.Maintenance || vds.getStatus() == VDSStatus.PendingApproval) && vds.getSupportedClusterVersionsSet().contains(getEntity().getcompatibility_version())) { availableHosts.add(vds); } } UICommand selectHostAction = new UICommand("SelectHost", this); if (availableHosts.size() > 0) { if (hosts.isEmpty()) { selectHostAction.setTitle(SelectHostsAction); getCompulsoryActions().add(selectHostAction); } else { selectHostAction.setTitle(SelectHostsAction); getOptionalActions().add(selectHostAction); } } StopProgress(); }

Target:
private void UpdateOptionsNonLocalFS() { if (hosts == null || allHosts == null) { return; } if (getEntity() == null) { StopProgress(); setWindow(null); return; } UICommand addHostAction = new UICommand("AddHost", this); if (hosts.size() > 1) { hosts.remove(0); } if (hosts.isEmpty()) { addHostAction.setTitle(ClusterConfigureHostsAction); getCompulsoryActions().add(addHostAction); } else { addHostAction.setTitle(ClusterAddAnotherHostAction); getOptionalActions().add(addHostAction); } if (getEntity().getStoragePoolId() == null) { addHostAction.getExecuteProhibitionReasons().add(ConstantsManager.getInstance() .getConstants() .theClusterIsntAttachedToADcClusterGuide()); addHostAction.setIsExecutionAllowed(false); return; } ArrayList<VDS> availableHosts = new ArrayList<VDS>(); for (VDS vds : allHosts) { if (!getEntity().getId().equals(vds.getVdsGroupId()) && (vds.getStatus() == VDSStatus.Maintenance || vds.getStatus() == VDSStatus.PendingApproval) && vds.getSupportedClusterVersionsSet().contains(getEntity().getcompatibility_version())) { availableHosts.add(vds); } } UICommand selectHostAction = new UICommand("SelectHost", this); if (availableHosts.size() > 0) { if (hosts.isEmpty()) { selectHostAction.setTitle(SelectHostsAction); getCompulsoryActions().add(selectHostAction); } else { selectHostAction.setTitle(SelectHostsAction); getOptionalActions().add(selectHostAction); } } StopProgress(); }
Source:
public void testActivateDeActivate() throws GridClientException { GridClientClusterState state = client.state(); boolean active = state.state() == ACTIVE; assertTrue(active); state.state(INACTIVE, true); IgniteEx ig1 = grid(0); IgniteEx ig2 = grid(1); assertFalse(ig1.active()); assertFalse(ig2.active()); assertEquals(state.state(), INACTIVE); state.state(ACTIVE, true); assertTrue(ig1.active()); assertTrue(ig2.active()); assertEquals(state.state(), ACTIVE); }

Target:
public void testActivateDeActivate() throws GridClientException { GridClientClusterState state = client.state(); boolean active = active(state.state()); assertTrue(active); state.state(INACTIVE, true); IgniteEx ig1 = grid(0); IgniteEx ig2 = grid(1); assertFalse(ig1.active()); assertFalse(ig2.active()); assertEquals(INACTIVE, state.state()); state.state(ACTIVE, false); assertTrue(ig1.active()); assertTrue(ig2.active()); assertEquals(ACTIVE, state.state()); }
Source:
public static boolean customImageExists(String storage, String key) { boolean retval = false; final AzureBlobClient azureBlob = ContextBuilder.newBuilder("azureblob") .credentials(storage, key) .buildApi(AzureBlobClient.class); if (azureBlob.containerExists("system")) retval = true; try { azureBlob.close(); } catch (IOException e) { e.printStackTrace(); } return retval; }

Target:
public static boolean customImageExists(String storage, String key) { final AzureBlobClient azureBlob = ContextBuilder.newBuilder("azureblob") .credentials(storage, key) .buildApi(AzureBlobClient.class); try { return azureBlob.containerExists("system"); } finally { Closeables2.closeQuietly(azureBlob); } }
Source:
public static List<Path> unrollPaths(final Collection<Path> inputs, final String... extensions) { if (extensions.length < 1) throw new IllegalArgumentException("Must provide at least one extension."); final Stack<Path> stack = new Stack<>(); final List<Path> output = new ArrayList<>(); stack.addAll(inputs); while (!stack.empty()) { final Path p = stack.pop(); final String name = p.toString(); boolean matched = false; for (final String ext : extensions) { if (!matched && name.endsWith(ext)) { output.add(p); matched = true; } } if (!matched) { try { Files.lines(p) .map(String::trim) .filter(s -> !s.isEmpty()) .forEach(s -> { final Path innerPath; try { innerPath = getPath(s); stack.push(innerPath); } catch (IOException e) { throw new IllegalArgumentException("cannot convert " + s + " to a Path."); } } ); } catch (IOException e) { throw new IllegalArgumentException("had trouble reading from " + p.toUri().toString()); } } } Collections.reverse(output); return output; }

Target:
public static List<Path> unrollPaths(final Collection<Path> inputs, final String... extensions) { if (extensions.length < 1) throw new IllegalArgumentException("Must provide at least one extension."); final Stack<Path> stack = new Stack<>(); final List<Path> output = new ArrayList<>(); stack.addAll(inputs); while (!stack.empty()) { final Path p = stack.pop(); final String name = p.toString(); boolean matched = false; for (final String ext : extensions) { if (!matched && name.endsWith(ext)) { output.add(p); matched = true; } } if (!matched) { try { Files.lines(p) .map(String::trim) .filter(s -> !s.isEmpty()) .forEach(s -> { final Path innerPath; try { innerPath = getPath(s); stack.push(innerPath); } catch (IOException e) { throw new IllegalArgumentException("cannot convert " + s + " to a Path.", e); } } ); } catch (IOException e) { throw new IllegalArgumentException("had trouble reading from " + p.toUri().toString(), e); } } } Collections.reverse(output); return output; }