code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { protected String getArguments(Object[] args) { if (args == null || args.length == 0) { return ""; } StringBuilder sb = new StringBuilder(); if (args.length == 1) { Object arg = args[0]; String param = getSingleArgParameterAsString(arg); String displayParam = getSingleArgDisplayParameter(param); if (arg instanceof String) { sb.append("\""); sb.append(displayParam); sb.append("\""); } else { sb.append(displayParam); } } else { for (int i = 0; i < args.length; i++) { Object arg = args[i]; boolean lastArg = i == args.length - 1; String param = getParameterAsString(arg); String displayParam = getDisplayParameter(param); if (arg instanceof String) { sb.append("\""); sb.append(displayParam); sb.append("\""); } else { sb.append(displayParam); } if (!lastArg) { sb.append(","); } } } return sb.toString(); } }
public class class_name { protected String getArguments(Object[] args) { if (args == null || args.length == 0) { return ""; // depends on control dependency: [if], data = [none] } StringBuilder sb = new StringBuilder(); if (args.length == 1) { Object arg = args[0]; String param = getSingleArgParameterAsString(arg); String displayParam = getSingleArgDisplayParameter(param); if (arg instanceof String) { sb.append("\""); // depends on control dependency: [if], data = [none] sb.append(displayParam); // depends on control dependency: [if], data = [none] sb.append("\""); // depends on control dependency: [if], data = [none] } else { sb.append(displayParam); // depends on control dependency: [if], data = [none] } } else { for (int i = 0; i < args.length; i++) { Object arg = args[i]; boolean lastArg = i == args.length - 1; String param = getParameterAsString(arg); String displayParam = getDisplayParameter(param); if (arg instanceof String) { sb.append("\""); // depends on control dependency: [if], data = [none] sb.append(displayParam); // depends on control dependency: [if], data = [none] sb.append("\""); // depends on control dependency: [if], data = [none] } else { sb.append(displayParam); // depends on control dependency: [if], data = [none] } if (!lastArg) { sb.append(","); // depends on control dependency: [if], data = [none] } } } return sb.toString(); } }
public class class_name { private void setAndValidateProperties(String systemDomain, String defaultAppDomain) { if (isConfigurationDefinedInFile()) { if ((systemDomain == null) || systemDomain.isEmpty()) { Tr.error(tc, "SECURITY_SERVICE_ERROR_MISSING_ATTRIBUTE", CFG_KEY_SYSTEM_DOMAIN); throw new IllegalArgumentException(Tr.formatMessage(tc, "SECURITY_SERVICE_ERROR_MISSING_ATTRIBUTE", CFG_KEY_SYSTEM_DOMAIN)); } this.cfgSystemDomain = systemDomain; if ((defaultAppDomain == null) || defaultAppDomain.isEmpty()) { this.cfgDefaultAppDomain = systemDomain; } else { this.cfgDefaultAppDomain = defaultAppDomain; } } } }
public class class_name { private void setAndValidateProperties(String systemDomain, String defaultAppDomain) { if (isConfigurationDefinedInFile()) { if ((systemDomain == null) || systemDomain.isEmpty()) { Tr.error(tc, "SECURITY_SERVICE_ERROR_MISSING_ATTRIBUTE", CFG_KEY_SYSTEM_DOMAIN); // depends on control dependency: [if], data = [none] throw new IllegalArgumentException(Tr.formatMessage(tc, "SECURITY_SERVICE_ERROR_MISSING_ATTRIBUTE", CFG_KEY_SYSTEM_DOMAIN)); } this.cfgSystemDomain = systemDomain; // depends on control dependency: [if], data = [none] if ((defaultAppDomain == null) || defaultAppDomain.isEmpty()) { this.cfgDefaultAppDomain = systemDomain; // depends on control dependency: [if], data = [none] } else { this.cfgDefaultAppDomain = defaultAppDomain; // depends on control dependency: [if], data = [none] } } } }
public class class_name { private void onDelete(EventLog log) { if (deleteEvents == null) { deleteEvents = new ConcurrentHashMap<Object, EventLog>(); } deleteEvents.put(log.getEntityId(), log); } }
public class class_name { private void onDelete(EventLog log) { if (deleteEvents == null) { deleteEvents = new ConcurrentHashMap<Object, EventLog>(); // depends on control dependency: [if], data = [none] } deleteEvents.put(log.getEntityId(), log); } }
public class class_name { @Override public boolean hasRemoteObjectWithPrefix(String appName, String moduleName, String compName, String namespaceString, String name) throws NamingException { boolean b = false; NamingConstants.JavaColonNamespace namespace = NamingConstants.JavaColonNamespace.fromName(namespaceString); ComponentMetaData cmd = getCMD(appName, moduleName, compName, namespace); try { ComponentMetaDataAccessorImpl.getComponentMetaDataAccessor().beginContext(cmd); Iterator<RemoteJavaColonNamingHelper> remoteJCNHelpers = remoteJavaColonNamingHelpers.getServices(); while (remoteJCNHelpers.hasNext()) { RemoteJavaColonNamingHelper helper = remoteJCNHelpers.next(); b = helper.hasRemoteObjectWithPrefix(namespace, name); if (b == true) break; } } finally { ComponentMetaDataAccessorImpl.getComponentMetaDataAccessor().endContext(); } return b; } }
public class class_name { @Override public boolean hasRemoteObjectWithPrefix(String appName, String moduleName, String compName, String namespaceString, String name) throws NamingException { boolean b = false; NamingConstants.JavaColonNamespace namespace = NamingConstants.JavaColonNamespace.fromName(namespaceString); ComponentMetaData cmd = getCMD(appName, moduleName, compName, namespace); try { ComponentMetaDataAccessorImpl.getComponentMetaDataAccessor().beginContext(cmd); Iterator<RemoteJavaColonNamingHelper> remoteJCNHelpers = remoteJavaColonNamingHelpers.getServices(); while (remoteJCNHelpers.hasNext()) { RemoteJavaColonNamingHelper helper = remoteJCNHelpers.next(); b = helper.hasRemoteObjectWithPrefix(namespace, name); // depends on control dependency: [while], data = [none] if (b == true) break; } } finally { ComponentMetaDataAccessorImpl.getComponentMetaDataAccessor().endContext(); } return b; } }
public class class_name { public <X> X invokeOnInstance(Object instance, Object... parameters) throws IllegalArgumentException, SecurityException, IllegalAccessException, InvocationTargetException, NoSuchMethodException { final Map<Class<?>, Method> methods = this.methods; Method method = methods.get(instance.getClass()); if (method == null) { // the same method may be written to the map twice, but that is ok // lookupMethod is very slow Method delegate = annotatedMethod.getJavaMember(); method = SecurityActions.lookupMethod(instance.getClass(), delegate.getName(), delegate.getParameterTypes()); SecurityActions.ensureAccessible(method); synchronized (this) { final Map<Class<?>, Method> newMethods = new HashMap<Class<?>, Method>(methods); newMethods.put(instance.getClass(), method); this.methods = WeldCollections.immutableMapView(newMethods); } } return cast(method.invoke(instance, parameters)); } }
public class class_name { public <X> X invokeOnInstance(Object instance, Object... parameters) throws IllegalArgumentException, SecurityException, IllegalAccessException, InvocationTargetException, NoSuchMethodException { final Map<Class<?>, Method> methods = this.methods; Method method = methods.get(instance.getClass()); if (method == null) { // the same method may be written to the map twice, but that is ok // lookupMethod is very slow Method delegate = annotatedMethod.getJavaMember(); method = SecurityActions.lookupMethod(instance.getClass(), delegate.getName(), delegate.getParameterTypes()); // depends on control dependency: [if], data = [none] SecurityActions.ensureAccessible(method); // depends on control dependency: [if], data = [(method] synchronized (this) { // depends on control dependency: [if], data = [none] final Map<Class<?>, Method> newMethods = new HashMap<Class<?>, Method>(methods); newMethods.put(instance.getClass(), method); this.methods = WeldCollections.immutableMapView(newMethods); } } return cast(method.invoke(instance, parameters)); } }
public class class_name { public java.util.List<String> getDeploymentStatusMessages() { if (deploymentStatusMessages == null) { deploymentStatusMessages = new com.amazonaws.internal.SdkInternalList<String>(); } return deploymentStatusMessages; } }
public class class_name { public java.util.List<String> getDeploymentStatusMessages() { if (deploymentStatusMessages == null) { deploymentStatusMessages = new com.amazonaws.internal.SdkInternalList<String>(); // depends on control dependency: [if], data = [none] } return deploymentStatusMessages; } }
public class class_name { public void actionPerformed(ActionEvent rEvent) { try{ // get the control that has fired the event, XControl xControl = (XControl) UnoRuntime.queryInterface(XControl.class, rEvent.Source); XControlModel xControlModel = xControl.getModel(); XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xControlModel); String sName = (String) xPSet.getPropertyValue("Name"); // just in case the listener has been added to several controls, // we make sure we refer to the right one if (sName.equals("CommandButton1")) { //... } }catch (com.sun.star.uno.Exception ex){ /* perform individual exception handling here. * Possible exception types are: * com.sun.star.lang.WrappedTargetException, * com.sun.star.beans.UnknownPropertyException, * com.sun.star.uno.Exception */ ex.printStackTrace(System.out); } } }
public class class_name { public void actionPerformed(ActionEvent rEvent) { try{ // get the control that has fired the event, XControl xControl = (XControl) UnoRuntime.queryInterface(XControl.class, rEvent.Source); XControlModel xControlModel = xControl.getModel(); XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xControlModel); String sName = (String) xPSet.getPropertyValue("Name"); // just in case the listener has been added to several controls, // we make sure we refer to the right one if (sName.equals("CommandButton1")) { //... } }catch (com.sun.star.uno.Exception ex){ /* perform individual exception handling here. * Possible exception types are: * com.sun.star.lang.WrappedTargetException, * com.sun.star.beans.UnknownPropertyException, * com.sun.star.uno.Exception */ ex.printStackTrace(System.out); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public ResultMatcher isArray() { return new AbstractResultMatcher(path, configuration) { public void doMatch(Object actual) { isPresent(actual); Node node = getNode(actual); if (node.getNodeType() != ARRAY) { failOnType(node, "an array"); } } }; } }
public class class_name { public ResultMatcher isArray() { return new AbstractResultMatcher(path, configuration) { public void doMatch(Object actual) { isPresent(actual); Node node = getNode(actual); if (node.getNodeType() != ARRAY) { failOnType(node, "an array"); // depends on control dependency: [if], data = [none] } } }; } }
public class class_name { public static void setDebugConfigs(OneProperties debugConfigsObj, String debugConfigAbsoluteClassPath) { if (debugConfigsObj != null) { Configs.debugConfigs = debugConfigsObj; } if (debugConfigAbsoluteClassPath != null) { Configs.debugConfigAbsoluteClassPath = debugConfigAbsoluteClassPath; Configs.debugConfigs.initConfigs(Configs.debugConfigAbsoluteClassPath); } else if (debugConfigs != null) { // use new systemConfigs, need initConfigs. Configs.debugConfigs.initConfigs(Configs.debugConfigAbsoluteClassPath); } } }
public class class_name { public static void setDebugConfigs(OneProperties debugConfigsObj, String debugConfigAbsoluteClassPath) { if (debugConfigsObj != null) { Configs.debugConfigs = debugConfigsObj; // depends on control dependency: [if], data = [none] } if (debugConfigAbsoluteClassPath != null) { Configs.debugConfigAbsoluteClassPath = debugConfigAbsoluteClassPath; // depends on control dependency: [if], data = [none] Configs.debugConfigs.initConfigs(Configs.debugConfigAbsoluteClassPath); // depends on control dependency: [if], data = [none] } else if (debugConfigs != null) { // use new systemConfigs, need initConfigs. Configs.debugConfigs.initConfigs(Configs.debugConfigAbsoluteClassPath); // depends on control dependency: [if], data = [none] } } }
public class class_name { protected String getPath(String urlName) { if (urlName.equals("")) { return m_entry.getSitePath(); } return CmsResource.getParentFolder(m_entry.getSitePath()) + urlName + "/"; } }
public class class_name { protected String getPath(String urlName) { if (urlName.equals("")) { return m_entry.getSitePath(); // depends on control dependency: [if], data = [none] } return CmsResource.getParentFolder(m_entry.getSitePath()) + urlName + "/"; } }
public class class_name { public static boolean getHandleErrorWithFatalErrorPageFactory() { Boolean parameterValue = get().getBoolean(HANDLE_ERROR_WITH_FATAL_PAGE_FACTORY, null); if (parameterValue != null) { return parameterValue; } // fall-back to the old parameter value if the new value is not set. return get().getBoolean(HANDLE_ERROR_WITH_FATAL_PAGE_FACTORY_DEPRECATED, false); } }
public class class_name { public static boolean getHandleErrorWithFatalErrorPageFactory() { Boolean parameterValue = get().getBoolean(HANDLE_ERROR_WITH_FATAL_PAGE_FACTORY, null); if (parameterValue != null) { return parameterValue; // depends on control dependency: [if], data = [none] } // fall-back to the old parameter value if the new value is not set. return get().getBoolean(HANDLE_ERROR_WITH_FATAL_PAGE_FACTORY_DEPRECATED, false); } }
public class class_name { public double[][] Kernel2D(int size) { if (((size % 2) == 0) || (size < 3) || (size > 101)) { try { throw new Exception("Wrong size"); } catch (Exception e) { e.printStackTrace(); } } int r = size / 2; double[][] kernel = new double[size][size]; // compute kernel double sum = 0; for (int y = -r, i = 0; i < size; y++, i++) { for (int x = -r, j = 0; j < size; x++, j++) { kernel[i][j] = Function2D(x, y); sum += kernel[i][j]; } } for (int i = 0; i < kernel.length; i++) { for (int j = 0; j < kernel[0].length; j++) { kernel[i][j] /= sum; } } return kernel; } }
public class class_name { public double[][] Kernel2D(int size) { if (((size % 2) == 0) || (size < 3) || (size > 101)) { try { throw new Exception("Wrong size"); } catch (Exception e) { e.printStackTrace(); } // depends on control dependency: [catch], data = [none] } int r = size / 2; double[][] kernel = new double[size][size]; // compute kernel double sum = 0; for (int y = -r, i = 0; i < size; y++, i++) { for (int x = -r, j = 0; j < size; x++, j++) { kernel[i][j] = Function2D(x, y); // depends on control dependency: [for], data = [x] sum += kernel[i][j]; // depends on control dependency: [for], data = [none] } } for (int i = 0; i < kernel.length; i++) { for (int j = 0; j < kernel[0].length; j++) { kernel[i][j] /= sum; // depends on control dependency: [for], data = [j] } } return kernel; } }
public class class_name { public static void toGeojsonMultiLineString(MultiLineString multiLineString, StringBuilder sb) { sb.append("{\"type\":\"MultiLineString\",\"coordinates\":["); for (int i = 0; i < multiLineString.getNumGeometries(); i++) { toGeojsonCoordinates(multiLineString.getGeometryN(i).getCoordinates(), sb); if (i < multiLineString.getNumGeometries() - 1) { sb.append(","); } } sb.append("]}"); } }
public class class_name { public static void toGeojsonMultiLineString(MultiLineString multiLineString, StringBuilder sb) { sb.append("{\"type\":\"MultiLineString\",\"coordinates\":["); for (int i = 0; i < multiLineString.getNumGeometries(); i++) { toGeojsonCoordinates(multiLineString.getGeometryN(i).getCoordinates(), sb); // depends on control dependency: [for], data = [i] if (i < multiLineString.getNumGeometries() - 1) { sb.append(","); // depends on control dependency: [if], data = [none] } } sb.append("]}"); } }
public class class_name { @SuppressWarnings("unchecked") public static <T> T getFieldValue(Object object, String fieldName) { if(object instanceof Class<?>) { return getFieldValue(null, (Class<?>)object, fieldName, null, false); } Class<?> clazz = object.getClass(); try { Field f = clazz.getDeclaredField(fieldName); f.setAccessible(true); return (T)f.get(Modifier.isStatic(f.getModifiers()) ? null : object); } catch(java.lang.NoSuchFieldException e) { throw new NoSuchBeingException("Missing field |%s| from |%s|.", fieldName, clazz); } catch(IllegalAccessException e) { throw new BugError(e); } } }
public class class_name { @SuppressWarnings("unchecked") public static <T> T getFieldValue(Object object, String fieldName) { if(object instanceof Class<?>) { return getFieldValue(null, (Class<?>)object, fieldName, null, false); // depends on control dependency: [if], data = [)] } Class<?> clazz = object.getClass(); try { Field f = clazz.getDeclaredField(fieldName); f.setAccessible(true); // depends on control dependency: [try], data = [none] return (T)f.get(Modifier.isStatic(f.getModifiers()) ? null : object); // depends on control dependency: [try], data = [none] } catch(java.lang.NoSuchFieldException e) { throw new NoSuchBeingException("Missing field |%s| from |%s|.", fieldName, clazz); } // depends on control dependency: [catch], data = [none] catch(IllegalAccessException e) { throw new BugError(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public int skipWhitespace() { int length = 0; while (CharType.isWhitespace(charAt(offset + length))) { length++; } return offset + length; } }
public class class_name { public int skipWhitespace() { int length = 0; while (CharType.isWhitespace(charAt(offset + length))) { length++; // depends on control dependency: [while], data = [none] } return offset + length; } }
public class class_name { private static List<Class<?>> findClasses(final File iDirectory, String iPackageName, ClassLoader iClassLoader) throws ClassNotFoundException { final List<Class<?>> classes = new ArrayList<Class<?>>(); if (!iDirectory.exists()) return classes; iPackageName += "." + iDirectory.getName(); String className; final File[] files = iDirectory.listFiles(); if (files != null) for (File file : files) { if (file.isDirectory()) { if (file.getName().contains(".")) continue; classes.addAll(findClasses(file, iPackageName, iClassLoader)); } else if (file.getName().endsWith(CLASS_EXTENSION)) { className = file.getName().substring(0, file.getName().length() - CLASS_EXTENSION.length()); classes.add(Class.forName(iPackageName + '.' + className, true, iClassLoader)); } } return classes; } }
public class class_name { private static List<Class<?>> findClasses(final File iDirectory, String iPackageName, ClassLoader iClassLoader) throws ClassNotFoundException { final List<Class<?>> classes = new ArrayList<Class<?>>(); if (!iDirectory.exists()) return classes; iPackageName += "." + iDirectory.getName(); String className; final File[] files = iDirectory.listFiles(); if (files != null) for (File file : files) { if (file.isDirectory()) { if (file.getName().contains(".")) continue; classes.addAll(findClasses(file, iPackageName, iClassLoader)); // depends on control dependency: [if], data = [none] } else if (file.getName().endsWith(CLASS_EXTENSION)) { className = file.getName().substring(0, file.getName().length() - CLASS_EXTENSION.length()); // depends on control dependency: [if], data = [none] classes.add(Class.forName(iPackageName + '.' + className, true, iClassLoader)); // depends on control dependency: [if], data = [none] } } return classes; } }
public class class_name { private static int escapeFunctionArguments(StringBuilder newsql, String functionName, char[] sql, int i, boolean stdStrings) throws SQLException { // Maximum arity of functions in EscapedFunctions is 3 List<CharSequence> parsedArgs = new ArrayList<CharSequence>(3); while (true) { StringBuilder arg = new StringBuilder(); int lastPos = i; i = parseSql(sql, i, arg, true, stdStrings); if (i != lastPos) { parsedArgs.add(arg); } if (i >= sql.length // should not happen || sql[i] != ',') { break; } i++; } Method method = EscapedFunctions2.getFunction(functionName); if (method == null) { newsql.append(functionName); EscapedFunctions2.appendCall(newsql, "(", ",", ")", parsedArgs); return i; } try { method.invoke(null, newsql, parsedArgs); } catch (InvocationTargetException e) { Throwable targetException = e.getTargetException(); if (targetException instanceof SQLException) { throw (SQLException) targetException; } else { throw new PSQLException(targetException.getMessage(), PSQLState.SYSTEM_ERROR); } } catch (IllegalAccessException e) { throw new PSQLException(e.getMessage(), PSQLState.SYSTEM_ERROR); } return i; } }
public class class_name { private static int escapeFunctionArguments(StringBuilder newsql, String functionName, char[] sql, int i, boolean stdStrings) throws SQLException { // Maximum arity of functions in EscapedFunctions is 3 List<CharSequence> parsedArgs = new ArrayList<CharSequence>(3); while (true) { StringBuilder arg = new StringBuilder(); int lastPos = i; i = parseSql(sql, i, arg, true, stdStrings); if (i != lastPos) { parsedArgs.add(arg); // depends on control dependency: [if], data = [none] } if (i >= sql.length // should not happen || sql[i] != ',') { break; } i++; } Method method = EscapedFunctions2.getFunction(functionName); if (method == null) { newsql.append(functionName); EscapedFunctions2.appendCall(newsql, "(", ",", ")", parsedArgs); return i; } try { method.invoke(null, newsql, parsedArgs); } catch (InvocationTargetException e) { Throwable targetException = e.getTargetException(); if (targetException instanceof SQLException) { throw (SQLException) targetException; } else { throw new PSQLException(targetException.getMessage(), PSQLState.SYSTEM_ERROR); } } catch (IllegalAccessException e) { throw new PSQLException(e.getMessage(), PSQLState.SYSTEM_ERROR); } return i; } }
public class class_name { public Map<Change, PatchSet> getChanges(GerritQueryHandler gerritQueryHandler) { if (StringUtils.isEmpty(name)) { logger.error("Topic name can not be empty"); return Collections.emptyMap(); } if (changes == null) { Map<Change, PatchSet> temp = new HashMap<Change, PatchSet>(); try { List<JSONObject> jsonList = gerritQueryHandler.queryCurrentPatchSets("topic:{" + name + "}"); for (JSONObject json : jsonList) { if (json.has("type") && "stats".equalsIgnoreCase(json.getString("type"))) { continue; } if (json.has("currentPatchSet")) { JSONObject currentPatchSet = json.getJSONObject("currentPatchSet"); temp.put(new Change(json), new PatchSet(currentPatchSet)); } } changes = temp; } catch (IOException e) { logger.error("IOException occured. ", e); } catch (GerritQueryException e) { logger.error("Bad query. ", e); } } return changes; } }
public class class_name { public Map<Change, PatchSet> getChanges(GerritQueryHandler gerritQueryHandler) { if (StringUtils.isEmpty(name)) { logger.error("Topic name can not be empty"); // depends on control dependency: [if], data = [none] return Collections.emptyMap(); // depends on control dependency: [if], data = [none] } if (changes == null) { Map<Change, PatchSet> temp = new HashMap<Change, PatchSet>(); try { List<JSONObject> jsonList = gerritQueryHandler.queryCurrentPatchSets("topic:{" + name + "}"); for (JSONObject json : jsonList) { if (json.has("type") && "stats".equalsIgnoreCase(json.getString("type"))) { continue; } if (json.has("currentPatchSet")) { JSONObject currentPatchSet = json.getJSONObject("currentPatchSet"); temp.put(new Change(json), new PatchSet(currentPatchSet)); // depends on control dependency: [if], data = [none] } } changes = temp; // depends on control dependency: [try], data = [none] } catch (IOException e) { logger.error("IOException occured. ", e); } catch (GerritQueryException e) { // depends on control dependency: [catch], data = [none] logger.error("Bad query. ", e); } // depends on control dependency: [catch], data = [none] } return changes; } }
public class class_name { public static AnnotatedType<?> getDeclaringAnnotatedType(Annotated annotated) { if (annotated == null) { throw new IllegalArgumentException("Annotated cannot be null"); } if (annotated instanceof AnnotatedType<?>) { return cast(annotated); } if (annotated instanceof AnnotatedMember<?>) { return Reflections.<AnnotatedMember<?>>cast(annotated).getDeclaringType(); } if (annotated instanceof AnnotatedParameter<?>) { return getDeclaringAnnotatedType(Reflections.<AnnotatedParameter<?>>cast(annotated).getDeclaringCallable()); } throw new IllegalArgumentException("Unrecognized annotated " + annotated); } }
public class class_name { public static AnnotatedType<?> getDeclaringAnnotatedType(Annotated annotated) { if (annotated == null) { throw new IllegalArgumentException("Annotated cannot be null"); } if (annotated instanceof AnnotatedType<?>) { return cast(annotated); // depends on control dependency: [if], data = [)] } if (annotated instanceof AnnotatedMember<?>) { return Reflections.<AnnotatedMember<?>>cast(annotated).getDeclaringType(); // depends on control dependency: [if], data = [)] } if (annotated instanceof AnnotatedParameter<?>) { return getDeclaringAnnotatedType(Reflections.<AnnotatedParameter<?>>cast(annotated).getDeclaringCallable()); } throw new IllegalArgumentException("Unrecognized annotated " + annotated); // depends on control dependency: [if], data = [none] } }
public class class_name { @Override public void taskStarting() throws RejectedExecutionException { // Deserialization path. By the time we are here the metadata should already be present. if (metaDataIdentifier != null && metadataToPropagate == null) metadataToPropagate = (ComponentMetaData) jeeMetadataContextProvider.metadataIdentifierService.getMetaData(metaDataIdentifier); if (metadataToPropagate == null) compMetadataAccessor.beginDefaultContext(); else { for (Iterator<ComponentMetaDataDecorator> it = jeeMetadataContextProvider.componentMetadataDecoratorRefs.getServices(); it.hasNext();) { ComponentMetaDataDecorator decorator = it.next(); ComponentMetaData metadata = decorator.decorate(metadataToPropagate); if (metadata != null) { compMetadataAccessor.beginContext(metadata); return; } } compMetadataAccessor.beginContext(metadataToPropagate); } } }
public class class_name { @Override public void taskStarting() throws RejectedExecutionException { // Deserialization path. By the time we are here the metadata should already be present. if (metaDataIdentifier != null && metadataToPropagate == null) metadataToPropagate = (ComponentMetaData) jeeMetadataContextProvider.metadataIdentifierService.getMetaData(metaDataIdentifier); if (metadataToPropagate == null) compMetadataAccessor.beginDefaultContext(); else { for (Iterator<ComponentMetaDataDecorator> it = jeeMetadataContextProvider.componentMetadataDecoratorRefs.getServices(); it.hasNext();) { ComponentMetaDataDecorator decorator = it.next(); ComponentMetaData metadata = decorator.decorate(metadataToPropagate); if (metadata != null) { compMetadataAccessor.beginContext(metadata); // depends on control dependency: [if], data = [(metadata] return; // depends on control dependency: [if], data = [none] } } compMetadataAccessor.beginContext(metadataToPropagate); } } }
public class class_name { private static Set<Long> getFeedItemIdsFromArgument(Function function) { if (function.getLhsOperand().length == 1 && function.getLhsOperand(0) instanceof RequestContextOperand) { RequestContextOperand requestContextOperand = (RequestContextOperand) function.getLhsOperand(0); if (RequestContextOperandContextType.FEED_ITEM_ID.equals( requestContextOperand.getContextType()) && FunctionOperator.IN.equals(function.getOperator())) { return Arrays.stream(function.getRhsOperand()) .filter(ConstantOperand.class::isInstance) .map(argument -> ((ConstantOperand) argument).getLongValue()) .collect(Collectors.toSet()); } } return new HashSet<>(); } }
public class class_name { private static Set<Long> getFeedItemIdsFromArgument(Function function) { if (function.getLhsOperand().length == 1 && function.getLhsOperand(0) instanceof RequestContextOperand) { RequestContextOperand requestContextOperand = (RequestContextOperand) function.getLhsOperand(0); if (RequestContextOperandContextType.FEED_ITEM_ID.equals( requestContextOperand.getContextType()) && FunctionOperator.IN.equals(function.getOperator())) { return Arrays.stream(function.getRhsOperand()) .filter(ConstantOperand.class::isInstance) .map(argument -> ((ConstantOperand) argument).getLongValue()) .collect(Collectors.toSet()); // depends on control dependency: [if], data = [none] } } return new HashSet<>(); } }
public class class_name { @Override public int findIn(Source source) { if (schemaless) { return -1; } int start = source.getOffset(); int sourceLength = source.length(); int index; int length = -1; do { index = sourceLength; // Prepare URL's prefixes. List<String> prefixes = preparePrefixes(); // Find nearest prefix for (String prefix : prefixes) { int ni = source.findFrom(start, prefix.toCharArray(), true); if (ni > 0 && ni < index) { index = ni; } } // Try to parse it if (index < sourceLength) { length = parseLength(source, index, null); if (length < 0) { start = index + 1; } } } while (length < 0 && index < sourceLength); if (length >= 0) { return index; } else { return -1; } } }
public class class_name { @Override public int findIn(Source source) { if (schemaless) { return -1; // depends on control dependency: [if], data = [none] } int start = source.getOffset(); int sourceLength = source.length(); int index; int length = -1; do { index = sourceLength; // Prepare URL's prefixes. List<String> prefixes = preparePrefixes(); // Find nearest prefix for (String prefix : prefixes) { int ni = source.findFrom(start, prefix.toCharArray(), true); if (ni > 0 && ni < index) { index = ni; // depends on control dependency: [if], data = [none] } } // Try to parse it if (index < sourceLength) { length = parseLength(source, index, null); // depends on control dependency: [if], data = [none] if (length < 0) { start = index + 1; // depends on control dependency: [if], data = [none] } } } while (length < 0 && index < sourceLength); if (length >= 0) { return index; // depends on control dependency: [if], data = [none] } else { return -1; // depends on control dependency: [if], data = [none] } } }
public class class_name { protected void setSyncConfig(SyncToolConfig syncConfig) { this.syncConfig = syncConfig; this.syncConfig.setVersion(version); File exclusionListFile = this.syncConfig.getExcludeList(); if (exclusionListFile != null) { this.fileExclusionManager = new FileExclusionManager(exclusionListFile); } else { this.fileExclusionManager = new FileExclusionManager(); } ChangedList.getInstance() .setFileExclusionManager(this.fileExclusionManager); } }
public class class_name { protected void setSyncConfig(SyncToolConfig syncConfig) { this.syncConfig = syncConfig; this.syncConfig.setVersion(version); File exclusionListFile = this.syncConfig.getExcludeList(); if (exclusionListFile != null) { this.fileExclusionManager = new FileExclusionManager(exclusionListFile); // depends on control dependency: [if], data = [(exclusionListFile] } else { this.fileExclusionManager = new FileExclusionManager(); // depends on control dependency: [if], data = [none] } ChangedList.getInstance() .setFileExclusionManager(this.fileExclusionManager); } }
public class class_name { public Collection<String> getProcessNameContainsCount(String name) { List<String> retProcessList = new ArrayList<String>(); // Get the list of processes List<Integer> processList = getProcessList(); for (Integer proc : processList) { // Get information for each process ProcessInfo p = new ProcessInfo(proc); if (constructProcessInfo(p, procfsDir) != null) { if (p.getCmdLine(procfsDir).contains(name)) { StringBuilder processSb = new StringBuilder(); processSb.append(String.format(PROCESSTREE_DUMP_FORMAT, p.getPid(), p.getPpid(), p.getPgrpId(), p.getSessionId(), p.getName(), p.getUtime(), p.getStime(), p.getVmem(), p.getRssmemPage(), p.getCmdLine(procfsDir))); retProcessList.add(processSb.toString()); } } } return retProcessList; } }
public class class_name { public Collection<String> getProcessNameContainsCount(String name) { List<String> retProcessList = new ArrayList<String>(); // Get the list of processes List<Integer> processList = getProcessList(); for (Integer proc : processList) { // Get information for each process ProcessInfo p = new ProcessInfo(proc); if (constructProcessInfo(p, procfsDir) != null) { if (p.getCmdLine(procfsDir).contains(name)) { StringBuilder processSb = new StringBuilder(); processSb.append(String.format(PROCESSTREE_DUMP_FORMAT, p.getPid(), p.getPpid(), p.getPgrpId(), p.getSessionId(), p.getName(), p.getUtime(), p.getStime(), p.getVmem(), p.getRssmemPage(), p.getCmdLine(procfsDir))); // depends on control dependency: [if], data = [none] retProcessList.add(processSb.toString()); // depends on control dependency: [if], data = [none] } } } return retProcessList; } }
public class class_name { private static void queueTask(long threadId, Runnable toRun){ assert control.isHeldByCurrentThread(); assert threadId != currentThread; //(get queue) if(!threadedLogQueue.containsKey(threadId)){ threadedLogQueue.put(threadId, new LinkedList<Runnable>()); } Queue<Runnable> threadLogQueue = threadedLogQueue.get(threadId); //(add to queue) threadLogQueue.offer( toRun ); //(register this thread as waiting) if(!threadsWaiting.contains(threadId)){ threadsWaiting.offer(threadId); assert threadedLogQueue.get(threadId) != null && !threadedLogQueue.get(threadId).isEmpty(); } } }
public class class_name { private static void queueTask(long threadId, Runnable toRun){ assert control.isHeldByCurrentThread(); assert threadId != currentThread; //(get queue) if(!threadedLogQueue.containsKey(threadId)){ threadedLogQueue.put(threadId, new LinkedList<Runnable>()); // depends on control dependency: [if], data = [none] } Queue<Runnable> threadLogQueue = threadedLogQueue.get(threadId); //(add to queue) threadLogQueue.offer( toRun ); //(register this thread as waiting) if(!threadsWaiting.contains(threadId)){ threadsWaiting.offer(threadId); // depends on control dependency: [if], data = [none] assert threadedLogQueue.get(threadId) != null && !threadedLogQueue.get(threadId).isEmpty(); // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override public Transformed<Val<Expression>> transform(String field, String operator, Val<Expression> arg, int index, int count, EbeanExprInvoker invoker, QueryExprMeta parent) { switch (operator) { case "eq": case "ne": case "ieq": case "gt": case "ge": case "lt": case "le": case "startsWith": case "istartsWith": case "endsWith": case "iendsWith": case "contains": case "icontains": case "id": case "in": case "notIn": case "exists": case "notExists": if (count != 1) { throw new QuerySyntaxException(Messages.get("dsl.arguments.error0", operator)); } break; case "between": if (count != 2) { throw new QuerySyntaxException(Messages.get("dsl.arguments.error1", operator)); } break; case "filter": case "not": case "select": if (count < 1) { throw new QuerySyntaxException(Messages.get("dsl.arguments.error2", operator, ">", "1")); } break; case "option": String argStr = arg.string(); if (ArrayUtils.contains(OPT_STR_ARG, argStr)) { arg = Val.of(MapExpression.of(argStr, null)); } break; } return Transformed.succ(this, arg); } }
public class class_name { @Override public Transformed<Val<Expression>> transform(String field, String operator, Val<Expression> arg, int index, int count, EbeanExprInvoker invoker, QueryExprMeta parent) { switch (operator) { case "eq": case "ne": case "ieq": case "gt": case "ge": case "lt": case "le": case "startsWith": case "istartsWith": case "endsWith": case "iendsWith": case "contains": case "icontains": case "id": case "in": case "notIn": case "exists": case "notExists": if (count != 1) { throw new QuerySyntaxException(Messages.get("dsl.arguments.error0", operator)); } break; case "between": if (count != 2) { throw new QuerySyntaxException(Messages.get("dsl.arguments.error1", operator)); } break; case "filter": case "not": case "select": if (count < 1) { throw new QuerySyntaxException(Messages.get("dsl.arguments.error2", operator, ">", "1")); } break; case "option": String argStr = arg.string(); if (ArrayUtils.contains(OPT_STR_ARG, argStr)) { arg = Val.of(MapExpression.of(argStr, null)); // depends on control dependency: [if], data = [none] } break; } return Transformed.succ(this, arg); } }
public class class_name { public void setSystemPropertiesMode(String pMode) { systemPropertyMode = SystemPropertyMode.fromMode(pMode); if (systemPropertyMode == null) { systemPropertyMode = SystemPropertyMode.MODE_NEVER; } } }
public class class_name { public void setSystemPropertiesMode(String pMode) { systemPropertyMode = SystemPropertyMode.fromMode(pMode); if (systemPropertyMode == null) { systemPropertyMode = SystemPropertyMode.MODE_NEVER; // depends on control dependency: [if], data = [none] } } }
public class class_name { private static boolean isIPv4MappedAddress(final byte[] addr) { if (addr.length < INADDR16SZ) { return false; } return addr[0] == 0x00 && addr[1] == 0x00 && addr[2] == 0x00 && addr[3] == 0x00 && addr[4] == 0x00 && addr[5] == 0x00 && addr[6] == 0x00 && addr[7] == 0x00 && addr[8] == 0x00 && addr[9] == 0x00 && addr[10] == (byte) 0xff && addr[11] == (byte) 0xff; } }
public class class_name { private static boolean isIPv4MappedAddress(final byte[] addr) { if (addr.length < INADDR16SZ) { return false; // depends on control dependency: [if], data = [none] } return addr[0] == 0x00 && addr[1] == 0x00 && addr[2] == 0x00 && addr[3] == 0x00 && addr[4] == 0x00 && addr[5] == 0x00 && addr[6] == 0x00 && addr[7] == 0x00 && addr[8] == 0x00 && addr[9] == 0x00 && addr[10] == (byte) 0xff && addr[11] == (byte) 0xff; } }
public class class_name { public static synchronized VelocityEngine getVelocityEngine() { if (engine == null) { String fileTemplates = ConfigurationProperties.getVelocityFileTemplates(); boolean cacheTemplates = ConfigurationProperties.getVelocityCacheTemplates(); VelocityEngine newEngine = new VelocityEngine(); Properties props = new Properties(); // Configure the velocity template differently according to whether we are in // "source mode" or not if (fileTemplates != null && !"".equals(fileTemplates)) { // Source mode LOG.info("Velocity engine running in source mode from " + fileTemplates); props.setProperty("resource.loader", "file,class"); props.setProperty("file.resource.loader.path", fileTemplates); props.setProperty("file.resource.loader.cache", "false"); props.setProperty("file.resource.loader.modificationCheckInterval", "2"); props.setProperty("class.resource.loader.cache", "false"); props.setProperty("class.resource.loader.modificationCheckInterval", "2"); props.setProperty("class.resource.loader.class", "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader"); } else { String cache = String.valueOf(cacheTemplates); props.setProperty("class.resource.loader.cache", cache); props.setProperty("resource.loader", "class"); props.setProperty("class.resource.loader.class", "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader"); } // Setup commons logging for velocity props.setProperty(RuntimeConstants.RUNTIME_LOG_LOGSYSTEM_CLASS, "com.github.bordertech.wcomponents.velocity.VelocityLogger"); // Set up access to the common velocity macros. props.setProperty(RuntimeConstants.VM_LIBRARY, ConfigurationProperties.getVelocityMacroLibrary()); try { if (LOG.isInfoEnabled()) { // Dump properties StringWriter writer = new StringWriter(); props.list(new PrintWriter(writer)); LOG.info("Configuring velocity with the following properties...\n" + writer); } newEngine.init(props); } catch (Exception ex) { throw new SystemException("Failed to configure VelocityEngine", ex); } engine = newEngine; } return engine; } }
public class class_name { public static synchronized VelocityEngine getVelocityEngine() { if (engine == null) { String fileTemplates = ConfigurationProperties.getVelocityFileTemplates(); boolean cacheTemplates = ConfigurationProperties.getVelocityCacheTemplates(); VelocityEngine newEngine = new VelocityEngine(); Properties props = new Properties(); // Configure the velocity template differently according to whether we are in // "source mode" or not if (fileTemplates != null && !"".equals(fileTemplates)) { // Source mode LOG.info("Velocity engine running in source mode from " + fileTemplates); // depends on control dependency: [if], data = [none] props.setProperty("resource.loader", "file,class"); // depends on control dependency: [if], data = [none] props.setProperty("file.resource.loader.path", fileTemplates); // depends on control dependency: [if], data = [none] props.setProperty("file.resource.loader.cache", "false"); // depends on control dependency: [if], data = [none] props.setProperty("file.resource.loader.modificationCheckInterval", "2"); // depends on control dependency: [if], data = [none] props.setProperty("class.resource.loader.cache", "false"); // depends on control dependency: [if], data = [none] props.setProperty("class.resource.loader.modificationCheckInterval", "2"); // depends on control dependency: [if], data = [none] props.setProperty("class.resource.loader.class", "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader"); // depends on control dependency: [if], data = [none] } else { String cache = String.valueOf(cacheTemplates); props.setProperty("class.resource.loader.cache", cache); // depends on control dependency: [if], data = [none] props.setProperty("resource.loader", "class"); // depends on control dependency: [if], data = [none] props.setProperty("class.resource.loader.class", "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader"); // depends on control dependency: [if], data = [none] } // Setup commons logging for velocity props.setProperty(RuntimeConstants.RUNTIME_LOG_LOGSYSTEM_CLASS, "com.github.bordertech.wcomponents.velocity.VelocityLogger"); // depends on control dependency: [if], data = [none] // Set up access to the common velocity macros. props.setProperty(RuntimeConstants.VM_LIBRARY, ConfigurationProperties.getVelocityMacroLibrary()); // depends on control dependency: [if], data = [none] try { if (LOG.isInfoEnabled()) { // Dump properties StringWriter writer = new StringWriter(); props.list(new PrintWriter(writer)); // depends on control dependency: [if], data = [none] LOG.info("Configuring velocity with the following properties...\n" + writer); // depends on control dependency: [if], data = [none] } newEngine.init(props); // depends on control dependency: [try], data = [none] } catch (Exception ex) { throw new SystemException("Failed to configure VelocityEngine", ex); } // depends on control dependency: [catch], data = [none] engine = newEngine; // depends on control dependency: [if], data = [none] } return engine; } }
public class class_name { @NotNull public OptionalDouble average() { long count = 0; double sum = 0d; while (iterator.hasNext()) { sum += iterator.nextDouble(); count++; } if (count == 0) return OptionalDouble.empty(); return OptionalDouble.of(sum / (double) count); } }
public class class_name { @NotNull public OptionalDouble average() { long count = 0; double sum = 0d; while (iterator.hasNext()) { sum += iterator.nextDouble(); // depends on control dependency: [while], data = [none] count++; // depends on control dependency: [while], data = [none] } if (count == 0) return OptionalDouble.empty(); return OptionalDouble.of(sum / (double) count); } }
public class class_name { @SuppressWarnings("unchecked") public static <A> A create(Class<A> swaggerInterface, AzureEnvironment azureEnvironment, HttpPipeline httpPipeline, SerializerAdapter serializer) { String baseUrl = null; if (azureEnvironment != null) { final AzureHost azureHost = swaggerInterface.getAnnotation(AzureHost.class); if (azureHost != null) { baseUrl = azureEnvironment.url(azureHost.endpoint()); } } final SwaggerInterfaceParser interfaceParser = new SwaggerInterfaceParser(swaggerInterface, serializer, baseUrl); final AzureProxy azureProxy = new AzureProxy(httpPipeline, serializer, interfaceParser); return (A) Proxy.newProxyInstance(swaggerInterface.getClassLoader(), new Class[]{swaggerInterface}, azureProxy); } }
public class class_name { @SuppressWarnings("unchecked") public static <A> A create(Class<A> swaggerInterface, AzureEnvironment azureEnvironment, HttpPipeline httpPipeline, SerializerAdapter serializer) { String baseUrl = null; if (azureEnvironment != null) { final AzureHost azureHost = swaggerInterface.getAnnotation(AzureHost.class); if (azureHost != null) { baseUrl = azureEnvironment.url(azureHost.endpoint()); // depends on control dependency: [if], data = [(azureHost] } } final SwaggerInterfaceParser interfaceParser = new SwaggerInterfaceParser(swaggerInterface, serializer, baseUrl); final AzureProxy azureProxy = new AzureProxy(httpPipeline, serializer, interfaceParser); return (A) Proxy.newProxyInstance(swaggerInterface.getClassLoader(), new Class[]{swaggerInterface}, azureProxy); } }
public class class_name { public void setValidCharRange(int minValidChar, int maxValidChar) { if (minValidChar <= maxValidChar) { this.minValidChar = minValidChar; this.maxValidChar = maxValidChar; } else { this.maxValidChar = minValidChar; this.minValidChar = maxValidChar; } } }
public class class_name { public void setValidCharRange(int minValidChar, int maxValidChar) { if (minValidChar <= maxValidChar) { this.minValidChar = minValidChar; // depends on control dependency: [if], data = [none] this.maxValidChar = maxValidChar; // depends on control dependency: [if], data = [none] } else { this.maxValidChar = minValidChar; // depends on control dependency: [if], data = [none] this.minValidChar = maxValidChar; // depends on control dependency: [if], data = [none] } } }
public class class_name { private static int getDayOfYear(int cycleNumber, int dayOfCycle, int yearInCycle) { Integer[] cycles = getAdjustedCycle(cycleNumber); if (dayOfCycle > 0) { return dayOfCycle - cycles[yearInCycle].intValue(); } else { return cycles[yearInCycle].intValue() + dayOfCycle; } } }
public class class_name { private static int getDayOfYear(int cycleNumber, int dayOfCycle, int yearInCycle) { Integer[] cycles = getAdjustedCycle(cycleNumber); if (dayOfCycle > 0) { return dayOfCycle - cycles[yearInCycle].intValue(); // depends on control dependency: [if], data = [none] } else { return cycles[yearInCycle].intValue() + dayOfCycle; // depends on control dependency: [if], data = [none] } } }
public class class_name { public static PdfTextArray getKernArray(String text, BaseFont font) { PdfTextArray pa = new PdfTextArray(); StringBuffer acc = new StringBuffer(); int len = text.length() - 1; char c[] = text.toCharArray(); if (len >= 0) acc.append(c, 0, 1); for (int k = 0; k < len; ++k) { char c2 = c[k + 1]; int kern = font.getKerning(c[k], c2); if (kern == 0) { acc.append(c2); } else { pa.add(acc.toString()); acc.setLength(0); acc.append(c, k + 1, 1); pa.add(-kern); } } pa.add(acc.toString()); return pa; } }
public class class_name { public static PdfTextArray getKernArray(String text, BaseFont font) { PdfTextArray pa = new PdfTextArray(); StringBuffer acc = new StringBuffer(); int len = text.length() - 1; char c[] = text.toCharArray(); if (len >= 0) acc.append(c, 0, 1); for (int k = 0; k < len; ++k) { char c2 = c[k + 1]; int kern = font.getKerning(c[k], c2); if (kern == 0) { acc.append(c2); // depends on control dependency: [if], data = [none] } else { pa.add(acc.toString()); // depends on control dependency: [if], data = [none] acc.setLength(0); // depends on control dependency: [if], data = [0)] acc.append(c, k + 1, 1); // depends on control dependency: [if], data = [none] pa.add(-kern); // depends on control dependency: [if], data = [none] } } pa.add(acc.toString()); return pa; } }
public class class_name { public void marshall(DeleteRetentionPolicyRequest deleteRetentionPolicyRequest, ProtocolMarshaller protocolMarshaller) { if (deleteRetentionPolicyRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(deleteRetentionPolicyRequest.getLogGroupName(), LOGGROUPNAME_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(DeleteRetentionPolicyRequest deleteRetentionPolicyRequest, ProtocolMarshaller protocolMarshaller) { if (deleteRetentionPolicyRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(deleteRetentionPolicyRequest.getLogGroupName(), LOGGROUPNAME_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 void saveConfiguration() { if (this.createConfigurationXML()) { XMLFileChooser fc = new XMLFileChooser(); if (fc.showSaveDialog(new JPanel()) == XMLFileChooser.APPROVE_OPTION) { String path = fc.getSelectedFile().getPath(); if (path.indexOf('.') == -1) { path += ".xml"; } if (this.saveConfiguration(path)) { System.out.println("SAVE CONFIG SUCCESSFULL"); } else { System.out.println("SAVE CONFIG FAILED"); } } } } }
public class class_name { public void saveConfiguration() { if (this.createConfigurationXML()) { XMLFileChooser fc = new XMLFileChooser(); if (fc.showSaveDialog(new JPanel()) == XMLFileChooser.APPROVE_OPTION) { String path = fc.getSelectedFile().getPath(); if (path.indexOf('.') == -1) { path += ".xml"; // depends on control dependency: [if], data = [none] } if (this.saveConfiguration(path)) { System.out.println("SAVE CONFIG SUCCESSFULL"); // depends on control dependency: [if], data = [none] } else { System.out.println("SAVE CONFIG FAILED"); // depends on control dependency: [if], data = [none] } } } } }
public class class_name { @Override public EClass getIfcOpenShell() { if (ifcOpenShellEClass == null) { ifcOpenShellEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI).getEClassifiers() .get(396); } return ifcOpenShellEClass; } }
public class class_name { @Override public EClass getIfcOpenShell() { if (ifcOpenShellEClass == null) { ifcOpenShellEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI).getEClassifiers() .get(396); // depends on control dependency: [if], data = [none] } return ifcOpenShellEClass; } }
public class class_name { public static void sortNode(TreeNode node, Comparator comparator) { TreeNodeList children = (TreeNodeList) node.getChildren(); if (children != null && !children.isEmpty()) { Object[] childrenArray = children.toArray(); Arrays.sort(childrenArray, comparator); for (int i = 0; i < childrenArray.length; i++) { children.setSibling(i, (TreeNode) childrenArray[i]); } for (int i = 0; i < children.size(); i++) { sortNode(children.get(i), comparator); } } } }
public class class_name { public static void sortNode(TreeNode node, Comparator comparator) { TreeNodeList children = (TreeNodeList) node.getChildren(); if (children != null && !children.isEmpty()) { Object[] childrenArray = children.toArray(); Arrays.sort(childrenArray, comparator); // depends on control dependency: [if], data = [(children] for (int i = 0; i < childrenArray.length; i++) { children.setSibling(i, (TreeNode) childrenArray[i]); // depends on control dependency: [for], data = [i] } for (int i = 0; i < children.size(); i++) { sortNode(children.get(i), comparator); // depends on control dependency: [for], data = [i] } } } }
public class class_name { @Override public void decode(FacesContext context, UIComponent component) { Slider slider = (Slider) component; if (slider.isDisabled() || slider.isReadonly()) { return; } decodeBehaviors(context, slider); String clientId = slider.getClientId(context); String submittedValue = (String) context.getExternalContext().getRequestParameterMap().get(clientId); if (submittedValue != null) { slider.setSubmittedValue(submittedValue); slider.setValid(true); } } }
public class class_name { @Override public void decode(FacesContext context, UIComponent component) { Slider slider = (Slider) component; if (slider.isDisabled() || slider.isReadonly()) { return; // depends on control dependency: [if], data = [none] } decodeBehaviors(context, slider); String clientId = slider.getClientId(context); String submittedValue = (String) context.getExternalContext().getRequestParameterMap().get(clientId); if (submittedValue != null) { slider.setSubmittedValue(submittedValue); // depends on control dependency: [if], data = [(submittedValue] slider.setValid(true); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static Type.Record[] typeRecordConstructor(Identifier field, Type... expected) { Type.Record[] result = new Type.Record[expected.length]; for (int i = 0; i != expected.length; ++i) { Tuple<Type.Field> fields = new Tuple<>(new Type.Field(field, expected[i])); result[i] = new Type.Record(true, fields); } return result; } }
public class class_name { public static Type.Record[] typeRecordConstructor(Identifier field, Type... expected) { Type.Record[] result = new Type.Record[expected.length]; for (int i = 0; i != expected.length; ++i) { Tuple<Type.Field> fields = new Tuple<>(new Type.Field(field, expected[i])); result[i] = new Type.Record(true, fields); // depends on control dependency: [for], data = [i] } return result; } }
public class class_name { private FilePosition getEndPosition(Node node) throws IOException { int length = node.getLength(); int lineno = currentLine; int charno = currentChar; while (charno + length > lineLengths[lineno]) { length -= (lineLengths[lineno]-charno); lineno++; charno = 0; if (lineno >= lineLengths.length) { // Node has an invalid length return new FilePosition(currentLine, currentChar); } } charno += length; return new FilePosition(lineno, charno); } }
public class class_name { private FilePosition getEndPosition(Node node) throws IOException { int length = node.getLength(); int lineno = currentLine; int charno = currentChar; while (charno + length > lineLengths[lineno]) { length -= (lineLengths[lineno]-charno); lineno++; charno = 0; if (lineno >= lineLengths.length) { // Node has an invalid length return new FilePosition(currentLine, currentChar); // depends on control dependency: [if], data = [none] } } charno += length; return new FilePosition(lineno, charno); } }
public class class_name { public static Class<?> getRawClass(Type type) { if (type instanceof Class) { return (Class<?>) type; } if (type instanceof ParameterizedType) { return (Class<?>) ((ParameterizedType) type).getRawType(); } if (type instanceof TypeVariable) { Type[] bounds = ((TypeVariable) type).getBounds(); if (null != bounds && 0 < bounds.length) { return getRawClass(bounds[0]); } } return Object.class; } }
public class class_name { public static Class<?> getRawClass(Type type) { if (type instanceof Class) { return (Class<?>) type; } if (type instanceof ParameterizedType) { return (Class<?>) ((ParameterizedType) type).getRawType(); } if (type instanceof TypeVariable) { Type[] bounds = ((TypeVariable) type).getBounds(); if (null != bounds && 0 < bounds.length) { return getRawClass(bounds[0]); // depends on control dependency: [if], data = [none] } } return Object.class; } }
public class class_name { private void respondWithFile(ChannelHandlerContext ctx, HttpRequest request, String requestPath) throws IOException, ParseException { // make sure we request the "index.html" in case there is a directory request if (requestPath.endsWith("/")) { requestPath = requestPath + "index.html"; } if (!requestPath.contains(".")) { // we assume that the path ends in either .html or .js requestPath = requestPath + ".json"; } // convert to absolute path final File file = new File(rootPath, requestPath); if (!file.exists()) { // file does not exist. Try to load it with the classloader ClassLoader cl = HistoryServerStaticFileServerHandler.class.getClassLoader(); try (InputStream resourceStream = cl.getResourceAsStream("web" + requestPath)) { boolean success = false; try { if (resourceStream != null) { URL root = cl.getResource("web"); URL requested = cl.getResource("web" + requestPath); if (root != null && requested != null) { URI rootURI = new URI(root.getPath()).normalize(); URI requestedURI = new URI(requested.getPath()).normalize(); // Check that we don't load anything from outside of the // expected scope. if (!rootURI.relativize(requestedURI).equals(requestedURI)) { LOG.debug("Loading missing file from classloader: {}", requestPath); // ensure that directory to file exists. file.getParentFile().mkdirs(); Files.copy(resourceStream, file.toPath()); success = true; } } } } catch (Throwable t) { LOG.error("error while responding", t); } finally { if (!success) { LOG.debug("Unable to load requested file {} from classloader", requestPath); HandlerUtils.sendErrorResponse( ctx, request, new ErrorResponseBody("File not found."), NOT_FOUND, Collections.emptyMap()); return; } } } } if (!file.exists() || file.isHidden() || file.isDirectory() || !file.isFile()) { HandlerUtils.sendErrorResponse( ctx, request, new ErrorResponseBody("File not found."), NOT_FOUND, Collections.emptyMap()); return; } if (!file.getCanonicalFile().toPath().startsWith(rootPath.toPath())) { HandlerUtils.sendErrorResponse( ctx, request, new ErrorResponseBody("File not found."), NOT_FOUND, Collections.emptyMap()); return; } // cache validation final String ifModifiedSince = request.headers().get(IF_MODIFIED_SINCE); if (ifModifiedSince != null && !ifModifiedSince.isEmpty()) { SimpleDateFormat dateFormatter = new SimpleDateFormat(StaticFileServerHandler.HTTP_DATE_FORMAT, Locale.US); Date ifModifiedSinceDate = dateFormatter.parse(ifModifiedSince); // Only compare up to the second because the datetime format we send to the client // does not have milliseconds long ifModifiedSinceDateSeconds = ifModifiedSinceDate.getTime() / 1000; long fileLastModifiedSeconds = file.lastModified() / 1000; if (ifModifiedSinceDateSeconds == fileLastModifiedSeconds) { if (LOG.isDebugEnabled()) { LOG.debug("Responding 'NOT MODIFIED' for file '" + file.getAbsolutePath() + '\''); } StaticFileServerHandler.sendNotModified(ctx); return; } } if (LOG.isDebugEnabled()) { LOG.debug("Responding with file '" + file.getAbsolutePath() + '\''); } // Don't need to close this manually. Netty's DefaultFileRegion will take care of it. final RandomAccessFile raf; try { raf = new RandomAccessFile(file, "r"); } catch (FileNotFoundException e) { HandlerUtils.sendErrorResponse( ctx, request, new ErrorResponseBody("File not found."), NOT_FOUND, Collections.emptyMap()); return; } try { long fileLength = raf.length(); HttpResponse response = new DefaultHttpResponse(HTTP_1_1, OK); StaticFileServerHandler.setContentTypeHeader(response, file); // the job overview should be updated as soon as possible if (!requestPath.equals("/joboverview.json")) { StaticFileServerHandler.setDateAndCacheHeaders(response, file); } if (HttpHeaders.isKeepAlive(request)) { response.headers().set(CONNECTION, HttpHeaders.Values.KEEP_ALIVE); } HttpHeaders.setContentLength(response, fileLength); // write the initial line and the header. ctx.write(response); // write the content. ChannelFuture lastContentFuture; if (ctx.pipeline().get(SslHandler.class) == null) { ctx.write(new DefaultFileRegion(raf.getChannel(), 0, fileLength), ctx.newProgressivePromise()); lastContentFuture = ctx.writeAndFlush(LastHttpContent.EMPTY_LAST_CONTENT); } else { lastContentFuture = ctx.writeAndFlush(new HttpChunkedInput(new ChunkedFile(raf, 0, fileLength, 8192)), ctx.newProgressivePromise()); // HttpChunkedInput will write the end marker (LastHttpContent) for us. } // close the connection, if no keep-alive is needed if (!HttpHeaders.isKeepAlive(request)) { lastContentFuture.addListener(ChannelFutureListener.CLOSE); } } catch (Exception e) { raf.close(); LOG.error("Failed to serve file.", e); HandlerUtils.sendErrorResponse( ctx, request, new ErrorResponseBody("Internal server error."), INTERNAL_SERVER_ERROR, Collections.emptyMap()); } } }
public class class_name { private void respondWithFile(ChannelHandlerContext ctx, HttpRequest request, String requestPath) throws IOException, ParseException { // make sure we request the "index.html" in case there is a directory request if (requestPath.endsWith("/")) { requestPath = requestPath + "index.html"; } if (!requestPath.contains(".")) { // we assume that the path ends in either .html or .js requestPath = requestPath + ".json"; } // convert to absolute path final File file = new File(rootPath, requestPath); if (!file.exists()) { // file does not exist. Try to load it with the classloader ClassLoader cl = HistoryServerStaticFileServerHandler.class.getClassLoader(); try (InputStream resourceStream = cl.getResourceAsStream("web" + requestPath)) { boolean success = false; try { if (resourceStream != null) { URL root = cl.getResource("web"); URL requested = cl.getResource("web" + requestPath); if (root != null && requested != null) { URI rootURI = new URI(root.getPath()).normalize(); URI requestedURI = new URI(requested.getPath()).normalize(); // Check that we don't load anything from outside of the // expected scope. if (!rootURI.relativize(requestedURI).equals(requestedURI)) { LOG.debug("Loading missing file from classloader: {}", requestPath); // depends on control dependency: [if], data = [none] // ensure that directory to file exists. file.getParentFile().mkdirs(); // depends on control dependency: [if], data = [none] Files.copy(resourceStream, file.toPath()); // depends on control dependency: [if], data = [none] success = true; // depends on control dependency: [if], data = [none] } } } } catch (Throwable t) { LOG.error("error while responding", t); } finally { if (!success) { LOG.debug("Unable to load requested file {} from classloader", requestPath); // depends on control dependency: [if], data = [none] HandlerUtils.sendErrorResponse( ctx, request, new ErrorResponseBody("File not found."), NOT_FOUND, Collections.emptyMap()); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } } } } if (!file.exists() || file.isHidden() || file.isDirectory() || !file.isFile()) { HandlerUtils.sendErrorResponse( ctx, request, new ErrorResponseBody("File not found."), NOT_FOUND, Collections.emptyMap()); return; } if (!file.getCanonicalFile().toPath().startsWith(rootPath.toPath())) { HandlerUtils.sendErrorResponse( ctx, request, new ErrorResponseBody("File not found."), NOT_FOUND, Collections.emptyMap()); return; } // cache validation final String ifModifiedSince = request.headers().get(IF_MODIFIED_SINCE); if (ifModifiedSince != null && !ifModifiedSince.isEmpty()) { SimpleDateFormat dateFormatter = new SimpleDateFormat(StaticFileServerHandler.HTTP_DATE_FORMAT, Locale.US); Date ifModifiedSinceDate = dateFormatter.parse(ifModifiedSince); // Only compare up to the second because the datetime format we send to the client // does not have milliseconds long ifModifiedSinceDateSeconds = ifModifiedSinceDate.getTime() / 1000; long fileLastModifiedSeconds = file.lastModified() / 1000; if (ifModifiedSinceDateSeconds == fileLastModifiedSeconds) { if (LOG.isDebugEnabled()) { LOG.debug("Responding 'NOT MODIFIED' for file '" + file.getAbsolutePath() + '\''); } StaticFileServerHandler.sendNotModified(ctx); return; } } if (LOG.isDebugEnabled()) { LOG.debug("Responding with file '" + file.getAbsolutePath() + '\''); } // Don't need to close this manually. Netty's DefaultFileRegion will take care of it. final RandomAccessFile raf; try { raf = new RandomAccessFile(file, "r"); } catch (FileNotFoundException e) { HandlerUtils.sendErrorResponse( ctx, request, new ErrorResponseBody("File not found."), NOT_FOUND, Collections.emptyMap()); return; } try { long fileLength = raf.length(); HttpResponse response = new DefaultHttpResponse(HTTP_1_1, OK); StaticFileServerHandler.setContentTypeHeader(response, file); // the job overview should be updated as soon as possible if (!requestPath.equals("/joboverview.json")) { StaticFileServerHandler.setDateAndCacheHeaders(response, file); } if (HttpHeaders.isKeepAlive(request)) { response.headers().set(CONNECTION, HttpHeaders.Values.KEEP_ALIVE); } HttpHeaders.setContentLength(response, fileLength); // write the initial line and the header. ctx.write(response); // write the content. ChannelFuture lastContentFuture; if (ctx.pipeline().get(SslHandler.class) == null) { ctx.write(new DefaultFileRegion(raf.getChannel(), 0, fileLength), ctx.newProgressivePromise()); lastContentFuture = ctx.writeAndFlush(LastHttpContent.EMPTY_LAST_CONTENT); } else { lastContentFuture = ctx.writeAndFlush(new HttpChunkedInput(new ChunkedFile(raf, 0, fileLength, 8192)), ctx.newProgressivePromise()); // HttpChunkedInput will write the end marker (LastHttpContent) for us. } // close the connection, if no keep-alive is needed if (!HttpHeaders.isKeepAlive(request)) { lastContentFuture.addListener(ChannelFutureListener.CLOSE); } } catch (Exception e) { raf.close(); LOG.error("Failed to serve file.", e); HandlerUtils.sendErrorResponse( ctx, request, new ErrorResponseBody("Internal server error."), INTERNAL_SERVER_ERROR, Collections.emptyMap()); } } }
public class class_name { @Check(CheckType.FAST) public void checkParameterName(XVariableDeclaration variable) { if (this.grammarAccess.getOccurrenceKeyword().equals(variable.getName())) { error(MessageFormat.format( Messages.SARLValidator_15, this.grammarAccess.getOccurrenceKeyword()), variable, XbasePackage.Literals.XVARIABLE_DECLARATION__NAME, ValidationMessageAcceptor.INSIGNIFICANT_INDEX, VARIABLE_NAME_DISALLOWED); } } }
public class class_name { @Check(CheckType.FAST) public void checkParameterName(XVariableDeclaration variable) { if (this.grammarAccess.getOccurrenceKeyword().equals(variable.getName())) { error(MessageFormat.format( Messages.SARLValidator_15, this.grammarAccess.getOccurrenceKeyword()), variable, XbasePackage.Literals.XVARIABLE_DECLARATION__NAME, ValidationMessageAcceptor.INSIGNIFICANT_INDEX, VARIABLE_NAME_DISALLOWED); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static Proxy getProxy(final IProxyProvider provider, final boolean test) throws IOException { LOGGER.info("Getting proxy..."); List<Proxy> proxies = provider.getProxies(-1, false, true); LOGGER.info("Total Proxies: " + proxies.size()); final CountDownLatch countDown = new CountDownLatch(proxies.size()); final AtomicReference<Proxy> useProxy = new AtomicReference<>(); int threadCount = proxies.size() > 10 ? 10 : proxies.size(); if (threadCount <= 0) { threadCount = 1; } final ExecutorService testService = Executors.newFixedThreadPool(threadCount); for (final Proxy proxy : proxies) { Thread validate = new Thread() { @Override public void run() { try { if (test) { if (proxy.isBlackListed()) { return; } proxy.updateStatus(); if (!proxy.isOnline()) { return; } proxy.updateAnonymity(); if (!proxy.isAnonymous()) { return; } } if (useProxy.get() == null) { LOGGER.info("Using Proxy: " + proxy.toString()); useProxy.set(proxy); // count to 0 while (countDown.getCount() > 0) { countDown.countDown(); } } } catch (Exception e) { LOGGER.info("Proxy validation returned error: " + e.getClass().getName() + " - " + e.getMessage()); } finally { countDown.countDown(); } } }; testService.submit(validate); } try { countDown.await(); } catch (InterruptedException e) { e.printStackTrace(); } testService.shutdownNow(); if (useProxy.get() == null) { //if null, use another provider return getProxy(test); } return useProxy.get(); } }
public class class_name { public static Proxy getProxy(final IProxyProvider provider, final boolean test) throws IOException { LOGGER.info("Getting proxy..."); List<Proxy> proxies = provider.getProxies(-1, false, true); LOGGER.info("Total Proxies: " + proxies.size()); final CountDownLatch countDown = new CountDownLatch(proxies.size()); final AtomicReference<Proxy> useProxy = new AtomicReference<>(); int threadCount = proxies.size() > 10 ? 10 : proxies.size(); if (threadCount <= 0) { threadCount = 1; } final ExecutorService testService = Executors.newFixedThreadPool(threadCount); for (final Proxy proxy : proxies) { Thread validate = new Thread() { @Override public void run() { try { if (test) { if (proxy.isBlackListed()) { return; // depends on control dependency: [if], data = [none] } proxy.updateStatus(); // depends on control dependency: [if], data = [none] if (!proxy.isOnline()) { return; // depends on control dependency: [if], data = [none] } proxy.updateAnonymity(); // depends on control dependency: [if], data = [none] if (!proxy.isAnonymous()) { return; // depends on control dependency: [if], data = [none] } } if (useProxy.get() == null) { LOGGER.info("Using Proxy: " + proxy.toString()); // depends on control dependency: [if], data = [none] useProxy.set(proxy); // depends on control dependency: [if], data = [none] // count to 0 while (countDown.getCount() > 0) { countDown.countDown(); // depends on control dependency: [while], data = [none] } } } catch (Exception e) { LOGGER.info("Proxy validation returned error: " + e.getClass().getName() + " - " + e.getMessage()); } finally { // depends on control dependency: [catch], data = [none] countDown.countDown(); } } }; testService.submit(validate); } try { countDown.await(); } catch (InterruptedException e) { e.printStackTrace(); } testService.shutdownNow(); if (useProxy.get() == null) { //if null, use another provider return getProxy(test); } return useProxy.get(); } }
public class class_name { @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:52:47+02:00", comments = "JAXB RI v2.2.11") public StellplatzKategorieTyp getParkplatz() { if (parkplatz == null) { return StellplatzKategorieTyp.KEINE_ANGABE; } else { return parkplatz; } } }
public class class_name { @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:52:47+02:00", comments = "JAXB RI v2.2.11") public StellplatzKategorieTyp getParkplatz() { if (parkplatz == null) { return StellplatzKategorieTyp.KEINE_ANGABE; // depends on control dependency: [if], data = [none] } else { return parkplatz; // depends on control dependency: [if], data = [none] } } }
public class class_name { private void _advance(int count) { if (buf != null) { bufPos += count; if (bufPos == buf.length) { buf = null; } } else { pos.setIndex(pos.getIndex() + count); if (pos.getIndex() > text.length()) { pos.setIndex(text.length()); } } } }
public class class_name { private void _advance(int count) { if (buf != null) { bufPos += count; // depends on control dependency: [if], data = [none] if (bufPos == buf.length) { buf = null; // depends on control dependency: [if], data = [none] } } else { pos.setIndex(pos.getIndex() + count); // depends on control dependency: [if], data = [none] if (pos.getIndex() > text.length()) { pos.setIndex(text.length()); // depends on control dependency: [if], data = [text.length())] } } } }
public class class_name { public void setValue(final Duration tenantDuration) { if (tenantDuration == null) { // no tenant specific configuration checkBox.setValue(false); durationField.setDuration(globalDuration); durationField.setEnabled(false); return; } checkBox.setValue(true); durationField.setDuration(tenantDuration); durationField.setEnabled(true); } }
public class class_name { public void setValue(final Duration tenantDuration) { if (tenantDuration == null) { // no tenant specific configuration checkBox.setValue(false); // depends on control dependency: [if], data = [none] durationField.setDuration(globalDuration); // depends on control dependency: [if], data = [none] durationField.setEnabled(false); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } checkBox.setValue(true); durationField.setDuration(tenantDuration); durationField.setEnabled(true); } }
public class class_name { private void configureTokenProviders() { STSType stsType = getFederationService().getValue().getStsType(); if (stsType != null) { int tokenTimeout = stsType.getTokenTimeout(); int clockSkew = stsType.getClockSkew(); STSType providerStsType = getPicketLinkType().getStsType(); providerStsType.setTokenTimeout(tokenTimeout); providerStsType.setClockSkew(clockSkew); List<TokenProviderType> tokenProviders = providerStsType.getTokenProviders().getTokenProvider(); for (TokenProviderType tokenProviderType : tokenProviders) { if (tokenProviderType.getTokenType().equals(JBossSAMLURIConstants.ASSERTION_NSURI.get())) { KeyValueType keyValueTypeTokenTimeout = new KeyValueType(); keyValueTypeTokenTimeout.setKey(GeneralConstants.ASSERTIONS_VALIDITY); keyValueTypeTokenTimeout.setValue(String.valueOf(tokenTimeout)); KeyValueType keyValueTypeClockSkew = new KeyValueType(); keyValueTypeClockSkew.setKey(GeneralConstants.CLOCK_SKEW); keyValueTypeClockSkew.setValue(String.valueOf(clockSkew)); tokenProviderType.add(keyValueTypeTokenTimeout); tokenProviderType.add(keyValueTypeClockSkew); } } } } }
public class class_name { private void configureTokenProviders() { STSType stsType = getFederationService().getValue().getStsType(); if (stsType != null) { int tokenTimeout = stsType.getTokenTimeout(); int clockSkew = stsType.getClockSkew(); STSType providerStsType = getPicketLinkType().getStsType(); providerStsType.setTokenTimeout(tokenTimeout); // depends on control dependency: [if], data = [none] providerStsType.setClockSkew(clockSkew); // depends on control dependency: [if], data = [none] List<TokenProviderType> tokenProviders = providerStsType.getTokenProviders().getTokenProvider(); for (TokenProviderType tokenProviderType : tokenProviders) { if (tokenProviderType.getTokenType().equals(JBossSAMLURIConstants.ASSERTION_NSURI.get())) { KeyValueType keyValueTypeTokenTimeout = new KeyValueType(); keyValueTypeTokenTimeout.setKey(GeneralConstants.ASSERTIONS_VALIDITY); // depends on control dependency: [if], data = [none] keyValueTypeTokenTimeout.setValue(String.valueOf(tokenTimeout)); // depends on control dependency: [if], data = [none] KeyValueType keyValueTypeClockSkew = new KeyValueType(); keyValueTypeClockSkew.setKey(GeneralConstants.CLOCK_SKEW); // depends on control dependency: [if], data = [none] keyValueTypeClockSkew.setValue(String.valueOf(clockSkew)); // depends on control dependency: [if], data = [none] tokenProviderType.add(keyValueTypeTokenTimeout); // depends on control dependency: [if], data = [none] tokenProviderType.add(keyValueTypeClockSkew); // depends on control dependency: [if], data = [none] } } } } }
public class class_name { protected List<String> getSignificantContent() { for (int i = segments.size() - 1; i >= 0; i--) { String segment = segments.get(i); if (lineDelimiter.equals(segment)) { return segments.subList(0, i + 1); } for (int j = 0; j < segment.length(); j++) { if (!WhitespaceMatcher.isWhitespace(segment.charAt(j))) { return segments; } } } return segments; } }
public class class_name { protected List<String> getSignificantContent() { for (int i = segments.size() - 1; i >= 0; i--) { String segment = segments.get(i); if (lineDelimiter.equals(segment)) { return segments.subList(0, i + 1); // depends on control dependency: [if], data = [none] } for (int j = 0; j < segment.length(); j++) { if (!WhitespaceMatcher.isWhitespace(segment.charAt(j))) { return segments; // depends on control dependency: [if], data = [none] } } } return segments; } }
public class class_name { @SuppressWarnings("unchecked") private void comparableDecreaseKey(Node<K, V> n, K newKey) { int c = ((Comparable<? super K>) newKey).compareTo(n.key); if (c > 0) { throw new IllegalArgumentException("Keys can only be decreased!"); } n.key = newKey; if (c == 0) { return; } if (n.next == null) { throw new IllegalArgumentException("Invalid handle!"); } // if not root and heap order violation Node<K, V> y = n.parent; if (y != null && ((Comparable<? super K>) n.key).compareTo(y.key) < 0) { cut(n, y); root.mark = false; cascadingRankChange(y); if (((Comparable<? super K>) n.key).compareTo(root.key) < 0) { root = link(root, n); } else { link(n, root); } } } }
public class class_name { @SuppressWarnings("unchecked") private void comparableDecreaseKey(Node<K, V> n, K newKey) { int c = ((Comparable<? super K>) newKey).compareTo(n.key); if (c > 0) { throw new IllegalArgumentException("Keys can only be decreased!"); } n.key = newKey; if (c == 0) { return; // depends on control dependency: [if], data = [none] } if (n.next == null) { throw new IllegalArgumentException("Invalid handle!"); } // if not root and heap order violation Node<K, V> y = n.parent; if (y != null && ((Comparable<? super K>) n.key).compareTo(y.key) < 0) { cut(n, y); // depends on control dependency: [if], data = [none] root.mark = false; // depends on control dependency: [if], data = [none] cascadingRankChange(y); // depends on control dependency: [if], data = [(y] if (((Comparable<? super K>) n.key).compareTo(root.key) < 0) { root = link(root, n); // depends on control dependency: [if], data = [none] } else { link(n, root); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public Collection<String> nearestLabels(LabelledDocument document, int topN) { if (document.getReferencedContent() != null) { return nearestLabels(document.getReferencedContent(), topN); } else return nearestLabels(document.getContent(), topN); } }
public class class_name { public Collection<String> nearestLabels(LabelledDocument document, int topN) { if (document.getReferencedContent() != null) { return nearestLabels(document.getReferencedContent(), topN); // depends on control dependency: [if], data = [(document.getReferencedContent()] } else return nearestLabels(document.getContent(), topN); } }
public class class_name { @SuppressWarnings("unchecked") public synchronized ValT get(Object elementKey) { KeyT key = (KeyT) elementKey; ValT value = cache.get(key); if (value != null) { // memory hit Log.d(name, "MEM cache hit for " + key.toString()); return value; } // memory miss, try reading from disk File file = getFileForKey(key); if (file.exists()) { // if file older than expirationInMinutes, remove it long lastModified = file.lastModified(); Date now = new Date(); long ageInMinutes = ((now.getTime() - lastModified) / (1000*60)); if (ageInMinutes >= expirationInMinutes) { Log.d(name, "DISK cache expiration for file " + file.toString()); file.delete(); return null; } // disk hit Log.d(name, "DISK cache hit for " + key.toString()); try { value = readValueFromDisk(file); } catch (IOException e) { // treat decoding errors as a cache miss e.printStackTrace(); return null; } if (value == null) { return null; } cache.put(key, value); return value; } // cache miss return null; } }
public class class_name { @SuppressWarnings("unchecked") public synchronized ValT get(Object elementKey) { KeyT key = (KeyT) elementKey; ValT value = cache.get(key); if (value != null) { // memory hit Log.d(name, "MEM cache hit for " + key.toString()); // depends on control dependency: [if], data = [none] return value; // depends on control dependency: [if], data = [none] } // memory miss, try reading from disk File file = getFileForKey(key); if (file.exists()) { // if file older than expirationInMinutes, remove it long lastModified = file.lastModified(); Date now = new Date(); long ageInMinutes = ((now.getTime() - lastModified) / (1000*60)); if (ageInMinutes >= expirationInMinutes) { Log.d(name, "DISK cache expiration for file " + file.toString()); // depends on control dependency: [if], data = [none] file.delete(); // depends on control dependency: [if], data = [none] return null; // depends on control dependency: [if], data = [none] } // disk hit Log.d(name, "DISK cache hit for " + key.toString()); // depends on control dependency: [if], data = [none] try { value = readValueFromDisk(file); // depends on control dependency: [try], data = [none] } catch (IOException e) { // treat decoding errors as a cache miss e.printStackTrace(); return null; } // depends on control dependency: [catch], data = [none] if (value == null) { return null; // depends on control dependency: [if], data = [none] } cache.put(key, value); // depends on control dependency: [if], data = [none] return value; // depends on control dependency: [if], data = [none] } // cache miss return null; } }
public class class_name { public static <T> T min( T[] array ) { if ( array.length > 1 ) { Sorting.sort(array); return array[0]; } else { return null; } } }
public class class_name { public static <T> T min( T[] array ) { if ( array.length > 1 ) { Sorting.sort(array); // depends on control dependency: [if], data = [none] return array[0]; // depends on control dependency: [if], data = [none] } else { return null; // depends on control dependency: [if], data = [none] } } }
public class class_name { protected String getXMLEncoding(Node nodeArg) { Document doc = null; // Determine the XML Encoding of the document if (nodeArg != null) { if (nodeArg.getNodeType() == Node.DOCUMENT_NODE) { // The Document node is the Node argument doc = (Document)nodeArg; } else { // The Document node is the Node argument's ownerDocument doc = nodeArg.getOwnerDocument(); } // Determine the XML Version. if (doc != null && doc.getImplementation().hasFeature("Core","3.0")) { return doc.getXmlEncoding(); } } // The default encoding is UTF-8 except for the writeToString method return "UTF-8"; } }
public class class_name { protected String getXMLEncoding(Node nodeArg) { Document doc = null; // Determine the XML Encoding of the document if (nodeArg != null) { if (nodeArg.getNodeType() == Node.DOCUMENT_NODE) { // The Document node is the Node argument doc = (Document)nodeArg; // depends on control dependency: [if], data = [none] } else { // The Document node is the Node argument's ownerDocument doc = nodeArg.getOwnerDocument(); // depends on control dependency: [if], data = [none] } // Determine the XML Version. if (doc != null && doc.getImplementation().hasFeature("Core","3.0")) { return doc.getXmlEncoding(); // depends on control dependency: [if], data = [none] } } // The default encoding is UTF-8 except for the writeToString method return "UTF-8"; } }
public class class_name { public boolean decode(ChannelBuffer buffer, CommandOutput<K, V, ?> output) { int length, end; ByteBuffer bytes; if (stack.isEmpty()) { stack.add(new State()); } loop: while (!stack.isEmpty()) { State state = stack.peek(); if (state.type == null) { if (!buffer.readable()) break; state.type = readReplyType(buffer); buffer.markReaderIndex(); } switch (state.type) { case SINGLE: if ((bytes = readLine(buffer)) == null) break loop; if (!QUEUED.equals(bytes)) { output.set(bytes); } break; case ERROR: if ((bytes = readLine(buffer)) == null) break loop; output.setError(bytes); break; case INTEGER: if ((end = findLineEnd(buffer)) == -1) break loop; output.set(readLong(buffer, buffer.readerIndex(), end)); break; case BULK: if ((end = findLineEnd(buffer)) == -1) break loop; length = (int) readLong(buffer, buffer.readerIndex(), end); if (length == -1) { output.set(null); } else { state.type = BYTES; state.count = length + 2; buffer.markReaderIndex(); continue loop; } break; case MULTI: if (state.count == -1) { if ((end = findLineEnd(buffer)) == -1) break loop; length = (int) readLong(buffer, buffer.readerIndex(), end); state.count = length; buffer.markReaderIndex(); } if (state.count <= 0) break; state.count--; stack.addFirst(new State()); continue loop; case BYTES: if ((bytes = readBytes(buffer, state.count)) == null) break loop; output.set(bytes); } buffer.markReaderIndex(); stack.remove(); output.complete(stack.size()); } return stack.isEmpty(); } }
public class class_name { public boolean decode(ChannelBuffer buffer, CommandOutput<K, V, ?> output) { int length, end; ByteBuffer bytes; if (stack.isEmpty()) { stack.add(new State()); // depends on control dependency: [if], data = [none] } loop: while (!stack.isEmpty()) { State state = stack.peek(); if (state.type == null) { if (!buffer.readable()) break; state.type = readReplyType(buffer); // depends on control dependency: [if], data = [none] buffer.markReaderIndex(); // depends on control dependency: [if], data = [none] } switch (state.type) { case SINGLE: if ((bytes = readLine(buffer)) == null) break loop; if (!QUEUED.equals(bytes)) { output.set(bytes); // depends on control dependency: [if], data = [none] } break; case ERROR: if ((bytes = readLine(buffer)) == null) break loop; output.setError(bytes); break; case INTEGER: if ((end = findLineEnd(buffer)) == -1) break loop; output.set(readLong(buffer, buffer.readerIndex(), end)); break; case BULK: if ((end = findLineEnd(buffer)) == -1) break loop; length = (int) readLong(buffer, buffer.readerIndex(), end); if (length == -1) { output.set(null); // depends on control dependency: [if], data = [none] } else { state.type = BYTES; // depends on control dependency: [if], data = [none] state.count = length + 2; // depends on control dependency: [if], data = [none] buffer.markReaderIndex(); // depends on control dependency: [if], data = [none] continue loop; } break; case MULTI: if (state.count == -1) { if ((end = findLineEnd(buffer)) == -1) break loop; length = (int) readLong(buffer, buffer.readerIndex(), end); // depends on control dependency: [if], data = [none] state.count = length; // depends on control dependency: [if], data = [none] buffer.markReaderIndex(); // depends on control dependency: [if], data = [none] } if (state.count <= 0) break; state.count--; stack.addFirst(new State()); continue loop; case BYTES: if ((bytes = readBytes(buffer, state.count)) == null) break loop; output.set(bytes); } buffer.markReaderIndex(); // depends on control dependency: [while], data = [none] stack.remove(); // depends on control dependency: [while], data = [none] output.complete(stack.size()); // depends on control dependency: [while], data = [none] } return stack.isEmpty(); } }
public class class_name { public static String injectVariables(String template, Map<String, String> variables) { VariablesWriter writer = new VariablesWriter(variables); try { Files.copy(new StringReader(template), writer); } catch(IOException e) { log.error(e); } return writer.toString(); } }
public class class_name { public static String injectVariables(String template, Map<String, String> variables) { VariablesWriter writer = new VariablesWriter(variables); try { Files.copy(new StringReader(template), writer); // depends on control dependency: [try], data = [none] } catch(IOException e) { log.error(e); } // depends on control dependency: [catch], data = [none] return writer.toString(); } }
public class class_name { public static boolean isProvider(String templatePath) { if (CmsStringUtil.isEmptyOrWhitespaceOnly(templatePath)) { return false; } templatePath = templatePath.trim(); return templatePath.startsWith(DYNAMIC_TEMPLATE_LEGACY_PREFIX) || templatePath.startsWith(DYNAMIC_TEMPLATE_PREFIX); } }
public class class_name { public static boolean isProvider(String templatePath) { if (CmsStringUtil.isEmptyOrWhitespaceOnly(templatePath)) { return false; // depends on control dependency: [if], data = [none] } templatePath = templatePath.trim(); return templatePath.startsWith(DYNAMIC_TEMPLATE_LEGACY_PREFIX) || templatePath.startsWith(DYNAMIC_TEMPLATE_PREFIX); } }
public class class_name { @Nullable public static String uppercaseFirstChar(String str, Language language) { if (language != null && "nl".equals(language.getShortCode()) && str != null && str.toLowerCase().startsWith("ij")) { // hack to fix https://github.com/languagetool-org/languagetool/issues/148 return "IJ" + str.substring(2); } else { return changeFirstCharCase(str, true); } } }
public class class_name { @Nullable public static String uppercaseFirstChar(String str, Language language) { if (language != null && "nl".equals(language.getShortCode()) && str != null && str.toLowerCase().startsWith("ij")) { // hack to fix https://github.com/languagetool-org/languagetool/issues/148 return "IJ" + str.substring(2); // depends on control dependency: [if], data = [none] } else { return changeFirstCharCase(str, true); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void setRolePolicyList(java.util.Collection<PolicyDetail> rolePolicyList) { if (rolePolicyList == null) { this.rolePolicyList = null; return; } this.rolePolicyList = new com.amazonaws.internal.SdkInternalList<PolicyDetail>(rolePolicyList); } }
public class class_name { public void setRolePolicyList(java.util.Collection<PolicyDetail> rolePolicyList) { if (rolePolicyList == null) { this.rolePolicyList = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.rolePolicyList = new com.amazonaws.internal.SdkInternalList<PolicyDetail>(rolePolicyList); } }
public class class_name { public static <T> T cloneObjectWithParents (T t) throws IllegalAccessException, InstantiationException { T clone = (T) t.getClass().newInstance(); List<Field> allFields = new ArrayList<>(); Class parentClass = t.getClass().getSuperclass(); while (parentClass != null) { Collections.addAll(allFields, parentClass.getDeclaredFields()); parentClass = parentClass.getSuperclass(); } Collections.addAll(allFields, t.getClass().getDeclaredFields()); for (Field field : allFields) { int modifiers = field.getModifiers(); //We skip final and static fields if ((Modifier.FINAL & modifiers) != 0 || (Modifier.STATIC & modifiers) != 0) { continue; } field.setAccessible(true); Object value = field.get(t); if (Collection.class.isAssignableFrom(field.getType())) { Collection collection = (Collection) field.get(clone); if (collection == null) { collection = (Collection) field.get(t).getClass().newInstance(); } collection.addAll((Collection) field.get(t)); value = collection; } else if (Map.class.isAssignableFrom(field.getType())) { Map clonMap = (Map) field.get(t).getClass().newInstance(); clonMap.putAll((Map) field.get(t)); value = clonMap; } field.set(clone, value); } return clone; } }
public class class_name { public static <T> T cloneObjectWithParents (T t) throws IllegalAccessException, InstantiationException { T clone = (T) t.getClass().newInstance(); List<Field> allFields = new ArrayList<>(); Class parentClass = t.getClass().getSuperclass(); while (parentClass != null) { Collections.addAll(allFields, parentClass.getDeclaredFields()); parentClass = parentClass.getSuperclass(); } Collections.addAll(allFields, t.getClass().getDeclaredFields()); for (Field field : allFields) { int modifiers = field.getModifiers(); //We skip final and static fields if ((Modifier.FINAL & modifiers) != 0 || (Modifier.STATIC & modifiers) != 0) { continue; } field.setAccessible(true); Object value = field.get(t); if (Collection.class.isAssignableFrom(field.getType())) { Collection collection = (Collection) field.get(clone); if (collection == null) { collection = (Collection) field.get(t).getClass().newInstance(); // depends on control dependency: [if], data = [none] } collection.addAll((Collection) field.get(t)); // depends on control dependency: [if], data = [none] value = collection; // depends on control dependency: [if], data = [none] } else if (Map.class.isAssignableFrom(field.getType())) { Map clonMap = (Map) field.get(t).getClass().newInstance(); clonMap.putAll((Map) field.get(t)); // depends on control dependency: [if], data = [none] value = clonMap; // depends on control dependency: [if], data = [none] } field.set(clone, value); } return clone; } }
public class class_name { @Override public void eval(INDArray labels, INDArray predictions, INDArray mask, final List<? extends Serializable> recordMetaData) { Triple<INDArray,INDArray, INDArray> p = BaseEvaluation.reshapeAndExtractNotMasked(labels, predictions, mask, axis); if(p == null){ //All values masked out; no-op return; } INDArray labels2d = p.getFirst(); INDArray predictions2d = p.getSecond(); INDArray maskArray = p.getThird(); Preconditions.checkState(maskArray == null, "Per-output masking for ROCMultiClass is not supported"); if(labels2d.dataType() != predictions2d.dataType()) labels2d = labels2d.castTo(predictions2d.dataType()); // FIXME: int cast int n = (int) labels2d.size(1); if (underlying == null) { underlying = new ROC[n]; for (int i = 0; i < n; i++) { underlying[i] = new ROC(thresholdSteps, rocRemoveRedundantPts); } } if (underlying.length != labels2d.size(1)) { throw new IllegalArgumentException( "Cannot evaluate data: number of label classes does not match previous call. " + "Got " + labels2d.size(1) + " labels (from array shape " + Arrays.toString(labels2d.shape()) + ")" + " vs. expected number of label classes = " + underlying.length); } for (int i = 0; i < n; i++) { INDArray prob = predictions2d.getColumn(i, true); //Probability of class i INDArray label = labels2d.getColumn(i, true); //Workaround for: https://github.com/deeplearning4j/deeplearning4j/issues/7305 if(prob.rank() == 0) prob = prob.reshape(1,1); if(label.rank() == 0) label = label.reshape(1,1); underlying[i].eval(label, prob); } } }
public class class_name { @Override public void eval(INDArray labels, INDArray predictions, INDArray mask, final List<? extends Serializable> recordMetaData) { Triple<INDArray,INDArray, INDArray> p = BaseEvaluation.reshapeAndExtractNotMasked(labels, predictions, mask, axis); if(p == null){ //All values masked out; no-op return; // depends on control dependency: [if], data = [none] } INDArray labels2d = p.getFirst(); INDArray predictions2d = p.getSecond(); INDArray maskArray = p.getThird(); Preconditions.checkState(maskArray == null, "Per-output masking for ROCMultiClass is not supported"); if(labels2d.dataType() != predictions2d.dataType()) labels2d = labels2d.castTo(predictions2d.dataType()); // FIXME: int cast int n = (int) labels2d.size(1); if (underlying == null) { underlying = new ROC[n]; // depends on control dependency: [if], data = [none] for (int i = 0; i < n; i++) { underlying[i] = new ROC(thresholdSteps, rocRemoveRedundantPts); // depends on control dependency: [for], data = [i] } } if (underlying.length != labels2d.size(1)) { throw new IllegalArgumentException( "Cannot evaluate data: number of label classes does not match previous call. " + "Got " + labels2d.size(1) + " labels (from array shape " + Arrays.toString(labels2d.shape()) + ")" + " vs. expected number of label classes = " + underlying.length); } for (int i = 0; i < n; i++) { INDArray prob = predictions2d.getColumn(i, true); //Probability of class i INDArray label = labels2d.getColumn(i, true); //Workaround for: https://github.com/deeplearning4j/deeplearning4j/issues/7305 if(prob.rank() == 0) prob = prob.reshape(1,1); if(label.rank() == 0) label = label.reshape(1,1); underlying[i].eval(label, prob); // depends on control dependency: [for], data = [i] } } }
public class class_name { public ParameterRanges withIntegerParameterRanges(IntegerParameterRange... integerParameterRanges) { if (this.integerParameterRanges == null) { setIntegerParameterRanges(new java.util.ArrayList<IntegerParameterRange>(integerParameterRanges.length)); } for (IntegerParameterRange ele : integerParameterRanges) { this.integerParameterRanges.add(ele); } return this; } }
public class class_name { public ParameterRanges withIntegerParameterRanges(IntegerParameterRange... integerParameterRanges) { if (this.integerParameterRanges == null) { setIntegerParameterRanges(new java.util.ArrayList<IntegerParameterRange>(integerParameterRanges.length)); // depends on control dependency: [if], data = [none] } for (IntegerParameterRange ele : integerParameterRanges) { this.integerParameterRanges.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { public Charset getCharset() { if (bootstrapEvent != null) { return Charset.forName(bootstrapEvent.getDefaultCharsetName()); } else { return Charset.defaultCharset(); } } }
public class class_name { public Charset getCharset() { if (bootstrapEvent != null) { return Charset.forName(bootstrapEvent.getDefaultCharsetName()); // depends on control dependency: [if], data = [(bootstrapEvent] } else { return Charset.defaultCharset(); // depends on control dependency: [if], data = [none] } } }
public class class_name { public Q setLong(final int index, final Number value) { if (value == null) { setNull(index, Types.BIGINT); } else { setLong(index, value.longValue()); } return _this(); } }
public class class_name { public Q setLong(final int index, final Number value) { if (value == null) { setNull(index, Types.BIGINT); // depends on control dependency: [if], data = [none] } else { setLong(index, value.longValue()); // depends on control dependency: [if], data = [none] } return _this(); } }
public class class_name { public Object getName(String methodName) { if (getProxyBuilder().nameMappingClosure != null) { return getProxyBuilder().nameMappingClosure.call(methodName); } return methodName; } }
public class class_name { public Object getName(String methodName) { if (getProxyBuilder().nameMappingClosure != null) { return getProxyBuilder().nameMappingClosure.call(methodName); // depends on control dependency: [if], data = [none] } return methodName; } }
public class class_name { @Execute public HtmlResponse index() { if (isLoginRequired()) { return redirectToLogin(); } return asHtml(virtualHost(path_IndexJsp)).useForm(SearchForm.class, op -> { op.setup(form -> { buildFormParams(form); }); }).renderWith(data -> { buildInitParams(); RenderDataUtil.register(data, "notification", fessConfig.getNotificationSearchTop()); }); } }
public class class_name { @Execute public HtmlResponse index() { if (isLoginRequired()) { return redirectToLogin(); // depends on control dependency: [if], data = [none] } return asHtml(virtualHost(path_IndexJsp)).useForm(SearchForm.class, op -> { op.setup(form -> { buildFormParams(form); }); }).renderWith(data -> { buildInitParams(); RenderDataUtil.register(data, "notification", fessConfig.getNotificationSearchTop()); }); } }
public class class_name { public static void configureAnnotatedHttpServices( ServerBuilder server, List<AnnotatedServiceRegistrationBean> beans, @Nullable MeterIdPrefixFunctionFactory meterIdPrefixFunctionFactory) { requireNonNull(server, "server"); requireNonNull(beans, "beans"); beans.forEach(bean -> { Function<Service<HttpRequest, HttpResponse>, ? extends Service<HttpRequest, HttpResponse>> decorator = Function.identity(); for (Function<Service<HttpRequest, HttpResponse>, ? extends Service<HttpRequest, HttpResponse>> d : bean.getDecorators()) { decorator = decorator.andThen(d); } if (meterIdPrefixFunctionFactory != null) { decorator = decorator.andThen( metricCollectingServiceDecorator(bean, meterIdPrefixFunctionFactory)); } final ImmutableList<Object> exceptionHandlersAndConverters = ImmutableList.builder() .addAll(bean.getExceptionHandlers()) .addAll(bean.getRequestConverters()) .addAll(bean.getResponseConverters()) .build(); server.annotatedService(bean.getPathPrefix(), bean.getService(), decorator, exceptionHandlersAndConverters); }); } }
public class class_name { public static void configureAnnotatedHttpServices( ServerBuilder server, List<AnnotatedServiceRegistrationBean> beans, @Nullable MeterIdPrefixFunctionFactory meterIdPrefixFunctionFactory) { requireNonNull(server, "server"); requireNonNull(beans, "beans"); beans.forEach(bean -> { Function<Service<HttpRequest, HttpResponse>, ? extends Service<HttpRequest, HttpResponse>> decorator = Function.identity(); for (Function<Service<HttpRequest, HttpResponse>, ? extends Service<HttpRequest, HttpResponse>> d : bean.getDecorators()) { decorator = decorator.andThen(d); // depends on control dependency: [for], data = [d] } if (meterIdPrefixFunctionFactory != null) { decorator = decorator.andThen( metricCollectingServiceDecorator(bean, meterIdPrefixFunctionFactory)); // depends on control dependency: [if], data = [none] } final ImmutableList<Object> exceptionHandlersAndConverters = ImmutableList.builder() .addAll(bean.getExceptionHandlers()) .addAll(bean.getRequestConverters()) .addAll(bean.getResponseConverters()) .build(); server.annotatedService(bean.getPathPrefix(), bean.getService(), decorator, exceptionHandlersAndConverters); }); } }
public class class_name { public static void setUserConsent(boolean value) { boolean hadUserConsent = hasUserConsent(); WonderPushConfiguration.setUserConsent(value); boolean nowHasUserConsent = hasUserConsent(); if (sIsInitialized && hadUserConsent != nowHasUserConsent) { hasUserConsentChanged(nowHasUserConsent); } } }
public class class_name { public static void setUserConsent(boolean value) { boolean hadUserConsent = hasUserConsent(); WonderPushConfiguration.setUserConsent(value); boolean nowHasUserConsent = hasUserConsent(); if (sIsInitialized && hadUserConsent != nowHasUserConsent) { hasUserConsentChanged(nowHasUserConsent); // depends on control dependency: [if], data = [nowHasUserConsent)] } } }
public class class_name { @Subscribe public synchronized void renew(final DisabledStateChangedEvent disabledStateChangedEvent) { OrchestrationShardingSchema shardingSchema = disabledStateChangedEvent.getShardingSchema(); if (ShardingConstant.LOGIC_SCHEMA_NAME.equals(shardingSchema.getSchemaName())) { for (MasterSlaveRule each : dataSource.getShardingContext().getShardingRule().getMasterSlaveRules()) { ((OrchestrationMasterSlaveRule) each).updateDisabledDataSourceNames(shardingSchema.getDataSourceName(), disabledStateChangedEvent.isDisabled()); } } } }
public class class_name { @Subscribe public synchronized void renew(final DisabledStateChangedEvent disabledStateChangedEvent) { OrchestrationShardingSchema shardingSchema = disabledStateChangedEvent.getShardingSchema(); if (ShardingConstant.LOGIC_SCHEMA_NAME.equals(shardingSchema.getSchemaName())) { for (MasterSlaveRule each : dataSource.getShardingContext().getShardingRule().getMasterSlaveRules()) { ((OrchestrationMasterSlaveRule) each).updateDisabledDataSourceNames(shardingSchema.getDataSourceName(), disabledStateChangedEvent.isDisabled()); // depends on control dependency: [for], data = [each] } } } }
public class class_name { public Filter<S> or(Filter<S> filter) { if (filter.isOpen()) { return filter; } if (filter.isClosed()) { return this; } return OrFilter.getCanonical(this, filter); } }
public class class_name { public Filter<S> or(Filter<S> filter) { if (filter.isOpen()) { return filter; // depends on control dependency: [if], data = [none] } if (filter.isClosed()) { return this; // depends on control dependency: [if], data = [none] } return OrFilter.getCanonical(this, filter); } }
public class class_name { private void initializeParameters(InitParams initParams) { ValueParam paramRepository = initParams.getValueParam(REPOSITORY_NAME); repositoryName = paramRepository != null ? paramRepository.getValue() : null; ValueParam paramStoragePath = initParams.getValueParam(STORAGE_PATH); storagePath = paramStoragePath != null ? paramStoragePath.getValue() : STORAGE_PATH_DEFAULT; ValueParam paramStorageWorkspace = initParams.getValueParam(STORAGE_WORKSPACE); storageWorkspace = paramStorageWorkspace != null ? paramStorageWorkspace.getValue() : null; ValueParam paramDisableCache = initParams.getValueParam(CACHE_ENABLED); cacheEnabled = paramDisableCache != null ? Boolean.parseBoolean(paramDisableCache.getValue()) : CACHE_ENABLED_DEFAULT; if (repositoryName != null) { LOG.info("Repository from configuration file: " + repositoryName); } if (storageWorkspace != null) { LOG.info("Workspace from configuration file: " + storageWorkspace); } if (storagePath != null) { LOG.info("Root node from configuration file: " + storagePath); } LOG.info("Cache is " + (cacheEnabled ? "enabled" : "disabled")); } }
public class class_name { private void initializeParameters(InitParams initParams) { ValueParam paramRepository = initParams.getValueParam(REPOSITORY_NAME); repositoryName = paramRepository != null ? paramRepository.getValue() : null; ValueParam paramStoragePath = initParams.getValueParam(STORAGE_PATH); storagePath = paramStoragePath != null ? paramStoragePath.getValue() : STORAGE_PATH_DEFAULT; ValueParam paramStorageWorkspace = initParams.getValueParam(STORAGE_WORKSPACE); storageWorkspace = paramStorageWorkspace != null ? paramStorageWorkspace.getValue() : null; ValueParam paramDisableCache = initParams.getValueParam(CACHE_ENABLED); cacheEnabled = paramDisableCache != null ? Boolean.parseBoolean(paramDisableCache.getValue()) : CACHE_ENABLED_DEFAULT; if (repositoryName != null) { LOG.info("Repository from configuration file: " + repositoryName); // depends on control dependency: [if], data = [none] } if (storageWorkspace != null) { LOG.info("Workspace from configuration file: " + storageWorkspace); // depends on control dependency: [if], data = [none] } if (storagePath != null) { LOG.info("Root node from configuration file: " + storagePath); // depends on control dependency: [if], data = [none] } LOG.info("Cache is " + (cacheEnabled ? "enabled" : "disabled")); } }
public class class_name { public static InvocationException newInstance(InvocationContext context, HttpResponse response, Throwable rootCause) { if(rootCause instanceof InvocationException) { return (InvocationException)rootCause; } return new InvocationException(context, response, rootCause); } }
public class class_name { public static InvocationException newInstance(InvocationContext context, HttpResponse response, Throwable rootCause) { if(rootCause instanceof InvocationException) { return (InvocationException)rootCause; // depends on control dependency: [if], data = [none] } return new InvocationException(context, response, rootCause); } }
public class class_name { private List<WorkUnit> getWorkUnitsForTopic(KafkaTopic topic, SourceState state, Optional<State> topicSpecificState) { Timer.Context context = this.metricContext.timer("isTopicQualifiedTimer").time(); boolean topicQualified = isTopicQualified(topic); context.close(); List<WorkUnit> workUnits = Lists.newArrayList(); for (KafkaPartition partition : topic.getPartitions()) { WorkUnit workUnit = getWorkUnitForTopicPartition(partition, state, topicSpecificState); if (workUnit != null) { // For disqualified topics, for each of its workunits set the high watermark to be the same // as the low watermark, so that it will be skipped. if (!topicQualified) { skipWorkUnit(workUnit); } workUnits.add(workUnit); } } this.partitionsToBeProcessed.addAll(topic.getPartitions()); return workUnits; } }
public class class_name { private List<WorkUnit> getWorkUnitsForTopic(KafkaTopic topic, SourceState state, Optional<State> topicSpecificState) { Timer.Context context = this.metricContext.timer("isTopicQualifiedTimer").time(); boolean topicQualified = isTopicQualified(topic); context.close(); List<WorkUnit> workUnits = Lists.newArrayList(); for (KafkaPartition partition : topic.getPartitions()) { WorkUnit workUnit = getWorkUnitForTopicPartition(partition, state, topicSpecificState); if (workUnit != null) { // For disqualified topics, for each of its workunits set the high watermark to be the same // as the low watermark, so that it will be skipped. if (!topicQualified) { skipWorkUnit(workUnit); // depends on control dependency: [if], data = [none] } workUnits.add(workUnit); // depends on control dependency: [if], data = [(workUnit] } } this.partitionsToBeProcessed.addAll(topic.getPartitions()); return workUnits; } }
public class class_name { private void overrideFromSystemProperties() { String url = System.getProperty("activejdbc.url"); String user = System.getProperty("activejdbc.user"); String password = System.getProperty("activejdbc.password"); String driver = System.getProperty("activejdbc.driver"); if(!blank(url) && !blank(user) && !blank(driver)){ connectionSpecMap.put(getEnvironment(), new ConnectionJdbcSpec(driver, url, user, password)); } String jndi = System.getProperty("activejdbc.jndi"); if(!blank(jndi)){ connectionSpecMap.put(getEnvironment(), new ConnectionJndiSpec(jndi)); } } }
public class class_name { private void overrideFromSystemProperties() { String url = System.getProperty("activejdbc.url"); String user = System.getProperty("activejdbc.user"); String password = System.getProperty("activejdbc.password"); String driver = System.getProperty("activejdbc.driver"); if(!blank(url) && !blank(user) && !blank(driver)){ connectionSpecMap.put(getEnvironment(), new ConnectionJdbcSpec(driver, url, user, password)); // depends on control dependency: [if], data = [none] } String jndi = System.getProperty("activejdbc.jndi"); if(!blank(jndi)){ connectionSpecMap.put(getEnvironment(), new ConnectionJndiSpec(jndi)); // depends on control dependency: [if], data = [none] } } }
public class class_name { protected final boolean shouldSkipFilter(final I inMesg, final ZuulFilter<I, O> filter) { if (filter.filterType() == ENDPOINT) { //Endpoints may not be skipped return false; } final SessionContext zuulCtx = inMesg.getContext(); if ((zuulCtx.shouldStopFilterProcessing()) && (!filter.overrideStopFilterProcessing())) { return true; } if (zuulCtx.isCancelled()) { return true; } if (!filter.shouldFilter(inMesg)) { return true; } return false; } }
public class class_name { protected final boolean shouldSkipFilter(final I inMesg, final ZuulFilter<I, O> filter) { if (filter.filterType() == ENDPOINT) { //Endpoints may not be skipped return false; // depends on control dependency: [if], data = [none] } final SessionContext zuulCtx = inMesg.getContext(); if ((zuulCtx.shouldStopFilterProcessing()) && (!filter.overrideStopFilterProcessing())) { return true; // depends on control dependency: [if], data = [none] } if (zuulCtx.isCancelled()) { return true; // depends on control dependency: [if], data = [none] } if (!filter.shouldFilter(inMesg)) { return true; // depends on control dependency: [if], data = [none] } return false; } }
public class class_name { protected String stripHeadingAndCode(String text) { if (text.startsWith(DSLMappingEntry.CONDITION.getSymbol())) { return text.substring(DSLMappingEntry.CONDITION.getSymbol().length() + 2,text.indexOf("=")); } else if (text.startsWith(DSLMappingEntry.CONSEQUENCE.getSymbol())) { return text.substring(DSLMappingEntry.CONSEQUENCE.getSymbol().length() + 2,text.indexOf("=")); } else if (text.startsWith(DSLMappingEntry.ANY.getSymbol())) { return text.substring(DSLMappingEntry.ANY.getSymbol().length() + 2,text.indexOf("=")); } else if (text.startsWith("#")) { return ""; } else { return text; } } }
public class class_name { protected String stripHeadingAndCode(String text) { if (text.startsWith(DSLMappingEntry.CONDITION.getSymbol())) { return text.substring(DSLMappingEntry.CONDITION.getSymbol().length() + 2,text.indexOf("=")); // depends on control dependency: [if], data = [none] } else if (text.startsWith(DSLMappingEntry.CONSEQUENCE.getSymbol())) { return text.substring(DSLMappingEntry.CONSEQUENCE.getSymbol().length() + 2,text.indexOf("=")); // depends on control dependency: [if], data = [none] } else if (text.startsWith(DSLMappingEntry.ANY.getSymbol())) { return text.substring(DSLMappingEntry.ANY.getSymbol().length() + 2,text.indexOf("=")); // depends on control dependency: [if], data = [none] } else if (text.startsWith("#")) { return ""; // depends on control dependency: [if], data = [none] } else { return text; // depends on control dependency: [if], data = [none] } } }
public class class_name { private boolean condissect(RuntimeSubexpression t, int begin, int end) { Dfa d; Dfa d2; int mid; assert t.op == '.'; assert t.left != null && t.left.machine.states.length > 0; assert t.right != null && t.right.machine.states.length > 0; boolean shorter = (t.left.flags & Subre.SHORTER) != 0; int stop = shorter ? end : begin; d = new Dfa(this, t.left.machine); d2 = new Dfa(this, t.right.machine); /* pick a tentative midpoint */ if (shorter) { mid = d.shortest(begin, begin, end, null, null); } else { mid = d.longest(begin, end, null); } if (mid == -1) { throw new RuntimeException("Impossible mid."); } /* iterate until satisfaction or failure */ while (d2.longest(mid, end, null) != end) { /* that midpoint didn't work, find a new one */ if (mid == stop) { /* all possibilities exhausted! */ throw new RuntimeException("no midpoint"); } if (shorter) { mid = d.shortest(begin, mid + 1, end, null, null); } else { mid = d.longest(begin, mid - 1, null); } if (mid == -1) { throw new RuntimeException("Failed midpoint"); } } /* satisfaction */ boolean dissectMatch = dissect(t.left, begin, mid); if (!dissectMatch) { return false; } return dissect(t.right, mid, end); } }
public class class_name { private boolean condissect(RuntimeSubexpression t, int begin, int end) { Dfa d; Dfa d2; int mid; assert t.op == '.'; assert t.left != null && t.left.machine.states.length > 0; assert t.right != null && t.right.machine.states.length > 0; boolean shorter = (t.left.flags & Subre.SHORTER) != 0; int stop = shorter ? end : begin; d = new Dfa(this, t.left.machine); d2 = new Dfa(this, t.right.machine); /* pick a tentative midpoint */ if (shorter) { mid = d.shortest(begin, begin, end, null, null); } else { mid = d.longest(begin, end, null); } if (mid == -1) { throw new RuntimeException("Impossible mid."); } /* iterate until satisfaction or failure */ while (d2.longest(mid, end, null) != end) { /* that midpoint didn't work, find a new one */ if (mid == stop) { /* all possibilities exhausted! */ throw new RuntimeException("no midpoint"); } if (shorter) { mid = d.shortest(begin, mid + 1, end, null, null); // depends on control dependency: [if], data = [none] } else { mid = d.longest(begin, mid - 1, null); // depends on control dependency: [if], data = [none] } if (mid == -1) { throw new RuntimeException("Failed midpoint"); } } /* satisfaction */ boolean dissectMatch = dissect(t.left, begin, mid); if (!dissectMatch) { return false; } return dissect(t.right, mid, end); } }
public class class_name { public java.util.List<IpRouteInfo> getIpRoutesInfo() { if (ipRoutesInfo == null) { ipRoutesInfo = new com.amazonaws.internal.SdkInternalList<IpRouteInfo>(); } return ipRoutesInfo; } }
public class class_name { public java.util.List<IpRouteInfo> getIpRoutesInfo() { if (ipRoutesInfo == null) { ipRoutesInfo = new com.amazonaws.internal.SdkInternalList<IpRouteInfo>(); // depends on control dependency: [if], data = [none] } return ipRoutesInfo; } }
public class class_name { @Override public void paint(final RenderContext renderContext) { super.paint(renderContext); if (!DebugUtil.isDebugFeaturesEnabled() || !(renderContext instanceof WebXmlRenderContext)) { return; } XmlStringBuilder xml = ((WebXmlRenderContext) renderContext).getWriter(); xml.appendTag("ui:debug"); writeDebugInfo(getUI(), xml); xml.appendEndTag("ui:debug"); } }
public class class_name { @Override public void paint(final RenderContext renderContext) { super.paint(renderContext); if (!DebugUtil.isDebugFeaturesEnabled() || !(renderContext instanceof WebXmlRenderContext)) { return; // depends on control dependency: [if], data = [none] } XmlStringBuilder xml = ((WebXmlRenderContext) renderContext).getWriter(); xml.appendTag("ui:debug"); writeDebugInfo(getUI(), xml); xml.appendEndTag("ui:debug"); } }
public class class_name { public void positionAvoidAnimation (Animation anim, Rectangle viewBounds) { Rectangle abounds = new Rectangle(anim.getBounds()); @SuppressWarnings("unchecked") ArrayList<Animation> avoidables = (ArrayList<Animation>) _avoidAnims.clone(); // if we are able to place it somewhere, do so if (SwingUtil.positionRect(abounds, viewBounds, avoidables)) { anim.setLocation(abounds.x, abounds.y); } // add the animation to the list of avoidables _avoidAnims.add(anim); // keep an eye on it so that we can remove it when it's finished anim.addAnimationObserver(_avoidAnimObs); } }
public class class_name { public void positionAvoidAnimation (Animation anim, Rectangle viewBounds) { Rectangle abounds = new Rectangle(anim.getBounds()); @SuppressWarnings("unchecked") ArrayList<Animation> avoidables = (ArrayList<Animation>) _avoidAnims.clone(); // if we are able to place it somewhere, do so if (SwingUtil.positionRect(abounds, viewBounds, avoidables)) { anim.setLocation(abounds.x, abounds.y); // depends on control dependency: [if], data = [none] } // add the animation to the list of avoidables _avoidAnims.add(anim); // keep an eye on it so that we can remove it when it's finished anim.addAnimationObserver(_avoidAnimObs); } }
public class class_name { public static <E> Schema getWriterSchema(Class<E> type, Schema schema) { Schema writerSchema = schema; GenericData dataModel = getDataModelForType(type); if (dataModel instanceof AllowNulls) { // assume fields are non-null by default to avoid schema conflicts dataModel = ReflectData.get(); } if (dataModel instanceof SpecificData) { writerSchema = ((SpecificData)dataModel).getSchema(type); } return writerSchema; } }
public class class_name { public static <E> Schema getWriterSchema(Class<E> type, Schema schema) { Schema writerSchema = schema; GenericData dataModel = getDataModelForType(type); if (dataModel instanceof AllowNulls) { // assume fields are non-null by default to avoid schema conflicts dataModel = ReflectData.get(); // depends on control dependency: [if], data = [none] } if (dataModel instanceof SpecificData) { writerSchema = ((SpecificData)dataModel).getSchema(type); // depends on control dependency: [if], data = [none] } return writerSchema; } }
public class class_name { public void configure(String loadedFontName) { String fontName; boolean isArrangeCase = true; if (isSystemFont) { if (LwjgFontUtil.isEmpty(fontAlias)) { if (loadedFontName.matches("\\p{ASCII}*")) { // ASCII 文字のみであれば、そのまま使う fontName = loadedFontName; } else { // ASCII 文字以外が含まれていれば、連番を割り当てる fontName = SYSTEM_FONT_ALIAS + systemFontNumber; systemFontNumber++; } } else { fontName = fontAlias; isArrangeCase = false; } } else { fontName = LwjgFontUtil.trimExtention(new File(fontPath).getName()); } // fontClassName を設定する fontClassName = toFontClassName(fontName, isArrangeCase); } }
public class class_name { public void configure(String loadedFontName) { String fontName; boolean isArrangeCase = true; if (isSystemFont) { if (LwjgFontUtil.isEmpty(fontAlias)) { if (loadedFontName.matches("\\p{ASCII}*")) { // ASCII 文字のみであれば、そのまま使う fontName = loadedFontName; // depends on control dependency: [if], data = [none] } else { // ASCII 文字以外が含まれていれば、連番を割り当てる fontName = SYSTEM_FONT_ALIAS + systemFontNumber; // depends on control dependency: [if], data = [none] systemFontNumber++; // depends on control dependency: [if], data = [none] } } else { fontName = fontAlias; // depends on control dependency: [if], data = [none] isArrangeCase = false; // depends on control dependency: [if], data = [none] } } else { fontName = LwjgFontUtil.trimExtention(new File(fontPath).getName()); // depends on control dependency: [if], data = [none] } // fontClassName を設定する fontClassName = toFontClassName(fontName, isArrangeCase); } }
public class class_name { private void outputIndexTerm(final IndexTerm term, final XMLStreamWriter serializer, final boolean indexsee) throws XMLStreamException { final List<IndexTerm> subTerms = term.getSubTerms(); final int subTermNum = subTerms.size(); outputIndexTermStartElement(term, serializer, indexsee); if (subTermNum > 0) { for (final IndexTerm subTerm : subTerms) { outputIndexTerm(subTerm, serializer, indexsee); } } outputIndexTermEndElement(term, serializer, indexsee); } }
public class class_name { private void outputIndexTerm(final IndexTerm term, final XMLStreamWriter serializer, final boolean indexsee) throws XMLStreamException { final List<IndexTerm> subTerms = term.getSubTerms(); final int subTermNum = subTerms.size(); outputIndexTermStartElement(term, serializer, indexsee); if (subTermNum > 0) { for (final IndexTerm subTerm : subTerms) { outputIndexTerm(subTerm, serializer, indexsee); // depends on control dependency: [for], data = [subTerm] } } outputIndexTermEndElement(term, serializer, indexsee); } }
public class class_name { public void revive(CmsObject cms) { if (m_needsRevive) { if (m_directPublishResourceUUIDs != null) { m_directPublishResources = internalReadResourceList(cms, m_directPublishResourceUUIDs); } if (m_fileUUIDs != null) { m_fileList = internalReadResourceList(cms, m_fileUUIDs); } if (m_folderUUIDs != null) { m_folderList = internalReadResourceList(cms, m_folderUUIDs); } if (m_deletedFolderUUIDs != null) { m_deletedFolderList = internalReadResourceList(cms, m_deletedFolderUUIDs); } m_needsRevive = false; } } }
public class class_name { public void revive(CmsObject cms) { if (m_needsRevive) { if (m_directPublishResourceUUIDs != null) { m_directPublishResources = internalReadResourceList(cms, m_directPublishResourceUUIDs); // depends on control dependency: [if], data = [none] } if (m_fileUUIDs != null) { m_fileList = internalReadResourceList(cms, m_fileUUIDs); // depends on control dependency: [if], data = [none] } if (m_folderUUIDs != null) { m_folderList = internalReadResourceList(cms, m_folderUUIDs); // depends on control dependency: [if], data = [none] } if (m_deletedFolderUUIDs != null) { m_deletedFolderList = internalReadResourceList(cms, m_deletedFolderUUIDs); // depends on control dependency: [if], data = [none] } m_needsRevive = false; // depends on control dependency: [if], data = [none] } } }
public class class_name { public static final File getValidDocumentRoot() { // If document root not explicitly set see if we are running from IDE File file = getIDEDocumentRoot(); // If document root not explicitly set see if we are running from a war archive file = file != null ? file : getWarOrJarFileDocumentRoot(); // If not a war archive maybe it is an exploded war file = file != null ? file : getExplodedWarFileDocumentRoot(); if (file == null) { log.debug("None of the document roots " + Arrays.asList(COMMON_DOC_ROOTS) + " point to a directory and will be ignored."); } else { log.debug("Document root: " + file); } return file; } }
public class class_name { public static final File getValidDocumentRoot() { // If document root not explicitly set see if we are running from IDE File file = getIDEDocumentRoot(); // If document root not explicitly set see if we are running from a war archive file = file != null ? file : getWarOrJarFileDocumentRoot(); // If not a war archive maybe it is an exploded war file = file != null ? file : getExplodedWarFileDocumentRoot(); if (file == null) { log.debug("None of the document roots " + Arrays.asList(COMMON_DOC_ROOTS) + " point to a directory and will be ignored."); // depends on control dependency: [if], data = [none] } else { log.debug("Document root: " + file); // depends on control dependency: [if], data = [none] } return file; } }
public class class_name { public static <E extends Comparable<E>> void sortDescending(List<E> list) { while(!Sort.isReverseSorted(list)) { FYShuffle.shuffle(list); } } }
public class class_name { public static <E extends Comparable<E>> void sortDescending(List<E> list) { while(!Sort.isReverseSorted(list)) { FYShuffle.shuffle(list); // depends on control dependency: [while], data = [none] } } }
public class class_name { public boolean evaluateCustomQuery(final String customQuery, final Map<String, Object> parameters) { final SessionTransaction tx = db.getCurrentTransaction(); boolean result = false; try { result = tx.getBoolean(customQuery, parameters); } catch (Exception ignore) {} return result; } }
public class class_name { public boolean evaluateCustomQuery(final String customQuery, final Map<String, Object> parameters) { final SessionTransaction tx = db.getCurrentTransaction(); boolean result = false; try { result = tx.getBoolean(customQuery, parameters); // depends on control dependency: [try], data = [none] } catch (Exception ignore) {} // depends on control dependency: [catch], data = [none] return result; } }
public class class_name { public void updateStatistics(Instance instance) { super.updateStatistics(instance); this.perceptron.trainOnInstance(instance); if (this.predictionFunction != 1) { //Train target mean if prediction function is not Perceptron this.targetMean.trainOnInstance(instance); } } }
public class class_name { public void updateStatistics(Instance instance) { super.updateStatistics(instance); this.perceptron.trainOnInstance(instance); if (this.predictionFunction != 1) { //Train target mean if prediction function is not Perceptron this.targetMean.trainOnInstance(instance); // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override public String createMachine( TargetHandlerParameters parameters ) throws TargetException { this.logger.fine( "Creating a new machine." ); // For IaaS, we only expect root instance names to be passed if( InstanceHelpers.countInstances( parameters.getScopedInstancePath()) > 1 ) throw new TargetException( "Only root instances can be passed in arguments." ); // Validate all the properties here String rootInstanceName = InstanceHelpers.findRootInstancePath( parameters.getScopedInstancePath()); Map<String,String> targetProperties = parameters.getTargetProperties(); validateAll( targetProperties, parameters.getApplicationName(), rootInstanceName ); // Prepare the work NovaApi novaApi = OpenstackIaasHandler.novaApi( targetProperties ); String zoneName = findZoneName( novaApi, targetProperties ); String vmName = parameters.getApplicationName() + "." + rootInstanceName; // Find flavor and image IDs String flavorId = null; String flavorName = targetProperties.get( OpenstackIaasHandler.FLAVOR_NAME ); for( Resource res : novaApi.getFlavorApiForZone( zoneName ).list().concat()) { if( res.getName().equalsIgnoreCase( flavorName )) { flavorId = res.getId(); break; } } if( flavorId == null ) throw new TargetException( "No flavor named '" + flavorName + "' was found." ); String imageId = null; String imageName = targetProperties.get( OpenstackIaasHandler.IMAGE_NAME ); for( Resource res : novaApi.getImageApiForZone( zoneName ).list().concat()) { if( res.getName().equalsIgnoreCase( imageName )) { imageId = res.getId(); break; } } if( imageId == null ) throw new TargetException( "No image named '" + imageName + "' was found." ); // Prepare the server creation Map<String,String> metadata = new HashMap<>(3); metadata.put( "Application Name", parameters.getApplicationName()); metadata.put( "Root Instance Name", rootInstanceName ); metadata.put( "Created by", "Roboconf" ); try { String userData = UserDataHelpers.writeUserDataAsString( parameters.getMessagingProperties(), parameters.getDomain(), parameters.getApplicationName(), rootInstanceName ); CreateServerOptions options = CreateServerOptions.Builder .keyPairName( targetProperties.get( OpenstackIaasHandler.KEY_PAIR )) .securityGroupNames( targetProperties.get( OpenstackIaasHandler.SECURITY_GROUP )) .userData( userData.getBytes( StandardCharsets.UTF_8 )) .metadata( metadata ); String networkId = targetProperties.get( OpenstackIaasHandler.NETWORK_ID ); if( ! Utils.isEmptyOrWhitespaces( networkId )) options = options.networks( networkId ); ServerCreated server = novaApi.getServerApiForZone( zoneName ).create( vmName, imageId, flavorId, options); String machineId = server.getId(); novaApi.close(); return machineId; } catch( Exception e ) { throw new TargetException( e ); } } }
public class class_name { @Override public String createMachine( TargetHandlerParameters parameters ) throws TargetException { this.logger.fine( "Creating a new machine." ); // For IaaS, we only expect root instance names to be passed if( InstanceHelpers.countInstances( parameters.getScopedInstancePath()) > 1 ) throw new TargetException( "Only root instances can be passed in arguments." ); // Validate all the properties here String rootInstanceName = InstanceHelpers.findRootInstancePath( parameters.getScopedInstancePath()); Map<String,String> targetProperties = parameters.getTargetProperties(); validateAll( targetProperties, parameters.getApplicationName(), rootInstanceName ); // Prepare the work NovaApi novaApi = OpenstackIaasHandler.novaApi( targetProperties ); String zoneName = findZoneName( novaApi, targetProperties ); String vmName = parameters.getApplicationName() + "." + rootInstanceName; // Find flavor and image IDs String flavorId = null; String flavorName = targetProperties.get( OpenstackIaasHandler.FLAVOR_NAME ); for( Resource res : novaApi.getFlavorApiForZone( zoneName ).list().concat()) { if( res.getName().equalsIgnoreCase( flavorName )) { flavorId = res.getId(); // depends on control dependency: [if], data = [none] break; } } if( flavorId == null ) throw new TargetException( "No flavor named '" + flavorName + "' was found." ); String imageId = null; String imageName = targetProperties.get( OpenstackIaasHandler.IMAGE_NAME ); for( Resource res : novaApi.getImageApiForZone( zoneName ).list().concat()) { if( res.getName().equalsIgnoreCase( imageName )) { imageId = res.getId(); // depends on control dependency: [if], data = [none] break; } } if( imageId == null ) throw new TargetException( "No image named '" + imageName + "' was found." ); // Prepare the server creation Map<String,String> metadata = new HashMap<>(3); metadata.put( "Application Name", parameters.getApplicationName()); metadata.put( "Root Instance Name", rootInstanceName ); metadata.put( "Created by", "Roboconf" ); try { String userData = UserDataHelpers.writeUserDataAsString( parameters.getMessagingProperties(), parameters.getDomain(), parameters.getApplicationName(), rootInstanceName ); CreateServerOptions options = CreateServerOptions.Builder .keyPairName( targetProperties.get( OpenstackIaasHandler.KEY_PAIR )) .securityGroupNames( targetProperties.get( OpenstackIaasHandler.SECURITY_GROUP )) .userData( userData.getBytes( StandardCharsets.UTF_8 )) .metadata( metadata ); String networkId = targetProperties.get( OpenstackIaasHandler.NETWORK_ID ); if( ! Utils.isEmptyOrWhitespaces( networkId )) options = options.networks( networkId ); ServerCreated server = novaApi.getServerApiForZone( zoneName ).create( vmName, imageId, flavorId, options); String machineId = server.getId(); novaApi.close(); return machineId; } catch( Exception e ) { throw new TargetException( e ); } } }
public class class_name { private static int getScaleFactor(ImageMetadata metadata, int maxPixels) { int scale = 1; int scaledW = metadata.getW(); int scaledH = metadata.getH(); while (scaledW * scaledH > maxPixels) { scale *= 2; scaledH /= 2; scaledW /= 2; } return scale; } }
public class class_name { private static int getScaleFactor(ImageMetadata metadata, int maxPixels) { int scale = 1; int scaledW = metadata.getW(); int scaledH = metadata.getH(); while (scaledW * scaledH > maxPixels) { scale *= 2; // depends on control dependency: [while], data = [none] scaledH /= 2; // depends on control dependency: [while], data = [none] scaledW /= 2; // depends on control dependency: [while], data = [none] } return scale; } }
public class class_name { public void add(Iterable<XElement> elements) { for (XElement e : elements) { e.parent = this; children.add(e); } } }
public class class_name { public void add(Iterable<XElement> elements) { for (XElement e : elements) { e.parent = this; // depends on control dependency: [for], data = [e] children.add(e); // depends on control dependency: [for], data = [e] } } }
public class class_name { public TransportApiResult<List<StopTimetable>> getStopTimetable(String stopId, StopTimetableQueryOptions options) { if (Extensions.isNullOrWhiteSpace(stopId)) { throw new IllegalArgumentException("StopId is required."); } if (options == null) { options = StopTimetableQueryOptions.defaultQueryOptions(); } return TransportApiClientCalls.getStopTimetable(tokenComponent, settings, stopId, options); } }
public class class_name { public TransportApiResult<List<StopTimetable>> getStopTimetable(String stopId, StopTimetableQueryOptions options) { if (Extensions.isNullOrWhiteSpace(stopId)) { throw new IllegalArgumentException("StopId is required."); } if (options == null) { options = StopTimetableQueryOptions.defaultQueryOptions(); // depends on control dependency: [if], data = [none] } return TransportApiClientCalls.getStopTimetable(tokenComponent, settings, stopId, options); } }
public class class_name { protected void readHeader(ByteBuffer buffer) { super.readHeader(buffer); if (this.responseStatus != ResponseStatus.NO_ERROR) { if (ByteUtils.stepBuffer(buffer, this.responseTotalBodyLength)) { this.decodeStatus = BinaryDecodeStatus.DONE; } } } }
public class class_name { protected void readHeader(ByteBuffer buffer) { super.readHeader(buffer); if (this.responseStatus != ResponseStatus.NO_ERROR) { if (ByteUtils.stepBuffer(buffer, this.responseTotalBodyLength)) { this.decodeStatus = BinaryDecodeStatus.DONE; // depends on control dependency: [if], data = [none] } } } }
public class class_name { static void tryAutoAttaching(final SlotReference slot) { if (!MetadataFinder.getInstance().getMountedMediaSlots().contains(slot)) { logger.error("Unable to auto-attach cache to empty slot {}", slot); return; } if (MetadataFinder.getInstance().getMetadataCache(slot) != null) { logger.info("Not auto-attaching to slot {}; already has a cache attached.", slot); return; } if (MetadataFinder.getInstance().getAutoAttachCacheFiles().isEmpty()) { logger.debug("No auto-attach files configured."); return; } new Thread(new Runnable() { @Override public void run() { try { Thread.sleep(5); // Give us a chance to find out what type of media is in the new mount. final MediaDetails details = MetadataFinder.getInstance().getMediaDetailsFor(slot); if (details != null && details.mediaType == CdjStatus.TrackType.REKORDBOX) { // First stage attempt: See if we can match based on stored media details, which is both more reliable and // less disruptive than trying to sample the player database to compare entries. boolean attached = false; for (File file : MetadataFinder.getInstance().getAutoAttachCacheFiles()) { final MetadataCache cache = new MetadataCache(file); try { if (cache.sourceMedia != null && cache.sourceMedia.hashKey().equals(details.hashKey())) { // We found a solid match, no need to probe tracks. final boolean changed = cache.sourceMedia.hasChanged(details); logger.info("Auto-attaching metadata cache " + cache.getName() + " to slot " + slot + " based on media details " + (changed? "(changed since created)!" : "(unchanged).")); MetadataFinder.getInstance().attachMetadataCacheInternal(slot, cache); attached = true; return; } } finally { if (!attached) { cache.close(); } } } // Could not match based on media details; fall back to older method based on probing track metadata. ConnectionManager.ClientTask<Object> task = new ConnectionManager.ClientTask<Object>() { @Override public Object useClient(Client client) throws Exception { tryAutoAttachingWithConnection(slot, client); return null; } }; ConnectionManager.getInstance().invokeWithClientSession(slot.player, task, "trying to auto-attach metadata cache"); } } catch (Exception e) { logger.error("Problem trying to auto-attach metadata cache for slot " + slot, e); } } }, "Metadata cache file auto-attachment attempt").start(); } }
public class class_name { static void tryAutoAttaching(final SlotReference slot) { if (!MetadataFinder.getInstance().getMountedMediaSlots().contains(slot)) { logger.error("Unable to auto-attach cache to empty slot {}", slot); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } if (MetadataFinder.getInstance().getMetadataCache(slot) != null) { logger.info("Not auto-attaching to slot {}; already has a cache attached.", slot); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } if (MetadataFinder.getInstance().getAutoAttachCacheFiles().isEmpty()) { logger.debug("No auto-attach files configured."); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } new Thread(new Runnable() { @Override public void run() { try { Thread.sleep(5); // Give us a chance to find out what type of media is in the new mount. // depends on control dependency: [try], data = [none] final MediaDetails details = MetadataFinder.getInstance().getMediaDetailsFor(slot); if (details != null && details.mediaType == CdjStatus.TrackType.REKORDBOX) { // First stage attempt: See if we can match based on stored media details, which is both more reliable and // less disruptive than trying to sample the player database to compare entries. boolean attached = false; for (File file : MetadataFinder.getInstance().getAutoAttachCacheFiles()) { final MetadataCache cache = new MetadataCache(file); try { if (cache.sourceMedia != null && cache.sourceMedia.hashKey().equals(details.hashKey())) { // We found a solid match, no need to probe tracks. final boolean changed = cache.sourceMedia.hasChanged(details); logger.info("Auto-attaching metadata cache " + cache.getName() + " to slot " + slot + " based on media details " + (changed? "(changed since created)!" : "(unchanged).")); // depends on control dependency: [if], data = [none] MetadataFinder.getInstance().attachMetadataCacheInternal(slot, cache); // depends on control dependency: [if], data = [none] attached = true; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } } finally { if (!attached) { cache.close(); // depends on control dependency: [if], data = [none] } } } // Could not match based on media details; fall back to older method based on probing track metadata. ConnectionManager.ClientTask<Object> task = new ConnectionManager.ClientTask<Object>() { @Override public Object useClient(Client client) throws Exception { tryAutoAttachingWithConnection(slot, client); return null; } }; ConnectionManager.getInstance().invokeWithClientSession(slot.player, task, "trying to auto-attach metadata cache"); // depends on control dependency: [if], data = [none] } } catch (Exception e) { logger.error("Problem trying to auto-attach metadata cache for slot " + slot, e); } // depends on control dependency: [catch], data = [none] } }, "Metadata cache file auto-attachment attempt").start(); } }
public class class_name { @SecuredAction public Result index() { if(logger.isDebugEnabled()){ logger.debug("access granted to index"); } DemoUser user = (DemoUser) ctx().args.get(SecureSocial.USER_KEY); return ok(index.render(user, SecureSocial.env())); } }
public class class_name { @SecuredAction public Result index() { if(logger.isDebugEnabled()){ logger.debug("access granted to index"); // depends on control dependency: [if], data = [none] } DemoUser user = (DemoUser) ctx().args.get(SecureSocial.USER_KEY); return ok(index.render(user, SecureSocial.env())); } }
public class class_name { public static String getFormatFromURI(String uri, MimeType[] mimeTypes) { if (uri.endsWith("/")) { return null; } int idx = uri.lastIndexOf('/'); if (idx > -1) { String lastToken = uri.substring(idx+1, uri.length()); idx = lastToken.lastIndexOf('.'); if (idx > -1 && idx != lastToken.length() - 1) { String extension = lastToken.substring(idx+1, lastToken.length()); if (mimeTypes != null) { for (MimeType mimeType : mimeTypes) { if (mimeType.getExtension().equals(extension)) return extension; } } } } return null; } }
public class class_name { public static String getFormatFromURI(String uri, MimeType[] mimeTypes) { if (uri.endsWith("/")) { return null; // depends on control dependency: [if], data = [none] } int idx = uri.lastIndexOf('/'); if (idx > -1) { String lastToken = uri.substring(idx+1, uri.length()); idx = lastToken.lastIndexOf('.'); // depends on control dependency: [if], data = [none] if (idx > -1 && idx != lastToken.length() - 1) { String extension = lastToken.substring(idx+1, lastToken.length()); if (mimeTypes != null) { for (MimeType mimeType : mimeTypes) { if (mimeType.getExtension().equals(extension)) return extension; } } } } return null; } }
public class class_name { @Override protected TypeReference getProposalProviderClass(Grammar grammar) { final String simpleName = GrammarUtil.getSimpleName(grammar); if (XTEND_GRAMMAR_NAME.equals(simpleName)) { return new TypeReference(XTEND_PROPOSAL_PROVIDER); } return super.getProposalProviderClass(grammar); } }
public class class_name { @Override protected TypeReference getProposalProviderClass(Grammar grammar) { final String simpleName = GrammarUtil.getSimpleName(grammar); if (XTEND_GRAMMAR_NAME.equals(simpleName)) { return new TypeReference(XTEND_PROPOSAL_PROVIDER); // depends on control dependency: [if], data = [none] } return super.getProposalProviderClass(grammar); } }
public class class_name { void free(boolean finalizer) { // As free() may be called either by the finalizer or by FastThreadLocal.onRemoval(...) we need to ensure // we only call this one time. if (freed.compareAndSet(false, true)) { int numFreed = free(tinySubPageDirectCaches, finalizer) + free(smallSubPageDirectCaches, finalizer) + free(normalDirectCaches, finalizer) + free(tinySubPageHeapCaches, finalizer) + free(smallSubPageHeapCaches, finalizer) + free(normalHeapCaches, finalizer); if (numFreed > 0 && logger.isDebugEnabled()) { logger.debug("Freed {} thread-local buffer(s) from thread: {}", numFreed, Thread.currentThread().getName()); } if (directArena != null) { directArena.numThreadCaches.getAndDecrement(); } if (heapArena != null) { heapArena.numThreadCaches.getAndDecrement(); } } } }
public class class_name { void free(boolean finalizer) { // As free() may be called either by the finalizer or by FastThreadLocal.onRemoval(...) we need to ensure // we only call this one time. if (freed.compareAndSet(false, true)) { int numFreed = free(tinySubPageDirectCaches, finalizer) + free(smallSubPageDirectCaches, finalizer) + free(normalDirectCaches, finalizer) + free(tinySubPageHeapCaches, finalizer) + free(smallSubPageHeapCaches, finalizer) + free(normalHeapCaches, finalizer); if (numFreed > 0 && logger.isDebugEnabled()) { logger.debug("Freed {} thread-local buffer(s) from thread: {}", numFreed, Thread.currentThread().getName()); // depends on control dependency: [if], data = [none] } if (directArena != null) { directArena.numThreadCaches.getAndDecrement(); // depends on control dependency: [if], data = [none] } if (heapArena != null) { heapArena.numThreadCaches.getAndDecrement(); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public void jmolColorByChain(){ String script = "function color_by_chain(objtype, color_list) {"+ String.format("%n") + ""+ String.format("%n") + " if (color_list) {"+ String.format("%n") + " if (color_list.type == \"string\") {"+ String.format("%n") + " color_list = color_list.split(\",\").trim();"+ String.format("%n") + " }"+ String.format("%n") + " } else {"+ String.format("%n") + " color_list = [\"104BA9\",\"AA00A2\",\"C9F600\",\"FFA200\",\"284A7E\",\"7F207B\",\"9FB82E\",\"BF8B30\",\"052D6E\",\"6E0069\",\"83A000\",\"A66A00\",\"447BD4\",\"D435CD\",\"D8FA3F\",\"FFBA40\",\"6A93D4\",\"D460CF\",\"E1FA71\",\"FFCC73\"];"+ String.format("%n") + " }"+ String.format("%n") + " var cmd2 = \"\";"+ String.format("%n") + " if (!objtype) {"+ String.format("%n") + " var type_list = [ \"backbone\",\"cartoon\",\"dots\",\"halo\",\"label\",\"meshribbon\",\"polyhedra\",\"rocket\",\"star\",\"strand\",\"strut\",\"trace\"];"+ String.format("%n") + " cmd2 = \"color \" + type_list.join(\" none; color \") + \" none;\";"+ String.format("%n") + " objtype = \"atoms\";"+ String.format("%n") + " }"+ String.format("%n") + " var chain_list = script(\"show chain\").trim().lines;"+ String.format("%n") + " var chain_count = chain_list.length;"+ String.format("%n") + " var color_count = color_list.length;"+ String.format("%n") + " var sel = {selected};"+ String.format("%n") + " var cmds = \"\";"+ String.format("%n") + " for (var chain_number=1; chain_number<=chain_count; chain_number++) {"+ String.format("%n") + " // remember, Jmol arrays start with 1, but % can return 0"+ String.format("%n") + " cmds += \"select sel and :\" + chain_list[chain_number] + \";color \" + objtype + \" [x\" + color_list[(chain_number-1) % color_count + 1] + \"];\" + cmd2;"+ String.format("%n") + " }"+ String.format("%n") + " script INLINE @{cmds + \"select sel\"}"+ String.format("%n") + "}"; executeCmd(script); } }
public class class_name { public void jmolColorByChain(){ String script = "function color_by_chain(objtype, color_list) {"+ String.format("%n") + ""+ String.format("%n") + " if (color_list) {"+ String.format("%n") + " if (color_list.type == \"string\") {"+ String.format("%n") + " color_list = color_list.split(\",\").trim();"+ String.format("%n") + // depends on control dependency: [if], data = [none] " }"+ String.format("%n") + " } else {"+ String.format("%n") + " color_list = [\"104BA9\",\"AA00A2\",\"C9F600\",\"FFA200\",\"284A7E\",\"7F207B\",\"9FB82E\",\"BF8B30\",\"052D6E\",\"6E0069\",\"83A000\",\"A66A00\",\"447BD4\",\"D435CD\",\"D8FA3F\",\"FFBA40\",\"6A93D4\",\"D460CF\",\"E1FA71\",\"FFCC73\"];"+ String.format("%n") + " }"+ String.format("%n") + " var cmd2 = \"\";"+ String.format("%n") + " if (!objtype) {"+ String.format("%n") + " var type_list = [ \"backbone\",\"cartoon\",\"dots\",\"halo\",\"label\",\"meshribbon\",\"polyhedra\",\"rocket\",\"star\",\"strand\",\"strut\",\"trace\"];"+ String.format("%n") + " cmd2 = \"color \" + type_list.join(\" none; color \") + \" none;\";"+ String.format("%n") + " objtype = \"atoms\";"+ String.format("%n") + " }"+ String.format("%n") + " var chain_list = script(\"show chain\").trim().lines;"+ String.format("%n") + " var chain_count = chain_list.length;"+ String.format("%n") + " var color_count = color_list.length;"+ String.format("%n") + " var sel = {selected};"+ String.format("%n") + " var cmds = \"\";"+ String.format("%n") + " for (var chain_number=1; chain_number<=chain_count; chain_number++) {"+ String.format("%n") + " // remember, Jmol arrays start with 1, but % can return 0"+ String.format("%n") + " cmds += \"select sel and :\" + chain_list[chain_number] + \";color \" + objtype + \" [x\" + color_list[(chain_number-1) % color_count + 1] + \"];\" + cmd2;"+ String.format("%n") + " }"+ String.format("%n") + " script INLINE @{cmds + \"select sel\"}"+ String.format("%n") + "}"; executeCmd(script); } }