code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { @Override protected void configure(HttpSecurity http) throws Exception { ConfigObject protectedResources = Config.getConfig().getObject("security.protected"); ConfigValue apiSec = Config.getConfig().getValue("security.api_security"); boolean enableRestFilter = apiSec != null && Boolean.TRUE.equals(apiSec.unwrapped()); String signinPath = Config.getConfigParam("security.signin", "/signin"); String signoutPath = Config.getConfigParam("security.signout", "/signout"); String accessDeniedPath = Config.getConfigParam("security.access_denied", "/403"); String signoutSuccessPath = Config.getConfigParam("security.signout_success", signinPath); // If API security is disabled don't add the API endpoint to the list of protected resources if (enableRestFilter) { http.authorizeRequests().requestMatchers(RestRequestMatcher.INSTANCE); } parseProtectedResources(http, protectedResources); if (Config.getConfigBoolean("security.csrf_protection", true)) { http.csrf().requireCsrfProtectionMatcher(CsrfProtectionRequestMatcher.INSTANCE). csrfTokenRepository(csrfTokenRepository); } else { http.csrf().disable(); } http.sessionManagement().enableSessionUrlRewriting(false); http.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.NEVER); http.sessionManagement().sessionAuthenticationStrategy(new NullAuthenticatedSessionStrategy()); http.exceptionHandling().authenticationEntryPoint(new SimpleAuthenticationEntryPoint(signinPath)); http.exceptionHandling().accessDeniedHandler(new SimpleAccessDeniedHandler(accessDeniedPath)); http.requestCache().requestCache(new SimpleRequestCache()); http.logout().logoutUrl(signoutPath).logoutSuccessUrl(signoutSuccessPath); http.rememberMe().rememberMeServices(rememberMeServices); registerAuthFilters(http); if (enableRestFilter) { if (jwtFilter != null) { jwtFilter.setAuthenticationManager(authenticationManager()); http.addFilterBefore(jwtFilter, RememberMeAuthenticationFilter.class); } RestAuthFilter restFilter = new RestAuthFilter(); http.addFilterAfter(restFilter, JWTRestfulAuthFilter.class); } } }
public class class_name { @Override protected void configure(HttpSecurity http) throws Exception { ConfigObject protectedResources = Config.getConfig().getObject("security.protected"); ConfigValue apiSec = Config.getConfig().getValue("security.api_security"); boolean enableRestFilter = apiSec != null && Boolean.TRUE.equals(apiSec.unwrapped()); String signinPath = Config.getConfigParam("security.signin", "/signin"); String signoutPath = Config.getConfigParam("security.signout", "/signout"); String accessDeniedPath = Config.getConfigParam("security.access_denied", "/403"); String signoutSuccessPath = Config.getConfigParam("security.signout_success", signinPath); // If API security is disabled don't add the API endpoint to the list of protected resources if (enableRestFilter) { http.authorizeRequests().requestMatchers(RestRequestMatcher.INSTANCE); } parseProtectedResources(http, protectedResources); if (Config.getConfigBoolean("security.csrf_protection", true)) { http.csrf().requireCsrfProtectionMatcher(CsrfProtectionRequestMatcher.INSTANCE). csrfTokenRepository(csrfTokenRepository); } else { http.csrf().disable(); } http.sessionManagement().enableSessionUrlRewriting(false); http.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.NEVER); http.sessionManagement().sessionAuthenticationStrategy(new NullAuthenticatedSessionStrategy()); http.exceptionHandling().authenticationEntryPoint(new SimpleAuthenticationEntryPoint(signinPath)); http.exceptionHandling().accessDeniedHandler(new SimpleAccessDeniedHandler(accessDeniedPath)); http.requestCache().requestCache(new SimpleRequestCache()); http.logout().logoutUrl(signoutPath).logoutSuccessUrl(signoutSuccessPath); http.rememberMe().rememberMeServices(rememberMeServices); registerAuthFilters(http); if (enableRestFilter) { if (jwtFilter != null) { jwtFilter.setAuthenticationManager(authenticationManager()); // depends on control dependency: [if], data = [none] http.addFilterBefore(jwtFilter, RememberMeAuthenticationFilter.class); // depends on control dependency: [if], data = [(jwtFilter] } RestAuthFilter restFilter = new RestAuthFilter(); http.addFilterAfter(restFilter, JWTRestfulAuthFilter.class); } } }
public class class_name { protected InvDatasetScan readDatasetScan(InvCatalogImpl catalog, InvDatasetImpl parent, Element dsElem, URI base) { InvDatasetScan datasetScan; if (dsElem.getAttributeValue("dirLocation") == null) { if (dsElem.getAttributeValue("location") == null) { logger.error("readDatasetScan(): datasetScan has neither a \"location\" nor a \"dirLocation\" attribute."); datasetScan = null; } else { return readDatasetScanNew(catalog, parent, dsElem, base); } } else { String name = dsElem.getAttributeValue("name"); factory.appendWarning("**Warning: Dataset " + name + " using old form of DatasetScan (dirLocation instead of location)\n"); String path = dsElem.getAttributeValue("path"); String scanDir = expandAliasForPath(dsElem.getAttributeValue("dirLocation")); String filter = dsElem.getAttributeValue("filter"); String addDatasetSizeString = dsElem.getAttributeValue("addDatasetSize"); String addLatest = dsElem.getAttributeValue("addLatest"); String sortOrderIncreasingString = dsElem.getAttributeValue("sortOrderIncreasing"); boolean sortOrderIncreasing = false; if (sortOrderIncreasingString != null) if (sortOrderIncreasingString.equalsIgnoreCase("true")) sortOrderIncreasing = true; boolean addDatasetSize = true; if (addDatasetSizeString != null) if (addDatasetSizeString.equalsIgnoreCase("false")) addDatasetSize = false; if (path != null) { if (path.charAt(0) == '/') path = path.substring(1); int last = path.length() - 1; if (path.charAt(last) == '/') path = path.substring(0, last); } if (scanDir != null) { int last = scanDir.length() - 1; if (scanDir.charAt(last) != '/') scanDir = scanDir + '/'; } Element atcElem = dsElem.getChild("addTimeCoverage", defNS); String dsNameMatchPattern = null; String startTimeSubstitutionPattern = null; String duration = null; if (atcElem != null) { dsNameMatchPattern = atcElem.getAttributeValue("datasetNameMatchPattern"); startTimeSubstitutionPattern = atcElem.getAttributeValue("startTimeSubstitutionPattern"); duration = atcElem.getAttributeValue("duration"); } try { datasetScan = new InvDatasetScan(catalog, parent, name, path, scanDir, filter, addDatasetSize, addLatest, sortOrderIncreasing, dsNameMatchPattern, startTimeSubstitutionPattern, duration); readDatasetInfo(catalog, datasetScan, dsElem, base); if (InvCatalogFactory.debugXML) System.out.println(" Dataset added: " + datasetScan.dump()); } catch (Exception e) { logger.error("Reading DatasetScan", e); datasetScan = null; } } return datasetScan; } }
public class class_name { protected InvDatasetScan readDatasetScan(InvCatalogImpl catalog, InvDatasetImpl parent, Element dsElem, URI base) { InvDatasetScan datasetScan; if (dsElem.getAttributeValue("dirLocation") == null) { if (dsElem.getAttributeValue("location") == null) { logger.error("readDatasetScan(): datasetScan has neither a \"location\" nor a \"dirLocation\" attribute."); // depends on control dependency: [if], data = [none] datasetScan = null; // depends on control dependency: [if], data = [none] } else { return readDatasetScanNew(catalog, parent, dsElem, base); // depends on control dependency: [if], data = [none] } } else { String name = dsElem.getAttributeValue("name"); factory.appendWarning("**Warning: Dataset " + name + " using old form of DatasetScan (dirLocation instead of location)\n"); // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none] String path = dsElem.getAttributeValue("path"); String scanDir = expandAliasForPath(dsElem.getAttributeValue("dirLocation")); String filter = dsElem.getAttributeValue("filter"); String addDatasetSizeString = dsElem.getAttributeValue("addDatasetSize"); String addLatest = dsElem.getAttributeValue("addLatest"); String sortOrderIncreasingString = dsElem.getAttributeValue("sortOrderIncreasing"); boolean sortOrderIncreasing = false; if (sortOrderIncreasingString != null) if (sortOrderIncreasingString.equalsIgnoreCase("true")) sortOrderIncreasing = true; boolean addDatasetSize = true; if (addDatasetSizeString != null) if (addDatasetSizeString.equalsIgnoreCase("false")) addDatasetSize = false; if (path != null) { if (path.charAt(0) == '/') path = path.substring(1); int last = path.length() - 1; if (path.charAt(last) == '/') path = path.substring(0, last); } if (scanDir != null) { int last = scanDir.length() - 1; if (scanDir.charAt(last) != '/') scanDir = scanDir + '/'; } Element atcElem = dsElem.getChild("addTimeCoverage", defNS); String dsNameMatchPattern = null; String startTimeSubstitutionPattern = null; String duration = null; if (atcElem != null) { dsNameMatchPattern = atcElem.getAttributeValue("datasetNameMatchPattern"); // depends on control dependency: [if], data = [none] startTimeSubstitutionPattern = atcElem.getAttributeValue("startTimeSubstitutionPattern"); // depends on control dependency: [if], data = [none] duration = atcElem.getAttributeValue("duration"); // depends on control dependency: [if], data = [none] } try { datasetScan = new InvDatasetScan(catalog, parent, name, path, scanDir, filter, addDatasetSize, addLatest, sortOrderIncreasing, dsNameMatchPattern, startTimeSubstitutionPattern, duration); // depends on control dependency: [try], data = [none] readDatasetInfo(catalog, datasetScan, dsElem, base); // depends on control dependency: [try], data = [none] if (InvCatalogFactory.debugXML) System.out.println(" Dataset added: " + datasetScan.dump()); } catch (Exception e) { logger.error("Reading DatasetScan", e); datasetScan = null; } // depends on control dependency: [catch], data = [none] } return datasetScan; } }
public class class_name { private static void parseFont(Style style, String val) { Integer fontWeight = null; Style.FontStyle fontStyle = null; String fontVariant = null; // Start by checking for the fixed size standard system font names (which we don't support) if (!"|caption|icon|menu|message-box|small-caption|status-bar|".contains('|'+val+'|')) return; // First part: style/variant/weight (opt - one or more) TextScanner scan = new TextScanner(val); String item; while (true) { item = scan.nextToken('/'); scan.skipWhitespace(); if (item == null) return; if (fontWeight != null && fontStyle != null) break; if (item.equals("normal")) // indeterminate which of these this refers to continue; if (fontWeight == null) { fontWeight = FontWeightKeywords.get(item); if (fontWeight != null) continue; } if (fontStyle == null) { fontStyle = parseFontStyle(item); if (fontStyle != null) continue; } // Must be a font-variant keyword? if (fontVariant == null && item.equals("small-caps")) { fontVariant = item; continue; } // Not any of these. Break and try next section break; } // Second part: font size (reqd) and line-height (opt) Length fontSize = parseFontSize(item); // Check for line-height (which we don't support) if (scan.consume('/')) { scan.skipWhitespace(); item = scan.nextToken(); if (item != null) { try { parseLength(item); } catch (SVGParseException e) { return; } } scan.skipWhitespace(); } // Third part: font family style.fontFamily = parseFontFamily(scan.restOfText()); style.fontSize = fontSize; style.fontWeight = (fontWeight == null) ? Style.FONT_WEIGHT_NORMAL : fontWeight; style.fontStyle = (fontStyle == null) ? Style.FontStyle.Normal : fontStyle; style.specifiedFlags |= (SVG.SPECIFIED_FONT_FAMILY | SVG.SPECIFIED_FONT_SIZE | SVG.SPECIFIED_FONT_WEIGHT | SVG.SPECIFIED_FONT_STYLE); } }
public class class_name { private static void parseFont(Style style, String val) { Integer fontWeight = null; Style.FontStyle fontStyle = null; String fontVariant = null; // Start by checking for the fixed size standard system font names (which we don't support) if (!"|caption|icon|menu|message-box|small-caption|status-bar|".contains('|'+val+'|')) return; // First part: style/variant/weight (opt - one or more) TextScanner scan = new TextScanner(val); String item; while (true) { item = scan.nextToken('/'); // depends on control dependency: [while], data = [none] scan.skipWhitespace(); // depends on control dependency: [while], data = [none] if (item == null) return; if (fontWeight != null && fontStyle != null) break; if (item.equals("normal")) // indeterminate which of these this refers to continue; if (fontWeight == null) { fontWeight = FontWeightKeywords.get(item); // depends on control dependency: [if], data = [none] if (fontWeight != null) continue; } if (fontStyle == null) { fontStyle = parseFontStyle(item); // depends on control dependency: [if], data = [none] if (fontStyle != null) continue; } // Must be a font-variant keyword? if (fontVariant == null && item.equals("small-caps")) { fontVariant = item; // depends on control dependency: [if], data = [none] continue; } // Not any of these. Break and try next section break; } // Second part: font size (reqd) and line-height (opt) Length fontSize = parseFontSize(item); // Check for line-height (which we don't support) if (scan.consume('/')) { scan.skipWhitespace(); // depends on control dependency: [if], data = [none] item = scan.nextToken(); // depends on control dependency: [if], data = [none] if (item != null) { try { parseLength(item); // depends on control dependency: [try], data = [none] } catch (SVGParseException e) { return; } // depends on control dependency: [catch], data = [none] } scan.skipWhitespace(); // depends on control dependency: [if], data = [none] } // Third part: font family style.fontFamily = parseFontFamily(scan.restOfText()); style.fontSize = fontSize; style.fontWeight = (fontWeight == null) ? Style.FONT_WEIGHT_NORMAL : fontWeight; style.fontStyle = (fontStyle == null) ? Style.FontStyle.Normal : fontStyle; style.specifiedFlags |= (SVG.SPECIFIED_FONT_FAMILY | SVG.SPECIFIED_FONT_SIZE | SVG.SPECIFIED_FONT_WEIGHT | SVG.SPECIFIED_FONT_STYLE); } }
public class class_name { public static StitchAppClient initializeAppClient( @Nonnull final String clientAppId, @Nonnull final StitchAppClientConfiguration config ) { ensureInitialized(); if (clientAppId == null || clientAppId.isEmpty()) { throw new IllegalArgumentException("clientAppId must be set to a non-empty string"); } final StitchAppClientImpl client; synchronized (Stitch.class) { if (appClients.containsKey(clientAppId)) { throw new IllegalStateException( String.format("client for app '%s' has already been initialized", clientAppId)); } final StitchAppClientConfiguration.Builder builder = config.builder(); final String sharedPrefFileName = SharedPreferencesStorage.getFileName(clientAppId); if (builder.getStorage() == null) { builder.withStorage( new SharedPreferencesStorage( applicationContext.getSharedPreferences(sharedPrefFileName, Context.MODE_PRIVATE))); } if (builder.getDataDirectory() == null || builder.getDataDirectory().isEmpty()) { builder.withDataDirectory(applicationContext.getApplicationInfo().dataDir); } if (builder.getTransport() == null) { builder.withTransport(new OkHttpTransport()); } if (builder.getDefaultRequestTimeout() == null) { builder.withDefaultRequestTimeout(DEFAULT_DEFAULT_REQUEST_TIMEOUT); } if (builder.getBaseUrl() == null || builder.getBaseUrl().isEmpty()) { builder.withBaseUrl(DEFAULT_BASE_URL); } if (builder.getLocalAppName() == null || builder.getLocalAppName().isEmpty()) { builder.withLocalAppName(localAppName); } if (builder.getLocalAppVersion() == null || builder.getLocalAppVersion().isEmpty()) { builder.withLocalAppVersion(localAppVersion); } if (builder.getNetworkMonitor() == null) { final ConnectivityManager connectivityManager = (ConnectivityManager) applicationContext.getSystemService( Context.CONNECTIVITY_SERVICE); final AndroidNetworkMonitor networkMonitor = new AndroidNetworkMonitor(connectivityManager); applicationContext.registerReceiver(networkMonitor, new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION)); builder.withNetworkMonitor(networkMonitor); } client = new StitchAppClientImpl(clientAppId, builder.build()); appClients.put(clientAppId, client); } return client; } }
public class class_name { public static StitchAppClient initializeAppClient( @Nonnull final String clientAppId, @Nonnull final StitchAppClientConfiguration config ) { ensureInitialized(); if (clientAppId == null || clientAppId.isEmpty()) { throw new IllegalArgumentException("clientAppId must be set to a non-empty string"); } final StitchAppClientImpl client; synchronized (Stitch.class) { if (appClients.containsKey(clientAppId)) { throw new IllegalStateException( String.format("client for app '%s' has already been initialized", clientAppId)); } final StitchAppClientConfiguration.Builder builder = config.builder(); final String sharedPrefFileName = SharedPreferencesStorage.getFileName(clientAppId); if (builder.getStorage() == null) { builder.withStorage( new SharedPreferencesStorage( applicationContext.getSharedPreferences(sharedPrefFileName, Context.MODE_PRIVATE))); // depends on control dependency: [if], data = [none] } if (builder.getDataDirectory() == null || builder.getDataDirectory().isEmpty()) { builder.withDataDirectory(applicationContext.getApplicationInfo().dataDir); // depends on control dependency: [if], data = [none] } if (builder.getTransport() == null) { builder.withTransport(new OkHttpTransport()); // depends on control dependency: [if], data = [none] } if (builder.getDefaultRequestTimeout() == null) { builder.withDefaultRequestTimeout(DEFAULT_DEFAULT_REQUEST_TIMEOUT); // depends on control dependency: [if], data = [none] } if (builder.getBaseUrl() == null || builder.getBaseUrl().isEmpty()) { builder.withBaseUrl(DEFAULT_BASE_URL); // depends on control dependency: [if], data = [none] } if (builder.getLocalAppName() == null || builder.getLocalAppName().isEmpty()) { builder.withLocalAppName(localAppName); // depends on control dependency: [if], data = [none] } if (builder.getLocalAppVersion() == null || builder.getLocalAppVersion().isEmpty()) { builder.withLocalAppVersion(localAppVersion); // depends on control dependency: [if], data = [none] } if (builder.getNetworkMonitor() == null) { final ConnectivityManager connectivityManager = (ConnectivityManager) applicationContext.getSystemService( Context.CONNECTIVITY_SERVICE); final AndroidNetworkMonitor networkMonitor = new AndroidNetworkMonitor(connectivityManager); applicationContext.registerReceiver(networkMonitor, new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION)); // depends on control dependency: [if], data = [none] builder.withNetworkMonitor(networkMonitor); // depends on control dependency: [if], data = [none] } client = new StitchAppClientImpl(clientAppId, builder.build()); appClients.put(clientAppId, client); } return client; } }
public class class_name { public void setClientVpnTargetNetworks(java.util.Collection<TargetNetwork> clientVpnTargetNetworks) { if (clientVpnTargetNetworks == null) { this.clientVpnTargetNetworks = null; return; } this.clientVpnTargetNetworks = new com.amazonaws.internal.SdkInternalList<TargetNetwork>(clientVpnTargetNetworks); } }
public class class_name { public void setClientVpnTargetNetworks(java.util.Collection<TargetNetwork> clientVpnTargetNetworks) { if (clientVpnTargetNetworks == null) { this.clientVpnTargetNetworks = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.clientVpnTargetNetworks = new com.amazonaws.internal.SdkInternalList<TargetNetwork>(clientVpnTargetNetworks); } }
public class class_name { private static int calcAdjustedMinimumSequenceLength( List<Subunit> subunits, int absMinLen, double fraction, int minLen) { int maxLength = Integer.MIN_VALUE; int minLength = Integer.MAX_VALUE; // Extract the length List, the min and the max List<Integer> lengths = new ArrayList<Integer>(); for (int i = 0; i < subunits.size(); i++) { if (subunits.get(i).size() >= absMinLen) { maxLength = Math.max(subunits.get(i).size(), maxLength); minLength = Math.min(subunits.get(i).size(), minLength); lengths.add(subunits.get(i).size()); } } int adjustedMinimumSequenceLength = minLen; if (lengths.size() < 2) return adjustedMinimumSequenceLength; // Calculate the median of the lengths double median = 0; Collections.sort(lengths); if (lengths.size() % 2 == 1) { int middle = (lengths.size() - 1) / 2; median = lengths.get(middle); } else { int middle2 = lengths.size() / 2; int middle1 = middle2 - 1; median = 0.5 * (lengths.get(middle1) + lengths.get(middle2)); } // If the median * fraction is lower than the minLength if (minLength >= median * fraction) { adjustedMinimumSequenceLength = Math.min(minLength, minLen); } return adjustedMinimumSequenceLength; } }
public class class_name { private static int calcAdjustedMinimumSequenceLength( List<Subunit> subunits, int absMinLen, double fraction, int minLen) { int maxLength = Integer.MIN_VALUE; int minLength = Integer.MAX_VALUE; // Extract the length List, the min and the max List<Integer> lengths = new ArrayList<Integer>(); for (int i = 0; i < subunits.size(); i++) { if (subunits.get(i).size() >= absMinLen) { maxLength = Math.max(subunits.get(i).size(), maxLength); // depends on control dependency: [if], data = [(subunits.get(i).size()] minLength = Math.min(subunits.get(i).size(), minLength); // depends on control dependency: [if], data = [(subunits.get(i).size()] lengths.add(subunits.get(i).size()); // depends on control dependency: [if], data = [(subunits.get(i).size()] } } int adjustedMinimumSequenceLength = minLen; if (lengths.size() < 2) return adjustedMinimumSequenceLength; // Calculate the median of the lengths double median = 0; Collections.sort(lengths); if (lengths.size() % 2 == 1) { int middle = (lengths.size() - 1) / 2; median = lengths.get(middle); // depends on control dependency: [if], data = [none] } else { int middle2 = lengths.size() / 2; int middle1 = middle2 - 1; median = 0.5 * (lengths.get(middle1) + lengths.get(middle2)); // depends on control dependency: [if], data = [1)] } // If the median * fraction is lower than the minLength if (minLength >= median * fraction) { adjustedMinimumSequenceLength = Math.min(minLength, minLen); // depends on control dependency: [if], data = [(minLength] } return adjustedMinimumSequenceLength; } }
public class class_name { @SuppressWarnings("unchecked") public V put(final int key, final V value) { checkNotNull(value, "Value cannot be null"); V oldValue = null; int index = intHash(key, mask); while (null != values[index]) { if (key == keys[index]) { oldValue = (V) values[index]; break; } index = ++index & mask; } if (null == oldValue) { ++size; keys[index] = key; } values[index] = value; if (size > resizeThreshold) { increaseCapacity(); } return oldValue; } }
public class class_name { @SuppressWarnings("unchecked") public V put(final int key, final V value) { checkNotNull(value, "Value cannot be null"); V oldValue = null; int index = intHash(key, mask); while (null != values[index]) { if (key == keys[index]) { oldValue = (V) values[index]; // depends on control dependency: [if], data = [none] break; } index = ++index & mask; // depends on control dependency: [while], data = [none] } if (null == oldValue) { ++size; // depends on control dependency: [if], data = [none] keys[index] = key; // depends on control dependency: [if], data = [none] } values[index] = value; if (size > resizeThreshold) { increaseCapacity(); // depends on control dependency: [if], data = [none] } return oldValue; } }
public class class_name { String toTag(Archive source, String name, Archive target) { if (source == target || !target.getModule().isNamed()) { return target.getName(); } Module module = target.getModule(); String pn = name; if ((type == CLASS || type == VERBOSE)) { int i = name.lastIndexOf('.'); pn = i > 0 ? name.substring(0, i) : ""; } // exported API if (module.isExported(pn) && !module.isJDKUnsupported()) { return showProfileOrModule(module); } // JDK internal API if (!source.getModule().isJDK() && module.isJDK()){ return "JDK internal API (" + module.name() + ")"; } // qualified exports or inaccessible boolean isExported = module.isExported(pn, source.getModule().name()); return module.name() + (isExported ? " (qualified)" : " (internal)"); } }
public class class_name { String toTag(Archive source, String name, Archive target) { if (source == target || !target.getModule().isNamed()) { return target.getName(); // depends on control dependency: [if], data = [none] } Module module = target.getModule(); String pn = name; if ((type == CLASS || type == VERBOSE)) { int i = name.lastIndexOf('.'); pn = i > 0 ? name.substring(0, i) : ""; // depends on control dependency: [if], data = [none] } // exported API if (module.isExported(pn) && !module.isJDKUnsupported()) { return showProfileOrModule(module); // depends on control dependency: [if], data = [none] } // JDK internal API if (!source.getModule().isJDK() && module.isJDK()){ return "JDK internal API (" + module.name() + ")"; // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none] } // qualified exports or inaccessible boolean isExported = module.isExported(pn, source.getModule().name()); return module.name() + (isExported ? " (qualified)" : " (internal)"); } }
public class class_name { public void marshall(RegisterTargetWithMaintenanceWindowRequest registerTargetWithMaintenanceWindowRequest, ProtocolMarshaller protocolMarshaller) { if (registerTargetWithMaintenanceWindowRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(registerTargetWithMaintenanceWindowRequest.getWindowId(), WINDOWID_BINDING); protocolMarshaller.marshall(registerTargetWithMaintenanceWindowRequest.getResourceType(), RESOURCETYPE_BINDING); protocolMarshaller.marshall(registerTargetWithMaintenanceWindowRequest.getTargets(), TARGETS_BINDING); protocolMarshaller.marshall(registerTargetWithMaintenanceWindowRequest.getOwnerInformation(), OWNERINFORMATION_BINDING); protocolMarshaller.marshall(registerTargetWithMaintenanceWindowRequest.getName(), NAME_BINDING); protocolMarshaller.marshall(registerTargetWithMaintenanceWindowRequest.getDescription(), DESCRIPTION_BINDING); protocolMarshaller.marshall(registerTargetWithMaintenanceWindowRequest.getClientToken(), CLIENTTOKEN_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(RegisterTargetWithMaintenanceWindowRequest registerTargetWithMaintenanceWindowRequest, ProtocolMarshaller protocolMarshaller) { if (registerTargetWithMaintenanceWindowRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(registerTargetWithMaintenanceWindowRequest.getWindowId(), WINDOWID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(registerTargetWithMaintenanceWindowRequest.getResourceType(), RESOURCETYPE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(registerTargetWithMaintenanceWindowRequest.getTargets(), TARGETS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(registerTargetWithMaintenanceWindowRequest.getOwnerInformation(), OWNERINFORMATION_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(registerTargetWithMaintenanceWindowRequest.getName(), NAME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(registerTargetWithMaintenanceWindowRequest.getDescription(), DESCRIPTION_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(registerTargetWithMaintenanceWindowRequest.getClientToken(), CLIENTTOKEN_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { @NullSafe @SuppressWarnings("all") public static boolean notInstanceOf(Object obj, Class... types) { boolean result = true; for (int index = 0; result && index < ArrayUtils.nullSafeLength(types); index++) { result &= !instanceOf(obj, types[index]); } return result; } }
public class class_name { @NullSafe @SuppressWarnings("all") public static boolean notInstanceOf(Object obj, Class... types) { boolean result = true; for (int index = 0; result && index < ArrayUtils.nullSafeLength(types); index++) { result &= !instanceOf(obj, types[index]); // depends on control dependency: [for], data = [index] } return result; } }
public class class_name { @Override public void requestJoin(SocketChannel socket, SSLEngine sslEngine, MessagingChannel messagingChannel, InetSocketAddress listeningAddress, JSONObject jo) throws Exception { /* * Generate the host id via creating an ephemeral sequential node */ Integer hostId = selectNewHostId(socket.socket().getInetAddress().getHostAddress()); prepSocketChannel(socket); ForeignHost fhost = null; try { try { JoinAcceptor.PleaDecision decision = m_acceptor.considerMeshPlea(m_zk, hostId, jo); /* * Write the response that advertises the cluster topology */ writeRequestJoinResponse(hostId, decision, socket, messagingChannel); if (!decision.accepted) { socket.close(); return; } /* * Wait for the a response from the joining node saying that it connected * to all the nodes we just advertised. Use a timeout so that the cluster can't be stuck * on failed joins. */ ByteBuffer finishedJoining = ByteBuffer.allocate(1); socket.configureBlocking(false); long start = System.currentTimeMillis(); while (finishedJoining.hasRemaining() && System.currentTimeMillis() - start < 120000) { // This is just one byte to indicate that it finished joining. // No need to encrypt because the value of it doesn't matter int read = socket.read(finishedJoining); if (read == -1) { networkLog.info("New connection was unable to establish mesh"); socket.close(); return; } else if (read < 1) { Thread.sleep(5); } } /* * Now add the host to the mailbox system */ PicoNetwork picoNetwork = createPicoNetwork(sslEngine, socket, false); fhost = new ForeignHost(this, hostId, socket, m_config.deadHostTimeout, listeningAddress, picoNetwork); putForeignHost(hostId, fhost); fhost.enableRead(VERBOTEN_THREADS); m_acceptor.accrue(hostId, jo); } catch (Exception e) { networkLog.error("Error joining new node", e); addFailedHost(hostId); synchronized(HostMessenger.this) { removeForeignHost(hostId); } m_acceptor.detract(m_zk, hostId); socket.close(); return; } /* * And the last step is to wait for the new node to join ZooKeeper. * This node is the one to create the txn that will add the new host to the list of hosts * with agreement sites across the cluster. */ long hsId = CoreUtils.getHSIdFromHostAndSite(hostId, AGREEMENT_SITE_ID); if (!m_agreementSite.requestJoin(hsId).await(60, TimeUnit.SECONDS)) { reportForeignHostFailed(hostId); } } catch (Throwable e) { org.voltdb.VoltDB.crashLocalVoltDB("", true, e); } } }
public class class_name { @Override public void requestJoin(SocketChannel socket, SSLEngine sslEngine, MessagingChannel messagingChannel, InetSocketAddress listeningAddress, JSONObject jo) throws Exception { /* * Generate the host id via creating an ephemeral sequential node */ Integer hostId = selectNewHostId(socket.socket().getInetAddress().getHostAddress()); prepSocketChannel(socket); ForeignHost fhost = null; try { try { JoinAcceptor.PleaDecision decision = m_acceptor.considerMeshPlea(m_zk, hostId, jo); /* * Write the response that advertises the cluster topology */ writeRequestJoinResponse(hostId, decision, socket, messagingChannel); if (!decision.accepted) { socket.close(); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } /* * Wait for the a response from the joining node saying that it connected * to all the nodes we just advertised. Use a timeout so that the cluster can't be stuck * on failed joins. */ ByteBuffer finishedJoining = ByteBuffer.allocate(1); socket.configureBlocking(false); long start = System.currentTimeMillis(); while (finishedJoining.hasRemaining() && System.currentTimeMillis() - start < 120000) { // This is just one byte to indicate that it finished joining. // No need to encrypt because the value of it doesn't matter int read = socket.read(finishedJoining); if (read == -1) { networkLog.info("New connection was unable to establish mesh"); // depends on control dependency: [if], data = [none] socket.close(); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } else if (read < 1) { Thread.sleep(5); // depends on control dependency: [if], data = [none] } } /* * Now add the host to the mailbox system */ PicoNetwork picoNetwork = createPicoNetwork(sslEngine, socket, false); fhost = new ForeignHost(this, hostId, socket, m_config.deadHostTimeout, listeningAddress, picoNetwork); putForeignHost(hostId, fhost); fhost.enableRead(VERBOTEN_THREADS); m_acceptor.accrue(hostId, jo); } catch (Exception e) { networkLog.error("Error joining new node", e); addFailedHost(hostId); synchronized(HostMessenger.this) { removeForeignHost(hostId); } m_acceptor.detract(m_zk, hostId); socket.close(); return; } /* * And the last step is to wait for the new node to join ZooKeeper. * This node is the one to create the txn that will add the new host to the list of hosts * with agreement sites across the cluster. */ long hsId = CoreUtils.getHSIdFromHostAndSite(hostId, AGREEMENT_SITE_ID); if (!m_agreementSite.requestJoin(hsId).await(60, TimeUnit.SECONDS)) { reportForeignHostFailed(hostId); } } catch (Throwable e) { org.voltdb.VoltDB.crashLocalVoltDB("", true, e); } } }
public class class_name { protected Container getContainer(short x) { int i = this.binarySearch(0, size, x); if (i < 0) { return null; } return this.values[i]; } }
public class class_name { protected Container getContainer(short x) { int i = this.binarySearch(0, size, x); if (i < 0) { return null; // depends on control dependency: [if], data = [none] } return this.values[i]; } }
public class class_name { public synchronized Object update(String key, Object value) { // evict until size < maxSize while (isEvictionRequired() && entryLimit > 0 && entryLimit < Integer.MAX_VALUE) { evictStaleEntries(); } CacheEntry oldEntry = null; CacheEntry curEntry = new CacheEntry(value); if (primaryTable.containsKey(key)) { oldEntry = (CacheEntry) primaryTable.put(key, curEntry); } else if (secondaryTable.containsKey(key)) { oldEntry = (CacheEntry) secondaryTable.put(key, curEntry); } else if (tertiaryTable.containsKey(key)) { oldEntry = (CacheEntry) tertiaryTable.put(key, curEntry); } else { oldEntry = (CacheEntry) primaryTable.put(key, curEntry); } return oldEntry != null ? oldEntry.value : null; } }
public class class_name { public synchronized Object update(String key, Object value) { // evict until size < maxSize while (isEvictionRequired() && entryLimit > 0 && entryLimit < Integer.MAX_VALUE) { evictStaleEntries(); // depends on control dependency: [while], data = [none] } CacheEntry oldEntry = null; CacheEntry curEntry = new CacheEntry(value); if (primaryTable.containsKey(key)) { oldEntry = (CacheEntry) primaryTable.put(key, curEntry); // depends on control dependency: [if], data = [none] } else if (secondaryTable.containsKey(key)) { oldEntry = (CacheEntry) secondaryTable.put(key, curEntry); // depends on control dependency: [if], data = [none] } else if (tertiaryTable.containsKey(key)) { oldEntry = (CacheEntry) tertiaryTable.put(key, curEntry); // depends on control dependency: [if], data = [none] } else { oldEntry = (CacheEntry) primaryTable.put(key, curEntry); // depends on control dependency: [if], data = [none] } return oldEntry != null ? oldEntry.value : null; } }
public class class_name { public static DiscreteFactor getVariances(Collection<DiscreteFactor> featureFactors, int featureVariableNum) { DiscreteFactor means = getMeans(featureFactors, featureVariableNum); DiscreteFactor sumSquares = null; int numEntries = 0; for (DiscreteFactor featureFactor : featureFactors) { VariableNumMap nonFeatureVars = featureFactor.getVars().removeAll(featureVariableNum); numEntries += nonFeatureVars.getNumberOfPossibleAssignments(); DiscreteFactor factorSumSquares = featureFactor.product(featureFactor) .marginalize(nonFeatureVars); if (sumSquares == null) { sumSquares = factorSumSquares; } else { sumSquares = sumSquares.add(factorSumSquares); } } return sumSquares.add(means.product(means).product(-1.0 * numEntries)) .product(1.0 / numEntries); } }
public class class_name { public static DiscreteFactor getVariances(Collection<DiscreteFactor> featureFactors, int featureVariableNum) { DiscreteFactor means = getMeans(featureFactors, featureVariableNum); DiscreteFactor sumSquares = null; int numEntries = 0; for (DiscreteFactor featureFactor : featureFactors) { VariableNumMap nonFeatureVars = featureFactor.getVars().removeAll(featureVariableNum); numEntries += nonFeatureVars.getNumberOfPossibleAssignments(); // depends on control dependency: [for], data = [none] DiscreteFactor factorSumSquares = featureFactor.product(featureFactor) .marginalize(nonFeatureVars); if (sumSquares == null) { sumSquares = factorSumSquares; // depends on control dependency: [if], data = [none] } else { sumSquares = sumSquares.add(factorSumSquares); // depends on control dependency: [if], data = [none] } } return sumSquares.add(means.product(means).product(-1.0 * numEntries)) .product(1.0 / numEntries); } }
public class class_name { public static <T> T[] filter(T[] array, Editor<T> editor) { ArrayList<T> list = new ArrayList<T>(array.length); T modified; for (T t : array) { modified = editor.edit(t); if (null != modified) { list.add(modified); } } return list.toArray(Arrays.copyOf(array, list.size())); } }
public class class_name { public static <T> T[] filter(T[] array, Editor<T> editor) { ArrayList<T> list = new ArrayList<T>(array.length); T modified; for (T t : array) { modified = editor.edit(t); // depends on control dependency: [for], data = [t] if (null != modified) { list.add(modified); // depends on control dependency: [if], data = [modified)] } } return list.toArray(Arrays.copyOf(array, list.size())); } }
public class class_name { @Override public final void storeCacheState(final OWriteCache writeCache) { if (!OGlobalConfiguration.STORAGE_KEEP_DISK_CACHE_STATE.getValueAsBoolean()) { return; } if (writeCache == null) { return; } cacheLock.acquireWriteLock(); try { final Path rootDirectory = writeCache.getRootDirectory(); final Path stateFile = rootDirectory.resolve(CACHE_STATE_FILE); if (Files.exists(stateFile)) { Files.delete(stateFile); } final Set<Long> filesToStore = new HashSet<>(writeCache.files().values()); try (final FileChannel channel = FileChannel.open(stateFile, StandardOpenOption.WRITE, StandardOpenOption.CREATE)) { final OutputStream channelStream = Channels.newOutputStream(channel); final BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(channelStream, 64 * 1024); try (final DataOutputStream dataOutputStream = new DataOutputStream(bufferedOutputStream)) { dataOutputStream.writeLong(memoryDataContainer.get().maxSize); storeQueueState(writeCache, filesToStore, dataOutputStream, am); dataOutputStream.writeInt(-1); storeQueueState(writeCache, filesToStore, dataOutputStream, a1in); dataOutputStream.writeInt(-1); storeQueueState(writeCache, filesToStore, dataOutputStream, a1out); dataOutputStream.writeInt(-1); } } } catch (final Exception e) { OLogManager.instance() .error(this, "Cannot store state of cache for storage placed under %s", e, writeCache.getRootDirectory()); } finally { cacheLock.releaseWriteLock(); } } }
public class class_name { @Override public final void storeCacheState(final OWriteCache writeCache) { if (!OGlobalConfiguration.STORAGE_KEEP_DISK_CACHE_STATE.getValueAsBoolean()) { return; // depends on control dependency: [if], data = [none] } if (writeCache == null) { return; // depends on control dependency: [if], data = [none] } cacheLock.acquireWriteLock(); try { final Path rootDirectory = writeCache.getRootDirectory(); final Path stateFile = rootDirectory.resolve(CACHE_STATE_FILE); if (Files.exists(stateFile)) { Files.delete(stateFile); // depends on control dependency: [if], data = [none] } final Set<Long> filesToStore = new HashSet<>(writeCache.files().values()); try (final FileChannel channel = FileChannel.open(stateFile, StandardOpenOption.WRITE, StandardOpenOption.CREATE)) { final OutputStream channelStream = Channels.newOutputStream(channel); final BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(channelStream, 64 * 1024); try (final DataOutputStream dataOutputStream = new DataOutputStream(bufferedOutputStream)) { dataOutputStream.writeLong(memoryDataContainer.get().maxSize); storeQueueState(writeCache, filesToStore, dataOutputStream, am); // depends on control dependency: [try], data = [none] dataOutputStream.writeInt(-1); // depends on control dependency: [try], data = [none] storeQueueState(writeCache, filesToStore, dataOutputStream, a1in); // depends on control dependency: [try], data = [none] dataOutputStream.writeInt(-1); // depends on control dependency: [try], data = [none] storeQueueState(writeCache, filesToStore, dataOutputStream, a1out); // depends on control dependency: [try], data = [none] dataOutputStream.writeInt(-1); // depends on control dependency: [try], data = [none] } } } catch (final Exception e) { OLogManager.instance() .error(this, "Cannot store state of cache for storage placed under %s", e, writeCache.getRootDirectory()); } finally { // depends on control dependency: [catch], data = [none] cacheLock.releaseWriteLock(); } } }
public class class_name { public static String bareError(String pattern) { List<String> camelKeys = getCamelKeys(pattern), orignalKeys = getOriginalKeys(pattern); for (int i = 0; i < camelKeys.size(); i++) { pattern = pattern.replaceFirst("\\{" + orignalKeys.get(i) + "\\}", "{" + camelKeys.get(i) + "}"); } return pattern; } }
public class class_name { public static String bareError(String pattern) { List<String> camelKeys = getCamelKeys(pattern), orignalKeys = getOriginalKeys(pattern); for (int i = 0; i < camelKeys.size(); i++) { pattern = pattern.replaceFirst("\\{" + orignalKeys.get(i) + "\\}", "{" + camelKeys.get(i) + "}"); // depends on control dependency: [for], data = [i] } return pattern; } }
public class class_name { private void initGraphics() { // Set initial size if (Double.compare(gauge.getPrefWidth(), 0.0) <= 0 || Double.compare(gauge.getPrefHeight(), 0.0) <= 0 || Double.compare(gauge.getWidth(), 0.0) <= 0 || Double.compare(gauge.getHeight(), 0.0) <= 0) { if (gauge.getPrefWidth() > 0 && gauge.getPrefHeight() > 0) { gauge.setPrefSize(gauge.getPrefWidth(), gauge.getPrefHeight()); } else { gauge.setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT); } } sectionsCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT); sectionsCtx = sectionsCanvas.getGraphicsContext2D(); needleRotate = new Rotate(180 - START_ANGLE); angleStep = ANGLE_RANGE / (gauge.getRange()); double targetAngle = 180 - START_ANGLE + (gauge.getValue() - gauge.getMinValue()) * angleStep; needleRotate.setAngle(Helper.clamp(180 - START_ANGLE, 180 - START_ANGLE + ANGLE_RANGE, targetAngle)); needleMoveTo1 = new MoveTo(); needleCubicCurveTo2 = new CubicCurveTo(); needleCubicCurveTo3 = new CubicCurveTo(); needleCubicCurveTo4 = new CubicCurveTo(); needleLineTo5 = new LineTo(); needleLineTo6 = new LineTo(); needleCubicCurveTo7 = new CubicCurveTo(); needleClosePath8 = new ClosePath(); needle = new Path(needleMoveTo1, needleCubicCurveTo2, needleCubicCurveTo3, needleCubicCurveTo4, needleLineTo5, needleLineTo6, needleCubicCurveTo7, needleClosePath8); needle.setFillRule(FillRule.EVEN_ODD); needle.getTransforms().setAll(needleRotate); needle.setFill(gauge.getNeedleColor()); needle.setStroke(gauge.getBorderPaint()); needle.setStrokeLineCap(StrokeLineCap.ROUND); needle.setStrokeLineJoin(StrokeLineJoin.BEVEL); valueText = new Text(formatNumber(gauge.getLocale(), gauge.getFormatString(), gauge.getDecimals(), gauge.getMinValue()) + gauge.getUnit()); valueText.setMouseTransparent(true); valueText.setTextOrigin(VPos.CENTER); valueText.setFill(gauge.getValueColor()); enableNode(valueText, gauge.isValueVisible()); titleText = new Text(gauge.getTitle()); titleText.setTextOrigin(VPos.CENTER); titleText.setFill(gauge.getTitleColor()); enableNode(titleText, !gauge.getTitle().isEmpty()); subTitleText = new Text(gauge.getSubTitle()); subTitleText.setTextOrigin(VPos.CENTER); subTitleText.setFill(gauge.getSubTitleColor()); enableNode(subTitleText, !gauge.getSubTitle().isEmpty()); // Add all nodes pane = new Pane(sectionsCanvas, needle, valueText, titleText, subTitleText); getChildren().setAll(pane); } }
public class class_name { private void initGraphics() { // Set initial size if (Double.compare(gauge.getPrefWidth(), 0.0) <= 0 || Double.compare(gauge.getPrefHeight(), 0.0) <= 0 || Double.compare(gauge.getWidth(), 0.0) <= 0 || Double.compare(gauge.getHeight(), 0.0) <= 0) { if (gauge.getPrefWidth() > 0 && gauge.getPrefHeight() > 0) { gauge.setPrefSize(gauge.getPrefWidth(), gauge.getPrefHeight()); // depends on control dependency: [if], data = [(gauge.getPrefWidth()] } else { gauge.setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT); // depends on control dependency: [if], data = [none] } } sectionsCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT); sectionsCtx = sectionsCanvas.getGraphicsContext2D(); needleRotate = new Rotate(180 - START_ANGLE); angleStep = ANGLE_RANGE / (gauge.getRange()); double targetAngle = 180 - START_ANGLE + (gauge.getValue() - gauge.getMinValue()) * angleStep; needleRotate.setAngle(Helper.clamp(180 - START_ANGLE, 180 - START_ANGLE + ANGLE_RANGE, targetAngle)); needleMoveTo1 = new MoveTo(); needleCubicCurveTo2 = new CubicCurveTo(); needleCubicCurveTo3 = new CubicCurveTo(); needleCubicCurveTo4 = new CubicCurveTo(); needleLineTo5 = new LineTo(); needleLineTo6 = new LineTo(); needleCubicCurveTo7 = new CubicCurveTo(); needleClosePath8 = new ClosePath(); needle = new Path(needleMoveTo1, needleCubicCurveTo2, needleCubicCurveTo3, needleCubicCurveTo4, needleLineTo5, needleLineTo6, needleCubicCurveTo7, needleClosePath8); needle.setFillRule(FillRule.EVEN_ODD); needle.getTransforms().setAll(needleRotate); needle.setFill(gauge.getNeedleColor()); needle.setStroke(gauge.getBorderPaint()); needle.setStrokeLineCap(StrokeLineCap.ROUND); needle.setStrokeLineJoin(StrokeLineJoin.BEVEL); valueText = new Text(formatNumber(gauge.getLocale(), gauge.getFormatString(), gauge.getDecimals(), gauge.getMinValue()) + gauge.getUnit()); valueText.setMouseTransparent(true); valueText.setTextOrigin(VPos.CENTER); valueText.setFill(gauge.getValueColor()); enableNode(valueText, gauge.isValueVisible()); titleText = new Text(gauge.getTitle()); titleText.setTextOrigin(VPos.CENTER); titleText.setFill(gauge.getTitleColor()); enableNode(titleText, !gauge.getTitle().isEmpty()); subTitleText = new Text(gauge.getSubTitle()); subTitleText.setTextOrigin(VPos.CENTER); subTitleText.setFill(gauge.getSubTitleColor()); enableNode(subTitleText, !gauge.getSubTitle().isEmpty()); // Add all nodes pane = new Pane(sectionsCanvas, needle, valueText, titleText, subTitleText); getChildren().setAll(pane); } }
public class class_name { @Override public int getCurrentlyExecutingAmount(JobKey jobKey) throws SchedulerException { List<JobExecutionContext> executingJobs = scheduler.getCurrentlyExecutingJobs(); JobDetail jobDetail = scheduler.getJobDetail(jobKey); int numInstances = 0; for (JobExecutionContext jobExecutionContext : executingJobs) { JobDetail execJobDetail = jobExecutionContext.getJobDetail(); if (execJobDetail.getKey().equals(jobDetail.getKey())) { if (LOGGER.isTraceEnabled()) LOGGER.trace(String.format("found running job for jobkey: (%s, %s)", jobKey.getGroup(), jobKey.getName())); ++numInstances; } } return numInstances; } }
public class class_name { @Override public int getCurrentlyExecutingAmount(JobKey jobKey) throws SchedulerException { List<JobExecutionContext> executingJobs = scheduler.getCurrentlyExecutingJobs(); JobDetail jobDetail = scheduler.getJobDetail(jobKey); int numInstances = 0; for (JobExecutionContext jobExecutionContext : executingJobs) { JobDetail execJobDetail = jobExecutionContext.getJobDetail(); if (execJobDetail.getKey().equals(jobDetail.getKey())) { if (LOGGER.isTraceEnabled()) LOGGER.trace(String.format("found running job for jobkey: (%s, %s)", jobKey.getGroup(), jobKey.getName())); ++numInstances; // depends on control dependency: [if], data = [none] } } return numInstances; } }
public class class_name { @Override protected void processAutoFilters(byte[] data) { //System.out.println(ByteArrayHelper.hexdump(data, true, 16, "")); // // 16 byte block header containing the filter count // int filterCount = MPPUtility.getShort(data, 8); int offset = 16; CriteriaReader criteria = new FilterCriteriaReader14(); // // 16 byte header // followed by 4 bytes = field type // followed by 2 byte block size for (int loop = 0; loop < filterCount; loop++) { FieldType field = getFieldType(data, offset); int blockSize = MPPUtility.getShort(data, offset + 4); // // Steelray 12335: the block size may be zero // if (blockSize == 0) { break; } //System.out.println(ByteArrayHelper.hexdump(data, offset, 32, false)); // may need to sort this out GenericCriteria c = criteria.process(m_properties, data, offset + 12, -1, null, null, null); //System.out.println(c); Filter filter = new Filter(); filter.setCriteria(c); m_autoFilters.add(filter); m_autoFiltersByType.put(field, filter); // // Move to the next filter // offset += blockSize; } } }
public class class_name { @Override protected void processAutoFilters(byte[] data) { //System.out.println(ByteArrayHelper.hexdump(data, true, 16, "")); // // 16 byte block header containing the filter count // int filterCount = MPPUtility.getShort(data, 8); int offset = 16; CriteriaReader criteria = new FilterCriteriaReader14(); // // 16 byte header // followed by 4 bytes = field type // followed by 2 byte block size for (int loop = 0; loop < filterCount; loop++) { FieldType field = getFieldType(data, offset); int blockSize = MPPUtility.getShort(data, offset + 4); // // Steelray 12335: the block size may be zero // if (blockSize == 0) { break; } //System.out.println(ByteArrayHelper.hexdump(data, offset, 32, false)); // may need to sort this out GenericCriteria c = criteria.process(m_properties, data, offset + 12, -1, null, null, null); //System.out.println(c); Filter filter = new Filter(); filter.setCriteria(c); // depends on control dependency: [for], data = [none] m_autoFilters.add(filter); // depends on control dependency: [for], data = [none] m_autoFiltersByType.put(field, filter); // depends on control dependency: [for], data = [none] // // Move to the next filter // offset += blockSize; // depends on control dependency: [for], data = [none] } } }
public class class_name { BufferAllocator allocator() { Class<?> allocator = reader.getClass(ALLOCATOR, UnpooledUnsafeHeapAllocator.class); try { return (BufferAllocator) allocator.newInstance(); } catch (InstantiationException | IllegalAccessException e) { throw new ConfigurationException(e); } catch (ClassCastException e) { throw new ConfigurationException("invalid allocator class: " + allocator.getName()); } } }
public class class_name { BufferAllocator allocator() { Class<?> allocator = reader.getClass(ALLOCATOR, UnpooledUnsafeHeapAllocator.class); try { return (BufferAllocator) allocator.newInstance(); // depends on control dependency: [try], data = [none] } catch (InstantiationException | IllegalAccessException e) { throw new ConfigurationException(e); } catch (ClassCastException e) { // depends on control dependency: [catch], data = [none] throw new ConfigurationException("invalid allocator class: " + allocator.getName()); } // depends on control dependency: [catch], data = [none] } }
public class class_name { protected void processNodeCreated(String path) { if (path.equals(masterZnode)) { LOG.info(masterZnode + " created and try to become active master"); handleMasterNodeChange(); } } }
public class class_name { protected void processNodeCreated(String path) { if (path.equals(masterZnode)) { LOG.info(masterZnode + " created and try to become active master"); // depends on control dependency: [if], data = [none] handleMasterNodeChange(); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static String getTypeName(Type type) { if(type instanceof Class) { Class<?> clazz = (Class<?>) type; return clazz.isArray() ? (getTypeName(clazz.getComponentType()) + "[]") : clazz.getName(); } else { return type.toString(); } } }
public class class_name { public static String getTypeName(Type type) { if(type instanceof Class) { Class<?> clazz = (Class<?>) type; return clazz.isArray() ? (getTypeName(clazz.getComponentType()) + "[]") : clazz.getName(); } else { return type.toString(); // depends on control dependency: [if], data = [none] } } }
public class class_name { private DatanodeDescriptor chooseSourceDatanode( Block block, List<DatanodeDescriptor> containingNodes, NumberReplicas numReplicas) { containingNodes.clear(); DatanodeDescriptor srcNode = null; int live = 0; int decommissioned = 0; int corrupt = 0; int excess = 0; Iterator<DatanodeDescriptor> it = blocksMap.nodeIterator(block); Collection<DatanodeDescriptor> nodesCorrupt = corruptReplicas.getNodes(block); DatanodeDescriptor excessReplica = null; while (it.hasNext()) { DatanodeDescriptor node = it.next(); Collection<Block> excessBlocks = excessReplicateMap.get(node.getStorageID()); if ((nodesCorrupt != null) && (nodesCorrupt.contains(node))) { corrupt++; } else if (node.isDecommissionInProgress() || node.isDecommissioned()) { decommissioned++; } else if (excessBlocks != null && excessBlocks.contains(block)) { excess++; } else { live++; } containingNodes.add(node); // Check if this replica is corrupt // If so, do not select the node as src node if ((nodesCorrupt != null) && nodesCorrupt.contains(node)) { continue; } if (node.getNumberOfBlocksToBeReplicated() >= maxReplicationStreams) { continue; } // already reached replication limit // the block must not be scheduled for removal on srcNode if (excessBlocks != null && excessBlocks.contains(block)) { excessReplica = node; continue; } // never use already decommissioned nodes if (node.isDecommissioned()) { continue; } // we prefer nodes that are in DECOMMISSION_INPROGRESS state if (node.isDecommissionInProgress() || srcNode == null) { srcNode = node; continue; } if (srcNode.isDecommissionInProgress()) { continue; } // switch to a different node randomly // this to prevent from deterministically selecting the same node even // if the node failed to replicate the block on previous iterations if (r.nextBoolean()) { srcNode = node; } } if (numReplicas != null) { numReplicas.initialize(live, decommissioned, corrupt, excess); } if (srcNode == null && live == 0 && excessReplica != null) { // try excessReplica if there is no other choice srcNode = excessReplica; } return srcNode; } }
public class class_name { private DatanodeDescriptor chooseSourceDatanode( Block block, List<DatanodeDescriptor> containingNodes, NumberReplicas numReplicas) { containingNodes.clear(); DatanodeDescriptor srcNode = null; int live = 0; int decommissioned = 0; int corrupt = 0; int excess = 0; Iterator<DatanodeDescriptor> it = blocksMap.nodeIterator(block); Collection<DatanodeDescriptor> nodesCorrupt = corruptReplicas.getNodes(block); DatanodeDescriptor excessReplica = null; while (it.hasNext()) { DatanodeDescriptor node = it.next(); Collection<Block> excessBlocks = excessReplicateMap.get(node.getStorageID()); if ((nodesCorrupt != null) && (nodesCorrupt.contains(node))) { corrupt++; // depends on control dependency: [if], data = [none] } else if (node.isDecommissionInProgress() || node.isDecommissioned()) { decommissioned++; // depends on control dependency: [if], data = [none] } else if (excessBlocks != null && excessBlocks.contains(block)) { excess++; // depends on control dependency: [if], data = [none] } else { live++; // depends on control dependency: [if], data = [none] } containingNodes.add(node); // depends on control dependency: [while], data = [none] // Check if this replica is corrupt // If so, do not select the node as src node if ((nodesCorrupt != null) && nodesCorrupt.contains(node)) { continue; } if (node.getNumberOfBlocksToBeReplicated() >= maxReplicationStreams) { continue; } // already reached replication limit // the block must not be scheduled for removal on srcNode if (excessBlocks != null && excessBlocks.contains(block)) { excessReplica = node; // depends on control dependency: [if], data = [none] continue; } // never use already decommissioned nodes if (node.isDecommissioned()) { continue; } // we prefer nodes that are in DECOMMISSION_INPROGRESS state if (node.isDecommissionInProgress() || srcNode == null) { srcNode = node; // depends on control dependency: [if], data = [none] continue; } if (srcNode.isDecommissionInProgress()) { continue; } // switch to a different node randomly // this to prevent from deterministically selecting the same node even // if the node failed to replicate the block on previous iterations if (r.nextBoolean()) { srcNode = node; // depends on control dependency: [if], data = [none] } } if (numReplicas != null) { numReplicas.initialize(live, decommissioned, corrupt, excess); // depends on control dependency: [if], data = [none] } if (srcNode == null && live == 0 && excessReplica != null) { // try excessReplica if there is no other choice srcNode = excessReplica; // depends on control dependency: [if], data = [none] } return srcNode; } }
public class class_name { public HostKey getHostKey(Computer host) throws IOException { HostKey key = cache.get(host); if (null == key) { File hostKeyFile = getSshHostKeyFile(host.getNode()); if (hostKeyFile.exists()) { XmlFile xmlHostKeyFile = new XmlFile(hostKeyFile); key = (HostKey) xmlHostKeyFile.read(); } else { key = null; } cache.put(host, key); } return key; } }
public class class_name { public HostKey getHostKey(Computer host) throws IOException { HostKey key = cache.get(host); if (null == key) { File hostKeyFile = getSshHostKeyFile(host.getNode()); if (hostKeyFile.exists()) { XmlFile xmlHostKeyFile = new XmlFile(hostKeyFile); key = (HostKey) xmlHostKeyFile.read(); // depends on control dependency: [if], data = [none] } else { key = null; // depends on control dependency: [if], data = [none] } cache.put(host, key); } return key; } }
public class class_name { public void marshall(DeleteBGPPeerRequest deleteBGPPeerRequest, ProtocolMarshaller protocolMarshaller) { if (deleteBGPPeerRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(deleteBGPPeerRequest.getVirtualInterfaceId(), VIRTUALINTERFACEID_BINDING); protocolMarshaller.marshall(deleteBGPPeerRequest.getAsn(), ASN_BINDING); protocolMarshaller.marshall(deleteBGPPeerRequest.getCustomerAddress(), CUSTOMERADDRESS_BINDING); protocolMarshaller.marshall(deleteBGPPeerRequest.getBgpPeerId(), BGPPEERID_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(DeleteBGPPeerRequest deleteBGPPeerRequest, ProtocolMarshaller protocolMarshaller) { if (deleteBGPPeerRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(deleteBGPPeerRequest.getVirtualInterfaceId(), VIRTUALINTERFACEID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(deleteBGPPeerRequest.getAsn(), ASN_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(deleteBGPPeerRequest.getCustomerAddress(), CUSTOMERADDRESS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(deleteBGPPeerRequest.getBgpPeerId(), BGPPEERID_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { protected Tuple2<CompletableFuture<Channel>, CompletableFuture<SocketAddress>> reconnect() { CompletableFuture<Channel> future = new CompletableFuture<>(); CompletableFuture<SocketAddress> address = new CompletableFuture<>(); socketAddressSupplier.subscribe(remoteAddress -> { address.complete(remoteAddress); if (future.isCancelled()) { return; } reconnect0(future, remoteAddress); }, ex -> { if (!address.isDone()) { address.completeExceptionally(ex); } future.completeExceptionally(ex); }); this.currentFuture = future; return Tuples.of(future, address); } }
public class class_name { protected Tuple2<CompletableFuture<Channel>, CompletableFuture<SocketAddress>> reconnect() { CompletableFuture<Channel> future = new CompletableFuture<>(); CompletableFuture<SocketAddress> address = new CompletableFuture<>(); socketAddressSupplier.subscribe(remoteAddress -> { address.complete(remoteAddress); if (future.isCancelled()) { return; // depends on control dependency: [if], data = [none] } reconnect0(future, remoteAddress); }, ex -> { if (!address.isDone()) { address.completeExceptionally(ex); // depends on control dependency: [if], data = [none] } future.completeExceptionally(ex); }); this.currentFuture = future; return Tuples.of(future, address); } }
public class class_name { @Override public CPInstance fetchByC_LtD_S_First(long CPDefinitionId, Date displayDate, int status, OrderByComparator<CPInstance> orderByComparator) { List<CPInstance> list = findByC_LtD_S(CPDefinitionId, displayDate, status, 0, 1, orderByComparator); if (!list.isEmpty()) { return list.get(0); } return null; } }
public class class_name { @Override public CPInstance fetchByC_LtD_S_First(long CPDefinitionId, Date displayDate, int status, OrderByComparator<CPInstance> orderByComparator) { List<CPInstance> list = findByC_LtD_S(CPDefinitionId, displayDate, status, 0, 1, orderByComparator); if (!list.isEmpty()) { return list.get(0); // depends on control dependency: [if], data = [none] } return null; } }
public class class_name { public void fireMetatypeAddedEvents(Set<String> updatedPids) { for (String pid : updatedPids) { caSupport.fireMetatypeAddedEvent(pid); } } }
public class class_name { public void fireMetatypeAddedEvents(Set<String> updatedPids) { for (String pid : updatedPids) { caSupport.fireMetatypeAddedEvent(pid); // depends on control dependency: [for], data = [pid] } } }
public class class_name { private void cleanUp(final DataSet ds) { Set<String> indexedKeys = Sets.newHashSet(); for (String key : ds.getDataView().keySet()) { // Search for indexed entries if (key.contains("#")) { // Remember key (without index) indexedKeys.add(key.substring(0, key.indexOf("#"))); } } // Remove all indexes for (String indexedKey : indexedKeys) { ds.removeValue(indexedKey); } } }
public class class_name { private void cleanUp(final DataSet ds) { Set<String> indexedKeys = Sets.newHashSet(); for (String key : ds.getDataView().keySet()) { // Search for indexed entries if (key.contains("#")) { // Remember key (without index) indexedKeys.add(key.substring(0, key.indexOf("#"))); // depends on control dependency: [if], data = [none] } } // Remove all indexes for (String indexedKey : indexedKeys) { ds.removeValue(indexedKey); // depends on control dependency: [for], data = [indexedKey] } } }
public class class_name { private static void renderExpr(boolean first, CodeBlock.Builder code, Node<PluralType> expr) { Iterator<Node<PluralType>> iter = expr.asStruct().nodes().iterator(); // Parse out the two forms of operand expressions we support: // // n = <rangelist> // n % m = <rangelist> // Atom<PluralType> operand = iter.next().asAtom(); Atom<PluralType> modop = null; Atom<PluralType> relop = iter.next().asAtom(); if (relop.type() == PluralType.MODOP) { modop = relop; relop = iter.next().asAtom(); } String var = (String)operand.value(); List<Node<PluralType>> rangeList = iter.next().asStruct().nodes(); boolean decimalsZero = false; if (var.equals("n") && modop != null) { // We're applying mod to the 'n' operand, we must also ensure that // decimal value == 0. decimalsZero = true; } // If this is the first expression, define the variable; otherwise reuse it. String fmt = "zz = o.$L()"; if (first) { fmt = "long " + fmt; } // Mod operations modify the operand before assignment. if (modop != null) { fmt += " % $LL"; } // Emit the expression. if (modop != null) { code.addStatement(fmt, var, (int)modop.value()); } else { code.addStatement(fmt, var); } renderExpr(code, rangeList, relop.value().equals("="), decimalsZero); } }
public class class_name { private static void renderExpr(boolean first, CodeBlock.Builder code, Node<PluralType> expr) { Iterator<Node<PluralType>> iter = expr.asStruct().nodes().iterator(); // Parse out the two forms of operand expressions we support: // // n = <rangelist> // n % m = <rangelist> // Atom<PluralType> operand = iter.next().asAtom(); Atom<PluralType> modop = null; Atom<PluralType> relop = iter.next().asAtom(); if (relop.type() == PluralType.MODOP) { modop = relop; // depends on control dependency: [if], data = [none] relop = iter.next().asAtom(); // depends on control dependency: [if], data = [none] } String var = (String)operand.value(); List<Node<PluralType>> rangeList = iter.next().asStruct().nodes(); boolean decimalsZero = false; if (var.equals("n") && modop != null) { // We're applying mod to the 'n' operand, we must also ensure that // decimal value == 0. decimalsZero = true; // depends on control dependency: [if], data = [none] } // If this is the first expression, define the variable; otherwise reuse it. String fmt = "zz = o.$L()"; if (first) { fmt = "long " + fmt; // depends on control dependency: [if], data = [none] } // Mod operations modify the operand before assignment. if (modop != null) { fmt += " % $LL"; // depends on control dependency: [if], data = [none] } // Emit the expression. if (modop != null) { code.addStatement(fmt, var, (int)modop.value()); // depends on control dependency: [if], data = [none] } else { code.addStatement(fmt, var); // depends on control dependency: [if], data = [none] } renderExpr(code, rangeList, relop.value().equals("="), decimalsZero); } }
public class class_name { public void blockDecrypt(final long[] c, final long[] p) { // initial value = plain System.arraycopy(c, 0, vd, 0, nw); for (int d = nr; d > 0; d--) { // do the rounds // calculate e{d,i} if (d % SUBKEY_INTERVAL == 0) { final int s = d / SUBKEY_INTERVAL; keySchedule(s); // calculate same keys for (int i = 0; i < nw; i++) { fd[i] = vd[i] - ksd[i]; } } else { System.arraycopy(vd, 0, fd, 0, nw); } for (int i = 0; i < nw; i++) { ed[i] = fd[rpi[i]]; } for (int j = 0; j < nw / 2; j++) { y[0] = ed[j * 2]; y[1] = ed[j * 2 + 1]; demix(j, d - 1); vd[j * 2] = x[0]; vd[j * 2 + 1] = x[1]; } } // do the first keyschedule keySchedule(0); for (int i = 0; i < nw; i++) { p[i] = vd[i] - ksd[i]; } } }
public class class_name { public void blockDecrypt(final long[] c, final long[] p) { // initial value = plain System.arraycopy(c, 0, vd, 0, nw); for (int d = nr; d > 0; d--) { // do the rounds // calculate e{d,i} if (d % SUBKEY_INTERVAL == 0) { final int s = d / SUBKEY_INTERVAL; keySchedule(s); // calculate same keys // depends on control dependency: [if], data = [none] for (int i = 0; i < nw; i++) { fd[i] = vd[i] - ksd[i]; // depends on control dependency: [for], data = [i] } } else { System.arraycopy(vd, 0, fd, 0, nw); // depends on control dependency: [if], data = [none] } for (int i = 0; i < nw; i++) { ed[i] = fd[rpi[i]]; // depends on control dependency: [for], data = [i] } for (int j = 0; j < nw / 2; j++) { y[0] = ed[j * 2]; // depends on control dependency: [for], data = [j] y[1] = ed[j * 2 + 1]; // depends on control dependency: [for], data = [j] demix(j, d - 1); // depends on control dependency: [for], data = [j] vd[j * 2] = x[0]; // depends on control dependency: [for], data = [j] vd[j * 2 + 1] = x[1]; // depends on control dependency: [for], data = [j] } } // do the first keyschedule keySchedule(0); for (int i = 0; i < nw; i++) { p[i] = vd[i] - ksd[i]; // depends on control dependency: [for], data = [i] } } }
public class class_name { public static void extract(Bundle bundle, File destDir, String selector) throws IOException { final String sourceMethod = "extract"; //$NON-NLS-1$ final boolean isTraceLogging = log.isLoggable(Level.FINER); if (isTraceLogging) { log.entering(sourceClass, sourceMethod, new Object[]{bundle, destDir}); } if (selector == null) selector = ""; //$NON-NLS-1$ if (isFolder(selector)) { // Selector specifies a folder path. Get the contents of the folder Enumeration<?> urls = bundle.findEntries(selector, "*", true); //$NON-NLS-1$ // iterates over entries in the folder while (urls.hasMoreElements()) { URL url = (URL)urls.nextElement(); String path = url.getPath(); // Make sure path doesn't start with '/' if (path.charAt(0) == '/') { path = path.substring(1); } // Make sure target path is rooted at the folder specified by selector String targetName = path.substring(selector.length()); File file = new File(destDir, targetName.replace("/", File.separator)); //$NON-NLS-1$ if (isFolder(path)) { extractDirectory(url, file); } else { extractFile(url, file); } } } else { // Selector specifies a file URL entry = bundle.getEntry(selector); String pathName = entry.getPath(); // target name is just the filename int idx = pathName.lastIndexOf('/'); String targetName = (idx == -1) ? pathName : pathName.substring(idx+1); File file = new File(destDir, targetName); extractFile(entry, file); } if (isTraceLogging) { log.exiting(sourceClass, sourceMethod); } } }
public class class_name { public static void extract(Bundle bundle, File destDir, String selector) throws IOException { final String sourceMethod = "extract"; //$NON-NLS-1$ final boolean isTraceLogging = log.isLoggable(Level.FINER); if (isTraceLogging) { log.entering(sourceClass, sourceMethod, new Object[]{bundle, destDir}); } if (selector == null) selector = ""; //$NON-NLS-1$ if (isFolder(selector)) { // Selector specifies a folder path. Get the contents of the folder Enumeration<?> urls = bundle.findEntries(selector, "*", true); //$NON-NLS-1$ // iterates over entries in the folder while (urls.hasMoreElements()) { URL url = (URL)urls.nextElement(); String path = url.getPath(); // Make sure path doesn't start with '/' if (path.charAt(0) == '/') { path = path.substring(1); // depends on control dependency: [if], data = [none] } // Make sure target path is rooted at the folder specified by selector String targetName = path.substring(selector.length()); File file = new File(destDir, targetName.replace("/", File.separator)); //$NON-NLS-1$ if (isFolder(path)) { extractDirectory(url, file); // depends on control dependency: [if], data = [none] } else { extractFile(url, file); // depends on control dependency: [if], data = [none] } } } else { // Selector specifies a file URL entry = bundle.getEntry(selector); String pathName = entry.getPath(); // target name is just the filename int idx = pathName.lastIndexOf('/'); String targetName = (idx == -1) ? pathName : pathName.substring(idx+1); File file = new File(destDir, targetName); extractFile(entry, file); } if (isTraceLogging) { log.exiting(sourceClass, sourceMethod); } } }
public class class_name { @Nullable public static StorageDirView selectDirWithRequestedSpace(long bytesToBeAvailable, BlockStoreLocation location, BlockMetadataManagerView mManagerView) { if (location.equals(BlockStoreLocation.anyTier())) { for (StorageTierView tierView : mManagerView.getTierViews()) { for (StorageDirView dirView : tierView.getDirViews()) { if (dirView.getAvailableBytes() >= bytesToBeAvailable) { return dirView; } } } return null; } String tierAlias = location.tierAlias(); StorageTierView tierView = mManagerView.getTierView(tierAlias); if (location.equals(BlockStoreLocation.anyDirInTier(tierAlias))) { for (StorageDirView dirView : tierView.getDirViews()) { if (dirView.getAvailableBytes() >= bytesToBeAvailable) { return dirView; } } return null; } StorageDirView dirView = tierView.getDirView(location.dir()); return (dirView.getAvailableBytes() >= bytesToBeAvailable) ? dirView : null; } }
public class class_name { @Nullable public static StorageDirView selectDirWithRequestedSpace(long bytesToBeAvailable, BlockStoreLocation location, BlockMetadataManagerView mManagerView) { if (location.equals(BlockStoreLocation.anyTier())) { for (StorageTierView tierView : mManagerView.getTierViews()) { for (StorageDirView dirView : tierView.getDirViews()) { if (dirView.getAvailableBytes() >= bytesToBeAvailable) { return dirView; // depends on control dependency: [if], data = [none] } } } return null; // depends on control dependency: [if], data = [none] } String tierAlias = location.tierAlias(); StorageTierView tierView = mManagerView.getTierView(tierAlias); if (location.equals(BlockStoreLocation.anyDirInTier(tierAlias))) { for (StorageDirView dirView : tierView.getDirViews()) { if (dirView.getAvailableBytes() >= bytesToBeAvailable) { return dirView; // depends on control dependency: [if], data = [none] } } return null; // depends on control dependency: [if], data = [none] } StorageDirView dirView = tierView.getDirView(location.dir()); return (dirView.getAvailableBytes() >= bytesToBeAvailable) ? dirView : null; } }
public class class_name { boolean shouldSuppressField(FieldDefinition fieldDef) { if (!m_config.optimize) { return false; } Set<String> suppressedFields = m_dbSuppressedFieldMap.get(fieldDef.getTableName()); return suppressedFields != null && suppressedFields.contains(fieldDef.getName()); } }
public class class_name { boolean shouldSuppressField(FieldDefinition fieldDef) { if (!m_config.optimize) { return false; // depends on control dependency: [if], data = [none] } Set<String> suppressedFields = m_dbSuppressedFieldMap.get(fieldDef.getTableName()); return suppressedFields != null && suppressedFields.contains(fieldDef.getName()); } }
public class class_name { public static void constraintMatrix3x3( DMatrixRMaj L_3x6 , DMatrixRMaj L_6x3 ) { int index = 0; for( int i = 0; i < 3; i++ ) { L_6x3.data[index++] = L_3x6.get(i,0); L_6x3.data[index++] = L_3x6.get(i,1); L_6x3.data[index++] = L_3x6.get(i,3); } } }
public class class_name { public static void constraintMatrix3x3( DMatrixRMaj L_3x6 , DMatrixRMaj L_6x3 ) { int index = 0; for( int i = 0; i < 3; i++ ) { L_6x3.data[index++] = L_3x6.get(i,0); // depends on control dependency: [for], data = [i] L_6x3.data[index++] = L_3x6.get(i,1); // depends on control dependency: [for], data = [i] L_6x3.data[index++] = L_3x6.get(i,3); // depends on control dependency: [for], data = [i] } } }
public class class_name { public static java.util.function.Function<Identifier, SyntacticItem> removeFromBinding( java.util.function.Function<Identifier, SyntacticItem> binding, Tuple<Identifier> variables) { return (Identifier var) -> { // Sanity check whether this is a variable which is being removed for (int i = 0; i != variables.size(); ++i) { if (var.equals(variables.get(i))) { return null; } } // Not being removed, reuse existing binding return binding.apply(var); }; } }
public class class_name { public static java.util.function.Function<Identifier, SyntacticItem> removeFromBinding( java.util.function.Function<Identifier, SyntacticItem> binding, Tuple<Identifier> variables) { return (Identifier var) -> { // Sanity check whether this is a variable which is being removed for (int i = 0; i != variables.size(); ++i) { if (var.equals(variables.get(i))) { return null; // depends on control dependency: [if], data = [none] } } // Not being removed, reuse existing binding return binding.apply(var); }; } }
public class class_name { public URI location() { String loc = http().getHeaderField("Location"); if (loc != null) { return URI.create(loc); } return null; } }
public class class_name { public URI location() { String loc = http().getHeaderField("Location"); if (loc != null) { return URI.create(loc); // depends on control dependency: [if], data = [(loc] } return null; } }
public class class_name { public SectionHeader getSectionHeader(String sectionName) { for (SectionHeader entry : headers) { if (entry.getName().equals(sectionName)) { return entry; } } throw new IllegalArgumentException( "invalid section name, no section header found"); } }
public class class_name { public SectionHeader getSectionHeader(String sectionName) { for (SectionHeader entry : headers) { if (entry.getName().equals(sectionName)) { return entry; // depends on control dependency: [if], data = [none] } } throw new IllegalArgumentException( "invalid section name, no section header found"); } }
public class class_name { private int getMaxPartCount() { int max = 0; for (Object k : super.fWords.keySet()) { String key = k.toString(); int count = key.split("\\s+?").length; if (count > max) { max = count; } } return max; } }
public class class_name { private int getMaxPartCount() { int max = 0; for (Object k : super.fWords.keySet()) { String key = k.toString(); int count = key.split("\\s+?").length; if (count > max) { max = count; // depends on control dependency: [if], data = [none] } } return max; } }
public class class_name { public void marshall(RecordDetail recordDetail, ProtocolMarshaller protocolMarshaller) { if (recordDetail == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(recordDetail.getRecordId(), RECORDID_BINDING); protocolMarshaller.marshall(recordDetail.getProvisionedProductName(), PROVISIONEDPRODUCTNAME_BINDING); protocolMarshaller.marshall(recordDetail.getStatus(), STATUS_BINDING); protocolMarshaller.marshall(recordDetail.getCreatedTime(), CREATEDTIME_BINDING); protocolMarshaller.marshall(recordDetail.getUpdatedTime(), UPDATEDTIME_BINDING); protocolMarshaller.marshall(recordDetail.getProvisionedProductType(), PROVISIONEDPRODUCTTYPE_BINDING); protocolMarshaller.marshall(recordDetail.getRecordType(), RECORDTYPE_BINDING); protocolMarshaller.marshall(recordDetail.getProvisionedProductId(), PROVISIONEDPRODUCTID_BINDING); protocolMarshaller.marshall(recordDetail.getProductId(), PRODUCTID_BINDING); protocolMarshaller.marshall(recordDetail.getProvisioningArtifactId(), PROVISIONINGARTIFACTID_BINDING); protocolMarshaller.marshall(recordDetail.getPathId(), PATHID_BINDING); protocolMarshaller.marshall(recordDetail.getRecordErrors(), RECORDERRORS_BINDING); protocolMarshaller.marshall(recordDetail.getRecordTags(), RECORDTAGS_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(RecordDetail recordDetail, ProtocolMarshaller protocolMarshaller) { if (recordDetail == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(recordDetail.getRecordId(), RECORDID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(recordDetail.getProvisionedProductName(), PROVISIONEDPRODUCTNAME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(recordDetail.getStatus(), STATUS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(recordDetail.getCreatedTime(), CREATEDTIME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(recordDetail.getUpdatedTime(), UPDATEDTIME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(recordDetail.getProvisionedProductType(), PROVISIONEDPRODUCTTYPE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(recordDetail.getRecordType(), RECORDTYPE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(recordDetail.getProvisionedProductId(), PROVISIONEDPRODUCTID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(recordDetail.getProductId(), PRODUCTID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(recordDetail.getProvisioningArtifactId(), PROVISIONINGARTIFACTID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(recordDetail.getPathId(), PATHID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(recordDetail.getRecordErrors(), RECORDERRORS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(recordDetail.getRecordTags(), RECORDTAGS_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public <T extends Widget & Checkable> List<Integer> getCheckedWidgetIndexes() { List<Integer> checked = new ArrayList<>(); List<Widget> children = getChildren(); final int size = children.size(); for (int i = 0, j = -1; i < size; ++i) { Widget c = children.get(i); if (c instanceof Checkable) { ++j; if (((Checkable) c).isChecked()) { checked.add(j); } } } return checked; } }
public class class_name { public <T extends Widget & Checkable> List<Integer> getCheckedWidgetIndexes() { List<Integer> checked = new ArrayList<>(); List<Widget> children = getChildren(); final int size = children.size(); for (int i = 0, j = -1; i < size; ++i) { Widget c = children.get(i); if (c instanceof Checkable) { ++j; // depends on control dependency: [if], data = [none] if (((Checkable) c).isChecked()) { checked.add(j); // depends on control dependency: [if], data = [none] } } } return checked; } }
public class class_name { public void flush() { if (active) { for (Iterator<Entry<String, Object>> it = attributes.entrySet().iterator(); it.hasNext();) { final Entry<String, Object> entry = (Entry<String, Object>) it.next(); final String key = (String) entry.getKey(); try { originalSession.setAttribute(key, new SerializedObjectHolder(key, entry.getValue())); } catch (final IllegalStateException e) { return; } catch (final Exception e) { logger.info("Failed to set session attribute as HotDeploy: " + key, e); } } } } }
public class class_name { public void flush() { if (active) { for (Iterator<Entry<String, Object>> it = attributes.entrySet().iterator(); it.hasNext();) { final Entry<String, Object> entry = (Entry<String, Object>) it.next(); final String key = (String) entry.getKey(); try { originalSession.setAttribute(key, new SerializedObjectHolder(key, entry.getValue())); // depends on control dependency: [try], data = [none] } catch (final IllegalStateException e) { return; } catch (final Exception e) { // depends on control dependency: [catch], data = [none] logger.info("Failed to set session attribute as HotDeploy: " + key, e); } // depends on control dependency: [catch], data = [none] } } } }
public class class_name { public AccountListNodeAgentSkusNextOptions withOcpDate(DateTime ocpDate) { if (ocpDate == null) { this.ocpDate = null; } else { this.ocpDate = new DateTimeRfc1123(ocpDate); } return this; } }
public class class_name { public AccountListNodeAgentSkusNextOptions withOcpDate(DateTime ocpDate) { if (ocpDate == null) { this.ocpDate = null; // depends on control dependency: [if], data = [none] } else { this.ocpDate = new DateTimeRfc1123(ocpDate); // depends on control dependency: [if], data = [(ocpDate] } return this; } }
public class class_name { public void createIndexingThread(CmsVfsIndexer indexer, I_CmsIndexWriter writer, CmsResource res) { I_CmsReport report = indexer.getReport(); m_startedCounter++; CmsIndexingThread thread = new CmsIndexingThread( indexer.getCms(), res, indexer.getIndex(), m_startedCounter, report); thread.setPriority(Thread.MIN_PRIORITY); thread.start(); try { thread.join(m_timeout); } catch (InterruptedException e) { // ignore } if (thread.isAlive()) { // the thread has not finished - so it must be marked as an abandoned thread m_abandonedCounter++; thread.interrupt(); if (LOG.isWarnEnabled()) { LOG.warn(Messages.get().getBundle().key(Messages.LOG_INDEXING_TIMEOUT_1, res.getRootPath())); } if (report != null) { report.println(); report.print( org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_FAILED_0), I_CmsReport.FORMAT_WARNING); report.println( Messages.get().container(Messages.RPT_SEARCH_INDEXING_TIMEOUT_1, res.getRootPath()), I_CmsReport.FORMAT_WARNING); } } else { // the thread finished normally m_returnedCounter++; } I_CmsSearchDocument doc = thread.getResult(); if (doc != null) { // write the document to the index indexer.updateResource(writer, res.getRootPath(), doc); } else { indexer.deleteResource(writer, new CmsPublishedResource(res)); } if ((m_startedCounter % m_maxModificationsBeforeCommit) == 0) { try { writer.commit(); } catch (IOException e) { if (LOG.isWarnEnabled()) { LOG.warn( Messages.get().getBundle().key( Messages.LOG_IO_INDEX_WRITER_COMMIT_2, indexer.getIndex().getName(), indexer.getIndex().getPath()), e); } } } } }
public class class_name { public void createIndexingThread(CmsVfsIndexer indexer, I_CmsIndexWriter writer, CmsResource res) { I_CmsReport report = indexer.getReport(); m_startedCounter++; CmsIndexingThread thread = new CmsIndexingThread( indexer.getCms(), res, indexer.getIndex(), m_startedCounter, report); thread.setPriority(Thread.MIN_PRIORITY); thread.start(); try { thread.join(m_timeout); // depends on control dependency: [try], data = [none] } catch (InterruptedException e) { // ignore } // depends on control dependency: [catch], data = [none] if (thread.isAlive()) { // the thread has not finished - so it must be marked as an abandoned thread m_abandonedCounter++; // depends on control dependency: [if], data = [none] thread.interrupt(); // depends on control dependency: [if], data = [none] if (LOG.isWarnEnabled()) { LOG.warn(Messages.get().getBundle().key(Messages.LOG_INDEXING_TIMEOUT_1, res.getRootPath())); // depends on control dependency: [if], data = [none] } if (report != null) { report.println(); // depends on control dependency: [if], data = [none] report.print( org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_FAILED_0), I_CmsReport.FORMAT_WARNING); // depends on control dependency: [if], data = [none] report.println( Messages.get().container(Messages.RPT_SEARCH_INDEXING_TIMEOUT_1, res.getRootPath()), I_CmsReport.FORMAT_WARNING); // depends on control dependency: [if], data = [none] } } else { // the thread finished normally m_returnedCounter++; // depends on control dependency: [if], data = [none] } I_CmsSearchDocument doc = thread.getResult(); if (doc != null) { // write the document to the index indexer.updateResource(writer, res.getRootPath(), doc); // depends on control dependency: [if], data = [none] } else { indexer.deleteResource(writer, new CmsPublishedResource(res)); // depends on control dependency: [if], data = [none] } if ((m_startedCounter % m_maxModificationsBeforeCommit) == 0) { try { writer.commit(); // depends on control dependency: [try], data = [none] } catch (IOException e) { if (LOG.isWarnEnabled()) { LOG.warn( Messages.get().getBundle().key( Messages.LOG_IO_INDEX_WRITER_COMMIT_2, indexer.getIndex().getName(), indexer.getIndex().getPath()), e); // depends on control dependency: [if], data = [none] } } // depends on control dependency: [catch], data = [none] } } }
public class class_name { public int[] makeLut() { int numKnots = x.length; float[] nx = new float[numKnots + 2]; float[] ny = new float[numKnots + 2]; System.arraycopy(x, 0, nx, 1, numKnots); System.arraycopy(y, 0, ny, 1, numKnots); nx[0] = nx[1]; ny[0] = ny[1]; nx[numKnots + 1] = nx[numKnots]; ny[numKnots + 1] = ny[numKnots]; int[] table = new int[256]; for (int i = 0; i < 1024; i++) { float f = i / 1024.0f; int x = (int) (255 * Curve.Spline(f, nx.length, nx) + 0.5f); int y = (int) (255 * Curve.Spline(f, nx.length, ny) + 0.5f); x = x > 255 ? 255 : x; x = x < 0 ? 0 : x; y = y > 255 ? 255 : y; y = y < 0 ? 0 : y; table[x] = y; } return table; } }
public class class_name { public int[] makeLut() { int numKnots = x.length; float[] nx = new float[numKnots + 2]; float[] ny = new float[numKnots + 2]; System.arraycopy(x, 0, nx, 1, numKnots); System.arraycopy(y, 0, ny, 1, numKnots); nx[0] = nx[1]; ny[0] = ny[1]; nx[numKnots + 1] = nx[numKnots]; ny[numKnots + 1] = ny[numKnots]; int[] table = new int[256]; for (int i = 0; i < 1024; i++) { float f = i / 1024.0f; int x = (int) (255 * Curve.Spline(f, nx.length, nx) + 0.5f); int y = (int) (255 * Curve.Spline(f, nx.length, ny) + 0.5f); x = x > 255 ? 255 : x; // depends on control dependency: [for], data = [none] x = x < 0 ? 0 : x; // depends on control dependency: [for], data = [none] y = y > 255 ? 255 : y; // depends on control dependency: [for], data = [none] y = y < 0 ? 0 : y; // depends on control dependency: [for], data = [none] table[x] = y; // depends on control dependency: [for], data = [none] } return table; } }
public class class_name { @SuppressWarnings("unchecked") public T dequeue(String name) { for (Element e : elements()) { dequeueCurrentAndRunNext(e, name); } return (T) this; } }
public class class_name { @SuppressWarnings("unchecked") public T dequeue(String name) { for (Element e : elements()) { dequeueCurrentAndRunNext(e, name); // depends on control dependency: [for], data = [e] } return (T) this; } }
public class class_name { void saveLastSavedPreferences() { String templateName = ""; //$NON-NLS-1$ Template template = getSelectedTemplate(); if (template != null) { templateName = template.getName(); } GlassmakerUIPlugin.getDefault().getPreferenceStore().setValue("newFileTemplateName", templateName); GlassmakerUIPlugin.getDefault().savePluginPreferences(); } }
public class class_name { void saveLastSavedPreferences() { String templateName = ""; //$NON-NLS-1$ Template template = getSelectedTemplate(); if (template != null) { templateName = template.getName(); // depends on control dependency: [if], data = [none] } GlassmakerUIPlugin.getDefault().getPreferenceStore().setValue("newFileTemplateName", templateName); GlassmakerUIPlugin.getDefault().savePluginPreferences(); } }
public class class_name { @Override public synchronized boolean stopFollowing(final Follower follower) { if (!this.isFollowedBy(follower)) { return false; } this.stopConsuming(follower); DefaultLogWatch.LOGGER.info("Unregistered {} for {}.", follower, this); return true; } }
public class class_name { @Override public synchronized boolean stopFollowing(final Follower follower) { if (!this.isFollowedBy(follower)) { return false; // depends on control dependency: [if], data = [none] } this.stopConsuming(follower); DefaultLogWatch.LOGGER.info("Unregistered {} for {}.", follower, this); return true; } }
public class class_name { @GetMapping("/sp/metadata") public ResponseEntity<String> getFirstServiceProviderMetadata() { val saml2Client = builtClients.findClient(SAML2Client.class); if (saml2Client != null) { return getSaml2ClientServiceProviderMetadataResponseEntity(saml2Client); } return getNotAcceptableResponseEntity(); } }
public class class_name { @GetMapping("/sp/metadata") public ResponseEntity<String> getFirstServiceProviderMetadata() { val saml2Client = builtClients.findClient(SAML2Client.class); if (saml2Client != null) { return getSaml2ClientServiceProviderMetadataResponseEntity(saml2Client); // depends on control dependency: [if], data = [(saml2Client] } return getNotAcceptableResponseEntity(); } }
public class class_name { public void marshall(DeleteRouteResponseRequest deleteRouteResponseRequest, ProtocolMarshaller protocolMarshaller) { if (deleteRouteResponseRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(deleteRouteResponseRequest.getApiId(), APIID_BINDING); protocolMarshaller.marshall(deleteRouteResponseRequest.getRouteId(), ROUTEID_BINDING); protocolMarshaller.marshall(deleteRouteResponseRequest.getRouteResponseId(), ROUTERESPONSEID_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(DeleteRouteResponseRequest deleteRouteResponseRequest, ProtocolMarshaller protocolMarshaller) { if (deleteRouteResponseRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(deleteRouteResponseRequest.getApiId(), APIID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(deleteRouteResponseRequest.getRouteId(), ROUTEID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(deleteRouteResponseRequest.getRouteResponseId(), ROUTERESPONSEID_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { @Override public Scriptable getExtraMethodSource(Context cx) { if (hasSimpleContent()) { String src = toString(); return ScriptRuntime.toObjectOrNull(cx, src); } return null; } }
public class class_name { @Override public Scriptable getExtraMethodSource(Context cx) { if (hasSimpleContent()) { String src = toString(); return ScriptRuntime.toObjectOrNull(cx, src); // depends on control dependency: [if], data = [none] } return null; } }
public class class_name { static Profile getProfileFromSystemProperties() { Profile result = null; // try to get system property String systemPropertyProfileName = System.getProperty(ProfilePropertyNames.PROFILE_SET_GLOBALLY_VIA_SYSTEM_PROPERTIES); if (systemPropertyProfileName != null) { // try to convert String to enum value try { result = Profile.valueOf(systemPropertyProfileName); } catch (IllegalArgumentException e) { logger.warn("Tracee ContextLoggerBuilder profile property ('" + ProfilePropertyNames.PROFILE_SET_GLOBALLY_VIA_SYSTEM_PROPERTIES + "') is set to the invalid value '" + systemPropertyProfileName + "' ==> Use default profile"); } } return result; } }
public class class_name { static Profile getProfileFromSystemProperties() { Profile result = null; // try to get system property String systemPropertyProfileName = System.getProperty(ProfilePropertyNames.PROFILE_SET_GLOBALLY_VIA_SYSTEM_PROPERTIES); if (systemPropertyProfileName != null) { // try to convert String to enum value try { result = Profile.valueOf(systemPropertyProfileName); // depends on control dependency: [try], data = [none] } catch (IllegalArgumentException e) { logger.warn("Tracee ContextLoggerBuilder profile property ('" + ProfilePropertyNames.PROFILE_SET_GLOBALLY_VIA_SYSTEM_PROPERTIES + "') is set to the invalid value '" + systemPropertyProfileName + "' ==> Use default profile"); } // depends on control dependency: [catch], data = [none] } return result; } }
public class class_name { static ObjectType getInstanceOfCtor(@Nullable JSType t) { if (t == null) { return null; } FunctionType ctor = JSType.toMaybeFunctionType(t.dereference()); if (ctor != null && ctor.isConstructor()) { return ctor.getInstanceType(); } return null; } }
public class class_name { static ObjectType getInstanceOfCtor(@Nullable JSType t) { if (t == null) { return null; // depends on control dependency: [if], data = [none] } FunctionType ctor = JSType.toMaybeFunctionType(t.dereference()); if (ctor != null && ctor.isConstructor()) { return ctor.getInstanceType(); // depends on control dependency: [if], data = [none] } return null; } }
public class class_name { protected static String execute(HttpHost targetHost, HttpHost proxyHost, HttpRequest httpRequestMethod, String encoding, UsernamePasswordCredentials upc, InputStream keystore, char[] password) throws IOException { HttpClientBuilder hcb = HttpClients.custom(); hcb.setDefaultRequestConfig(getRequestConfig()); if (proxyHost != null) { hcb.setProxy(proxyHost); } if (keystore != null) { try { KeyStore trustStore = KeyStore.getInstance(KeyStore .getDefaultType()); trustStore.load(keystore, password); SSLContext sslcontext = SSLContexts.custom() .loadTrustMaterial(trustStore, new TrustSelfSignedStrategy()) .build(); SSLConnectionSocketFactory ssf = new SSLConnectionSocketFactory( sslcontext); hcb.setSSLSocketFactory(ssf); } catch (KeyStoreException e) { log.error("{}", e.getMessage(), e); } catch (CertificateException e) { log.error("{}", e.getMessage(), e); } catch (NoSuchAlgorithmException e) { log.error("{}", e.getMessage(), e); } catch (KeyManagementException e) { log.error("{}", e.getMessage(), e); } finally { keystore.close(); } } if (upc != null) { CredentialsProvider cp = new BasicCredentialsProvider(); AuthScope as = new AuthScope(targetHost); cp.setCredentials(as, upc); hcb.setDefaultCredentialsProvider(cp); } CloseableHttpClient chc = hcb.build(); try { CloseableHttpResponse response = chc.execute(targetHost, httpRequestMethod); return getResponse(response, encoding); } finally { chc.close(); } } }
public class class_name { protected static String execute(HttpHost targetHost, HttpHost proxyHost, HttpRequest httpRequestMethod, String encoding, UsernamePasswordCredentials upc, InputStream keystore, char[] password) throws IOException { HttpClientBuilder hcb = HttpClients.custom(); hcb.setDefaultRequestConfig(getRequestConfig()); if (proxyHost != null) { hcb.setProxy(proxyHost); } if (keystore != null) { try { KeyStore trustStore = KeyStore.getInstance(KeyStore .getDefaultType()); trustStore.load(keystore, password); // depends on control dependency: [try], data = [none] SSLContext sslcontext = SSLContexts.custom() .loadTrustMaterial(trustStore, new TrustSelfSignedStrategy()) .build(); SSLConnectionSocketFactory ssf = new SSLConnectionSocketFactory( sslcontext); hcb.setSSLSocketFactory(ssf); // depends on control dependency: [try], data = [none] } catch (KeyStoreException e) { log.error("{}", e.getMessage(), e); } catch (CertificateException e) { // depends on control dependency: [catch], data = [none] log.error("{}", e.getMessage(), e); } catch (NoSuchAlgorithmException e) { // depends on control dependency: [catch], data = [none] log.error("{}", e.getMessage(), e); } catch (KeyManagementException e) { // depends on control dependency: [catch], data = [none] log.error("{}", e.getMessage(), e); } finally { // depends on control dependency: [catch], data = [none] keystore.close(); } } if (upc != null) { CredentialsProvider cp = new BasicCredentialsProvider(); AuthScope as = new AuthScope(targetHost); cp.setCredentials(as, upc); hcb.setDefaultCredentialsProvider(cp); } CloseableHttpClient chc = hcb.build(); try { CloseableHttpResponse response = chc.execute(targetHost, httpRequestMethod); return getResponse(response, encoding); } finally { chc.close(); } } }
public class class_name { @Override public MockResponse dispatch(RecordedRequest request) { HttpUrl requestUrl = mockWebServer.url(request.getPath()); String code = requestUrl.queryParameter("code"); String stateString = requestUrl.queryParameter("state"); ByteString state = stateString != null ? ByteString.decodeBase64(stateString) : null; Listener listener; synchronized (this) { listener = listeners.get(state); } if (code == null || listener == null) { return new MockResponse() .setResponseCode(404) .setBody("unexpected request"); } try { OAuthSession session = slackApi.exchangeCode(code, redirectUrl()); listener.sessionGranted(session); } catch (IOException e) { return new MockResponse() .setResponseCode(400) .setBody("code exchange failed: " + e.getMessage()); } synchronized (this) { listeners.remove(state); } // Success! return new MockResponse() .setResponseCode(302) .addHeader("Location", "https://twitter.com/CuteEmergency/status/789457462864863232"); } }
public class class_name { @Override public MockResponse dispatch(RecordedRequest request) { HttpUrl requestUrl = mockWebServer.url(request.getPath()); String code = requestUrl.queryParameter("code"); String stateString = requestUrl.queryParameter("state"); ByteString state = stateString != null ? ByteString.decodeBase64(stateString) : null; Listener listener; synchronized (this) { listener = listeners.get(state); } if (code == null || listener == null) { return new MockResponse() .setResponseCode(404) .setBody("unexpected request"); // depends on control dependency: [if], data = [none] } try { OAuthSession session = slackApi.exchangeCode(code, redirectUrl()); listener.sessionGranted(session); // depends on control dependency: [try], data = [none] } catch (IOException e) { return new MockResponse() .setResponseCode(400) .setBody("code exchange failed: " + e.getMessage()); } // depends on control dependency: [catch], data = [none] synchronized (this) { listeners.remove(state); } // Success! return new MockResponse() .setResponseCode(302) .addHeader("Location", "https://twitter.com/CuteEmergency/status/789457462864863232"); } }
public class class_name { public List<FieldResult<EntityResult<T>>> getAllFieldResult() { List<FieldResult<EntityResult<T>>> list = new ArrayList<FieldResult<EntityResult<T>>>(); List<Node> nodeList = childNode.get("field-result"); for(Node node: nodeList) { FieldResult<EntityResult<T>> type = new FieldResultImpl<EntityResult<T>>(this, "field-result", childNode, node); list.add(type); } return list; } }
public class class_name { public List<FieldResult<EntityResult<T>>> getAllFieldResult() { List<FieldResult<EntityResult<T>>> list = new ArrayList<FieldResult<EntityResult<T>>>(); List<Node> nodeList = childNode.get("field-result"); for(Node node: nodeList) { FieldResult<EntityResult<T>> type = new FieldResultImpl<EntityResult<T>>(this, "field-result", childNode, node); list.add(type); // depends on control dependency: [for], data = [none] } return list; } }
public class class_name { public static void saveService(final RegisteredService service, final ServicesManager servicesManager) { servicesManager.load(); if (servicesManager.findServiceBy(registeredService -> registeredService instanceof SamlRegisteredService && registeredService.getServiceId().equals(service.getServiceId())).isEmpty()) { LOGGER.info("Service [{}] does not exist in the registry and will be added.", service.getServiceId()); servicesManager.save(service); servicesManager.load(); } else { LOGGER.info("Service [{}] exists in the registry and will not be added again.", service.getServiceId()); } } }
public class class_name { public static void saveService(final RegisteredService service, final ServicesManager servicesManager) { servicesManager.load(); if (servicesManager.findServiceBy(registeredService -> registeredService instanceof SamlRegisteredService && registeredService.getServiceId().equals(service.getServiceId())).isEmpty()) { LOGGER.info("Service [{}] does not exist in the registry and will be added.", service.getServiceId()); // depends on control dependency: [if], data = [none] servicesManager.save(service); // depends on control dependency: [if], data = [none] servicesManager.load(); // depends on control dependency: [if], data = [none] } else { LOGGER.info("Service [{}] exists in the registry and will not be added again.", service.getServiceId()); // depends on control dependency: [if], data = [none] } } }
public class class_name { protected Format getFormat(Map<String,String> metaInfo) { Format format = Format.json; metaInfo.put(Listener.METAINFO_CONTENT_TYPE, Listener.CONTENT_TYPE_JSON); String formatParam = (String) metaInfo.get("format"); if (formatParam != null) { if (formatParam.equals("xml")) { format = Format.xml; metaInfo.put(Listener.METAINFO_CONTENT_TYPE, Listener.CONTENT_TYPE_XML); } else if (formatParam.equals("text")) { format = Format.text; metaInfo.put(Listener.METAINFO_CONTENT_TYPE, Listener.CONTENT_TYPE_TEXT); } } else { if (Listener.CONTENT_TYPE_XML.equals(metaInfo.get(Listener.METAINFO_CONTENT_TYPE)) || Listener.CONTENT_TYPE_XML.equals(metaInfo.get(Listener.METAINFO_CONTENT_TYPE.toLowerCase()))) { format = Format.xml; metaInfo.put(Listener.METAINFO_CONTENT_TYPE, Listener.CONTENT_TYPE_XML); } else if (Listener.CONTENT_TYPE_TEXT.equals(metaInfo.get(Listener.METAINFO_CONTENT_TYPE)) || Listener.CONTENT_TYPE_TEXT.equals(metaInfo.get(Listener.METAINFO_CONTENT_TYPE.toLowerCase()))) { format = Format.text; metaInfo.put(Listener.METAINFO_CONTENT_TYPE, Listener.CONTENT_TYPE_JSON); } } return format; } }
public class class_name { protected Format getFormat(Map<String,String> metaInfo) { Format format = Format.json; metaInfo.put(Listener.METAINFO_CONTENT_TYPE, Listener.CONTENT_TYPE_JSON); String formatParam = (String) metaInfo.get("format"); if (formatParam != null) { if (formatParam.equals("xml")) { format = Format.xml; // depends on control dependency: [if], data = [none] metaInfo.put(Listener.METAINFO_CONTENT_TYPE, Listener.CONTENT_TYPE_XML); // depends on control dependency: [if], data = [none] } else if (formatParam.equals("text")) { format = Format.text; // depends on control dependency: [if], data = [none] metaInfo.put(Listener.METAINFO_CONTENT_TYPE, Listener.CONTENT_TYPE_TEXT); // depends on control dependency: [if], data = [none] } } else { if (Listener.CONTENT_TYPE_XML.equals(metaInfo.get(Listener.METAINFO_CONTENT_TYPE)) || Listener.CONTENT_TYPE_XML.equals(metaInfo.get(Listener.METAINFO_CONTENT_TYPE.toLowerCase()))) { format = Format.xml; // depends on control dependency: [if], data = [none] metaInfo.put(Listener.METAINFO_CONTENT_TYPE, Listener.CONTENT_TYPE_XML); // depends on control dependency: [if], data = [none] } else if (Listener.CONTENT_TYPE_TEXT.equals(metaInfo.get(Listener.METAINFO_CONTENT_TYPE)) || Listener.CONTENT_TYPE_TEXT.equals(metaInfo.get(Listener.METAINFO_CONTENT_TYPE.toLowerCase()))) { format = Format.text; // depends on control dependency: [if], data = [none] metaInfo.put(Listener.METAINFO_CONTENT_TYPE, Listener.CONTENT_TYPE_JSON); // depends on control dependency: [if], data = [none] } } return format; } }
public class class_name { public Message setBuffer(byte[] b) { buf=b; if(buf != null) { offset=0; length=buf.length; } else offset=length=0; return this; } }
public class class_name { public Message setBuffer(byte[] b) { buf=b; if(buf != null) { offset=0; // depends on control dependency: [if], data = [none] length=buf.length; // depends on control dependency: [if], data = [none] } else offset=length=0; return this; } }
public class class_name { public void marshall(StopQueryExecutionRequest stopQueryExecutionRequest, ProtocolMarshaller protocolMarshaller) { if (stopQueryExecutionRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(stopQueryExecutionRequest.getQueryExecutionId(), QUERYEXECUTIONID_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(StopQueryExecutionRequest stopQueryExecutionRequest, ProtocolMarshaller protocolMarshaller) { if (stopQueryExecutionRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(stopQueryExecutionRequest.getQueryExecutionId(), QUERYEXECUTIONID_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { static boolean isClassificationLinkedToFileModel(GraphRewrite event, ClassificationModel classificationModel, FileModel fileModel) { String key = getClassificationFileModelCacheKey(classificationModel, fileModel); Boolean linked = getCache(event).get(key); if (linked == null) { GraphTraversal<Vertex, Vertex> existenceCheck = new GraphTraversalSource(event.getGraphContext().getGraph()).V(classificationModel.getElement()); existenceCheck.out(ClassificationModel.FILE_MODEL); existenceCheck.filter(vertexTraverser -> vertexTraverser.get().equals(fileModel.getElement())); linked = existenceCheck.hasNext(); cacheClassificationFileModel(event, classificationModel, fileModel, linked); } return linked; } }
public class class_name { static boolean isClassificationLinkedToFileModel(GraphRewrite event, ClassificationModel classificationModel, FileModel fileModel) { String key = getClassificationFileModelCacheKey(classificationModel, fileModel); Boolean linked = getCache(event).get(key); if (linked == null) { GraphTraversal<Vertex, Vertex> existenceCheck = new GraphTraversalSource(event.getGraphContext().getGraph()).V(classificationModel.getElement()); existenceCheck.out(ClassificationModel.FILE_MODEL); // depends on control dependency: [if], data = [none] existenceCheck.filter(vertexTraverser -> vertexTraverser.get().equals(fileModel.getElement())); // depends on control dependency: [if], data = [none] linked = existenceCheck.hasNext(); // depends on control dependency: [if], data = [none] cacheClassificationFileModel(event, classificationModel, fileModel, linked); // depends on control dependency: [if], data = [none] } return linked; } }
public class class_name { public GeometryIndex getParent(GeometryIndex index) { GeometryIndex parent = new GeometryIndex(index); GeometryIndex deepestParent = null; GeometryIndex p = parent; while (p.hasChild()) { deepestParent = p; p = p.getChild(); } if (deepestParent != null) { deepestParent.setChild(null); } return parent; } }
public class class_name { public GeometryIndex getParent(GeometryIndex index) { GeometryIndex parent = new GeometryIndex(index); GeometryIndex deepestParent = null; GeometryIndex p = parent; while (p.hasChild()) { deepestParent = p; // depends on control dependency: [while], data = [none] p = p.getChild(); // depends on control dependency: [while], data = [none] } if (deepestParent != null) { deepestParent.setChild(null); // depends on control dependency: [if], data = [null)] } return parent; } }
public class class_name { public boolean indexAppliesTo( Constraint constraint ) { if (constraint instanceof Comparison) { return indexAppliesTo((Comparison)constraint); } if (constraint instanceof And) { return indexAppliesTo((And)constraint); } if (constraint instanceof Or) { return indexAppliesTo((Or)constraint); } if (constraint instanceof Not) { return indexAppliesTo((Not)constraint); } if (constraint instanceof Between) { return indexAppliesTo((Between)constraint); } if (constraint instanceof SetCriteria) { return indexAppliesTo((SetCriteria)constraint); } if (constraint instanceof Relike) { return indexAppliesTo((Relike)constraint); } if (constraint instanceof PropertyExistence) { return indexAppliesTo((PropertyExistence)constraint); } if (constraint instanceof FullTextSearch) { return applies((FullTextSearch)constraint); } return false; } }
public class class_name { public boolean indexAppliesTo( Constraint constraint ) { if (constraint instanceof Comparison) { return indexAppliesTo((Comparison)constraint); // depends on control dependency: [if], data = [none] } if (constraint instanceof And) { return indexAppliesTo((And)constraint); // depends on control dependency: [if], data = [none] } if (constraint instanceof Or) { return indexAppliesTo((Or)constraint); // depends on control dependency: [if], data = [none] } if (constraint instanceof Not) { return indexAppliesTo((Not)constraint); // depends on control dependency: [if], data = [none] } if (constraint instanceof Between) { return indexAppliesTo((Between)constraint); // depends on control dependency: [if], data = [none] } if (constraint instanceof SetCriteria) { return indexAppliesTo((SetCriteria)constraint); // depends on control dependency: [if], data = [none] } if (constraint instanceof Relike) { return indexAppliesTo((Relike)constraint); // depends on control dependency: [if], data = [none] } if (constraint instanceof PropertyExistence) { return indexAppliesTo((PropertyExistence)constraint); // depends on control dependency: [if], data = [none] } if (constraint instanceof FullTextSearch) { return applies((FullTextSearch)constraint); // depends on control dependency: [if], data = [none] } return false; } }
public class class_name { public List<Attribute> asList() { ArrayList<Attribute> list = new ArrayList<>(size); for (int i = 0; i < size; i++) { Attribute attr = vals[i] == null ? new BooleanAttribute(keys[i]) : // deprecated class, but maybe someone still wants it new Attribute(keys[i], vals[i], Attributes.this); list.add(attr); } return Collections.unmodifiableList(list); } }
public class class_name { public List<Attribute> asList() { ArrayList<Attribute> list = new ArrayList<>(size); for (int i = 0; i < size; i++) { Attribute attr = vals[i] == null ? new BooleanAttribute(keys[i]) : // deprecated class, but maybe someone still wants it new Attribute(keys[i], vals[i], Attributes.this); list.add(attr); // depends on control dependency: [for], data = [none] } return Collections.unmodifiableList(list); } }
public class class_name { public ServerHandle detect(MBeanServerExecutor pMBeanServerExecutor) { String serverVersion = getSingleStringAttribute(pMBeanServerExecutor, "*:j2eeType=J2EEServer,type=Server,*", "serverVersion"); if (serverVersion != null && serverVersion.contains("WebSphere")) { Matcher matcher = SERVER_VERSION_PATTERN.matcher(serverVersion); if (matcher.find()) { String version = matcher.group(1); String date = matcher.group(2); JSONObject extraInfo = new JSONObject(); if (date != null) { extraInfo.put("buildDate",date); } return new WebsphereServerHandle(version, extraInfo.size() > 0 ? extraInfo : null); } return null; } else if (isWebsphere) { return new WebsphereServerHandle(isWebsphere6 ? "6" : "7 or 8", null); } return null; } }
public class class_name { public ServerHandle detect(MBeanServerExecutor pMBeanServerExecutor) { String serverVersion = getSingleStringAttribute(pMBeanServerExecutor, "*:j2eeType=J2EEServer,type=Server,*", "serverVersion"); if (serverVersion != null && serverVersion.contains("WebSphere")) { Matcher matcher = SERVER_VERSION_PATTERN.matcher(serverVersion); if (matcher.find()) { String version = matcher.group(1); String date = matcher.group(2); JSONObject extraInfo = new JSONObject(); if (date != null) { extraInfo.put("buildDate",date); // depends on control dependency: [if], data = [none] } return new WebsphereServerHandle(version, extraInfo.size() > 0 ? extraInfo : null); // depends on control dependency: [if], data = [none] } return null; // depends on control dependency: [if], data = [none] } else if (isWebsphere) { return new WebsphereServerHandle(isWebsphere6 ? "6" : "7 or 8", null); // depends on control dependency: [if], data = [none] } return null; } }
public class class_name { private void appendFill(int length, int fillType) { assert length > 0; assert lastWordIndex >= -1; fillType &= ConciseSetUtils.SEQUENCE_BIT; // it is actually a literal... if (length == 1) { appendLiteral(fillType == 0 ? ConciseSetUtils.ALL_ZEROS_LITERAL : ConciseSetUtils.ALL_ONES_LITERAL); return; } // empty set if (lastWordIndex < 0) { words[lastWordIndex = 0] = fillType | (length - 1); return; } final int lastWord = words[lastWordIndex]; if (isLiteral(lastWord)) { if (fillType == 0 && lastWord == ConciseSetUtils.ALL_ZEROS_LITERAL) { words[lastWordIndex] = length; } else if (fillType == ConciseSetUtils.SEQUENCE_BIT && lastWord == ConciseSetUtils.ALL_ONES_LITERAL) { words[lastWordIndex] = ConciseSetUtils.SEQUENCE_BIT | length; } else if (!simulateWAH) { if (fillType == 0 && containsOnlyOneBit(getLiteralBits(lastWord))) { words[lastWordIndex] = length | ((1 + Integer.numberOfTrailingZeros(lastWord)) << 25); } else if (fillType == ConciseSetUtils.SEQUENCE_BIT && containsOnlyOneBit(~lastWord)) { words[lastWordIndex] = ConciseSetUtils.SEQUENCE_BIT | length | ((1 + Integer.numberOfTrailingZeros(~lastWord)) << 25); } else { words[++lastWordIndex] = fillType | (length - 1); } } else { words[++lastWordIndex] = fillType | (length - 1); } } else { if ((lastWord & 0xC0000000) == fillType) { words[lastWordIndex] += length; } else { words[++lastWordIndex] = fillType | (length - 1); } } } }
public class class_name { private void appendFill(int length, int fillType) { assert length > 0; assert lastWordIndex >= -1; fillType &= ConciseSetUtils.SEQUENCE_BIT; // it is actually a literal... if (length == 1) { appendLiteral(fillType == 0 ? ConciseSetUtils.ALL_ZEROS_LITERAL : ConciseSetUtils.ALL_ONES_LITERAL); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } // empty set if (lastWordIndex < 0) { words[lastWordIndex = 0] = fillType | (length - 1); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } final int lastWord = words[lastWordIndex]; if (isLiteral(lastWord)) { if (fillType == 0 && lastWord == ConciseSetUtils.ALL_ZEROS_LITERAL) { words[lastWordIndex] = length; // depends on control dependency: [if], data = [none] } else if (fillType == ConciseSetUtils.SEQUENCE_BIT && lastWord == ConciseSetUtils.ALL_ONES_LITERAL) { words[lastWordIndex] = ConciseSetUtils.SEQUENCE_BIT | length; // depends on control dependency: [if], data = [none] } else if (!simulateWAH) { if (fillType == 0 && containsOnlyOneBit(getLiteralBits(lastWord))) { words[lastWordIndex] = length | ((1 + Integer.numberOfTrailingZeros(lastWord)) << 25); // depends on control dependency: [if], data = [none] } else if (fillType == ConciseSetUtils.SEQUENCE_BIT && containsOnlyOneBit(~lastWord)) { words[lastWordIndex] = ConciseSetUtils.SEQUENCE_BIT | length | ((1 + Integer.numberOfTrailingZeros(~lastWord)) << 25); // depends on control dependency: [if], data = [none] } else { words[++lastWordIndex] = fillType | (length - 1); // depends on control dependency: [if], data = [none] } } else { words[++lastWordIndex] = fillType | (length - 1); // depends on control dependency: [if], data = [none] } } else { if ((lastWord & 0xC0000000) == fillType) { words[lastWordIndex] += length; // depends on control dependency: [if], data = [none] } else { words[++lastWordIndex] = fillType | (length - 1); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public void updateUI() { if (!Util.empty(panelContent.getText())) { panelContentRO.setData(panelContent.getData()); } else { panelContentRO.setText(SAMPLE_CONTENT); } panel.setType((WPanel.Type) panelType.getSelected()); String headingText = tfHeading.getText(); if (!Util.empty(tfHeading.getText())) { heading.setText(tfHeading.getText()); panel.setTitleText(headingText); } else { heading.setText(SAMPLE_HEADER); panel.setTitleText(SAMPLE_TITLE_TEXT); } } }
public class class_name { public void updateUI() { if (!Util.empty(panelContent.getText())) { panelContentRO.setData(panelContent.getData()); // depends on control dependency: [if], data = [none] } else { panelContentRO.setText(SAMPLE_CONTENT); // depends on control dependency: [if], data = [none] } panel.setType((WPanel.Type) panelType.getSelected()); String headingText = tfHeading.getText(); if (!Util.empty(tfHeading.getText())) { heading.setText(tfHeading.getText()); // depends on control dependency: [if], data = [none] panel.setTitleText(headingText); // depends on control dependency: [if], data = [none] } else { heading.setText(SAMPLE_HEADER); // depends on control dependency: [if], data = [none] panel.setTitleText(SAMPLE_TITLE_TEXT); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void setPlatforms(java.util.Collection<EnvironmentPlatform> platforms) { if (platforms == null) { this.platforms = null; return; } this.platforms = new java.util.ArrayList<EnvironmentPlatform>(platforms); } }
public class class_name { public void setPlatforms(java.util.Collection<EnvironmentPlatform> platforms) { if (platforms == null) { this.platforms = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.platforms = new java.util.ArrayList<EnvironmentPlatform>(platforms); } }
public class class_name { private static void setStorageEngine(Dataframe dataset) { //create a single storage engine for all the MapRealMatrixes if (storageEngine == null) { synchronized(DataframeMatrix.class) { if (storageEngine == null) { String storageName = "mdf" + RandomGenerator.getThreadLocalRandomUnseeded().nextLong(); storageEngine = dataset.configuration.getStorageConfiguration().createStorageEngine(storageName); } } } } }
public class class_name { private static void setStorageEngine(Dataframe dataset) { //create a single storage engine for all the MapRealMatrixes if (storageEngine == null) { synchronized(DataframeMatrix.class) { // depends on control dependency: [if], data = [none] if (storageEngine == null) { String storageName = "mdf" + RandomGenerator.getThreadLocalRandomUnseeded().nextLong(); storageEngine = dataset.configuration.getStorageConfiguration().createStorageEngine(storageName); // depends on control dependency: [if], data = [none] } } } } }
public class class_name { public Observable<ServiceResponse<BackupSecretResult>> backupSecretWithServiceResponseAsync(String vaultBaseUrl, String secretName) { if (vaultBaseUrl == null) { throw new IllegalArgumentException("Parameter vaultBaseUrl is required and cannot be null."); } if (secretName == null) { throw new IllegalArgumentException("Parameter secretName is required and cannot be null."); } if (this.apiVersion() == null) { throw new IllegalArgumentException("Parameter this.apiVersion() is required and cannot be null."); } String parameterizedHost = Joiner.on(", ").join("{vaultBaseUrl}", vaultBaseUrl); return service.backupSecret(secretName, this.apiVersion(), this.acceptLanguage(), parameterizedHost, this.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<BackupSecretResult>>>() { @Override public Observable<ServiceResponse<BackupSecretResult>> call(Response<ResponseBody> response) { try { ServiceResponse<BackupSecretResult> clientResponse = backupSecretDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } }
public class class_name { public Observable<ServiceResponse<BackupSecretResult>> backupSecretWithServiceResponseAsync(String vaultBaseUrl, String secretName) { if (vaultBaseUrl == null) { throw new IllegalArgumentException("Parameter vaultBaseUrl is required and cannot be null."); } if (secretName == null) { throw new IllegalArgumentException("Parameter secretName is required and cannot be null."); } if (this.apiVersion() == null) { throw new IllegalArgumentException("Parameter this.apiVersion() is required and cannot be null."); } String parameterizedHost = Joiner.on(", ").join("{vaultBaseUrl}", vaultBaseUrl); return service.backupSecret(secretName, this.apiVersion(), this.acceptLanguage(), parameterizedHost, this.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<BackupSecretResult>>>() { @Override public Observable<ServiceResponse<BackupSecretResult>> call(Response<ResponseBody> response) { try { ServiceResponse<BackupSecretResult> clientResponse = backupSecretDelegate(response); return Observable.just(clientResponse); // depends on control dependency: [try], data = [none] } catch (Throwable t) { return Observable.error(t); } // depends on control dependency: [catch], data = [none] } }); } }
public class class_name { public void marshall(S3MachineLearningModelResourceData s3MachineLearningModelResourceData, ProtocolMarshaller protocolMarshaller) { if (s3MachineLearningModelResourceData == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(s3MachineLearningModelResourceData.getDestinationPath(), DESTINATIONPATH_BINDING); protocolMarshaller.marshall(s3MachineLearningModelResourceData.getS3Uri(), S3URI_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(S3MachineLearningModelResourceData s3MachineLearningModelResourceData, ProtocolMarshaller protocolMarshaller) { if (s3MachineLearningModelResourceData == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(s3MachineLearningModelResourceData.getDestinationPath(), DESTINATIONPATH_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(s3MachineLearningModelResourceData.getS3Uri(), S3URI_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private void checkForBlips() { blips.clear(); for (Poi poi : pois.values()) { if (poi.distanceTo(MY_LOCATION) < this.range) { if (!blips.keySet().contains(poi.getName())) { blips.put(poi.getName(), poi); } } } } }
public class class_name { private void checkForBlips() { blips.clear(); for (Poi poi : pois.values()) { if (poi.distanceTo(MY_LOCATION) < this.range) { if (!blips.keySet().contains(poi.getName())) { blips.put(poi.getName(), poi); // depends on control dependency: [if], data = [none] } } } } }
public class class_name { protected boolean attemptConnectWork(ConnectInfo ci) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, "attemptConnectWork"); } boolean returnConnectDone = true; switch (ci.action) { case (ConnectInfo.FINISH_CONNECTION): { if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Finish_connection case for, local: " + ci.localAddress + " remote: " + ci.remoteAddress); } if (ci.channel.isConnectionPending()) { try { boolean connectDone = ci.channel.finishConnect(); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Finishconnect returned " + connectDone + " for, local: " + ci.ioSocket.getSocket().getLocalSocketAddress() + " remote: " + ci.ioSocket.getSocket().getRemoteSocketAddress()); } if (!connectDone) { // Not connected yet, so just put it back in the selector. // This can happen if the network connection goes down // while connect is in selector if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "FinishConnect returned false, retrying"); } queueConnectForSelector(ci); returnConnectDone = false; break; } if (!ci.channel.isConnected()) { if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "FinishConnect returned true, but not connected"); } // Add local and remote address information InetSocketAddress iaRemote = ci.remoteAddress; InetSocketAddress iaLocal = ci.localAddress; IOException e = new IOException("Connection could not be established. local=" + iaLocal + " remote=" + iaRemote); ci.setError(e); ci.tcpConnLink.connectFailed(e); break; } } catch (IOException ioe) { if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "SocketChannel connect failed, local: " + ci.ioSocket.getSocket().getLocalSocketAddress() + " remote: " + ci.ioSocket.getSocket().getRemoteSocketAddress()); } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "SocketChannel.finishConnect Exception Caught: " + ioe); } ci.setError(ioe); ci.tcpConnLink.connectFailed(ioe); break; } } else { if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Connection got selected, but isConnectionPending returned false"); } returnConnectDone = false; queueConnectForSelector(ci); break; } if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "SocketChannel connected, local: " + ci.ioSocket.getSocket().getLocalSocketAddress() + " remote: " + ci.ioSocket.getSocket().getRemoteSocketAddress()); } ci.setFinishComplete(); try { ci.tcpConnLink.connectComplete(ci.ioSocket); } catch (IOException ioe) { if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "SocketChannel connect failed, local: " + ci.ioSocket.getSocket().getLocalSocketAddress() + " remote: " + ci.ioSocket.getSocket().getRemoteSocketAddress()); } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "SocketChannel.finishConnect Exception Caught: " + ioe); } ci.setError(ioe); ci.tcpConnLink.connectFailed(ioe); } break; } case (ConnectInfo.CALL_ERROR): { ci.tcpConnLink.connectFailed(ci.errorException); break; } default: { if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Should never get here - default."); } break; } } // end-switch if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "attemptConnectWork returning " + returnConnectDone); } return returnConnectDone; } }
public class class_name { protected boolean attemptConnectWork(ConnectInfo ci) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, "attemptConnectWork"); // depends on control dependency: [if], data = [none] } boolean returnConnectDone = true; switch (ci.action) { case (ConnectInfo.FINISH_CONNECTION): { if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Finish_connection case for, local: " + ci.localAddress + " remote: " + ci.remoteAddress); // depends on control dependency: [if], data = [none] } if (ci.channel.isConnectionPending()) { try { boolean connectDone = ci.channel.finishConnect(); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Finishconnect returned " + connectDone + " for, local: " + ci.ioSocket.getSocket().getLocalSocketAddress() + " remote: " + ci.ioSocket.getSocket().getRemoteSocketAddress()); // depends on control dependency: [if], data = [none] } if (!connectDone) { // Not connected yet, so just put it back in the selector. // This can happen if the network connection goes down // while connect is in selector if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "FinishConnect returned false, retrying"); // depends on control dependency: [if], data = [none] } queueConnectForSelector(ci); // depends on control dependency: [if], data = [none] returnConnectDone = false; // depends on control dependency: [if], data = [none] break; } if (!ci.channel.isConnected()) { if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "FinishConnect returned true, but not connected"); // depends on control dependency: [if], data = [none] } // Add local and remote address information InetSocketAddress iaRemote = ci.remoteAddress; InetSocketAddress iaLocal = ci.localAddress; IOException e = new IOException("Connection could not be established. local=" + iaLocal + " remote=" + iaRemote); ci.setError(e); // depends on control dependency: [if], data = [none] ci.tcpConnLink.connectFailed(e); // depends on control dependency: [if], data = [none] break; } } catch (IOException ioe) { if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "SocketChannel connect failed, local: " + ci.ioSocket.getSocket().getLocalSocketAddress() + " remote: " + ci.ioSocket.getSocket().getRemoteSocketAddress()); // depends on control dependency: [if], data = [none] } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "SocketChannel.finishConnect Exception Caught: " + ioe); // depends on control dependency: [if], data = [none] } ci.setError(ioe); ci.tcpConnLink.connectFailed(ioe); break; } // depends on control dependency: [catch], data = [none] } else { if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Connection got selected, but isConnectionPending returned false"); // depends on control dependency: [if], data = [none] } returnConnectDone = false; // depends on control dependency: [if], data = [none] queueConnectForSelector(ci); // depends on control dependency: [if], data = [none] break; } if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "SocketChannel connected, local: " + ci.ioSocket.getSocket().getLocalSocketAddress() + " remote: " + ci.ioSocket.getSocket().getRemoteSocketAddress()); // depends on control dependency: [if], data = [none] } ci.setFinishComplete(); try { ci.tcpConnLink.connectComplete(ci.ioSocket); // depends on control dependency: [try], data = [none] } catch (IOException ioe) { if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "SocketChannel connect failed, local: " + ci.ioSocket.getSocket().getLocalSocketAddress() + " remote: " + ci.ioSocket.getSocket().getRemoteSocketAddress()); // depends on control dependency: [if], data = [none] } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "SocketChannel.finishConnect Exception Caught: " + ioe); // depends on control dependency: [if], data = [none] } ci.setError(ioe); ci.tcpConnLink.connectFailed(ioe); } // depends on control dependency: [catch], data = [none] break; } case (ConnectInfo.CALL_ERROR): { ci.tcpConnLink.connectFailed(ci.errorException); break; } default: { if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Should never get here - default."); // depends on control dependency: [if], data = [none] } break; } } // end-switch if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "attemptConnectWork returning " + returnConnectDone); // depends on control dependency: [if], data = [none] } return returnConnectDone; } }
public class class_name { public static void loadProperties(String filename) { InputStream in = null; ClassLoader threadContextClassLoader = Thread.currentThread().getContextClassLoader(); properties = new Properties(); if (threadContextClassLoader != null) { in = threadContextClassLoader.getResourceAsStream(filename); } if (in == null) { in = ConfigHelper.class.getResourceAsStream(filename); if (in == null) { log.warn("No properties file found in the classpath by filename " + filename); } } else { try { properties.load(in); log.info("Properties read " + properties); } catch (Exception e) { log.error("Error reading from " + filename, e); } finally { try { in.close(); } catch (IOException e) { log.warn("IOException while closing InputStream: " + e.getMessage()); } } } } }
public class class_name { public static void loadProperties(String filename) { InputStream in = null; ClassLoader threadContextClassLoader = Thread.currentThread().getContextClassLoader(); properties = new Properties(); if (threadContextClassLoader != null) { in = threadContextClassLoader.getResourceAsStream(filename); // depends on control dependency: [if], data = [none] } if (in == null) { in = ConfigHelper.class.getResourceAsStream(filename); // depends on control dependency: [if], data = [none] if (in == null) { log.warn("No properties file found in the classpath by filename " + filename); // depends on control dependency: [if], data = [none] } } else { try { properties.load(in); // depends on control dependency: [try], data = [none] log.info("Properties read " + properties); // depends on control dependency: [try], data = [none] } catch (Exception e) { log.error("Error reading from " + filename, e); } finally { // depends on control dependency: [catch], data = [none] try { in.close(); // depends on control dependency: [try], data = [none] } catch (IOException e) { log.warn("IOException while closing InputStream: " + e.getMessage()); } // depends on control dependency: [catch], data = [none] } } } }
public class class_name { public static ShapeMarshaller createInputShapeMarshaller(ServiceMetadata service, Operation operation) { if (operation == null) throw new IllegalArgumentException( "The operation parameter must be specified!"); ShapeMarshaller marshaller = new ShapeMarshaller() .withAction(operation.getName()) .withVerb(operation.getHttp().getMethod()) .withRequestUri(operation.getHttp().getRequestUri()); Input input = operation.getInput(); if (input != null) { marshaller.setLocationName(input.getLocationName()); // Pass the xmlNamespace trait from the input reference XmlNamespace xmlNamespace = input.getXmlNamespace(); if (xmlNamespace != null) { marshaller.setXmlNameSpaceUri(xmlNamespace.getUri()); } } if (!StringUtils.isNullOrEmpty(service.getTargetPrefix()) && Metadata.isNotRestProtocol(service.getProtocol())) { marshaller.setTarget(service.getTargetPrefix() + "." + operation.getName()); } return marshaller; } }
public class class_name { public static ShapeMarshaller createInputShapeMarshaller(ServiceMetadata service, Operation operation) { if (operation == null) throw new IllegalArgumentException( "The operation parameter must be specified!"); ShapeMarshaller marshaller = new ShapeMarshaller() .withAction(operation.getName()) .withVerb(operation.getHttp().getMethod()) .withRequestUri(operation.getHttp().getRequestUri()); Input input = operation.getInput(); if (input != null) { marshaller.setLocationName(input.getLocationName()); // depends on control dependency: [if], data = [(input] // Pass the xmlNamespace trait from the input reference XmlNamespace xmlNamespace = input.getXmlNamespace(); if (xmlNamespace != null) { marshaller.setXmlNameSpaceUri(xmlNamespace.getUri()); // depends on control dependency: [if], data = [(xmlNamespace] } } if (!StringUtils.isNullOrEmpty(service.getTargetPrefix()) && Metadata.isNotRestProtocol(service.getProtocol())) { marshaller.setTarget(service.getTargetPrefix() + "." + operation.getName()); // depends on control dependency: [if], data = [none] } return marshaller; } }
public class class_name { public static URL getResourceBundleURL(String resourcePath, ServletContext servletContext) { URL resourceUrl = null; try { resourceUrl = ClassLoaderResourceUtils.getResourceURL(resourcePath, LocaleUtils.class); } catch (Exception e) { // Nothing to do } if (resourceUrl == null && servletContext != null && resourcePath.startsWith("grails-app/")) { try { resourceUrl = servletContext.getResource("/WEB-INF/" + resourcePath); } catch (MalformedURLException e) { // Nothing to do } } return resourceUrl; } }
public class class_name { public static URL getResourceBundleURL(String resourcePath, ServletContext servletContext) { URL resourceUrl = null; try { resourceUrl = ClassLoaderResourceUtils.getResourceURL(resourcePath, LocaleUtils.class); // depends on control dependency: [try], data = [none] } catch (Exception e) { // Nothing to do } // depends on control dependency: [catch], data = [none] if (resourceUrl == null && servletContext != null && resourcePath.startsWith("grails-app/")) { try { resourceUrl = servletContext.getResource("/WEB-INF/" + resourcePath); // depends on control dependency: [try], data = [none] } catch (MalformedURLException e) { // Nothing to do } // depends on control dependency: [catch], data = [none] } return resourceUrl; } }
public class class_name { @VisibleForTesting synchronized boolean isMaxSizeSoftCapExceeded() { final boolean isMaxSizeSoftCapExceeded = (mUsed.mNumBytes + mFree.mNumBytes) > mPoolParams.maxSizeSoftCap; if (isMaxSizeSoftCapExceeded) { mPoolStatsTracker.onSoftCapReached(); } return isMaxSizeSoftCapExceeded; } }
public class class_name { @VisibleForTesting synchronized boolean isMaxSizeSoftCapExceeded() { final boolean isMaxSizeSoftCapExceeded = (mUsed.mNumBytes + mFree.mNumBytes) > mPoolParams.maxSizeSoftCap; if (isMaxSizeSoftCapExceeded) { mPoolStatsTracker.onSoftCapReached(); // depends on control dependency: [if], data = [none] } return isMaxSizeSoftCapExceeded; } }
public class class_name { public void restartFragment(FragmentResponseMessage message, List<Long> masters, Map<Integer, Long> partitionMastersMap) { final int partionId = message.getPartitionId(); Long restartHsid = partitionMastersMap.get(partionId); Long hsid = message.getExecutorSiteId(); if (!hsid.equals(restartHsid)) { m_masterMapForFragmentRestart.clear(); m_masterMapForFragmentRestart.put(restartHsid, hsid); //The very first fragment is to be rerouted to the new leader, then all the follow-up fragments are routed //to new leaders. updateMasters(masters, partitionMastersMap); } if (restartHsid == null) { restartHsid = hsid; } if (tmLog.isDebugEnabled()) { tmLog.debug("Rerouted fragment from " + CoreUtils.hsIdToString(hsid) + " to " + CoreUtils.hsIdToString(restartHsid) + "\n" + m_remoteWork); } m_fragmentRestarted = true; m_mbox.send(restartHsid, m_remoteWork); } }
public class class_name { public void restartFragment(FragmentResponseMessage message, List<Long> masters, Map<Integer, Long> partitionMastersMap) { final int partionId = message.getPartitionId(); Long restartHsid = partitionMastersMap.get(partionId); Long hsid = message.getExecutorSiteId(); if (!hsid.equals(restartHsid)) { m_masterMapForFragmentRestart.clear(); // depends on control dependency: [if], data = [none] m_masterMapForFragmentRestart.put(restartHsid, hsid); // depends on control dependency: [if], data = [none] //The very first fragment is to be rerouted to the new leader, then all the follow-up fragments are routed //to new leaders. updateMasters(masters, partitionMastersMap); // depends on control dependency: [if], data = [none] } if (restartHsid == null) { restartHsid = hsid; // depends on control dependency: [if], data = [none] } if (tmLog.isDebugEnabled()) { tmLog.debug("Rerouted fragment from " + CoreUtils.hsIdToString(hsid) + " to " + CoreUtils.hsIdToString(restartHsid) + "\n" + m_remoteWork); // depends on control dependency: [if], data = [none] } m_fragmentRestarted = true; m_mbox.send(restartHsid, m_remoteWork); } }
public class class_name { public Result<Void> addRole(AuthzTrans trans, PermDAO.Data perm, String roleFullName) { // Note: Prepared Statements for Collection updates aren't supported //ResultSet rv = try { getSession(trans).execute(UPDATE_SP + TABLE + " SET roles = roles + {'" + roleFullName + "'} " + "WHERE " + "ns = '" + perm.ns + "' AND " + "type = '" + perm.type + "' AND " + "instance = '" + perm.instance + "' AND " + "action = '" + perm.action + "';" ); } catch (DriverException | APIException | IOException e) { reportPerhapsReset(trans,e); return Result.err(Result.ERR_Backend, CassAccess.ERR_ACCESS_MSG); } wasModified(trans, CRUD.update, perm, "Added role " + roleFullName + " to perm " + perm.ns + '.' + perm.type + '|' + perm.instance + '|' + perm.action); return Result.ok(); } }
public class class_name { public Result<Void> addRole(AuthzTrans trans, PermDAO.Data perm, String roleFullName) { // Note: Prepared Statements for Collection updates aren't supported //ResultSet rv = try { getSession(trans).execute(UPDATE_SP + TABLE + " SET roles = roles + {'" + roleFullName + "'} " + "WHERE " + "ns = '" + perm.ns + "' AND " + "type = '" + perm.type + "' AND " + "instance = '" + perm.instance + "' AND " + "action = '" + perm.action + "';" ); // depends on control dependency: [try], data = [none] } catch (DriverException | APIException | IOException e) { reportPerhapsReset(trans,e); return Result.err(Result.ERR_Backend, CassAccess.ERR_ACCESS_MSG); } // depends on control dependency: [catch], data = [none] wasModified(trans, CRUD.update, perm, "Added role " + roleFullName + " to perm " + perm.ns + '.' + perm.type + '|' + perm.instance + '|' + perm.action); return Result.ok(); } }
public class class_name { public static <T> Constraint checking(Function<String, T> check, String messageOrKey, boolean isKey, String... extraMessageArgs) { return mkSimpleConstraint(((label, vString, messages) -> { logger.debug("checking for {}", vString); if (isEmptyStr(vString)) return null; else { try { check.apply(vString); return null; } catch (Exception ex) { String msgTemplate = isKey ? messages.get(messageOrKey) : messageOrKey; List<String> messageArgs = appendList(Arrays.asList(vString), extraMessageArgs); return String.format(msgTemplate, messageArgs.toArray()); } } }), null); } }
public class class_name { public static <T> Constraint checking(Function<String, T> check, String messageOrKey, boolean isKey, String... extraMessageArgs) { return mkSimpleConstraint(((label, vString, messages) -> { logger.debug("checking for {}", vString); if (isEmptyStr(vString)) return null; else { try { check.apply(vString); // depends on control dependency: [try], data = [none] return null; // depends on control dependency: [try], data = [none] } catch (Exception ex) { String msgTemplate = isKey ? messages.get(messageOrKey) : messageOrKey; List<String> messageArgs = appendList(Arrays.asList(vString), extraMessageArgs); return String.format(msgTemplate, messageArgs.toArray()); } // depends on control dependency: [catch], data = [none] } }), null); } }
public class class_name { @Override public void removeColumn(TableColumn column) { int allColumnsIndex = allTableColumns.indexOf(column); if (allColumnsIndex != -1) { allTableColumns.removeElementAt(allColumnsIndex); } super.removeColumn(column); } }
public class class_name { @Override public void removeColumn(TableColumn column) { int allColumnsIndex = allTableColumns.indexOf(column); if (allColumnsIndex != -1) { allTableColumns.removeElementAt(allColumnsIndex); // depends on control dependency: [if], data = [(allColumnsIndex] } super.removeColumn(column); } }
public class class_name { private void registerLocalComponents(TypeElement component, MethodSpec.Builder initBuilder, List<CodeBlock> staticInitParameters) { List<TypeMirror> localComponents = getComponentLocalComponents(elements, component); if (localComponents.isEmpty()) { return; } initBuilder.addStatement("$T<$T> components = jsConstructor.getOptionsComponents()", JsPropertyMap.class, ParameterizedTypeName.get(VueJsAsyncProvider.class, VueJsConstructor.class)); localComponents.forEach(localComponent -> { ClassName factory = componentFactoryName(localComponent); String parameterName = factory.reflectionName().replaceAll("\\.", "_"); initBuilder.addParameter(providerOf(factory), parameterName); staticInitParameters.add(CodeBlock.of("() -> $T.get()", factory)); initBuilder.addStatement( "components.set($L.get().getComponentTagName(), render -> render.accept($L.get().getJsConstructor()))", parameterName, parameterName); }); } }
public class class_name { private void registerLocalComponents(TypeElement component, MethodSpec.Builder initBuilder, List<CodeBlock> staticInitParameters) { List<TypeMirror> localComponents = getComponentLocalComponents(elements, component); if (localComponents.isEmpty()) { return; // depends on control dependency: [if], data = [none] } initBuilder.addStatement("$T<$T> components = jsConstructor.getOptionsComponents()", JsPropertyMap.class, ParameterizedTypeName.get(VueJsAsyncProvider.class, VueJsConstructor.class)); localComponents.forEach(localComponent -> { ClassName factory = componentFactoryName(localComponent); String parameterName = factory.reflectionName().replaceAll("\\.", "_"); initBuilder.addParameter(providerOf(factory), parameterName); staticInitParameters.add(CodeBlock.of("() -> $T.get()", factory)); initBuilder.addStatement( "components.set($L.get().getComponentTagName(), render -> render.accept($L.get().getJsConstructor()))", parameterName, parameterName); }); } }
public class class_name { public void deleted(String pid) { LOGGER.entering(CLASS_NAME, "deleted", pid); ServiceRegistration serviceRegistration = serviceAgents.remove(pid); if (serviceRegistration != null) { ServiceReference serviceReference = serviceRegistration.getReference(); ServiceAgent serviceAgent = (ServiceAgent)bundleContext.getService(serviceReference); serviceRegistration.unregister(); if (LOGGER.isLoggable(Level.FINER)) LOGGER.finer("Service Agent " + pid + " starting..."); serviceAgent.stop(); if (LOGGER.isLoggable(Level.FINE)) LOGGER.fine("Service Agent " + pid + " stopped successfully"); } LOGGER.exiting(CLASS_NAME, "deleted"); } }
public class class_name { public void deleted(String pid) { LOGGER.entering(CLASS_NAME, "deleted", pid); ServiceRegistration serviceRegistration = serviceAgents.remove(pid); if (serviceRegistration != null) { ServiceReference serviceReference = serviceRegistration.getReference(); ServiceAgent serviceAgent = (ServiceAgent)bundleContext.getService(serviceReference); serviceRegistration.unregister(); // depends on control dependency: [if], data = [none] if (LOGGER.isLoggable(Level.FINER)) LOGGER.finer("Service Agent " + pid + " starting..."); serviceAgent.stop(); // depends on control dependency: [if], data = [none] if (LOGGER.isLoggable(Level.FINE)) LOGGER.fine("Service Agent " + pid + " stopped successfully"); } LOGGER.exiting(CLASS_NAME, "deleted"); } }
public class class_name { public void setBackground(Color bg) { super.setBackground(bg); if (dayChooser != null) { dayChooser.setBackground(bg); } } }
public class class_name { public void setBackground(Color bg) { super.setBackground(bg); if (dayChooser != null) { dayChooser.setBackground(bg); // depends on control dependency: [if], data = [none] } } }
public class class_name { protected void computeFields() { int offsets[] = new int[2]; getTimeZone().getOffset(time, false, offsets); long localMillis = time + offsets[0] + offsets[1]; // Mark fields as set. Do this before calling handleComputeFields(). int mask = internalSetMask; for (int i=0; i<fields.length; ++i) { if ((mask & 1) == 0) { stamp[i] = INTERNALLY_SET; } else { stamp[i] = UNSET; } mask >>= 1; } // We used to check for and correct extreme millis values (near // Long.MIN_VALUE or Long.MAX_VALUE) here. Such values would cause // overflows from positive to negative (or vice versa) and had to // be manually tweaked. We no longer need to do this because we // have limited the range of supported dates to those that have a // Julian day that fits into an int. This allows us to implement a // JULIAN_DAY field and also removes some inelegant code. - Liu // 11/6/00 long days = floorDivide(localMillis, ONE_DAY); fields[JULIAN_DAY] = (int) days + EPOCH_JULIAN_DAY; computeGregorianAndDOWFields(fields[JULIAN_DAY]); // Call framework method to have subclass compute its fields. // These must include, at a minimum, MONTH, DAY_OF_MONTH, // EXTENDED_YEAR, YEAR, DAY_OF_YEAR. This method will call internalSet(), // which will update stamp[]. handleComputeFields(fields[JULIAN_DAY]); // Compute week-related fields, based on the subclass-computed // fields computed by handleComputeFields(). computeWeekFields(); // Compute time-related fields. These are indepent of the date and // of the subclass algorithm. They depend only on the local zone // wall milliseconds in day. int millisInDay = (int) (localMillis - (days * ONE_DAY)); fields[MILLISECONDS_IN_DAY] = millisInDay; fields[MILLISECOND] = millisInDay % 1000; millisInDay /= 1000; fields[SECOND] = millisInDay % 60; millisInDay /= 60; fields[MINUTE] = millisInDay % 60; millisInDay /= 60; fields[HOUR_OF_DAY] = millisInDay; fields[AM_PM] = millisInDay / 12; // Assume AM == 0 fields[HOUR] = millisInDay % 12; fields[ZONE_OFFSET] = offsets[0]; fields[DST_OFFSET] = offsets[1]; } }
public class class_name { protected void computeFields() { int offsets[] = new int[2]; getTimeZone().getOffset(time, false, offsets); long localMillis = time + offsets[0] + offsets[1]; // Mark fields as set. Do this before calling handleComputeFields(). int mask = internalSetMask; for (int i=0; i<fields.length; ++i) { if ((mask & 1) == 0) { stamp[i] = INTERNALLY_SET; // depends on control dependency: [if], data = [none] } else { stamp[i] = UNSET; // depends on control dependency: [if], data = [none] } mask >>= 1; // depends on control dependency: [for], data = [none] } // We used to check for and correct extreme millis values (near // Long.MIN_VALUE or Long.MAX_VALUE) here. Such values would cause // overflows from positive to negative (or vice versa) and had to // be manually tweaked. We no longer need to do this because we // have limited the range of supported dates to those that have a // Julian day that fits into an int. This allows us to implement a // JULIAN_DAY field and also removes some inelegant code. - Liu // 11/6/00 long days = floorDivide(localMillis, ONE_DAY); fields[JULIAN_DAY] = (int) days + EPOCH_JULIAN_DAY; computeGregorianAndDOWFields(fields[JULIAN_DAY]); // Call framework method to have subclass compute its fields. // These must include, at a minimum, MONTH, DAY_OF_MONTH, // EXTENDED_YEAR, YEAR, DAY_OF_YEAR. This method will call internalSet(), // which will update stamp[]. handleComputeFields(fields[JULIAN_DAY]); // Compute week-related fields, based on the subclass-computed // fields computed by handleComputeFields(). computeWeekFields(); // Compute time-related fields. These are indepent of the date and // of the subclass algorithm. They depend only on the local zone // wall milliseconds in day. int millisInDay = (int) (localMillis - (days * ONE_DAY)); fields[MILLISECONDS_IN_DAY] = millisInDay; fields[MILLISECOND] = millisInDay % 1000; millisInDay /= 1000; fields[SECOND] = millisInDay % 60; millisInDay /= 60; fields[MINUTE] = millisInDay % 60; millisInDay /= 60; fields[HOUR_OF_DAY] = millisInDay; fields[AM_PM] = millisInDay / 12; // Assume AM == 0 fields[HOUR] = millisInDay % 12; fields[ZONE_OFFSET] = offsets[0]; fields[DST_OFFSET] = offsets[1]; } }
public class class_name { public boolean evaluate(final LoggingEvent event, Map matches) { //both util.logging and log4j contain 'info' - use the int values instead of equality //info level set to the same value for both levels Level eventLevel = event.getLevel(); boolean result = level.toInt() != eventLevel.toInt(); if (result && matches != null) { Set entries = (Set) matches.get(LoggingEventFieldResolver.LEVEL_FIELD); if (entries == null) { entries = new HashSet(); matches.put(LoggingEventFieldResolver.LEVEL_FIELD, entries); } entries.add(eventLevel); } return result; } }
public class class_name { public boolean evaluate(final LoggingEvent event, Map matches) { //both util.logging and log4j contain 'info' - use the int values instead of equality //info level set to the same value for both levels Level eventLevel = event.getLevel(); boolean result = level.toInt() != eventLevel.toInt(); if (result && matches != null) { Set entries = (Set) matches.get(LoggingEventFieldResolver.LEVEL_FIELD); if (entries == null) { entries = new HashSet(); // depends on control dependency: [if], data = [none] matches.put(LoggingEventFieldResolver.LEVEL_FIELD, entries); // depends on control dependency: [if], data = [none] } entries.add(eventLevel); // depends on control dependency: [if], data = [none] } return result; } }
public class class_name { @Override public void setPeriod(int pPeriod) { if (pPeriod < 0) { throw new IllegalArgumentException("Period cannot be negative"); } int actual = Math.max(pPeriod, MIN_PERIOD); log.debug("Changing clock period to {}", actual); period = actual; if (isRunning()) { stop(); start(false); } } }
public class class_name { @Override public void setPeriod(int pPeriod) { if (pPeriod < 0) { throw new IllegalArgumentException("Period cannot be negative"); } int actual = Math.max(pPeriod, MIN_PERIOD); log.debug("Changing clock period to {}", actual); period = actual; if (isRunning()) { stop(); // depends on control dependency: [if], data = [none] start(false); // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override public List<Assignment> findAssignments() { List<Assignment> assignmentList; try { assignmentList = createAssignments(ldapDao.getDirectChildren(DnFactory.assignments())); } catch (NoSuchNodeException | MissingParentException e) { LOGGER.error("LDAP exception", e); throw new LdapRuntimeException(e); } return assignmentList; } }
public class class_name { @Override public List<Assignment> findAssignments() { List<Assignment> assignmentList; try { assignmentList = createAssignments(ldapDao.getDirectChildren(DnFactory.assignments())); // depends on control dependency: [try], data = [none] } catch (NoSuchNodeException | MissingParentException e) { LOGGER.error("LDAP exception", e); throw new LdapRuntimeException(e); } // depends on control dependency: [catch], data = [none] return assignmentList; } }
public class class_name { @PostDeploy public void startFirstProcess(ProcessEngine processEngine) { processEngine = BpmPlatform.getProcessEngineService().getProcessEngine("anders"); createUsers(processEngine); startProcessInstances(processEngine, "invoice", 1); startProcessInstances(processEngine, "invoice", null); for (int i=0; i<1000; i++) { startProcessInstances(processEngine, "invoice", null); } } }
public class class_name { @PostDeploy public void startFirstProcess(ProcessEngine processEngine) { processEngine = BpmPlatform.getProcessEngineService().getProcessEngine("anders"); createUsers(processEngine); startProcessInstances(processEngine, "invoice", 1); startProcessInstances(processEngine, "invoice", null); for (int i=0; i<1000; i++) { startProcessInstances(processEngine, "invoice", null); // depends on control dependency: [for], data = [none] } } }
public class class_name { private boolean drawFeature(int zoom, BoundingBox boundingBox, BoundingBox expandedBoundingBox, ProjectionTransform transform, FeatureTileCanvas canvas, FeatureRow row) { boolean drawn = false; try { GeoPackageGeometryData geomData = row.getGeometry(); if (geomData != null) { Geometry geometry = geomData.getGeometry(); if (geometry != null) { GeometryEnvelope envelope = geomData.getOrBuildEnvelope(); BoundingBox geometryBoundingBox = new BoundingBox(envelope); BoundingBox transformedBoundingBox = geometryBoundingBox.transform(transform); if (expandedBoundingBox.intersects(transformedBoundingBox, true)) { double simplifyTolerance = TileBoundingBoxUtils.toleranceDistance(zoom, tileWidth, tileHeight); drawn = drawShape(simplifyTolerance, boundingBox, transform, canvas, row, geometry); } } } } catch (Exception e) { Log.e(DefaultFeatureTiles.class.getSimpleName(), "Failed to draw feature in tile. Table: " + featureDao.getTableName(), e); } return drawn; } }
public class class_name { private boolean drawFeature(int zoom, BoundingBox boundingBox, BoundingBox expandedBoundingBox, ProjectionTransform transform, FeatureTileCanvas canvas, FeatureRow row) { boolean drawn = false; try { GeoPackageGeometryData geomData = row.getGeometry(); if (geomData != null) { Geometry geometry = geomData.getGeometry(); if (geometry != null) { GeometryEnvelope envelope = geomData.getOrBuildEnvelope(); BoundingBox geometryBoundingBox = new BoundingBox(envelope); BoundingBox transformedBoundingBox = geometryBoundingBox.transform(transform); if (expandedBoundingBox.intersects(transformedBoundingBox, true)) { double simplifyTolerance = TileBoundingBoxUtils.toleranceDistance(zoom, tileWidth, tileHeight); drawn = drawShape(simplifyTolerance, boundingBox, transform, canvas, row, geometry); // depends on control dependency: [if], data = [none] } } } } catch (Exception e) { Log.e(DefaultFeatureTiles.class.getSimpleName(), "Failed to draw feature in tile. Table: " + featureDao.getTableName(), e); } // depends on control dependency: [catch], data = [none] return drawn; } }
public class class_name { private void processArgs(final String[] arguments) { args = argumentParser.processArgs(arguments); final Map<String, Object> definedProps = new HashMap<>(args.definedProps); buildFile = args.buildFile; if (args.justPrintUsage || args.justPrintVersion || args.justPrintDiagnostics || args.justPrintPlugins || args.justPrintTranstypes || args.justPrintDeliverables) { if (args.justPrintVersion) { printVersion(args.msgOutputLevel); } if (args.justPrintUsage) { printUsage(); } if (args.justPrintDiagnostics) { Diagnostics.doReport(System.out, args.msgOutputLevel); } if (args.justPrintPlugins) { printPlugins(); } if (args.justPrintTranstypes) { printTranstypes(); } if (args.justPrintDeliverables) { if (args.projectFile == null) { printErrorMessage("Error: Project file not defined"); printUsage(); throw new BuildException(""); } printDeliverables(); } return; } if (args.install) { buildFile = findBuildFile(System.getProperty("dita.dir"), "integrator.xml"); targets.clear(); if (args.installFile != null) { targets.add("install"); final File f = new File(args.installFile.replace('/', File.separatorChar)).getAbsoluteFile(); if (f.exists()) { definedProps.put(ANT_PLUGIN_FILE, f.getAbsolutePath()); } else { definedProps.put(ANT_PLUGIN_FILE, args.installFile); } } else if (args.uninstallId != null) { targets.add("uninstall"); definedProps.put(ANT_PLUGIN_ID, args.uninstallId); } else { targets.add("integrate"); } } else { if (args.projectFile == null) { if (!definedProps.containsKey(ANT_TRANSTYPE)) { printErrorMessage("Error: Transformation type not defined"); printUsage(); throw new BuildException(""); //justPrintUsage = true; } if (!definedProps.containsKey(ANT_ARGS_INPUT)) { printErrorMessage("Error: Input file not defined"); printUsage(); throw new BuildException(""); //justPrintUsage = true; } } // default values if (!definedProps.containsKey(ANT_OUTPUT_DIR)) { definedProps.put(ANT_OUTPUT_DIR, new File(new File("."), "out").getAbsolutePath()); } if (!definedProps.containsKey(ANT_BASE_TEMP_DIR) && !definedProps.containsKey(ANT_TEMP_DIR)) { definedProps.put(ANT_BASE_TEMP_DIR, new File(System.getProperty("java.io.tmpdir")).getAbsolutePath()); } } projectProps = args.projectFile != null ? handleProject(definedProps) : Collections.singletonList(definedProps); // make sure buildfile exists if (!args.buildFile.exists() || buildFile.isDirectory()) { System.out.println("Buildfile: " + buildFile + " does not exist!"); throw new BuildException("Build failed"); } // Normalize buildFile for re-import detection buildFile = FileUtils.getFileUtils().normalize(buildFile.getAbsolutePath()); if (args.msgOutputLevel >= Project.MSG_VERBOSE) { System.out.println("Buildfile: " + buildFile); } if (args.logFile != null) { PrintStream logTo; try { logTo = new PrintStream(new FileOutputStream(args.logFile)); } catch (final IOException ioe) { throw new BuildException("Cannot write on the specified log file. " + "Make sure the path exists and you have write permissions."); } out = logTo; err = logTo; System.setOut(out); System.setErr(err); } readyToRun = true; } }
public class class_name { private void processArgs(final String[] arguments) { args = argumentParser.processArgs(arguments); final Map<String, Object> definedProps = new HashMap<>(args.definedProps); buildFile = args.buildFile; if (args.justPrintUsage || args.justPrintVersion || args.justPrintDiagnostics || args.justPrintPlugins || args.justPrintTranstypes || args.justPrintDeliverables) { if (args.justPrintVersion) { printVersion(args.msgOutputLevel); // depends on control dependency: [if], data = [none] } if (args.justPrintUsage) { printUsage(); // depends on control dependency: [if], data = [none] } if (args.justPrintDiagnostics) { Diagnostics.doReport(System.out, args.msgOutputLevel); // depends on control dependency: [if], data = [none] } if (args.justPrintPlugins) { printPlugins(); // depends on control dependency: [if], data = [none] } if (args.justPrintTranstypes) { printTranstypes(); // depends on control dependency: [if], data = [none] } if (args.justPrintDeliverables) { if (args.projectFile == null) { printErrorMessage("Error: Project file not defined"); // depends on control dependency: [if], data = [none] printUsage(); // depends on control dependency: [if], data = [none] throw new BuildException(""); } printDeliverables(); // depends on control dependency: [if], data = [none] } return; // depends on control dependency: [if], data = [none] } if (args.install) { buildFile = findBuildFile(System.getProperty("dita.dir"), "integrator.xml"); targets.clear(); if (args.installFile != null) { targets.add("install"); final File f = new File(args.installFile.replace('/', File.separatorChar)).getAbsoluteFile(); if (f.exists()) { definedProps.put(ANT_PLUGIN_FILE, f.getAbsolutePath()); } else { definedProps.put(ANT_PLUGIN_FILE, args.installFile); } } else if (args.uninstallId != null) { targets.add("uninstall"); definedProps.put(ANT_PLUGIN_ID, args.uninstallId); } else { targets.add("integrate"); } } else { if (args.projectFile == null) { if (!definedProps.containsKey(ANT_TRANSTYPE)) { printErrorMessage("Error: Transformation type not defined"); printUsage(); throw new BuildException(""); //justPrintUsage = true; } if (!definedProps.containsKey(ANT_ARGS_INPUT)) { printErrorMessage("Error: Input file not defined"); printUsage(); throw new BuildException(""); //justPrintUsage = true; } } // default values if (!definedProps.containsKey(ANT_OUTPUT_DIR)) { definedProps.put(ANT_OUTPUT_DIR, new File(new File("."), "out").getAbsolutePath()); } if (!definedProps.containsKey(ANT_BASE_TEMP_DIR) && !definedProps.containsKey(ANT_TEMP_DIR)) { definedProps.put(ANT_BASE_TEMP_DIR, new File(System.getProperty("java.io.tmpdir")).getAbsolutePath()); } } projectProps = args.projectFile != null ? handleProject(definedProps) : Collections.singletonList(definedProps); // make sure buildfile exists if (!args.buildFile.exists() || buildFile.isDirectory()) { System.out.println("Buildfile: " + buildFile + " does not exist!"); throw new BuildException("Build failed"); } // Normalize buildFile for re-import detection buildFile = FileUtils.getFileUtils().normalize(buildFile.getAbsolutePath()); if (args.msgOutputLevel >= Project.MSG_VERBOSE) { System.out.println("Buildfile: " + buildFile); } if (args.logFile != null) { PrintStream logTo; try { logTo = new PrintStream(new FileOutputStream(args.logFile)); } catch (final IOException ioe) { throw new BuildException("Cannot write on the specified log file. " + "Make sure the path exists and you have write permissions."); } out = logTo; err = logTo; System.setOut(out); System.setErr(err); } readyToRun = true; } }
public class class_name { public EntityManager createEntityManager(ConnectionParameters parameters) { try { DatastoreOptions.Builder datastoreOptionsBuilder = DatastoreOptions.newBuilder(); datastoreOptionsBuilder.setHost(parameters.getServiceURL()); datastoreOptionsBuilder.setTransportOptions(getHttpTransportOptions(parameters)); String projectId = parameters.getProjectId(); if (!Utility.isNullOrEmpty(projectId)) { datastoreOptionsBuilder.setProjectId(projectId); } String namespace = parameters.getNamespace(); if (namespace != null) { datastoreOptionsBuilder.setNamespace(namespace); } datastoreOptionsBuilder.setCredentials(getCredentials(parameters)); Datastore datastore = datastoreOptionsBuilder.build().getService(); return new DefaultEntityManager(datastore); } catch (Exception exp) { throw new EntityManagerFactoryException(exp); } } }
public class class_name { public EntityManager createEntityManager(ConnectionParameters parameters) { try { DatastoreOptions.Builder datastoreOptionsBuilder = DatastoreOptions.newBuilder(); datastoreOptionsBuilder.setHost(parameters.getServiceURL()); // depends on control dependency: [try], data = [none] datastoreOptionsBuilder.setTransportOptions(getHttpTransportOptions(parameters)); // depends on control dependency: [try], data = [none] String projectId = parameters.getProjectId(); if (!Utility.isNullOrEmpty(projectId)) { datastoreOptionsBuilder.setProjectId(projectId); // depends on control dependency: [if], data = [none] } String namespace = parameters.getNamespace(); if (namespace != null) { datastoreOptionsBuilder.setNamespace(namespace); // depends on control dependency: [if], data = [(namespace] } datastoreOptionsBuilder.setCredentials(getCredentials(parameters)); // depends on control dependency: [try], data = [none] Datastore datastore = datastoreOptionsBuilder.build().getService(); return new DefaultEntityManager(datastore); // depends on control dependency: [try], data = [none] } catch (Exception exp) { throw new EntityManagerFactoryException(exp); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private synchronized void kickstartHandshake() throws IOException { switch (connectionState) { case cs_START: if (!serverModeSet) { throw new IllegalStateException( "Client/Server mode not yet set."); } initHandshaker(); break; case cs_HANDSHAKE: // handshaker already setup, proceed break; case cs_DATA: if (!secureRenegotiation && !Handshaker.allowUnsafeRenegotiation) { throw new SSLHandshakeException( "Insecure renegotiation is not allowed"); } if (!secureRenegotiation) { if (debug != null && Debug.isOn("handshake")) { System.out.println( "Warning: Using insecure renegotiation"); } } // initialize the handshaker, move to cs_RENEGOTIATE initHandshaker(); break; case cs_RENEGOTIATE: // handshaking already in progress, return return; default: // cs_ERROR/cs_CLOSED throw new SSLException("SSLEngine is closing/closed"); } // // Kickstart handshake state machine if we need to ... // // Note that handshaker.kickstart() writes the message // to its HandshakeOutStream, which calls back into // SSLSocketImpl.writeRecord() to send it. // if (!handshaker.activated()) { // prior to handshaking, activate the handshake if (connectionState == cs_RENEGOTIATE) { // don't use SSLv2Hello when renegotiating handshaker.activate(protocolVersion); } else { handshaker.activate(null); } if (handshaker instanceof ClientHandshaker) { // send client hello handshaker.kickstart(); } else { // instanceof ServerHandshaker if (connectionState == cs_HANDSHAKE) { // initial handshake, no kickstart message to send } else { // we want to renegotiate, send hello request handshaker.kickstart(); // hello request is not included in the handshake // hashes, reset them handshaker.handshakeHash.reset(); } } } } }
public class class_name { private synchronized void kickstartHandshake() throws IOException { switch (connectionState) { case cs_START: if (!serverModeSet) { throw new IllegalStateException( "Client/Server mode not yet set."); } initHandshaker(); break; case cs_HANDSHAKE: // handshaker already setup, proceed break; case cs_DATA: if (!secureRenegotiation && !Handshaker.allowUnsafeRenegotiation) { throw new SSLHandshakeException( "Insecure renegotiation is not allowed"); } if (!secureRenegotiation) { if (debug != null && Debug.isOn("handshake")) { System.out.println( "Warning: Using insecure renegotiation"); // depends on control dependency: [if], data = [none] } } // initialize the handshaker, move to cs_RENEGOTIATE initHandshaker(); break; case cs_RENEGOTIATE: // handshaking already in progress, return return; default: // cs_ERROR/cs_CLOSED throw new SSLException("SSLEngine is closing/closed"); } // // Kickstart handshake state machine if we need to ... // // Note that handshaker.kickstart() writes the message // to its HandshakeOutStream, which calls back into // SSLSocketImpl.writeRecord() to send it. // if (!handshaker.activated()) { // prior to handshaking, activate the handshake if (connectionState == cs_RENEGOTIATE) { // don't use SSLv2Hello when renegotiating handshaker.activate(protocolVersion); } else { handshaker.activate(null); } if (handshaker instanceof ClientHandshaker) { // send client hello handshaker.kickstart(); } else { // instanceof ServerHandshaker if (connectionState == cs_HANDSHAKE) { // initial handshake, no kickstart message to send } else { // we want to renegotiate, send hello request handshaker.kickstart(); // depends on control dependency: [if], data = [none] // hello request is not included in the handshake // hashes, reset them handshaker.handshakeHash.reset(); // depends on control dependency: [if], data = [none] } } } } }
public class class_name { public static boolean intersect(long[] x, long[] y) { final int min = (x.length < y.length) ? x.length : y.length; for(int i = 0; i < min; i++) { if((x[i] & y[i]) != 0L) { return true; } } return false; } }
public class class_name { public static boolean intersect(long[] x, long[] y) { final int min = (x.length < y.length) ? x.length : y.length; for(int i = 0; i < min; i++) { if((x[i] & y[i]) != 0L) { return true; // depends on control dependency: [if], data = [none] } } return false; } }
public class class_name { public static String getSolrRangeString(String from, String to) { // If a parameter is not initialized, use the asterisk '*' operator if (CmsStringUtil.isEmptyOrWhitespaceOnly(from)) { from = "*"; } if (CmsStringUtil.isEmptyOrWhitespaceOnly(to)) { to = "*"; } return String.format("[%s TO %s]", from, to); } }
public class class_name { public static String getSolrRangeString(String from, String to) { // If a parameter is not initialized, use the asterisk '*' operator if (CmsStringUtil.isEmptyOrWhitespaceOnly(from)) { from = "*"; // depends on control dependency: [if], data = [none] } if (CmsStringUtil.isEmptyOrWhitespaceOnly(to)) { to = "*"; // depends on control dependency: [if], data = [none] } return String.format("[%s TO %s]", from, to); } }
public class class_name { public final boolean removeDeliveryDelayable(DeliveryDelayable deliveryDelayable) throws SevereMessageStoreException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(tc, "removeDeliveryDelayable", "objId=" + (deliveryDelayable == null ? "null" : String.valueOf(deliveryDelayable.deliveryDelayableGetID())) + " ET=" + (deliveryDelayable == null ? "null" : String.valueOf(deliveryDelayable.deliveryDelayableGetDeliveryDelayTime())) + " addEnabled=" + addEnabled); } boolean reply = false; boolean cancelled = false; // Ignore this request if the DeliveryDelayManager has ended or the given entry is null synchronized (lockObject) { if (addEnabled && deliveryDelayable != null) { long deliveryDelay = deliveryDelayable.deliveryDelayableGetDeliveryDelayTime(); DeliveryDelayableReference delayedDeliverableRef = new DeliveryDelayableReference(deliveryDelayable); delayedDeliverableRef.setDeliveryDelayTime(deliveryDelay); // Remove the DeliveryDelayable from the deliveryDelay index reply = deliveryDelayIndex.remove(delayedDeliverableRef); if (reply && deliveryDelayIndex.size() <= 0) // We just removed the last entry { if (deliveryDelayAlarm != null) { deliveryDelayAlarm.cancel(); alarmScheduled = false; cancelled = true; } } } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "removeDeliveryDelayable", "deliveryDelayIndexSize=" + deliveryDelayIndex.size() + " reply=" + reply + " cancelled=" + cancelled); return reply; } }
public class class_name { public final boolean removeDeliveryDelayable(DeliveryDelayable deliveryDelayable) throws SevereMessageStoreException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(tc, "removeDeliveryDelayable", "objId=" + (deliveryDelayable == null ? "null" : String.valueOf(deliveryDelayable.deliveryDelayableGetID())) + " ET=" + (deliveryDelayable == null ? "null" : String.valueOf(deliveryDelayable.deliveryDelayableGetDeliveryDelayTime())) + " addEnabled=" + addEnabled); } boolean reply = false; boolean cancelled = false; // Ignore this request if the DeliveryDelayManager has ended or the given entry is null synchronized (lockObject) { if (addEnabled && deliveryDelayable != null) { long deliveryDelay = deliveryDelayable.deliveryDelayableGetDeliveryDelayTime(); DeliveryDelayableReference delayedDeliverableRef = new DeliveryDelayableReference(deliveryDelayable); delayedDeliverableRef.setDeliveryDelayTime(deliveryDelay); // depends on control dependency: [if], data = [none] // Remove the DeliveryDelayable from the deliveryDelay index reply = deliveryDelayIndex.remove(delayedDeliverableRef); // depends on control dependency: [if], data = [none] if (reply && deliveryDelayIndex.size() <= 0) // We just removed the last entry { if (deliveryDelayAlarm != null) { deliveryDelayAlarm.cancel(); // depends on control dependency: [if], data = [none] alarmScheduled = false; // depends on control dependency: [if], data = [none] cancelled = true; // depends on control dependency: [if], data = [none] } } } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "removeDeliveryDelayable", "deliveryDelayIndexSize=" + deliveryDelayIndex.size() + " reply=" + reply + " cancelled=" + cancelled); return reply; } }
public class class_name { @Override public void received(ByteBuffer buffer) { if (ended) { throw new IllegalStateException(); } while (true) { while (!chunkHeaderRead) { String line = lineReader.handle(buffer); if (line == null) { return; } try { chunkLength = Integer.parseInt(line, 16); } catch (NumberFormatException e) { ended = true; failing.failed(new IOException("Invalid chunk size: " + line)); return; } chunkHeaderRead = true; chunkCountRead = 0; } if (chunkHeaderRead) { if (chunkCountRead < chunkLength) { if (!buffer.hasRemaining()) { return; } long toRead = chunkLength - chunkCountRead; ByteBuffer d = buffer.duplicate(); if (toRead >= 0) { if (d.remaining() > toRead) { d.limit((int) (buffer.position() + toRead)); } } chunkCountRead += d.remaining(); buffer.position((int) (buffer.position() + d.remaining())); wrappee.received(d); } if (chunkCountRead == chunkLength) { while (chunkHeaderRead) { String line = lineReader.handle(buffer); if (line == null) { return; } if (!line.isEmpty()) { ended = true; failing.failed(new IOException("Invalid chunk footer")); return; } chunkHeaderRead = false; } if (chunkLength == 0) { ended = true; wrappee.ended(); return; } } } } } }
public class class_name { @Override public void received(ByteBuffer buffer) { if (ended) { throw new IllegalStateException(); } while (true) { while (!chunkHeaderRead) { String line = lineReader.handle(buffer); if (line == null) { return; // depends on control dependency: [if], data = [none] } try { chunkLength = Integer.parseInt(line, 16); // depends on control dependency: [try], data = [none] } catch (NumberFormatException e) { ended = true; failing.failed(new IOException("Invalid chunk size: " + line)); return; } // depends on control dependency: [catch], data = [none] chunkHeaderRead = true; // depends on control dependency: [while], data = [none] chunkCountRead = 0; // depends on control dependency: [while], data = [none] } if (chunkHeaderRead) { if (chunkCountRead < chunkLength) { if (!buffer.hasRemaining()) { return; // depends on control dependency: [if], data = [none] } long toRead = chunkLength - chunkCountRead; ByteBuffer d = buffer.duplicate(); if (toRead >= 0) { if (d.remaining() > toRead) { d.limit((int) (buffer.position() + toRead)); // depends on control dependency: [if], data = [toRead)] } } chunkCountRead += d.remaining(); // depends on control dependency: [if], data = [none] buffer.position((int) (buffer.position() + d.remaining())); // depends on control dependency: [if], data = [none] wrappee.received(d); // depends on control dependency: [if], data = [none] } if (chunkCountRead == chunkLength) { while (chunkHeaderRead) { String line = lineReader.handle(buffer); if (line == null) { return; // depends on control dependency: [if], data = [none] } if (!line.isEmpty()) { ended = true; // depends on control dependency: [if], data = [none] failing.failed(new IOException("Invalid chunk footer")); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } chunkHeaderRead = false; // depends on control dependency: [while], data = [none] } if (chunkLength == 0) { ended = true; // depends on control dependency: [if], data = [none] wrappee.ended(); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } } } } } }
public class class_name { private XPathFactory loadFromServicesFile(String uri, String resourceName, InputStream in) { if (debug) debugPrintln("Reading " + resourceName ); BufferedReader rd; try { rd = new BufferedReader(new InputStreamReader(in, "UTF-8"), DEFAULT_LINE_LENGTH); } catch (java.io.UnsupportedEncodingException e) { rd = new BufferedReader(new InputStreamReader(in), DEFAULT_LINE_LENGTH); } String factoryClassName; XPathFactory resultFactory = null; // See spec for provider-configuration files: http://java.sun.com/j2se/1.5.0/docs/guide/jar/jar.html#Provider%20Configuration%20File while (true) { try { factoryClassName = rd.readLine(); } catch (IOException x) { // No provider found break; } if (factoryClassName != null) { // Ignore comments in the provider-configuration file int hashIndex = factoryClassName.indexOf('#'); if (hashIndex != -1) { factoryClassName = factoryClassName.substring(0, hashIndex); } // Ignore leading and trailing whitespace factoryClassName = factoryClassName.trim(); // If there's no text left or if this was a blank line, go to the next one. if (factoryClassName.length() == 0) { continue; } try { // Found the right XPathFactory if its isObjectModelSupported(String uri) method returns true. XPathFactory foundFactory = createInstance(factoryClassName); if (foundFactory.isObjectModelSupported(uri)) { resultFactory = foundFactory; break; } } catch (Exception ignored) { } } else { break; } } IoUtils.closeQuietly(rd); return resultFactory; } }
public class class_name { private XPathFactory loadFromServicesFile(String uri, String resourceName, InputStream in) { if (debug) debugPrintln("Reading " + resourceName ); BufferedReader rd; try { rd = new BufferedReader(new InputStreamReader(in, "UTF-8"), DEFAULT_LINE_LENGTH); // depends on control dependency: [try], data = [none] } catch (java.io.UnsupportedEncodingException e) { rd = new BufferedReader(new InputStreamReader(in), DEFAULT_LINE_LENGTH); } // depends on control dependency: [catch], data = [none] String factoryClassName; XPathFactory resultFactory = null; // See spec for provider-configuration files: http://java.sun.com/j2se/1.5.0/docs/guide/jar/jar.html#Provider%20Configuration%20File while (true) { try { factoryClassName = rd.readLine(); // depends on control dependency: [try], data = [none] } catch (IOException x) { // No provider found break; } // depends on control dependency: [catch], data = [none] if (factoryClassName != null) { // Ignore comments in the provider-configuration file int hashIndex = factoryClassName.indexOf('#'); if (hashIndex != -1) { factoryClassName = factoryClassName.substring(0, hashIndex); // depends on control dependency: [if], data = [none] } // Ignore leading and trailing whitespace factoryClassName = factoryClassName.trim(); // depends on control dependency: [if], data = [none] // If there's no text left or if this was a blank line, go to the next one. if (factoryClassName.length() == 0) { continue; } try { // Found the right XPathFactory if its isObjectModelSupported(String uri) method returns true. XPathFactory foundFactory = createInstance(factoryClassName); if (foundFactory.isObjectModelSupported(uri)) { resultFactory = foundFactory; // depends on control dependency: [if], data = [none] break; } } catch (Exception ignored) { } // depends on control dependency: [catch], data = [none] } else { break; } } IoUtils.closeQuietly(rd); return resultFactory; } }
public class class_name { public Observable<ServiceResponse<RecommendationRuleInner>> getRuleDetailsByWebAppWithServiceResponseAsync(String resourceGroupName, String siteName, String name) { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (siteName == null) { throw new IllegalArgumentException("Parameter siteName is required and cannot be null."); } if (name == null) { throw new IllegalArgumentException("Parameter name is required and cannot be null."); } if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } if (this.client.apiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } final Boolean updateSeen = null; final String recommendationId = null; return service.getRuleDetailsByWebApp(resourceGroupName, siteName, name, this.client.subscriptionId(), updateSeen, recommendationId, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<RecommendationRuleInner>>>() { @Override public Observable<ServiceResponse<RecommendationRuleInner>> call(Response<ResponseBody> response) { try { ServiceResponse<RecommendationRuleInner> clientResponse = getRuleDetailsByWebAppDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } }
public class class_name { public Observable<ServiceResponse<RecommendationRuleInner>> getRuleDetailsByWebAppWithServiceResponseAsync(String resourceGroupName, String siteName, String name) { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (siteName == null) { throw new IllegalArgumentException("Parameter siteName is required and cannot be null."); } if (name == null) { throw new IllegalArgumentException("Parameter name is required and cannot be null."); } if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } if (this.client.apiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } final Boolean updateSeen = null; final String recommendationId = null; return service.getRuleDetailsByWebApp(resourceGroupName, siteName, name, this.client.subscriptionId(), updateSeen, recommendationId, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<RecommendationRuleInner>>>() { @Override public Observable<ServiceResponse<RecommendationRuleInner>> call(Response<ResponseBody> response) { try { ServiceResponse<RecommendationRuleInner> clientResponse = getRuleDetailsByWebAppDelegate(response); return Observable.just(clientResponse); // depends on control dependency: [try], data = [none] } catch (Throwable t) { return Observable.error(t); } // depends on control dependency: [catch], data = [none] } }); } }