auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testFileUpdateTestTable() throws Exception { final String xml = loadResource("Update Test Table.gdst"); final GuidedDecisionTable52 table52 = GuidedDTXMLPersistence.getInstance().unmarshal(xml); final DecisionTableAnalyzer analyzer = getDecisionTableAnalyzer(table52); analyzer.onValidate(new ValidateEvent(new HashMap<Coordinate, List<List<CellValue<? extends Comparable<?>>>>>())); assertContains("RedundantRows", analysisReport); table52.getData().get(0).get(3).setBooleanValue(false); update(analyzer, new Coordinate(0, 3)); assertContains("ConflictingRows", analysisReport); table52.getData().get(0).get(3).setBooleanValue(true); update(analyzer, new Coordinate(0, 3)); List<Issue> analysisData = analysisReport.getAnalysisData(); for (Issue issue : analysisData) { System.out.println(issue.toString()); } assertContains("RedundantRows", analysisReport); }

Target:
public void testFileUpdateTestTable() throws Exception { final String xml = loadResource("Update Test Table.gdst"); final GuidedDecisionTable52 table52 = GuidedDTXMLPersistence.getInstance().unmarshal(xml); final DecisionTableAnalyzer analyzer = getDecisionTableAnalyzer(table52); analyzer.onValidate(new ValidateEvent(new HashMap<Coordinate, List<List<CellValue<? extends Comparable<?>>>>>())); assertContains("RedundantRows", analysisReport); table52.getData().get(0).get(3).setBooleanValue(false); update(analyzer, new Coordinate(0, 3)); assertContains("ConflictingRows", analysisReport); table52.getData().get(0).get(3).setBooleanValue(true); update(analyzer, new Coordinate(0, 3)); assertContains("RedundantRows", analysisReport); assertEquals(1, analysisReport.getAnalysisData().size()); }
Source:
protected void init() { T parameters = getParameters(); super.setVmTemplateName(parameters.getName()); VmStatic parameterMasterVm = parameters.getMasterVm(); if (parameterMasterVm != null) { super.setVmId(parameterMasterVm.getId()); setClusterId(parameterMasterVm.getClusterId()); if (VmDeviceUtils.shouldOverrideSoundDevice( getParameters().getMasterVm(), CompatibilityVersionUtils.getEffective(parameterMasterVm, getCluster()), getParameters().isSoundDeviceEnabled())) { parameters.setSoundDeviceEnabled(true); } if (getParameters().isConsoleEnabled() == null) { parameters.setConsoleEnabled(false); } VmHandler.updateDefaultTimeZone(parameterMasterVm); VmHandler.autoSelectUsbPolicy(getParameters().getMasterVm(), getCluster()); VmHandler.autoSelectDefaultDisplayType(getVmId(), getParameters().getMasterVm(), getCluster(), getParameters().getGraphicsDevices()); separateCustomProperties(parameterMasterVm); } if (getVm() != null) { updateVmDevices(); images.addAll(getVmDisksFromDB()); setStoragePoolId(getVm().getStoragePoolId()); isVmInDb = true; } else if (getCluster() != null && parameterMasterVm != null) { VM vm = new VM(parameterMasterVm, new VmDynamic(), null); vm.setClusterCompatibilityVersion(getCluster().getCompatibilityVersion()); setVm(vm); setStoragePoolId(getCluster().getStoragePoolId()); } updateDiskInfoDestinationMap(); parameters.setUseCinderCommandCallback(!getCinderDisks().isEmpty()); }

Target:
protected void init() { T parameters = getParameters(); super.setVmTemplateName(parameters.getName()); VmStatic parameterMasterVm = parameters.getMasterVm(); if (parameterMasterVm != null) { super.setVmId(parameterMasterVm.getId()); setClusterId(parameterMasterVm.getClusterId()); if (VmDeviceUtils.shouldOverrideSoundDevice( getParameters().getMasterVm(), getVm() == null ? CompatibilityVersionUtils.getEffective(parameterMasterVm, getCluster()) : getVm().getCompatibilityVersion(), getParameters().isSoundDeviceEnabled())) { parameters.setSoundDeviceEnabled(true); } if (getParameters().isConsoleEnabled() == null) { parameters.setConsoleEnabled(false); } VmHandler.updateDefaultTimeZone(parameterMasterVm); VmHandler.autoSelectUsbPolicy(getParameters().getMasterVm(), getCluster()); VmHandler.autoSelectDefaultDisplayType(getVmId(), getParameters().getMasterVm(), getCluster(), getParameters().getGraphicsDevices()); separateCustomProperties(parameterMasterVm); } if (getVm() != null) { updateVmDevices(); images.addAll(getVmDisksFromDB()); setStoragePoolId(getVm().getStoragePoolId()); isVmInDb = true; } else if (getCluster() != null && parameterMasterVm != null) { VM vm = new VM(parameterMasterVm, new VmDynamic(), null); vm.setClusterCompatibilityVersion(getCluster().getCompatibilityVersion()); setVm(vm); setStoragePoolId(getCluster().getStoragePoolId()); } updateDiskInfoDestinationMap(); parameters.setUseCinderCommandCallback(!getCinderDisks().isEmpty()); }
Source:
public void enableSetDateAndSetTime() throws Exception { Instrumentation instrumentation = testFramework.getInstrumentation(); UiDevice device = testFramework.getDevice(); AppLauncher.launch(instrumentation, "Settings"); UiScrollable itemList = new UiScrollable( new UiSelector().resourceIdMatches(Res.SETTINGS_LIST_CONTAINER_RES)); itemList.setAsVerticalList(); itemList.scrollIntoView(new UiSelector().textContains("Date & time")); device.findObject(new UiSelector().text("Date & time")).click(); UiObject2 switchWidget = UiAutomatorPlus.findObjectByRelative( instrumentation, By.clazz("android.widget.Switch"), By.text("Automatic date & time"), By.clazz("android.widget.ListView")); if (!switchWidget.isChecked()) { switchWidget.click(); } assertTrue((switchWidget).isChecked()); assertTrue(!device.findObject(new UiSelector().text("Set date")).isEnabled()); assertTrue(!device.findObject(new UiSelector().text("Set time")).isEnabled()); switchWidget.click(); assertTrue(device.findObject(new UiSelector().text("Set date")).isEnabled()); assertTrue(device.findObject(new UiSelector().text("Set time")).isEnabled()); device.findObject(new UiSelector().text("Set date")).click(); assertTrue(device.findObject( new UiSelector().resourceId(Res.ANDROID_DATE_PICKER_HEADER_RES)).exists()); device.findObject(new UiSelector().textContains("CANCEL")).click(); device.findObject(new UiSelector().text("Set time")).click(); assertTrue(device.findObject( new UiSelector().resourceId(Res.ANDROID_TIME_HEADER_RES)).exists()); device.findObject(new UiSelector().textContains("CANCEL")).click(); }

Target:
public void enableSetDateAndSetTime() throws Exception { Instrumentation instrumentation = testFramework.getInstrumentation(); UiDevice device = testFramework.getDevice(); AppLauncher.launch(instrumentation, "Settings"); UiScrollable itemList = new UiScrollable( new UiSelector().resourceIdMatches(Res.SETTINGS_LIST_CONTAINER_RES)); itemList.setAsVerticalList(); itemList.scrollIntoView(new UiSelector().textContains("Date & time")); device.findObject(new UiSelector().text("Date & time")).click(); UiObject2 switchWidget = UiAutomatorPlus.findObjectByRelative( instrumentation, By.clazz("android.widget.Switch"), By.text("Automatic date & time"), By.clazz("android.widget.ListView")); if (!switchWidget.isChecked()) { switchWidget.click(); } assertTrue(!device.findObject(new UiSelector().text("Set date")).isEnabled()); assertTrue(!device.findObject(new UiSelector().text("Set time")).isEnabled()); switchWidget.click(); assertTrue(device.findObject(new UiSelector().text("Set date")).isEnabled()); assertTrue(device.findObject(new UiSelector().text("Set time")).isEnabled()); device.findObject(new UiSelector().text("Set date")).click(); assertTrue(device.findObject( new UiSelector().resourceId(Res.ANDROID_DATE_PICKER_HEADER_RES)).exists()); device.findObject(new UiSelector().textContains("CANCEL")).click(); device.findObject(new UiSelector().text("Set time")).click(); assertTrue(device.findObject( new UiSelector().resourceId(Res.ANDROID_TIME_HEADER_RES)).exists()); device.findObject(new UiSelector().textContains("CANCEL")).click(); }
Source:
public IdentifierRules identifierRules() { if (identifierRules.get() == null) { if (defaultIdentifierRules != null && connections.peek() == null) { return defaultIdentifierRules; } try (Connection connection = getConnection()) { DatabaseMetaData metaData = connection.getMetaData(); String leadingQuoteStr = metaData.getIdentifierQuoteString(); String trailingQuoteStr = leadingQuoteStr; String separator = metaData.getCatalogSeparator(); if (leadingQuoteStr == null || leadingQuoteStr.isEmpty()) { leadingQuoteStr = defaultIdentifierRules.leadingQuoteString(); trailingQuoteStr = defaultIdentifierRules.trailingQuoteString(); } if (separator == null || separator.isEmpty()) { separator = defaultIdentifierRules.identifierDelimiter(); } identifierRules.set(new IdentifierRules(separator, leadingQuoteStr, trailingQuoteStr)); } catch (SQLException e) { if (defaultIdentifierRules != null) { identifierRules.set(defaultIdentifierRules); log.warn("Unable to get identifier metadata; using default rules", e); } else { throw new ConnectException("Unable to get identifier metadata", e); } } } return identifierRules.get(); }

Target:
public IdentifierRules identifierRules() { if (identifierRules.get() == null) { try (Connection connection = getConnection()) { DatabaseMetaData metaData = connection.getMetaData(); String leadingQuoteStr = metaData.getIdentifierQuoteString(); String trailingQuoteStr = leadingQuoteStr; String separator = metaData.getCatalogSeparator(); if (leadingQuoteStr == null || leadingQuoteStr.isEmpty()) { leadingQuoteStr = defaultIdentifierRules.leadingQuoteString(); trailingQuoteStr = defaultIdentifierRules.trailingQuoteString(); } if (separator == null || separator.isEmpty()) { separator = defaultIdentifierRules.identifierDelimiter(); } identifierRules.set(new IdentifierRules(separator, leadingQuoteStr, trailingQuoteStr)); } catch (SQLException e) { if (defaultIdentifierRules != null) { identifierRules.set(defaultIdentifierRules); log.warn("Unable to get identifier metadata; using default rules", e); } else { throw new ConnectException("Unable to get identifier metadata", e); } } } return identifierRules.get(); }
Source:
private void add(@NotNull Value value) { Preconditions.checkArgument(value != null, "value cannot be null"); if(summary.empty) summary.empty = false; if(value.isSequence()) { if(value.isNull()) { summary.frequencyDist.addValue(NULL_NAME); } else { for(Value v : value.asSequence().getValue()) { add(v); } } } else { summary.frequencyDist.addValue(value.isNull() ? NULL_NAME : NOT_NULL_NAME); if(!value.isNull()) { if(value.getValueType() == PointType.get()) { coords.add((Coordinate) value.getValue()); } else if(value.getValueType() == LineStringType.get()) { coords.addAll((Collection<Coordinate>) value.getValue()); } else if(value.getValueType() == PolygonType.get()) { Collection<List<Coordinate>> coordinateList = (Collection<java.util.List<Coordinate>>) value.getValue(); for(List<Coordinate> coordinate : coordinateList) { coords.addAll(coordinate); } } } } }

Target:
private void add(@NotNull Value value) { Preconditions.checkArgument(value != null, "value cannot be null"); if(summary.empty) summary.empty = false; if(value.isSequence()) { if(value.isNull()) { summary.frequencyDist.addValue(NULL_NAME); } else { for(Value v : value.asSequence().getValue()) { add(v); } } } else { summary.frequencyDist.addValue(value.isNull() ? NULL_NAME : NOT_NULL_NAME); if(!value.isNull()) { getCoordinates(value); } } }
Source:
public void testInsertSortedBucketedTable() { String tableName = "test_insert_sorted_bucketed_table"; @Language("SQL") String createTable = "" + "CREATE TABLE " + tableName + " " + "(id int, name varchar, ds varchar) " + "WITH (" + "bucketed_by = ARRAY[ 'id' ], " + "bucket_count = 11, " + "sorted_by = ARRAY[ '+name' ]" + ")"; assertUpdate(createTable); try { assertUpdate( "INSERT INTO " + tableName + " " + "VALUES " + " (1, VARCHAR 'b', VARCHAR 'c'), " + " (2, 'bb', 'cc'), " + " (3, 'bbb', 'ccc')", 3); fail("expected failure"); } catch (Exception e) { assertEquals(e.getMessage(), format("Inserting into bucketed sorted tables is not supported. Table 'tpch.%s'", tableName)); } assertUpdate("DROP TABLE " + tableName); assertFalse(getQueryRunner().tableExists(getSession(), tableName)); }

Target:
public void testInsertSortedBucketedTable() { String tableName = "test_insert_sorted_bucketed_table"; @Language("SQL") String createTable = "" + "CREATE TABLE " + tableName + " " + "(id int, name varchar, ds varchar) " + "WITH (" + "bucketed_by = ARRAY['id'], " + "bucket_count = 11, " + "sorted_by = ARRAY['+name']" + ")"; assertUpdate(createTable); assertThatThrownBy(() -> assertUpdate("INSERT INTO " + tableName + " VALUES (1, VARCHAR 'b', VARCHAR 'c')", 1)) .hasMessage(format("Inserting into bucketed sorted tables is not supported. Table 'tpch.%s'", tableName)); assertUpdate("DROP TABLE " + tableName); assertFalse(getQueryRunner().tableExists(getSession(), tableName)); }
Source:
public void onDetach() { super.onDetach(); if (EventBus.getDefault().isRegistered(this)) EventBus.getDefault().unregister(this); }

Target:
public void onDetach() { super.onDetach(); if (EventBus.getDefault().isRegistered(this)) { EventBus.getDefault().unregister(this); } }
Source:
public static void loadPropertiesFromResources(String path) throws IOException { if (instance == null) { instance = getConfigInstance(); } ClassLoader loader = Thread.currentThread().getContextClassLoader(); Enumeration<URL> resources = loader.getResources(path); if (!resources.hasMoreElements()) { throw new IOException("Cannot locate " + path + " as a classpath resource."); } while (resources.hasMoreElements()) { URL url = resources.nextElement(); Properties props = new Properties(); InputStream fin = url.openStream(); InputStreamReader reader = new InputStreamReader(fin, "UTF-8"); try { props.load(reader); } finally { if (reader != null) { reader.close(); } if (fin != null) { fin.close(); } } if (instance instanceof AggregatedConfiguration) { String name = getConfigName(url); ConcurrentMapConfiguration config = new ConcurrentMapConfiguration(); config.loadProperties(props); ((AggregatedConfiguration) instance).addConfiguration(config, name); } else { ConfigurationUtils.loadProperties(props, instance); } } }

Target:
public static void loadPropertiesFromResources(String path) throws IOException { if (instance == null) { instance = getConfigInstance(); } ClassLoader loader = Thread.currentThread().getContextClassLoader(); Enumeration<URL> resources = loader.getResources(path); if (!resources.hasMoreElements()) { throw new IOException("Cannot locate " + path + " as a classpath resource."); } while (resources.hasMoreElements()) { URL url = resources.nextElement(); InputStream fin = url.openStream(); Properties props = ConfigurationUtils.loadPropertiesFromInputStream(fin); if (instance instanceof AggregatedConfiguration) { String name = getConfigName(url); ConcurrentMapConfiguration config = new ConcurrentMapConfiguration(); config.loadProperties(props); ((AggregatedConfiguration) instance).addConfiguration(config, name); } else { ConfigurationUtils.loadProperties(props, instance); } } }
Source:
public boolean hasVisitDuring(Patient patient, Location location, Date startDatetime, Date stopDatetime) { List<VisitDomainWrapper> visits = getVisits(patient, location, startDatetime, stopDatetime); return visits != null && !visits.isEmpty(); }

Target:
public boolean hasVisitDuring(Patient patient, Location location, Date startDatetime, Date stopDatetime) { List<VisitDomainWrapper> visits = getVisits(patient, location, startDatetime, stopDatetime); return visits == null || visits.isEmpty() ? false : true; }
Source:
public void testFail() { final boolean[] crFlags = new boolean[4]; TmfCoalescedEventRequest request = setupTestRequest(crFlags); TmfEventRequest subRequest1 = new TmfEventRequestStub(ITmfEvent.class, range1, 100, 200); TmfEventRequest subRequest2 = new TmfEventRequestStub(ITmfEvent.class, range1, 100, 200); request.addRequest(subRequest1); request.addRequest(subRequest2); request.fail(null); assertTrue("isCompleted", request.isCompleted()); assertTrue("isFailed", request.isFailed()); assertFalse("isCancelled", request.isCancelled()); assertTrue("handleCompleted", crFlags[0]); assertFalse("handleSuccess", crFlags[1]); assertTrue("handleFailure", crFlags[2]); assertFalse("handleCancel", crFlags[3]); assertTrue("isCompleted", subRequest1.isCompleted()); assertTrue("isFailed", subRequest1.isFailed()); assertFalse("isCancelled", subRequest1.isCancelled()); assertTrue("isCompleted", subRequest2.isCompleted()); assertTrue("isFailed", subRequest2.isFailed()); assertFalse("isCancelled", subRequest2.isCancelled()); }

Target:
public void testFail() { final boolean[] crFlags = new boolean[4]; TmfCoalescedEventRequest request = setupTestRequest(crFlags); TmfEventRequest subRequest1 = new TmfEventRequestStub(ITmfEvent.class, range1, 100, 200); TmfEventRequest subRequest2 = new TmfEventRequestStub(ITmfEvent.class, range1, 100, 200); request.addRequest(subRequest1); request.addRequest(subRequest2); request.fail(new IllformedLocaleException("Hi")); assertTrue("isCompleted", request.isCompleted()); assertTrue("isFailed", request.isFailed()); final Throwable failCause = request.getFailCause(); assertNotNull("Cause of failure", failCause); assertEquals("Cause of failure message", "Hi", failCause.getCause().getMessage()); assertFalse("isCancelled", request.isCancelled()); assertTrue("handleCompleted", crFlags[0]); assertFalse("handleSuccess", crFlags[1]); assertTrue("handleFailure", crFlags[2]); assertFalse("handleCancel", crFlags[3]); assertTrue("isCompleted", subRequest1.isCompleted()); assertTrue("isFailed", subRequest1.isFailed()); assertFalse("isCancelled", subRequest1.isCancelled()); assertTrue("isCompleted", subRequest2.isCompleted()); assertTrue("isFailed", subRequest2.isFailed()); assertFalse("isCancelled", subRequest2.isCancelled()); }
Source:
public ConflictHandler get(TableReference tableReference) { ConflictHandler conflictHandler = cache.getUnchecked(tableReference); if (conflictHandler == null) { return ConflictHandler.RETRY_ON_WRITE_WRITE; } else { return conflictHandler; } }

Target:
public ConflictHandler get(TableReference tableReference) { return cache.getUnchecked(tableReference); }
Source:
protected boolean applyForSingleAttributeValue(Comparable attributeValue) { Set<Comparable> set = convertedInValues; if (attributeValue == null && set == null) { for (Comparable value : values) { if (isNull(value)) { return true; } } return false; } attributeValue = (Comparable) convertEnumValue(attributeValue); if (set == null) { set = createHashSet(values.length); for (Comparable value : values) { Comparable converted = convert(attributeValue, value); set.add(Comparables.canonicalizeForHashLookup(converted)); } convertedInValues = set; } return set.contains(Comparables.canonicalizeForHashLookup(attributeValue)); }

Target:
protected boolean applyForSingleAttributeValue(Comparable attributeValue) { Set<Comparable> set = convertedInValues; if (attributeValue == null && set == null) { Boolean valuesContainNull = this.valuesContainNull; if (valuesContainNull != null) { return valuesContainNull; } for (Comparable value : values) { if (isNull(value)) { this.valuesContainNull = true; return true; } } this.valuesContainNull = false; return false; } attributeValue = (Comparable) convertEnumValue(attributeValue); if (set == null) { set = createHashSet(values.length); for (Comparable value : values) { Comparable converted = convert(attributeValue, value); if (isNull(converted)) { converted = null; } set.add(Comparables.canonicalizeForHashLookup(converted)); } convertedInValues = set; } return set.contains(Comparables.canonicalizeForHashLookup(attributeValue)); }
Source:
protected Response getAccount(final String accountSid, final MediaType responseType, UriInfo info, UserIdentityContext userIdentityContext) { Account account = null; permissionEvaluator.checkPermission("RestComm:Read:Accounts",userIdentityContext); if (Sid.pattern.matcher(accountSid).matches()) { try { account = accountsDao.getAccount(new Sid(accountSid)); } catch (Exception e) { return status(NOT_FOUND).build(); } } else { try { account = accountsDao.getAccount(accountSid); } catch (Exception e) { return status(NOT_FOUND).build(); } } URI baseUri = info.getBaseUri(); Organization org = organizationsDao.getOrganization(account.getOrganizationSid()); String accountOrgDomain = org.getDomainName(); if (!accountOrgDomain.equalsIgnoreCase(baseUri.getHost().toString())) { return status(FORBIDDEN).entity("Account is not allowed to access requested organization").build(); } permissionEvaluator.secure(account, "RestComm:Read:Accounts", SecuredType.SECURED_ACCOUNT,userIdentityContext ); if (account == null) { return status(NOT_FOUND).build(); } else { Response.ResponseBuilder ok = Response.ok(); Profile associatedProfile = profileService.retrieveEffectiveProfileByAccountSid(account.getSid()); if (associatedProfile != null) { LinkHeader profileLink = composeLink(new Sid(associatedProfile.getSid()), info); ok.header(ProfileEndpoint.LINK_HEADER, profileLink.toString()); } if (APPLICATION_XML_TYPE.equals(responseType)) { final RestCommResponse response = new RestCommResponse(account); return ok.type(APPLICATION_XML).entity(xstream.toXML(response)).build(); } else if (APPLICATION_JSON_TYPE.equals(responseType)) { return ok.type(APPLICATION_JSON).entity(gson.toJson(account)).build(); } else { return null; } } }

Target:
protected Response getAccount(final String accountSid, final MediaType responseType, UriInfo info, UserIdentityContext userIdentityContext) { Account account = null; permissionEvaluator.checkPermission("RestComm:Read:Accounts",userIdentityContext); if (Sid.pattern.matcher(accountSid).matches()) { try { account = accountsDao.getAccount(new Sid(accountSid)); } catch (Exception e) { return status(NOT_FOUND).build(); } } else { try { account = accountsDao.getAccount(accountSid); } catch (Exception e) { return status(NOT_FOUND).build(); } } permissionEvaluator.secure(account, "RestComm:Read:Accounts", SecuredType.SECURED_ACCOUNT,userIdentityContext ); if (account == null) { return status(NOT_FOUND).build(); } else { Response.ResponseBuilder ok = Response.ok(); Profile associatedProfile = profileService.retrieveEffectiveProfileByAccountSid(account.getSid()); if (associatedProfile != null) { LinkHeader profileLink = composeLink(new Sid(associatedProfile.getSid()), info); ok.header(ProfileEndpoint.LINK_HEADER, profileLink.toString()); } if (APPLICATION_XML_TYPE.equals(responseType)) { final RestCommResponse response = new RestCommResponse(account); return ok.type(APPLICATION_XML).entity(xstream.toXML(response)).build(); } else if (APPLICATION_JSON_TYPE.equals(responseType)) { return ok.type(APPLICATION_JSON).entity(gson.toJson(account)).build(); } else { return null; } } }
Source:
private boolean isDMNFactMappingValid(String typeName, FactMapping factMapping, DMNType dmnType) { Type rootType = getRootType((BaseDMNTypeImpl) dmnType); boolean isCoherent = UNKNOWN.equals(rootType) || ScenarioSimulationSharedUtils.isList(typeName) == dmnType.isCollection(); if (!isCoherent) { return false; } String factMappingType = ScenarioSimulationSharedUtils.isList(typeName) ? factMapping.getGenericTypes().get(0) : typeName; if (Objects.equals(factMappingType, dmnType.getName())) { return true; } return false; }

Target:
private boolean isDMNFactMappingValid(String typeName, FactMapping factMapping, DMNType dmnType) { Type rootType = getRootType((BaseDMNTypeImpl) dmnType); boolean isCoherent = UNKNOWN.equals(rootType) || ScenarioSimulationSharedUtils.isList(typeName) == dmnType.isCollection(); if (!isCoherent) { return false; } String factMappingType = ScenarioSimulationSharedUtils.isList(typeName) ? factMapping.getGenericTypes().get(0) : typeName; return Objects.equals(factMappingType, dmnType.getName()); }
Source:
protected void finalize() throws Throwable { try { if(!cm.getStatus().isTerminated()) { Throwable t = log.cacheManagerNotClosed(); t.setStackTrace(allocationStackTrace); log.leakedCacheManager(t); cm.stop(); } } finally { super.finalize(); } }

Target:
protected void finalize() throws Throwable { try { if(!isClosed) { Throwable t = log.cacheManagerNotClosed(); t.setStackTrace(allocationStackTrace); log.leakedCacheManager(t); cm.stop(); } } finally { super.finalize(); } }
Source:
private void onReloadConfigComplete(String result) { Log.v(TAG, "onReloadConfigComplete: " + result); mConfig = new Gson().fromJson(result, Config.class); if (mConfig == null) { throw new RuntimeException("config is null: " + result); } mCompletion.updateDevices(getDevices(true)); mCompletion.updateFolders(getFolders()); }

Target:
private void onReloadConfigComplete(String result) { Log.v(TAG, "onReloadConfigComplete: " + result); mConfig = new Gson().fromJson(result, Config.class); if (mConfig == null) { throw new RuntimeException("config is null: " + result); } mCompletion.updateFromConfig(getDevices(true), getFolders()); }
Source:
public void setup() { super.setup(); zone = Iterables.getLast(api.getConfiguredZones(), "nova"); volumeOption = api.getVolumeExtensionForZone(zone); Optional<? extends AvailabilityZoneAPI> availabilityZoneApi = api.getAvailabilityZoneApi(zone); availabilityZone = availabilityZoneApi.isPresent() ? Iterables.getLast(availabilityZoneApi.get().list()).getName() : zone; }

Target:
public void setup() { super.setup(); zone = Iterables.getLast(api.getConfiguredZones(), "nova"); volumeOption = api.getVolumeExtensionForZone(zone); Optional<? extends AvailabilityZoneApi> availabilityZoneApi = api.getAvailabilityZoneApi(zone); availabilityZone = availabilityZoneApi.isPresent() ? Iterables.getLast(availabilityZoneApi.get().list()).getName() : zone; }
Source:
public void testFour() throws Exception { final File fileToProcess = new File(getPath("SuppressionXpathRegressionImportControlFour.java")); final DefaultConfiguration moduleConfig = createModuleConfig(ImportControlCheck.class); moduleConfig.addAttribute("file", getPath("SuppressionXpathRegressionImportControlFour.xml")); final String[] expectedViolation = { "4:1: " + getCheckMessage(ImportControlCheck.class, ImportControlCheck.MSG_DISALLOWED, "java.util.Scanner"), }; final List<String> expectedXpathQueries = Collections.singletonList( "/IMPORT[2]" ); runVerifications(moduleConfig, fileToProcess, expectedViolation, expectedXpathQueries); }

Target:
public void testFour() throws Exception { final File fileToProcess = new File(getPath("SuppressionXpathRegressionImportControlFour.java")); final DefaultConfiguration moduleConfig = createModuleConfig(ImportControlCheck.class); moduleConfig.addAttribute("file", getPath("SuppressionXpathRegressionImportControlFour.xml")); final String[] expectedViolation = { "4:1: " + getCheckMessage(ImportControlCheck.class, ImportControlCheck.MSG_DISALLOWED, "java.util.Scanner"), }; final List<String> expectedXpathQueries = Collections.singletonList( "/IMPORT[./DOT/IDENT[@text='Scanner']]" ); runVerifications(moduleConfig, fileToProcess, expectedViolation, expectedXpathQueries); }
Source:
public Mono<Response<StorageServiceStats>> getStatistics() { return client.services().getStatisticsWithRestResponseAsync(Context.NONE) .map(response -> new SimpleResponse<>(response.request(), response.statusCode(), response.headers(), response.value())); }

Target:
public Mono<Response<StorageServiceStats>> getStatistics() { return client.services().getStatisticsWithRestResponseAsync(Context.NONE) .map(response -> new SimpleResponse<>(response, response.value())); }
Source:
public void start() throws Exception { String statemgrClass = Context.stateManagerClass(config); LOG.info("Context.stateManagerClass " + statemgrClass); IStateManager statemgr; try { statemgr = ReflectionUtils.newInstance(statemgrClass); } catch (IllegalAccessException | InstantiationException | ClassNotFoundException e) { throw new Exception(String.format( "Failed to instantiate state manager class '%s'", statemgrClass), e); } try { statemgr.initialize(config); Boolean b = statemgr.setMetricsCacheLocation(metricsCacheLocation, topologyName) .get(5000, TimeUnit.MILLISECONDS); if (b != null && b == Boolean.TRUE) { LOG.info("metricsCacheLocation " + metricsCacheLocation.toString()); LOG.info("topologyName " + topologyName.toString()); LOG.info("Starting Metrics Cache HTTP Server"); metricsCacheManagerHttpServer.start(); LOG.info("Starting Metrics Cache Server"); metricsCacheManagerServer.start(); metricsCacheManagerServerLoop.loop(); } else { LOG.severe("statemgr metricscahe node failure, fail fast"); } } finally { SysUtils.closeIgnoringExceptions(statemgr); } }

Target:
public void start() throws Exception { String statemgrClass = Context.stateManagerClass(config); LOG.info("Context.stateManagerClass " + statemgrClass); IStateManager statemgr; try { statemgr = ReflectionUtils.newInstance(statemgrClass); } catch (IllegalAccessException | InstantiationException | ClassNotFoundException e) { throw new Exception(String.format( "Failed to instantiate state manager class '%s'", statemgrClass), e); } try { statemgr.initialize(config); Boolean b = statemgr.setMetricsCacheLocation(metricsCacheLocation, topologyName) .get(5000, TimeUnit.MILLISECONDS); if (b != null && b) { LOG.info("metricsCacheLocation " + metricsCacheLocation.toString()); LOG.info("topologyName " + topologyName.toString()); LOG.info("Starting Metrics Cache HTTP Server"); metricsCacheManagerHttpServer.start(); LOG.info("Starting Metrics Cache Server"); metricsCacheManagerServer.start(); metricsCacheManagerServerLoop.loop(); } else { throw new RuntimeException("Failed to set metricscahe location."); } } finally { SysUtils.closeIgnoringExceptions(statemgr); } }
Source:
public static List<String> getDestinationFromTenantDomain(String tenantDomain) throws IdentityException { List<String> destinationURLs = new ArrayList<String>(); IdentityProvider identityProvider; int tenantId; if (StringUtils.isBlank(tenantDomain) || "null".equals(tenantDomain)) { tenantDomain = MultitenantConstants.SUPER_TENANT_DOMAIN_NAME; tenantId = MultitenantConstants.SUPER_TENANT_ID; } else { try { tenantId = SAMLSSOUtil.getRealmService().getTenantManager().getTenantId(tenantDomain); } catch (UserStoreException e) { throw new IdentityException("Error occurred while retrieving tenant id from tenant domain", e); } if (MultitenantConstants.INVALID_TENANT_ID == tenantId) { throw new IdentityException("Invalid tenant domain - '" + tenantDomain + "'"); } } IdentityTenantUtil.initializeRegistry(tenantId, tenantDomain); try { identityProvider = IdentityProviderManager.getInstance().getResidentIdP(tenantDomain); } catch (IdentityProviderManagementException e) { throw new IdentityException( "Error occurred while retrieving Resident Identity Provider information for tenant " + tenantDomain, e); } FederatedAuthenticatorConfig[] authnConfigs = identityProvider.getFederatedAuthenticatorConfigs(); for (FederatedAuthenticatorConfig config : authnConfigs) { if (IdentityApplicationConstants.Authenticator.SAML2SSO.NAME.equals(config.getName())) { for (Property prop : config.getProperties()) { if (prop.getName().startsWith(IdentityApplicationConstants.Authenticator.SAML2SSO .DESTINATION_URL_PREFIX)) { destinationURLs.add(prop.getValue()); } } } } if (destinationURLs.size() == 0) { String configDestination = IdentityUtil.getProperty(IdentityConstants.ServerConfig.SSO_IDP_URL); if (StringUtils.isBlank(configDestination)) { configDestination = IdentityUtil.getServerURL(SAMLSSOConstants.SAMLSSO_URL); } destinationURLs.add(configDestination); } return destinationURLs; }

Target:
public static List<String> getDestinationFromTenantDomain(String tenantDomain) throws IdentityException { List<String> destinationURLs = new ArrayList<String>(); IdentityProvider identityProvider; try { identityProvider = IdentityProviderManager.getInstance().getResidentIdP(tenantDomain); } catch (IdentityProviderManagementException e) { throw new IdentityException( "Error occurred while retrieving Resident Identity Provider information for tenant " + tenantDomain, e); } FederatedAuthenticatorConfig[] authnConfigs = identityProvider.getFederatedAuthenticatorConfigs(); destinationURLs.addAll(IdentityApplicationManagementUtil.getPropertyValuesForNameStartsWith(authnConfigs, IdentityApplicationConstants.Authenticator.SAML2SSO.NAME, IdentityApplicationConstants.Authenticator .SAML2SSO.DESTINATION_URL_PREFIX)); if (destinationURLs.size() == 0) { String configDestination = IdentityUtil.getProperty(IdentityConstants.ServerConfig.SSO_IDP_URL); if (StringUtils.isBlank(configDestination)) { configDestination = IdentityUtil.getServerURL(SAMLSSOConstants.SAMLSSO_URL,true); } destinationURLs.add(configDestination); } return destinationURLs; }
Source:
public Set<ConfigOption<?>> optionalOptions() { final Set<ConfigOption<?>> options = new HashSet<>(); options.add(FactoryUtil.KEY_FIELDS_PREFIX); options.add(KafkaOptions.TOPIC); options.add(KafkaOptions.TOPIC_PATTERN); options.add(FactoryUtil.VALUE_FIELDS_INCLUDE); return options; }

Target:
public Set<ConfigOption<?>> optionalOptions() { final Set<ConfigOption<?>> options = new HashSet<>(); options.add(KEY_FIELDS_PREFIX); options.add(VALUE_FIELDS_INCLUDE); options.add(FactoryUtil.SINK_PARALLELISM); return options; }
Source:
private static void generateConstructor( ClassDefinition classDefinition, CachedInstanceBinder cachedInstanceBinder, PreGeneratedExpressions preGeneratedExpressions, Consumer<MethodDefinition> additionalStatements) { MethodDefinition constructorDefinition = classDefinition.declareConstructor(a(PUBLIC)); BytecodeBlock body = constructorDefinition.getBody(); Variable thisVariable = constructorDefinition.getThis(); body.comment("super();") .append(thisVariable) .invokeConstructor(Object.class); additionalStatements.accept(constructorDefinition); cachedInstanceBinder.generateInitializations(thisVariable, body); preGeneratedExpressions.getLambdaFieldMap().values().forEach( lambdaExpressionField -> lambdaExpressionField.generateInitialization(thisVariable, body) ); body.ret(); }

Target:
private static void generateConstructor( ClassDefinition classDefinition, CachedInstanceBinder cachedInstanceBinder, PreGeneratedExpressions preGeneratedExpressions, Consumer<MethodDefinition> additionalStatements) { MethodDefinition constructorDefinition = classDefinition.declareConstructor(a(PUBLIC)); BytecodeBlock body = constructorDefinition.getBody(); Variable thisVariable = constructorDefinition.getThis(); body.comment("super();") .append(thisVariable) .invokeConstructor(Object.class); additionalStatements.accept(constructorDefinition); cachedInstanceBinder.generateInitializations(thisVariable, body); for (LambdaExpressionField field : preGeneratedExpressions.getLambdaFieldMap().values()) { field.generateInitialization(thisVariable, body); } body.ret(); }
Source:
public static void serverShutdown(int portOffset, AutomationContext automationContext) throws Exception { long time = System.currentTimeMillis() + DEFAULT_START_STOP_WAIT_MS; log.info("Shutting down server.."); boolean logOutSuccess = false; if (ClientConnectionUtil.isPortOpen( Integer.parseInt(ExtensionConstants.SERVER_DEFAULT_HTTPS_PORT))) { int httpsPort = Integer.parseInt(FrameworkConstants.SERVER_DEFAULT_HTTPS_PORT) + portOffset; String url = automationContext.getContextUrls().getBackEndUrl(); String backendURL = url.replaceAll("(:\\d+)", ":" + httpsPort); ServerAdminClient serverAdminServiceClient = new ServerAdminClient(backendURL, automationContext.getContextTenant().getTenantAdmin().getUserName(), automationContext.getContextTenant().getTenantAdmin().getPassword()); serverAdminServiceClient.shutdown(); while (System.currentTimeMillis() < time && !logOutSuccess) { logOutSuccess = isServerDown(automationContext, portOffset); } log.info("Server stopped successfully..."); } }

Target:
public static void serverShutdown(int portOffset, AutomationContext automationContext) throws CarbonToolsIntegrationTestException { long time = System.currentTimeMillis() + DEFAULT_START_STOP_WAIT_MS; log.info("Shutting down server.."); boolean logOutSuccess = false; try { if (ClientConnectionUtil.isPortOpen( Integer.parseInt(ExtensionConstants.SERVER_DEFAULT_HTTPS_PORT))) { int httpsPort = Integer.parseInt(FrameworkConstants.SERVER_DEFAULT_HTTPS_PORT) + portOffset; String url = automationContext.getContextUrls().getBackEndUrl(); String backendURL = url.replaceAll("(:\\d+)", ":" + httpsPort); ServerAdminClient serverAdminServiceClient = new ServerAdminClient(backendURL, automationContext.getContextTenant(). getTenantAdmin().getUserName(), automationContext.getContextTenant(). getTenantAdmin().getPassword()); serverAdminServiceClient.shutdown(); while (System.currentTimeMillis() < time && !logOutSuccess) { logOutSuccess = isServerDown(automationContext, portOffset); } log.info("Server stopped successfully..."); } } catch (Exception ex) { log.error("Error while shutting down the server using default credentials", ex); throw new CarbonToolsIntegrationTestException("Error while shutting down the server using " + "default credentials ", ex); } }
Source:
private GeneralCommandLine getPantsExportCommand(final File outputFile, @NotNull Consumer<String> statusConsumer) throws IOException, ExecutionException { final GeneralCommandLine commandLine = PantsUtil.defaultCommandLine(getProjectPath()); Optional<String> rcArg = IJRC.getImportPantsRc(commandLine.getWorkDirectory().getPath()); rcArg.ifPresent(commandLine::addParameter); final File targetSpecsFile = FileUtil.createTempFile("pants_target_specs", ".in"); try (FileWriter targetSpecsFileWriter = new FileWriter(targetSpecsFile)) { for (String targetSpec : getTargetSpecs()) { targetSpecsFileWriter.write(targetSpec); targetSpecsFileWriter.write('\n'); } } commandLine.addParameter("--target-spec-file=" + targetSpecsFile.getPath()); commandLine.addParameter("--no-quiet"); boolean exportAvailableTypes = isAtLeastPantsVersion(1, 23); if (exportAvailableTypes) { commandLine.addParameter("--export-available-target-types"); } if (getOptions().isImportSourceDepsAsJars()) { commandLine.addParameter("export-dep-as-jar"); } else { commandLine.addParameter("export"); } commandLine.addParameter("--output-file=" + outputFile.getPath()); commandLine.addParameter("--formatted"); if (myResolveSourcesAndDocsForJars) { commandLine.addParameter("--export-libraries-sources"); commandLine.addParameter("--export-libraries-javadocs"); } return commandLine; }

Target:
private GeneralCommandLine getPantsExportCommand(final File outputFile, @NotNull Consumer<String> statusConsumer) throws IOException { final GeneralCommandLine commandLine = PantsUtil.defaultCommandLine(getProjectPath()); Optional<String> rcArg = IJRC.getImportPantsRc(commandLine.getWorkDirectory().getPath()); rcArg.ifPresent(commandLine::addParameter); final File targetSpecsFile = FileUtil.createTempFile("pants_target_specs", ".in"); try (FileWriter targetSpecsFileWriter = new FileWriter(targetSpecsFile)) { for (String targetSpec : getTargetSpecs()) { targetSpecsFileWriter.write(targetSpec); targetSpecsFileWriter.write('\n'); } } commandLine.addParameter("--target-spec-file=" + targetSpecsFile.getPath()); commandLine.addParameter("--no-quiet"); if (PantsUtil.isCompatiblePantsVersion(getProjectPath(), "1.24.0")) { commandLine.addParameter("--export-available-target-types"); } if (getOptions().isImportSourceDepsAsJars()) { commandLine.addParameter("export-dep-as-jar"); } else { commandLine.addParameter("export"); } commandLine.addParameter("--output-file=" + outputFile.getPath()); commandLine.addParameter("--formatted"); if (myResolveSourcesAndDocsForJars) { commandLine.addParameter("--export-libraries-sources"); commandLine.addParameter("--export-libraries-javadocs"); } return commandLine; }
Source:
public Object handle(Request request, Response response) throws Exception { String transformerId = request.params(":transformerId"); String body = util.safeGetBody(request); CqlRequest cqlRequest = mapper.readValue(body, CqlRequest.class); CqlQueryResponse cqlQueryResponse = executeCqlQuery(cqlRequest); LOGGER.trace("Finding transformer to transform query response."); ServiceReference<QueryResponseTransformer> queryResponseTransformer = queryResponseTransformers .stream() .filter(transformer -> transformer.getProperty("id").equals(transformerId)) .findFirst() .orElse(null); if (queryResponseTransformer == null) { LOGGER.debug("Could not find transformer with id: {}", transformerId); response.status(404); return mapper.toJson(ImmutableMap.of("message", "Service not found")); } attachFileWithTransformer(queryResponseTransformer, cqlQueryResponse, request, response); return ""; }

Target:
public Object handle(Request request, Response response) throws Exception { String transformerId = request.params(":transformerId"); String body = util.safeGetBody(request); CqlRequest cqlRequest; try { cqlRequest = mapper.readValue(body, CqlRequest.class); } catch (IllegalArgumentException | ArrayIndexOutOfBoundsException e) { LOGGER.debug("Error fetching cql request"); response.status(HttpStatus.BAD_REQUEST_400); return ImmutableMap.of("message", "Error retrieving cql request"); } if (cqlRequest.getCql() == null) { LOGGER.debug("Cql not found in request"); return ImmutableMap.of("message", "Cql not found in request"); } Map<String, Serializable> arguments = mapper.readValue(body, Arguments.class).getSerializableArguments(); LOGGER.trace("Finding transformer to transform query response."); ServiceReference<QueryResponseTransformer> queryResponseTransformer = queryResponseTransformers .stream() .filter(transformer -> transformerId.equals(transformer.getProperty("id"))) .findFirst() .orElse(null); if (queryResponseTransformer == null) { LOGGER.debug("Could not find transformer with id: {}", transformerId); response.status(HttpStatus.NOT_FOUND_404); return ImmutableMap.of("message", "Service not found"); } CqlQueryResponse cqlQueryResponse = util.executeCqlQuery(cqlRequest); attachFileToResponse(request, response, queryResponseTransformer, cqlQueryResponse, arguments); return ""; }
Source:
public void testSendSerialDataOtherProtocolsIOError() throws XBeeException, IOException { Mockito.when(xbeeDevice.getXBeeProtocol()).thenReturn(XBeeProtocol.ZIGBEE); Mockito.doThrow(new IOException()).when(xbeeDevice).sendXBeePacket(transmitPacket); try { xbeeDevice.sendSerialData(XBEE_16BIT_ADDRESS, SEND_DATA_BYTES); fail("TransmitRequest frame shouldn't have been sent successfully."); } catch (Exception e) { assertEquals(XBeeException.class, e.getClass()); } try { xbeeDevice.sendSerialData(XBEE_64BIT_ADDRESS, SEND_DATA_BYTES); fail("TransmitRequest frame shouldn't have been sent successfully."); } catch (Exception e) { assertEquals(XBeeException.class, e.getClass()); } try { xbeeDevice.sendSerialData(mockedDevice, SEND_DATA_BYTES); fail("TransmitRequest frame shouldn't have been sent successfully."); } catch (Exception e) { assertEquals(XBeeException.class, e.getClass()); } }

Target:
public void testSendSerialDataOtherProtocolsIOError() throws XBeeException, IOException { Mockito.when(xbeeDevice.getXBeeProtocol()).thenReturn(XBeeProtocol.ZIGBEE); Mockito.doThrow(new IOException()).when(xbeeDevice).sendXBeePacket(transmitPacket); try { xbeeDevice.sendSerialData(XBEE_16BIT_ADDRESS, SEND_DATA_BYTES); fail("TransmitRequest frame shouldn't have been sent successfully."); } catch (Exception e) { assertEquals(XBeeException.class, e.getClass()); assertEquals(IOException.class, e.getCause().getClass()); } try { xbeeDevice.sendSerialData(XBEE_64BIT_ADDRESS, SEND_DATA_BYTES); fail("TransmitRequest frame shouldn't have been sent successfully."); } catch (Exception e) { assertEquals(XBeeException.class, e.getClass()); assertEquals(IOException.class, e.getCause().getClass()); } try { xbeeDevice.sendSerialData(mockedDevice, SEND_DATA_BYTES); fail("TransmitRequest frame shouldn't have been sent successfully."); } catch (Exception e) { assertEquals(XBeeException.class, e.getClass()); assertEquals(IOException.class, e.getCause().getClass()); } }
Source:
private INewAsyncCallback createGetVmsFromExportDomainCallback() { return new INewAsyncCallback() { @Override public void onSuccess(Object model, Object returnValue) { List<VM> vmsInExportDomain; VdcQueryReturnValue retVal = (VdcQueryReturnValue) returnValue; if (retVal != null && retVal.getReturnValue() != null && retVal.getSucceeded()) { vmsInExportDomain = retVal.getReturnValue(); if ((vmsInExportDomain.size() > 0)) { TemplateBackupModel templateBackupModel = (TemplateBackupModel) model; HashMap<String, List<String>> problematicVmNames = getDependentVMsForTemplate(vmsInExportDomain, templateBackupModel); if (!problematicVmNames.isEmpty()) { showRemoveTemplateWithDependentVMConfirmationWindow(problematicVmNames); } else { removeTemplateBackup(); } } else { removeTemplateBackup(); } } stopProgress(); } }; }

Target:
private INewAsyncCallback createGetVmsFromExportDomainCallback() { return new INewAsyncCallback() { @Override public void onSuccess(Object model, Object returnValue) { List<VM> vmsInExportDomain; VdcQueryReturnValue retVal = (VdcQueryReturnValue) returnValue; if (retVal == null || retVal.getReturnValue() == null || !retVal.getSucceeded()) { return; } vmsInExportDomain = retVal.getReturnValue(); if ((vmsInExportDomain.size() > 0)) { TemplateBackupModel templateBackupModel = (TemplateBackupModel) model; HashMap<String, List<String>> problematicVmNames = getDependentVMsForTemplate(vmsInExportDomain, templateBackupModel); if (!problematicVmNames.isEmpty()) { showRemoveTemplateWithDependentVMConfirmationWindow(problematicVmNames); } else { removeTemplateBackup(); } } else { removeTemplateBackup(); } } }; }
Source:
private UfsStatusCache populateStatusCache(AlluxioURI path, DescendantType syncDescendantType) { Map<AlluxioURI, UfsStatus> statusCache = new HashMap<>(); try { MountTable.Resolution resolution = mMountTable.resolve(path); AlluxioURI ufsUri = resolution.getUri(); try (CloseableResource<UnderFileSystem> ufsResource = resolution.acquireUfsResource()) { UnderFileSystem ufs = ufsResource.get(); ListOptions listOptions = ListOptions.defaults(); listOptions.setRecursive(syncDescendantType == DescendantType.ALL); try { UfsStatus[] children = ufs.listStatus(ufsUri.toString(), listOptions); if (children != null) { statusCache = new HashMap<>(Math.round(children.length * 1.34f), 0.75f); for (UfsStatus childStatus : children) { statusCache.put(path.joinUnsafe(childStatus.getName()), childStatus); } } } catch (Exception e) { LOG.debug("ListStatus failed as an preparation step for syncMetadata {}", path, e); } return new UfsStatusCache(ufsUri, statusCache); } } catch (InvalidPathException e) { return new UfsStatusCache(new AlluxioURI(""), statusCache); } }

Target:
private UfsStatusCache populateStatusCache(AlluxioURI path, DescendantType syncDescendantType) { Map<AlluxioURI, UfsStatus> statusCache = new HashMap<>(); try { MountTable.Resolution resolution = mMountTable.resolve(path); AlluxioURI ufsUri = resolution.getUri(); try (CloseableResource<UnderFileSystem> ufsResource = resolution.acquireUfsResource()) { UnderFileSystem ufs = ufsResource.get(); ListOptions listOptions = ListOptions.defaults(); listOptions.setRecursive(syncDescendantType == DescendantType.ALL); try { UfsStatus[] children = ufs.listStatus(ufsUri.toString(), listOptions); if (children != null) { statusCache = new HashMap<>(Math.round(children.length * 1.34f), 0.75f); for (UfsStatus childStatus : children) { statusCache.put(path.joinUnsafe(childStatus.getName()), childStatus); } } } catch (Exception e) { LOG.debug("ListStatus failed as an preparation step for syncMetadata {}", path, e); } return new UfsStatusCache(new AlluxioURI(ufsUri.getPath()), statusCache, listOptions.isRecursive()); } } catch (InvalidPathException e) { return new UfsStatusCache(new AlluxioURI(""), statusCache, false); } }
Source:
public void testCreateCollectionWithoutPath() throws Exception { Map<String, Object> params = new HashMap<String, Object>(); params.put("name", COLLECTION_NAME); params.put("description", COLLECTION_DESCRIPTION); chain = new OperationChain("test-chain"); chain.add(CreateCollectionOperation.ID).from(params); OperationContext ctx = new OperationContext(session); DocumentModel doc = (DocumentModel) service.run(ctx, chain); assertNotNull(doc); Assert.assertEquals(COLLECTION_NAME, doc.getTitle()); Assert.assertEquals(COLLECTION_DESCRIPTION, doc.getPropertyValue("dc:description")); }

Target:
public void testCreateCollectionWithoutPath() throws Exception { Map<String, Object> params = new HashMap<>(); params.put("name", COLLECTION_NAME); params.put("description", COLLECTION_DESCRIPTION); chain = new OperationChain("test-chain"); chain.add(CreateCollectionOperation.ID).from(params); DocumentModel doc = (DocumentModel) service.run(ctx, chain); assertNotNull(doc); Assert.assertEquals(COLLECTION_NAME, doc.getTitle()); Assert.assertEquals(COLLECTION_DESCRIPTION, doc.getPropertyValue("dc:description")); }