code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { public void stop() { if(log.isInfoEnabled()) { log.info("Stopping Zabbix agent."); } if(enablePassive) { if(log.isInfoEnabled()) { log.info("Stopping passive listener."); } listenerThread.shutdown(); try { listenerThread.join(); } catch(InterruptedException ie) { // } if(log.isInfoEnabled()) { log.info("Passive listener stopped."); } } if(enableActive) { if(log.isInfoEnabled()) { log.info("Stopping active agent."); } activeThread.shutdown(); try { activeThread.join(); } catch(InterruptedException ie) { // } if(log.isInfoEnabled()) { log.info("Active agent stopped."); } } if(log.isInfoEnabled()) { log.info("Zabbix agent stopped."); } } }
public class class_name { public void stop() { if(log.isInfoEnabled()) { log.info("Stopping Zabbix agent."); // depends on control dependency: [if], data = [none] } if(enablePassive) { if(log.isInfoEnabled()) { log.info("Stopping passive listener."); // depends on control dependency: [if], data = [none] } listenerThread.shutdown(); // depends on control dependency: [if], data = [none] try { listenerThread.join(); // depends on control dependency: [try], data = [none] } catch(InterruptedException ie) { // } // depends on control dependency: [catch], data = [none] if(log.isInfoEnabled()) { log.info("Passive listener stopped."); // depends on control dependency: [if], data = [none] } } if(enableActive) { if(log.isInfoEnabled()) { log.info("Stopping active agent."); // depends on control dependency: [if], data = [none] } activeThread.shutdown(); // depends on control dependency: [if], data = [none] try { activeThread.join(); // depends on control dependency: [try], data = [none] } catch(InterruptedException ie) { // } // depends on control dependency: [catch], data = [none] if(log.isInfoEnabled()) { log.info("Active agent stopped."); // depends on control dependency: [if], data = [none] } } if(log.isInfoEnabled()) { log.info("Zabbix agent stopped."); // depends on control dependency: [if], data = [none] } } }
public class class_name { protected void logSizes() { StringBuilder buf = new StringBuilder(1000); final int cols = widths.size(); final int rows = heights.size(); { buf.append("Widths: "); for(int x = 0; x < cols; x++) { if(x > 0) { buf.append(", "); } buf.append(widths.get(x)); } buf.append('\n'); } { buf.append("Heights: "); for(int y = 0; y < rows; y++) { if(y > 0) { buf.append(", "); } buf.append(heights.get(y)); } buf.append('\n'); } { for(int y = 0; y < rows; y++) { for(int x = 0; x < cols; x++) { buf.append(usage.get(y).get(x) != null ? 'X' : '_'); } buf.append("|\n"); } for(int x = 0; x < cols; x++) { buf.append('-'); } buf.append("+\n"); } LOG.debug(buf); } }
public class class_name { protected void logSizes() { StringBuilder buf = new StringBuilder(1000); final int cols = widths.size(); final int rows = heights.size(); { buf.append("Widths: "); for(int x = 0; x < cols; x++) { if(x > 0) { buf.append(", "); // depends on control dependency: [if], data = [none] } buf.append(widths.get(x)); // depends on control dependency: [for], data = [x] } buf.append('\n'); } { buf.append("Heights: "); for(int y = 0; y < rows; y++) { if(y > 0) { buf.append(", "); // depends on control dependency: [if], data = [none] } buf.append(heights.get(y)); // depends on control dependency: [for], data = [y] } buf.append('\n'); } { for(int y = 0; y < rows; y++) { for(int x = 0; x < cols; x++) { buf.append(usage.get(y).get(x) != null ? 'X' : '_'); // depends on control dependency: [for], data = [x] } buf.append("|\n"); // depends on control dependency: [for], data = [none] } for(int x = 0; x < cols; x++) { buf.append('-'); // depends on control dependency: [for], data = [none] } buf.append("+\n"); } LOG.debug(buf); } }
public class class_name { public static boolean isOverlay(Element element) { for (String overlayClass : Arrays.asList( I_CmsLayoutBundle.INSTANCE.containerpageCss().expiredOverlay(), CmsElementOptionBar.CSS_CLASS)) { if (element.hasClassName(overlayClass)) { return true; } } return false; } }
public class class_name { public static boolean isOverlay(Element element) { for (String overlayClass : Arrays.asList( I_CmsLayoutBundle.INSTANCE.containerpageCss().expiredOverlay(), CmsElementOptionBar.CSS_CLASS)) { if (element.hasClassName(overlayClass)) { return true; // depends on control dependency: [if], data = [none] } } return false; } }
public class class_name { public final boolean tryRelease() throws LockFile.FileSecurityException, LockFile.UnexpectedFileIOException { boolean released = !locked; if (released) { return true; } stopHeartbeat(); doOptionalReleaseActions(); UnexpectedFileIOException closeRAFReason = null; FileSecurityException securityReason = null; try { try { closeRAF(); } catch (UnexpectedFileIOException ex) { closeRAFReason = ex; } try { // Hack Alert: // // Even without the presence of concurrent locking attempts, // the delete or exists invocations below occasionally return // false otherwise, perhaps due to a race condition with the // heartbeat timestamp writer task or some nio file lock release // timing issue? // // TODO: // // determine if this is an external constraint or if we can // solve it instead by waiting for any in-progress // writeHeartbeat operation to conclude. Thread.sleep(100); } catch (Exception ex) { // ex.printStackTrace(); } try { released = file.delete(); // Perhaps excessive... // // Another Lockfile may recreate the file an instant after it is // deleted above (if it it deleted successfully, that is) // released = !file.exists(); } catch (SecurityException ex) { securityReason = new FileSecurityException(this, "tryRelease", ex); } } finally { // Regardless of whether all release work succeeds, it is important // to indicate that, from the perspective of this instance, a lock // condition is no longer held. // // However, in a world of concurrent execution, we do not want to // to expose this fact extenally until *after* all release work has // been at least attempted. this.locked = false; } if (closeRAFReason != null) { throw closeRAFReason; } else if (securityReason != null) { throw securityReason; } return released; } }
public class class_name { public final boolean tryRelease() throws LockFile.FileSecurityException, LockFile.UnexpectedFileIOException { boolean released = !locked; if (released) { return true; } stopHeartbeat(); doOptionalReleaseActions(); UnexpectedFileIOException closeRAFReason = null; FileSecurityException securityReason = null; try { try { closeRAF(); // depends on control dependency: [try], data = [none] } catch (UnexpectedFileIOException ex) { closeRAFReason = ex; } // depends on control dependency: [catch], data = [none] try { // Hack Alert: // // Even without the presence of concurrent locking attempts, // the delete or exists invocations below occasionally return // false otherwise, perhaps due to a race condition with the // heartbeat timestamp writer task or some nio file lock release // timing issue? // // TODO: // // determine if this is an external constraint or if we can // solve it instead by waiting for any in-progress // writeHeartbeat operation to conclude. Thread.sleep(100); // depends on control dependency: [try], data = [none] } catch (Exception ex) { // ex.printStackTrace(); } // depends on control dependency: [catch], data = [none] try { released = file.delete(); // depends on control dependency: [try], data = [none] // Perhaps excessive... // // Another Lockfile may recreate the file an instant after it is // deleted above (if it it deleted successfully, that is) // released = !file.exists(); } catch (SecurityException ex) { securityReason = new FileSecurityException(this, "tryRelease", ex); } // depends on control dependency: [catch], data = [none] } finally { // Regardless of whether all release work succeeds, it is important // to indicate that, from the perspective of this instance, a lock // condition is no longer held. // // However, in a world of concurrent execution, we do not want to // to expose this fact extenally until *after* all release work has // been at least attempted. this.locked = false; } if (closeRAFReason != null) { throw closeRAFReason; } else if (securityReason != null) { throw securityReason; } return released; } }
public class class_name { @Override public void run() { if (!mDone) { synchronized (this) { if (!mDone) { call(); mDone = true; try { this.notifyAll(); } catch (Exception ignored) { } } } } } }
public class class_name { @Override public void run() { if (!mDone) { synchronized (this) { // depends on control dependency: [if], data = [none] if (!mDone) { call(); // depends on control dependency: [if], data = [none] mDone = true; // depends on control dependency: [if], data = [none] try { this.notifyAll(); // depends on control dependency: [try], data = [none] } catch (Exception ignored) { } // depends on control dependency: [catch], data = [none] } } } } }
public class class_name { public Observable<ServiceResponse<List<PrebuiltDomain>>> listAvailableCustomPrebuiltDomainsWithServiceResponseAsync() { if (this.client.endpoint() == null) { throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); } String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); return service.listAvailableCustomPrebuiltDomains(this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<List<PrebuiltDomain>>>>() { @Override public Observable<ServiceResponse<List<PrebuiltDomain>>> call(Response<ResponseBody> response) { try { ServiceResponse<List<PrebuiltDomain>> clientResponse = listAvailableCustomPrebuiltDomainsDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } }
public class class_name { public Observable<ServiceResponse<List<PrebuiltDomain>>> listAvailableCustomPrebuiltDomainsWithServiceResponseAsync() { if (this.client.endpoint() == null) { throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); } String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); return service.listAvailableCustomPrebuiltDomains(this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<List<PrebuiltDomain>>>>() { @Override public Observable<ServiceResponse<List<PrebuiltDomain>>> call(Response<ResponseBody> response) { try { ServiceResponse<List<PrebuiltDomain>> clientResponse = listAvailableCustomPrebuiltDomainsDelegate(response); return Observable.just(clientResponse); // depends on control dependency: [try], data = [none] } catch (Throwable t) { return Observable.error(t); } // depends on control dependency: [catch], data = [none] } }); } }
public class class_name { public static String relativize(Path baseDir, Path file) { String path = baseDir.toUri().relativize(file.toUri()).getPath(); if (!"/".equals(baseDir.getFileSystem().getSeparator())) { // For windows return path.replace(baseDir.getFileSystem().getSeparator(), "/"); } else { return path; } } }
public class class_name { public static String relativize(Path baseDir, Path file) { String path = baseDir.toUri().relativize(file.toUri()).getPath(); if (!"/".equals(baseDir.getFileSystem().getSeparator())) { // For windows return path.replace(baseDir.getFileSystem().getSeparator(), "/"); // depends on control dependency: [if], data = [none] } else { return path; // depends on control dependency: [if], data = [none] } } }
public class class_name { public EClass getIfcHourInDay() { if (ifcHourInDayEClass == null) { ifcHourInDayEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI) .getEClassifiers().get(684); } return ifcHourInDayEClass; } }
public class class_name { public EClass getIfcHourInDay() { if (ifcHourInDayEClass == null) { ifcHourInDayEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI) .getEClassifiers().get(684); // depends on control dependency: [if], data = [none] } return ifcHourInDayEClass; } }
public class class_name { private int getDegreeSafe(Node node, RelationshipType relType, Direction direction) { if (relType == null) { return node.getDegree(direction); } return node.getDegree(relType, direction); } }
public class class_name { private int getDegreeSafe(Node node, RelationshipType relType, Direction direction) { if (relType == null) { return node.getDegree(direction); // depends on control dependency: [if], data = [none] } return node.getDegree(relType, direction); } }
public class class_name { public RenderScript getRenderScript() { if (renderScript == null) { renderScript = RenderScript.create(context, renderScriptContextType); } return renderScript; } }
public class class_name { public RenderScript getRenderScript() { if (renderScript == null) { renderScript = RenderScript.create(context, renderScriptContextType); // depends on control dependency: [if], data = [none] } return renderScript; } }
public class class_name { public void disableManager() { logger.info("Disabling Metric Manager"); if (isManagerEnabled) { isManagerEnabled = false; for (final IMetricEmitter emitter : this.metricEmitters) { try { emitter.purgeAllData(); } catch (final MetricException ex) { logger.error("Failed to purge data ", ex); } } } } }
public class class_name { public void disableManager() { logger.info("Disabling Metric Manager"); if (isManagerEnabled) { isManagerEnabled = false; // depends on control dependency: [if], data = [none] for (final IMetricEmitter emitter : this.metricEmitters) { try { emitter.purgeAllData(); // depends on control dependency: [try], data = [none] } catch (final MetricException ex) { logger.error("Failed to purge data ", ex); } // depends on control dependency: [catch], data = [none] } } } }
public class class_name { public ValidStorageOptions withIopsToStorageRatio(DoubleRange... iopsToStorageRatio) { if (this.iopsToStorageRatio == null) { setIopsToStorageRatio(new com.amazonaws.internal.SdkInternalList<DoubleRange>(iopsToStorageRatio.length)); } for (DoubleRange ele : iopsToStorageRatio) { this.iopsToStorageRatio.add(ele); } return this; } }
public class class_name { public ValidStorageOptions withIopsToStorageRatio(DoubleRange... iopsToStorageRatio) { if (this.iopsToStorageRatio == null) { setIopsToStorageRatio(new com.amazonaws.internal.SdkInternalList<DoubleRange>(iopsToStorageRatio.length)); // depends on control dependency: [if], data = [none] } for (DoubleRange ele : iopsToStorageRatio) { this.iopsToStorageRatio.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { public static <T> Collection<T> collect(Iterable<T> stream) { LinkedList<T> collection = new LinkedList<>(); for (T e : stream) { collection.add(e); } return collection; } }
public class class_name { public static <T> Collection<T> collect(Iterable<T> stream) { LinkedList<T> collection = new LinkedList<>(); for (T e : stream) { collection.add(e); // depends on control dependency: [for], data = [e] } return collection; } }
public class class_name { public static void convert (final SquareMatrix sm) { for (int r = 0; r < sm.m_nRows; ++r) { for (int c = 0; c < sm.m_nCols; ++c) { sm.m_aValues[r][c] = (r == c) ? 1 : 0; } } } }
public class class_name { public static void convert (final SquareMatrix sm) { for (int r = 0; r < sm.m_nRows; ++r) { for (int c = 0; c < sm.m_nCols; ++c) { sm.m_aValues[r][c] = (r == c) ? 1 : 0; // depends on control dependency: [for], data = [c] } } } }
public class class_name { public static double getCosinValue(double[] vector1, double[] vector2) { if (vector1 == null || vector2 == null) { return 0; } double dotProduct = VectorUtils.dotProduct(vector1, vector2); double euclideanDistance = VectorUtils.vectorLen(vector1) * VectorUtils.vectorLen(vector2); double cosineValue = Math.abs(dotProduct / euclideanDistance); return cosineValue > 1.0D ? 1.0D : cosineValue; // because of the precision error } }
public class class_name { public static double getCosinValue(double[] vector1, double[] vector2) { if (vector1 == null || vector2 == null) { return 0; // depends on control dependency: [if], data = [none] } double dotProduct = VectorUtils.dotProduct(vector1, vector2); double euclideanDistance = VectorUtils.vectorLen(vector1) * VectorUtils.vectorLen(vector2); double cosineValue = Math.abs(dotProduct / euclideanDistance); return cosineValue > 1.0D ? 1.0D : cosineValue; // because of the precision error } }
public class class_name { @Override public void onAdd(Response response) { String message = gson.toJson(response); try { ActiveMqUtils.sendMessage(message, buildQueueNames(response), environment); } catch (JMSException e) { logger.error("Failed to send response message to output queue.", e); } } }
public class class_name { @Override public void onAdd(Response response) { String message = gson.toJson(response); try { ActiveMqUtils.sendMessage(message, buildQueueNames(response), environment); // depends on control dependency: [try], data = [none] } catch (JMSException e) { logger.error("Failed to send response message to output queue.", e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { @Override public Prediction _predictRecord(Record r) { AbstractModelParameters modelParameters = knowledgeBase.getModelParameters(); Map<List<Object>, Double> logLikelihoods = modelParameters.getLogLikelihoods(); Map<Object, Double> logPriors = modelParameters.getLogPriors(); Set<Object> classesSet = modelParameters.getClasses(); Object someClass = classesSet.iterator().next(); boolean isBinarized = isBinarized(); //initialize scores with the scores of the priors AssociativeArray predictionScores = new AssociativeArray(new HashMap<>(logPriors)); for(Map.Entry<Object, Object> entry : r.getX().entrySet()) { Object feature = entry.getKey(); //EVERY feature within our dictionary has a value for EVERY class //So if the feature has no value for one random class (someClass has //no particular significance), then it will not have for any class //and thus the feature is not in the dictionary and can be ignored. if(!logLikelihoods.containsKey(Arrays.asList(feature, someClass))) { continue; } //extract the feature scores for each class for the particular feature AssociativeArray classLogScoresForThisFeature = new AssociativeArray(); for(Object theClass : classesSet) { Double logScore = logLikelihoods.get(Arrays.asList(feature, theClass)); classLogScoresForThisFeature.put(theClass, logScore); } Double occurrences=TypeInference.toDouble(entry.getValue()); if((!knowledgeBase.getTrainingParameters().isMultiProbabilityWeighted() || isBinarized) && occurrences>0) { occurrences=1.0; } for(Map.Entry<Object, Object> entry2 : classLogScoresForThisFeature.entrySet()) { Object theClass = entry2.getKey(); Double logScore = TypeInference.toDouble(entry2.getValue()); Double previousValue = predictionScores.getDouble(theClass); predictionScores.put(theClass, previousValue+occurrences*logScore); } //classLogScoresForThisFeature=null; } Object predictedClass=getSelectedClassFromClassScores(predictionScores); Descriptives.normalizeExp(predictionScores); return new Prediction(predictedClass, predictionScores); } }
public class class_name { @Override public Prediction _predictRecord(Record r) { AbstractModelParameters modelParameters = knowledgeBase.getModelParameters(); Map<List<Object>, Double> logLikelihoods = modelParameters.getLogLikelihoods(); Map<Object, Double> logPriors = modelParameters.getLogPriors(); Set<Object> classesSet = modelParameters.getClasses(); Object someClass = classesSet.iterator().next(); boolean isBinarized = isBinarized(); //initialize scores with the scores of the priors AssociativeArray predictionScores = new AssociativeArray(new HashMap<>(logPriors)); for(Map.Entry<Object, Object> entry : r.getX().entrySet()) { Object feature = entry.getKey(); //EVERY feature within our dictionary has a value for EVERY class //So if the feature has no value for one random class (someClass has //no particular significance), then it will not have for any class //and thus the feature is not in the dictionary and can be ignored. if(!logLikelihoods.containsKey(Arrays.asList(feature, someClass))) { continue; } //extract the feature scores for each class for the particular feature AssociativeArray classLogScoresForThisFeature = new AssociativeArray(); for(Object theClass : classesSet) { Double logScore = logLikelihoods.get(Arrays.asList(feature, theClass)); classLogScoresForThisFeature.put(theClass, logScore); // depends on control dependency: [for], data = [theClass] } Double occurrences=TypeInference.toDouble(entry.getValue()); if((!knowledgeBase.getTrainingParameters().isMultiProbabilityWeighted() || isBinarized) && occurrences>0) { occurrences=1.0; // depends on control dependency: [if], data = [none] } for(Map.Entry<Object, Object> entry2 : classLogScoresForThisFeature.entrySet()) { Object theClass = entry2.getKey(); Double logScore = TypeInference.toDouble(entry2.getValue()); Double previousValue = predictionScores.getDouble(theClass); predictionScores.put(theClass, previousValue+occurrences*logScore); // depends on control dependency: [for], data = [none] } //classLogScoresForThisFeature=null; } Object predictedClass=getSelectedClassFromClassScores(predictionScores); Descriptives.normalizeExp(predictionScores); return new Prediction(predictedClass, predictionScores); } }
public class class_name { private void updateStatistic(OIndex<?> index) { if (OProfiler.getInstance().isRecording()) { OProfiler.getInstance().updateCounter("Query.indexUsage", 1); final int paramCount = index.getDefinition().getParamCount(); if (paramCount > 1) { OProfiler.getInstance().updateCounter("Query.compositeIndexUsage", 1); OProfiler.getInstance().updateCounter("Query.compositeIndexUsage." + paramCount, 1); } } } }
public class class_name { private void updateStatistic(OIndex<?> index) { if (OProfiler.getInstance().isRecording()) { OProfiler.getInstance().updateCounter("Query.indexUsage", 1); // depends on control dependency: [if], data = [none] final int paramCount = index.getDefinition().getParamCount(); if (paramCount > 1) { OProfiler.getInstance().updateCounter("Query.compositeIndexUsage", 1); // depends on control dependency: [if], data = [1)] OProfiler.getInstance().updateCounter("Query.compositeIndexUsage." + paramCount, 1); // depends on control dependency: [if], data = [1)] } } } }
public class class_name { protected List<String> getTokensFromHeader(Request request, String headerName) { List<String> result = new ArrayList<>(); Enumeration<String> headers = request.getHeaders(headerName); while (headers.hasMoreElements()) { String header = headers.nextElement(); String[] tokens = header.split(","); for (String token : tokens) { result.add(token.trim()); } } return result; } }
public class class_name { protected List<String> getTokensFromHeader(Request request, String headerName) { List<String> result = new ArrayList<>(); Enumeration<String> headers = request.getHeaders(headerName); while (headers.hasMoreElements()) { String header = headers.nextElement(); String[] tokens = header.split(","); for (String token : tokens) { result.add(token.trim()); // depends on control dependency: [for], data = [token] } } return result; } }
public class class_name { public Field updateFieldDateTimeDate(Field formFieldParam) { if(formFieldParam != null && this.serviceTicket != null) { formFieldParam.setServiceTicket(this.serviceTicket); } if(formFieldParam != null) { formFieldParam.setTypeAsEnum(Field.Type.DateTime); formFieldParam.setTypeMetaData(FieldMetaData.DateTime.DATE); } return new Field(this.postJson( formFieldParam, WS.Path.UserField.Version1.userFieldUpdate())); } }
public class class_name { public Field updateFieldDateTimeDate(Field formFieldParam) { if(formFieldParam != null && this.serviceTicket != null) { formFieldParam.setServiceTicket(this.serviceTicket); // depends on control dependency: [if], data = [none] } if(formFieldParam != null) { formFieldParam.setTypeAsEnum(Field.Type.DateTime); // depends on control dependency: [if], data = [none] formFieldParam.setTypeMetaData(FieldMetaData.DateTime.DATE); // depends on control dependency: [if], data = [none] } return new Field(this.postJson( formFieldParam, WS.Path.UserField.Version1.userFieldUpdate())); } }
public class class_name { public void marshall(AccountAggregationSource accountAggregationSource, ProtocolMarshaller protocolMarshaller) { if (accountAggregationSource == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(accountAggregationSource.getAccountIds(), ACCOUNTIDS_BINDING); protocolMarshaller.marshall(accountAggregationSource.getAllAwsRegions(), ALLAWSREGIONS_BINDING); protocolMarshaller.marshall(accountAggregationSource.getAwsRegions(), AWSREGIONS_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(AccountAggregationSource accountAggregationSource, ProtocolMarshaller protocolMarshaller) { if (accountAggregationSource == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(accountAggregationSource.getAccountIds(), ACCOUNTIDS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(accountAggregationSource.getAllAwsRegions(), ALLAWSREGIONS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(accountAggregationSource.getAwsRegions(), AWSREGIONS_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { @Override @SuppressWarnings("unchecked") public <T> List<T> getResultList(JPAQuery<T> query, Expression<T> projection) { Query jpaQuery = query.createQuery(); if (jpaQuery instanceof QueryImpl) { QueryImpl casted = (QueryImpl) jpaQuery; if (casted.getDatabaseQuery() instanceof ObjectLevelReadQuery) { Field f = ReflectionUtils.findField(ObjectLevelReadQuery.class, "joinedAttributeManager"); f.setAccessible(true); JoinedAttributeManager old = (JoinedAttributeManager) ReflectionUtils.getField(f, casted.getDatabaseQuery()); if (old != null) { FixedJoinerAttributeManager newManager = new FixedJoinerAttributeManager(old.getDescriptor(), old.getBaseExpressionBuilder(), old.getBaseQuery()); newManager.copyFrom(old); ReflectionUtils.setField(f, casted.getDatabaseQuery(), newManager); } } } if (projection instanceof FactoryExpression) { FactoryExpression factoryExpression = (FactoryExpression) projection; List<?> results = jpaQuery.getResultList(); List<Object> rv = new ArrayList<>(results.size()); for (Object o : results) { if (o != null) { if (!o.getClass().isArray()) { o = new Object[]{o}; } rv.add(factoryExpression.newInstance((Object[]) o)); } else { rv.add(null); } } return (List<T>) rv; } else { return jpaQuery.getResultList(); } } }
public class class_name { @Override @SuppressWarnings("unchecked") public <T> List<T> getResultList(JPAQuery<T> query, Expression<T> projection) { Query jpaQuery = query.createQuery(); if (jpaQuery instanceof QueryImpl) { QueryImpl casted = (QueryImpl) jpaQuery; if (casted.getDatabaseQuery() instanceof ObjectLevelReadQuery) { Field f = ReflectionUtils.findField(ObjectLevelReadQuery.class, "joinedAttributeManager"); f.setAccessible(true); // depends on control dependency: [if], data = [none] JoinedAttributeManager old = (JoinedAttributeManager) ReflectionUtils.getField(f, casted.getDatabaseQuery()); if (old != null) { FixedJoinerAttributeManager newManager = new FixedJoinerAttributeManager(old.getDescriptor(), old.getBaseExpressionBuilder(), old.getBaseQuery()); newManager.copyFrom(old); // depends on control dependency: [if], data = [(old] ReflectionUtils.setField(f, casted.getDatabaseQuery(), newManager); // depends on control dependency: [if], data = [none] } } } if (projection instanceof FactoryExpression) { FactoryExpression factoryExpression = (FactoryExpression) projection; List<?> results = jpaQuery.getResultList(); List<Object> rv = new ArrayList<>(results.size()); for (Object o : results) { if (o != null) { if (!o.getClass().isArray()) { o = new Object[]{o}; // depends on control dependency: [if], data = [none] } rv.add(factoryExpression.newInstance((Object[]) o)); // depends on control dependency: [if], data = [none] } else { rv.add(null); // depends on control dependency: [if], data = [null)] } } return (List<T>) rv; // depends on control dependency: [if], data = [none] } else { return jpaQuery.getResultList(); // depends on control dependency: [if], data = [none] } } }
public class class_name { private static void compute(float[] matrix, int[] in, int[] out, int x, int index, int ioffset, int cols2, int width, boolean alpha, int edge) { float r = 0; float g = 0; float b = 0; float a = 0; final int moffset = cols2; for (int col = -cols2; col <= cols2; col++) { final float f = matrix[moffset + col]; if (Double.doubleToRawLongBits(f) != 0L) { final int ix = checkEdge(width, x, col, edge); final int rgb = in[ioffset + ix]; a += f * (rgb >> Constant.BYTE_4 & 0xFF); r += f * (rgb >> Constant.BYTE_3 & 0xFF); g += f * (rgb >> Constant.BYTE_2 & 0xFF); b += f * (rgb & 0xFF); } } final int ia; if (alpha) { ia = clamp((int) (a + Constant.HALF)); } else { ia = 0xFF; } final int ir = clamp((int) (r + 0.5)); final int ig = clamp((int) (g + 0.5)); final int ib = clamp((int) (b + 0.5)); out[index] = ia << Constant.BYTE_4 | ir << Constant.BYTE_3 | ig << Constant.BYTE_2 | ib; } }
public class class_name { private static void compute(float[] matrix, int[] in, int[] out, int x, int index, int ioffset, int cols2, int width, boolean alpha, int edge) { float r = 0; float g = 0; float b = 0; float a = 0; final int moffset = cols2; for (int col = -cols2; col <= cols2; col++) { final float f = matrix[moffset + col]; if (Double.doubleToRawLongBits(f) != 0L) { final int ix = checkEdge(width, x, col, edge); final int rgb = in[ioffset + ix]; a += f * (rgb >> Constant.BYTE_4 & 0xFF); // depends on control dependency: [if], data = [none] r += f * (rgb >> Constant.BYTE_3 & 0xFF); // depends on control dependency: [if], data = [none] g += f * (rgb >> Constant.BYTE_2 & 0xFF); // depends on control dependency: [if], data = [none] b += f * (rgb & 0xFF); // depends on control dependency: [if], data = [none] } } final int ia; if (alpha) { ia = clamp((int) (a + Constant.HALF)); // depends on control dependency: [if], data = [none] } else { ia = 0xFF; // depends on control dependency: [if], data = [none] } final int ir = clamp((int) (r + 0.5)); final int ig = clamp((int) (g + 0.5)); final int ib = clamp((int) (b + 0.5)); out[index] = ia << Constant.BYTE_4 | ir << Constant.BYTE_3 | ig << Constant.BYTE_2 | ib; } }
public class class_name { @Unbind(id = "importDeclarations") void unbindImportDeclaration(ServiceReference<ImportDeclaration> importDeclarationSRef) { try { if (!declarationsManager.matched(importDeclarationSRef)) { LOG.debug("Declaration {} do not match service, skipping",declarationsManager.getDeclaration(importDeclarationSRef)); return; } LOG.debug(linkerName + " : Unbind the ImportDeclaration " + declarationsManager.getDeclaration(importDeclarationSRef)); synchronized (lock) { declarationsManager.removeLinks(importDeclarationSRef); declarationsManager.remove(importDeclarationSRef); } } catch(Exception e){ LOG.error("Failed to unbind declaration",e); } } }
public class class_name { @Unbind(id = "importDeclarations") void unbindImportDeclaration(ServiceReference<ImportDeclaration> importDeclarationSRef) { try { if (!declarationsManager.matched(importDeclarationSRef)) { LOG.debug("Declaration {} do not match service, skipping",declarationsManager.getDeclaration(importDeclarationSRef)); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } LOG.debug(linkerName + " : Unbind the ImportDeclaration " + declarationsManager.getDeclaration(importDeclarationSRef)); // depends on control dependency: [try], data = [none] synchronized (lock) { // depends on control dependency: [try], data = [none] declarationsManager.removeLinks(importDeclarationSRef); declarationsManager.remove(importDeclarationSRef); } } catch(Exception e){ LOG.error("Failed to unbind declaration",e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private static String getEncodedInstance(String encodedResponse) { if (isReturnValue(encodedResponse) || isThrownException(encodedResponse)) { return encodedResponse.substring(4); } return encodedResponse; } }
public class class_name { private static String getEncodedInstance(String encodedResponse) { if (isReturnValue(encodedResponse) || isThrownException(encodedResponse)) { return encodedResponse.substring(4); // depends on control dependency: [if], data = [none] } return encodedResponse; } }
public class class_name { public Set<String> getKeywords() { Set<String> kws = this.allKeywords == null ? null : this.allKeywords.get(); if (kws == null) { kws = new TreeSet<>(); kws.add(getAsKeyword()); kws.add(getIfKeyword()); kws.add(getSynchronizedKeyword()); kws.add(getClassKeyword()); kws.add(getVolatileKeyword()); kws.add(getRequiresKeyword()); kws.add(getFalseKeyword()); kws.add(getWithKeyword()); kws.add(getItKeyword()); kws.add(getSwitchKeyword()); kws.add(getExtendsKeyword()); kws.add(getFinalKeyword()); kws.add(getSuperKeyword()); kws.add(getProtectedKeyword()); kws.add(getArtifactKeyword()); kws.add(getPrivateKeyword()); kws.add(getAnnotationKeyword()); kws.add(getFinallyKeyword()); kws.add(getReturnKeyword()); kws.add(getWhileKeyword()); kws.add(getAssertKeyword()); kws.add(getSpaceKeyword()); kws.add(getInstanceofKeyword()); kws.add(getBreakKeyword()); kws.add(getPublicKeyword()); kws.add(getIsTrueTrueKeyword()); kws.add(getTryKeyword()); kws.add(getOnKeyword()); kws.add(getCapacityKeyword()); kws.add(getEventKeyword()); kws.add(getVarKeyword()); kws.add(getImportKeyword()); kws.add(getAgentKeyword()); kws.add(getTransientKeyword()); kws.add(getNullKeyword()); kws.add(getCaseKeyword()); kws.add(getInterfaceKeyword()); kws.add(getThisKeyword()); kws.add(getDispatchKeyword()); kws.add(getEnumKeyword()); kws.add(getAbstractKeyword()); kws.add(getUsesKeyword()); kws.add(getSkillKeyword()); kws.add(getDefKeyword()); kws.add(getFiresKeyword()); kws.add(getContinueKeyword()); kws.add(getOverrideKeyword()); kws.add(getThrowKeyword()); kws.add(getElseKeyword()); kws.add(getForKeyword()); kws.add(getDefaultKeyword()); kws.add(getNativeKeyword()); kws.add(getThrowsKeyword()); kws.add(getCatchKeyword()); kws.add(getDoKeyword()); kws.add(getIsStaticAssumeKeyword()); kws.add(getBehaviorKeyword()); kws.add(getExtensionExtensionKeyword()); kws.add(getStaticStaticKeyword()); kws.add(getImplementsKeyword()); kws.add(getValKeyword()); kws.add(getNewKeyword()); kws.add(getStrictfpKeyword()); kws.add(getVoidKeyword()); kws.add(getTypeofKeyword()); kws.add(getPackageKeyword()); kws.add(getOccurrenceKeyword()); this.allKeywords = new SoftReference<>(kws); } return Collections.unmodifiableSet(kws); } }
public class class_name { public Set<String> getKeywords() { Set<String> kws = this.allKeywords == null ? null : this.allKeywords.get(); if (kws == null) { kws = new TreeSet<>(); // depends on control dependency: [if], data = [none] kws.add(getAsKeyword()); // depends on control dependency: [if], data = [none] kws.add(getIfKeyword()); // depends on control dependency: [if], data = [none] kws.add(getSynchronizedKeyword()); // depends on control dependency: [if], data = [none] kws.add(getClassKeyword()); // depends on control dependency: [if], data = [none] kws.add(getVolatileKeyword()); // depends on control dependency: [if], data = [none] kws.add(getRequiresKeyword()); // depends on control dependency: [if], data = [none] kws.add(getFalseKeyword()); // depends on control dependency: [if], data = [none] kws.add(getWithKeyword()); // depends on control dependency: [if], data = [none] kws.add(getItKeyword()); // depends on control dependency: [if], data = [none] kws.add(getSwitchKeyword()); // depends on control dependency: [if], data = [none] kws.add(getExtendsKeyword()); // depends on control dependency: [if], data = [none] kws.add(getFinalKeyword()); // depends on control dependency: [if], data = [none] kws.add(getSuperKeyword()); // depends on control dependency: [if], data = [none] kws.add(getProtectedKeyword()); // depends on control dependency: [if], data = [none] kws.add(getArtifactKeyword()); // depends on control dependency: [if], data = [none] kws.add(getPrivateKeyword()); // depends on control dependency: [if], data = [none] kws.add(getAnnotationKeyword()); // depends on control dependency: [if], data = [none] kws.add(getFinallyKeyword()); // depends on control dependency: [if], data = [none] kws.add(getReturnKeyword()); // depends on control dependency: [if], data = [none] kws.add(getWhileKeyword()); // depends on control dependency: [if], data = [none] kws.add(getAssertKeyword()); // depends on control dependency: [if], data = [none] kws.add(getSpaceKeyword()); // depends on control dependency: [if], data = [none] kws.add(getInstanceofKeyword()); // depends on control dependency: [if], data = [none] kws.add(getBreakKeyword()); // depends on control dependency: [if], data = [none] kws.add(getPublicKeyword()); // depends on control dependency: [if], data = [none] kws.add(getIsTrueTrueKeyword()); // depends on control dependency: [if], data = [none] kws.add(getTryKeyword()); // depends on control dependency: [if], data = [none] kws.add(getOnKeyword()); // depends on control dependency: [if], data = [none] kws.add(getCapacityKeyword()); // depends on control dependency: [if], data = [none] kws.add(getEventKeyword()); // depends on control dependency: [if], data = [none] kws.add(getVarKeyword()); // depends on control dependency: [if], data = [none] kws.add(getImportKeyword()); // depends on control dependency: [if], data = [none] kws.add(getAgentKeyword()); // depends on control dependency: [if], data = [none] kws.add(getTransientKeyword()); // depends on control dependency: [if], data = [none] kws.add(getNullKeyword()); // depends on control dependency: [if], data = [none] kws.add(getCaseKeyword()); // depends on control dependency: [if], data = [none] kws.add(getInterfaceKeyword()); // depends on control dependency: [if], data = [none] kws.add(getThisKeyword()); // depends on control dependency: [if], data = [none] kws.add(getDispatchKeyword()); // depends on control dependency: [if], data = [none] kws.add(getEnumKeyword()); // depends on control dependency: [if], data = [none] kws.add(getAbstractKeyword()); // depends on control dependency: [if], data = [none] kws.add(getUsesKeyword()); // depends on control dependency: [if], data = [none] kws.add(getSkillKeyword()); // depends on control dependency: [if], data = [none] kws.add(getDefKeyword()); // depends on control dependency: [if], data = [none] kws.add(getFiresKeyword()); // depends on control dependency: [if], data = [none] kws.add(getContinueKeyword()); // depends on control dependency: [if], data = [none] kws.add(getOverrideKeyword()); // depends on control dependency: [if], data = [none] kws.add(getThrowKeyword()); // depends on control dependency: [if], data = [none] kws.add(getElseKeyword()); // depends on control dependency: [if], data = [none] kws.add(getForKeyword()); // depends on control dependency: [if], data = [none] kws.add(getDefaultKeyword()); // depends on control dependency: [if], data = [none] kws.add(getNativeKeyword()); // depends on control dependency: [if], data = [none] kws.add(getThrowsKeyword()); // depends on control dependency: [if], data = [none] kws.add(getCatchKeyword()); // depends on control dependency: [if], data = [none] kws.add(getDoKeyword()); // depends on control dependency: [if], data = [none] kws.add(getIsStaticAssumeKeyword()); // depends on control dependency: [if], data = [none] kws.add(getBehaviorKeyword()); // depends on control dependency: [if], data = [none] kws.add(getExtensionExtensionKeyword()); // depends on control dependency: [if], data = [none] kws.add(getStaticStaticKeyword()); // depends on control dependency: [if], data = [none] kws.add(getImplementsKeyword()); // depends on control dependency: [if], data = [none] kws.add(getValKeyword()); // depends on control dependency: [if], data = [none] kws.add(getNewKeyword()); // depends on control dependency: [if], data = [none] kws.add(getStrictfpKeyword()); // depends on control dependency: [if], data = [none] kws.add(getVoidKeyword()); // depends on control dependency: [if], data = [none] kws.add(getTypeofKeyword()); // depends on control dependency: [if], data = [none] kws.add(getPackageKeyword()); // depends on control dependency: [if], data = [none] kws.add(getOccurrenceKeyword()); // depends on control dependency: [if], data = [none] this.allKeywords = new SoftReference<>(kws); // depends on control dependency: [if], data = [(kws] } return Collections.unmodifiableSet(kws); } }
public class class_name { @Nullable private static Type binaryNumericPromotion(Type leftType, Type rightType, VisitorState state) { Type unboxedLeft = unboxAndEnsureNumeric(leftType, state); Type unboxedRight = unboxAndEnsureNumeric(rightType, state); Set<TypeTag> tags = EnumSet.of(unboxedLeft.getTag(), unboxedRight.getTag()); if (tags.contains(TypeTag.DOUBLE)) { return state.getSymtab().doubleType; } else if (tags.contains(TypeTag.FLOAT)) { return state.getSymtab().floatType; } else if (tags.contains(TypeTag.LONG)) { return state.getSymtab().longType; } else { return state.getSymtab().intType; } } }
public class class_name { @Nullable private static Type binaryNumericPromotion(Type leftType, Type rightType, VisitorState state) { Type unboxedLeft = unboxAndEnsureNumeric(leftType, state); Type unboxedRight = unboxAndEnsureNumeric(rightType, state); Set<TypeTag> tags = EnumSet.of(unboxedLeft.getTag(), unboxedRight.getTag()); if (tags.contains(TypeTag.DOUBLE)) { return state.getSymtab().doubleType; // depends on control dependency: [if], data = [none] } else if (tags.contains(TypeTag.FLOAT)) { return state.getSymtab().floatType; // depends on control dependency: [if], data = [none] } else if (tags.contains(TypeTag.LONG)) { return state.getSymtab().longType; // depends on control dependency: [if], data = [none] } else { return state.getSymtab().intType; // depends on control dependency: [if], data = [none] } } }
public class class_name { public static final String getRequestUriWithoutContextPath(HttpServletRequest request) { String uri = request.getRequestURI().substring(request.getContextPath().length()); if (!uri.isEmpty()) { return uri; } else { return "/"; } } }
public class class_name { public static final String getRequestUriWithoutContextPath(HttpServletRequest request) { String uri = request.getRequestURI().substring(request.getContextPath().length()); if (!uri.isEmpty()) { return uri; // depends on control dependency: [if], data = [none] } else { return "/"; // depends on control dependency: [if], data = [none] } } }
public class class_name { public int read(char ch[], int offset, int length) throws IOException { int byteLength = length << ((fEncoding >= 4)?2:1); if (byteLength > fBuffer.length) { byteLength = fBuffer.length; } int count = fInputStream.read(fBuffer, 0, byteLength); if(count == -1) return -1; // try and make count be a multiple of the number of bytes we're looking for if(fEncoding >= 4) { // BigEndian // this looks ugly, but it avoids an if at any rate... int numToRead = (4 - (count & 3) & 3); for(int i=0; i<numToRead; i++) { int charRead = fInputStream.read(); if(charRead == -1) { // end of input; something likely went wrong!A Pad buffer with nulls. for (int j = i;j<numToRead; j++) fBuffer[count+j] = 0; break; } else { fBuffer[count+i] = (byte)charRead; } } count += numToRead; } else { int numToRead = count & 1; if(numToRead != 0) { count++; int charRead = fInputStream.read(); if(charRead == -1) { // end of input; something likely went wrong!A Pad buffer with nulls. fBuffer[count] = 0; } else { fBuffer[count] = (byte)charRead; } } } // now count is a multiple of the right number of bytes int numChars = count >> ((fEncoding >= 4)?2:1); int curPos = 0; for (int i = 0; i < numChars; i++) { int b0 = fBuffer[curPos++] & 0xff; int b1 = fBuffer[curPos++] & 0xff; if(fEncoding >=4) { int b2 = fBuffer[curPos++] & 0xff; int b3 = fBuffer[curPos++] & 0xff; if (fEncoding == UCS4BE) ch[offset+i] = (char)((b0<<24)+(b1<<16)+(b2<<8)+b3); else ch[offset+i] = (char)((b3<<24)+(b2<<16)+(b1<<8)+b0); } else { // UCS-2 if (fEncoding == UCS2BE) ch[offset+i] = (char)((b0<<8)+b1); else ch[offset+i] = (char)((b1<<8)+b0); } } return numChars; } }
public class class_name { public int read(char ch[], int offset, int length) throws IOException { int byteLength = length << ((fEncoding >= 4)?2:1); if (byteLength > fBuffer.length) { byteLength = fBuffer.length; } int count = fInputStream.read(fBuffer, 0, byteLength); if(count == -1) return -1; // try and make count be a multiple of the number of bytes we're looking for if(fEncoding >= 4) { // BigEndian // this looks ugly, but it avoids an if at any rate... int numToRead = (4 - (count & 3) & 3); for(int i=0; i<numToRead; i++) { int charRead = fInputStream.read(); if(charRead == -1) { // end of input; something likely went wrong!A Pad buffer with nulls. for (int j = i;j<numToRead; j++) fBuffer[count+j] = 0; break; } else { fBuffer[count+i] = (byte)charRead; // depends on control dependency: [if], data = [none] } } count += numToRead; } else { int numToRead = count & 1; if(numToRead != 0) { count++; // depends on control dependency: [if], data = [none] int charRead = fInputStream.read(); if(charRead == -1) { // end of input; something likely went wrong!A Pad buffer with nulls. fBuffer[count] = 0; // depends on control dependency: [if], data = [none] } else { fBuffer[count] = (byte)charRead; // depends on control dependency: [if], data = [none] } } } // now count is a multiple of the right number of bytes int numChars = count >> ((fEncoding >= 4)?2:1); int curPos = 0; for (int i = 0; i < numChars; i++) { int b0 = fBuffer[curPos++] & 0xff; int b1 = fBuffer[curPos++] & 0xff; if(fEncoding >=4) { int b2 = fBuffer[curPos++] & 0xff; int b3 = fBuffer[curPos++] & 0xff; if (fEncoding == UCS4BE) ch[offset+i] = (char)((b0<<24)+(b1<<16)+(b2<<8)+b3); else ch[offset+i] = (char)((b3<<24)+(b2<<16)+(b1<<8)+b0); } else { // UCS-2 if (fEncoding == UCS2BE) ch[offset+i] = (char)((b0<<8)+b1); else ch[offset+i] = (char)((b1<<8)+b0); } } return numChars; } }
public class class_name { private ParsedPermission parsePermission() throws Exception { ParsedPermission permission = new ParsedPermission(); lookahead = st.nextToken(); if (lookahead == StreamTokenizer.TT_WORD) { permission.setPermissionType(st.sval); } else { throw new Exception("ER021: Permission type expected."); } lookahead = st.nextToken(); if (lookahead == '\"') { permission.setPermissionName(st.sval); } else { // java.security.AllPermission possibility if (lookahead == ';') { return permission; } throw new Exception("ER022: Permission name or or [;] expected."); } lookahead = st.nextToken(); if (lookahead == ',') { lookahead = st.nextToken(); boolean shouldBeSigned = false; if (lookahead == '\"') { String actionsWords = st.sval; permission.setActions(actionsWords); lookahead = st.nextToken(); switch (lookahead) { case ',': shouldBeSigned = true; break; case ';': return permission; default: throw new Exception("ER023: Unexpected symbol, expected [,] or [;]."); } lookahead = st.nextToken(); } if (lookahead == StreamTokenizer.TT_WORD) { String signedByWord = st.sval; if (!signedByWord.toLowerCase().equals("signedby")) { throw new Exception("ER024: [signedBy] expected but was [" + signedByWord + "]."); } } else if (shouldBeSigned) { throw new Exception("ER025: [signedBy] expected after [,]."); } else { throw new Exception("ER026: Actions or [signedBy] expected after [,]."); } lookahead = st.nextToken(); if (lookahead == '\"') { permission.setSignedBy(st.sval); } else { throw new Exception("ER027: signedBy attribute expected."); } lookahead = st.nextToken(); } if (lookahead == ';') { return permission; } else { throw new Exception("ER028: [;] expected."); } } }
public class class_name { private ParsedPermission parsePermission() throws Exception { ParsedPermission permission = new ParsedPermission(); lookahead = st.nextToken(); if (lookahead == StreamTokenizer.TT_WORD) { permission.setPermissionType(st.sval); } else { throw new Exception("ER021: Permission type expected."); } lookahead = st.nextToken(); if (lookahead == '\"') { permission.setPermissionName(st.sval); } else { // java.security.AllPermission possibility if (lookahead == ';') { return permission; // depends on control dependency: [if], data = [none] } throw new Exception("ER022: Permission name or or [;] expected."); } lookahead = st.nextToken(); if (lookahead == ',') { lookahead = st.nextToken(); boolean shouldBeSigned = false; if (lookahead == '\"') { String actionsWords = st.sval; permission.setActions(actionsWords); lookahead = st.nextToken(); switch (lookahead) { case ',': shouldBeSigned = true; break; case ';': return permission; default: throw new Exception("ER023: Unexpected symbol, expected [,] or [;]."); } lookahead = st.nextToken(); } if (lookahead == StreamTokenizer.TT_WORD) { String signedByWord = st.sval; if (!signedByWord.toLowerCase().equals("signedby")) { throw new Exception("ER024: [signedBy] expected but was [" + signedByWord + "]."); } } else if (shouldBeSigned) { throw new Exception("ER025: [signedBy] expected after [,]."); } else { throw new Exception("ER026: Actions or [signedBy] expected after [,]."); } lookahead = st.nextToken(); if (lookahead == '\"') { permission.setSignedBy(st.sval); } else { throw new Exception("ER027: signedBy attribute expected."); } lookahead = st.nextToken(); } if (lookahead == ';') { return permission; } else { throw new Exception("ER028: [;] expected."); } } }
public class class_name { public final synchronized int compareTo (final Integer anotherSerialNumber) { long diff = serialNumber - Utils.getUnsignedLong(anotherSerialNumber.intValue()); if (diff >= MAXIMUM_VALUE) { diff -= (MAXIMUM_VALUE + 1); } else if (diff < -MAXIMUM_VALUE) { diff += (MAXIMUM_VALUE + 1); } return (int) diff; } }
public class class_name { public final synchronized int compareTo (final Integer anotherSerialNumber) { long diff = serialNumber - Utils.getUnsignedLong(anotherSerialNumber.intValue()); if (diff >= MAXIMUM_VALUE) { diff -= (MAXIMUM_VALUE + 1); // depends on control dependency: [if], data = [none] } else if (diff < -MAXIMUM_VALUE) { diff += (MAXIMUM_VALUE + 1); // depends on control dependency: [if], data = [none] } return (int) diff; } }
public class class_name { public static void removeRowsInSheet(final Sheet sheet, final int rowIndexStart, final int rowIndexEnd, final Map<Cell, String> cachedMap) { for (int irow = rowIndexStart; irow <= rowIndexEnd; irow++) { removeCachedCellForRow(sheet, irow, cachedMap); } int irows = rowIndexEnd - rowIndexStart + 1; if ((irows < 1) || (rowIndexStart < 0)) { return; } int lastRowNum = sheet.getLastRowNum(); if (rowIndexEnd < lastRowNum) { sheet.shiftRows(rowIndexEnd + 1, lastRowNum, -irows); } if (rowIndexEnd == lastRowNum) { // reverse order to delete rows. for (int i = rowIndexEnd; i >= rowIndexStart; i--) { removeSingleRowInSheet(sheet, rowIndexStart); } } } }
public class class_name { public static void removeRowsInSheet(final Sheet sheet, final int rowIndexStart, final int rowIndexEnd, final Map<Cell, String> cachedMap) { for (int irow = rowIndexStart; irow <= rowIndexEnd; irow++) { removeCachedCellForRow(sheet, irow, cachedMap); // depends on control dependency: [for], data = [irow] } int irows = rowIndexEnd - rowIndexStart + 1; if ((irows < 1) || (rowIndexStart < 0)) { return; // depends on control dependency: [if], data = [none] } int lastRowNum = sheet.getLastRowNum(); if (rowIndexEnd < lastRowNum) { sheet.shiftRows(rowIndexEnd + 1, lastRowNum, -irows); // depends on control dependency: [if], data = [(rowIndexEnd] } if (rowIndexEnd == lastRowNum) { // reverse order to delete rows. for (int i = rowIndexEnd; i >= rowIndexStart; i--) { removeSingleRowInSheet(sheet, rowIndexStart); // depends on control dependency: [for], data = [none] } } } }
public class class_name { public F4<P1, P2, P3, P4, R> andThen( final Func4<? super P1, ? super P2, ? super P3, ? super P4, ? extends R>... fs ) { if (0 == fs.length) { return this; } final Func4<P1, P2, P3, P4, R> me = this; return new F4<P1, P2, P3, P4, R>() { @Override public R apply(P1 p1, P2 p2, P3 p3, P4 p4) { R r = me.apply(p1, p2, p3, p4); for (Func4<? super P1, ? super P2, ? super P3, ? super P4, ? extends R> f : fs) { r = f.apply(p1, p2, p3, p4); } return r; } }; } }
public class class_name { public F4<P1, P2, P3, P4, R> andThen( final Func4<? super P1, ? super P2, ? super P3, ? super P4, ? extends R>... fs ) { if (0 == fs.length) { return this; // depends on control dependency: [if], data = [none] } final Func4<P1, P2, P3, P4, R> me = this; return new F4<P1, P2, P3, P4, R>() { @Override public R apply(P1 p1, P2 p2, P3 p3, P4 p4) { R r = me.apply(p1, p2, p3, p4); for (Func4<? super P1, ? super P2, ? super P3, ? super P4, ? extends R> f : fs) { r = f.apply(p1, p2, p3, p4); } return r; } }; } }
public class class_name { private float[] getFabTranslationYForBottomNavigationBar(CoordinatorLayout parent, FloatingActionButton fab) { float minOffset = 0; float viewHeight = 0; final List<View> dependencies = parent.getDependencies(fab); for (int i = 0, z = dependencies.size(); i < z; i++) { final View view = dependencies.get(i); if (view instanceof BottomNavigationBar) { viewHeight = view.getHeight(); minOffset = Math.min(minOffset, view.getTranslationY() - viewHeight); } } return new float[]{minOffset, viewHeight}; } }
public class class_name { private float[] getFabTranslationYForBottomNavigationBar(CoordinatorLayout parent, FloatingActionButton fab) { float minOffset = 0; float viewHeight = 0; final List<View> dependencies = parent.getDependencies(fab); for (int i = 0, z = dependencies.size(); i < z; i++) { final View view = dependencies.get(i); if (view instanceof BottomNavigationBar) { viewHeight = view.getHeight(); // depends on control dependency: [if], data = [none] minOffset = Math.min(minOffset, view.getTranslationY() - viewHeight); // depends on control dependency: [if], data = [none] } } return new float[]{minOffset, viewHeight}; } }
public class class_name { @Nonnull public DescribeCommand match(@Nullable String pattern) { if (!"*".equals(pattern)) { matchOption = Optional.ofNullable(pattern); log.info("--match = {}", matchOption.orElse("")); } return this; } }
public class class_name { @Nonnull public DescribeCommand match(@Nullable String pattern) { if (!"*".equals(pattern)) { matchOption = Optional.ofNullable(pattern); // depends on control dependency: [if], data = [none] log.info("--match = {}", matchOption.orElse("")); // depends on control dependency: [if], data = [none] } return this; } }
public class class_name { public static <V> Set<V> getLeafVertices(DirectedGraph<V, DefaultEdge> graph) { Set<V> vertexSet = graph.vertexSet(); Set<V> leaves = new HashSet<V>(vertexSet.size()*2); for (V vertex : vertexSet) { if (graph.outgoingEdgesOf(vertex).isEmpty()) { leaves.add(vertex); } } return leaves; } }
public class class_name { public static <V> Set<V> getLeafVertices(DirectedGraph<V, DefaultEdge> graph) { Set<V> vertexSet = graph.vertexSet(); Set<V> leaves = new HashSet<V>(vertexSet.size()*2); for (V vertex : vertexSet) { if (graph.outgoingEdgesOf(vertex).isEmpty()) { leaves.add(vertex); // depends on control dependency: [if], data = [none] } } return leaves; } }
public class class_name { @Override public synchronized TransactionManager getTransactionManager() { if (!lookupDone) { doLookups(globalCfg.classLoader()); } if (tm != null) return tm; if (lookupFailed) { if (!noJBossTM) { // First try an embedded JBossTM/Wildly instance tryEmbeddedJBossTM(); } if (noJBossTM) { //fall back to a dummy from Infinispan useDummyTM(); } } return tm; } }
public class class_name { @Override public synchronized TransactionManager getTransactionManager() { if (!lookupDone) { doLookups(globalCfg.classLoader()); // depends on control dependency: [if], data = [none] } if (tm != null) return tm; if (lookupFailed) { if (!noJBossTM) { // First try an embedded JBossTM/Wildly instance tryEmbeddedJBossTM(); // depends on control dependency: [if], data = [none] } if (noJBossTM) { //fall back to a dummy from Infinispan useDummyTM(); // depends on control dependency: [if], data = [none] } } return tm; } }
public class class_name { @Override public PropertyMap getGroupedProperties(SecurityContext securityContext, GraphObject source) { if(source instanceof AbstractRelationship) { AbstractRelationship rel = (AbstractRelationship)source; PropertyMap properties = new PropertyMap(); for (PropertyKey key : propertyKeys.values()) { Reference reference = (Reference)key; GraphObject referencedEntity = reference.getReferencedEntity(rel); PropertyKey referenceKey = reference.getReferenceKey(); PropertyKey propertyKey = reference.getPropertyKey(); if (referencedEntity != null) { properties.put(propertyKey, referencedEntity.getProperty(referenceKey)); } } return properties; } return null; } }
public class class_name { @Override public PropertyMap getGroupedProperties(SecurityContext securityContext, GraphObject source) { if(source instanceof AbstractRelationship) { AbstractRelationship rel = (AbstractRelationship)source; PropertyMap properties = new PropertyMap(); for (PropertyKey key : propertyKeys.values()) { Reference reference = (Reference)key; GraphObject referencedEntity = reference.getReferencedEntity(rel); PropertyKey referenceKey = reference.getReferenceKey(); PropertyKey propertyKey = reference.getPropertyKey(); if (referencedEntity != null) { properties.put(propertyKey, referencedEntity.getProperty(referenceKey)); // depends on control dependency: [if], data = [none] } } return properties; // depends on control dependency: [if], data = [none] } return null; } }
public class class_name { public I_CmsPropertyProvider getPropertyProvider(String key) { if (key.startsWith(PROPERTY_PREFIX_DYNAMIC)) { key = key.substring(PROPERTY_PREFIX_DYNAMIC.length()); } for (I_CmsPropertyProvider provider : m_propertyProviders) { if (provider.getName().equals(key)) { return provider; } } return null; } }
public class class_name { public I_CmsPropertyProvider getPropertyProvider(String key) { if (key.startsWith(PROPERTY_PREFIX_DYNAMIC)) { key = key.substring(PROPERTY_PREFIX_DYNAMIC.length()); // depends on control dependency: [if], data = [none] } for (I_CmsPropertyProvider provider : m_propertyProviders) { if (provider.getName().equals(key)) { return provider; // depends on control dependency: [if], data = [none] } } return null; } }
public class class_name { public static AtomicCounter findControlToggle(final CountersReader counters) { final AtomicBuffer buffer = counters.metaDataBuffer(); for (int i = 0, size = counters.maxCounterId(); i < size; i++) { final int recordOffset = CountersReader.metaDataOffset(i); if (counters.getCounterState(i) == RECORD_ALLOCATED && buffer.getInt(recordOffset + TYPE_ID_OFFSET) == CONTROL_TOGGLE_TYPE_ID) { return new AtomicCounter(counters.valuesBuffer(), i, null); } } return null; } }
public class class_name { public static AtomicCounter findControlToggle(final CountersReader counters) { final AtomicBuffer buffer = counters.metaDataBuffer(); for (int i = 0, size = counters.maxCounterId(); i < size; i++) { final int recordOffset = CountersReader.metaDataOffset(i); if (counters.getCounterState(i) == RECORD_ALLOCATED && buffer.getInt(recordOffset + TYPE_ID_OFFSET) == CONTROL_TOGGLE_TYPE_ID) { return new AtomicCounter(counters.valuesBuffer(), i, null); // depends on control dependency: [if], data = [none] } } return null; } }
public class class_name { public static void close(@CheckForNull InputStream inputStream) { if (inputStream == null) { return; } try { inputStream.close(); } catch (IOException e) { // Ignore } } }
public class class_name { public static void close(@CheckForNull InputStream inputStream) { if (inputStream == null) { return; // depends on control dependency: [if], data = [none] } try { inputStream.close(); // depends on control dependency: [try], data = [none] } catch (IOException e) { // Ignore } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static void saveChecksumFile(File csFile, Properties csprops, String reason) { FileOutputStream fOut = null; try { fOut = new FileOutputStream(csFile); csprops.store(fOut, null); logger.log(Level.FINEST, "Successfully updated the checksum file " + csFile.getAbsolutePath() + reason); } catch (Exception e) { logger.log(Level.FINEST, "Failed to save checksum file " + csFile.getAbsolutePath() + reason, e); } finally { InstallUtils.close(fOut); } } }
public class class_name { public static void saveChecksumFile(File csFile, Properties csprops, String reason) { FileOutputStream fOut = null; try { fOut = new FileOutputStream(csFile); // depends on control dependency: [try], data = [none] csprops.store(fOut, null); // depends on control dependency: [try], data = [none] logger.log(Level.FINEST, "Successfully updated the checksum file " + csFile.getAbsolutePath() + reason); // depends on control dependency: [try], data = [none] } catch (Exception e) { logger.log(Level.FINEST, "Failed to save checksum file " + csFile.getAbsolutePath() + reason, e); } finally { // depends on control dependency: [catch], data = [none] InstallUtils.close(fOut); } } }
public class class_name { public static StyleSpan bold(int i) { if (sBolds == null) { sBolds = new ArrayList<>(); sBolds.add(bold()); } if (i < sBolds.size()) { return sBolds.get(i); } else { StyleSpan bold = new StyleSpan(Typeface.BOLD); sBolds.add(bold); return bold; } } }
public class class_name { public static StyleSpan bold(int i) { if (sBolds == null) { sBolds = new ArrayList<>(); // depends on control dependency: [if], data = [none] sBolds.add(bold()); // depends on control dependency: [if], data = [none] } if (i < sBolds.size()) { return sBolds.get(i); // depends on control dependency: [if], data = [(i] } else { StyleSpan bold = new StyleSpan(Typeface.BOLD); sBolds.add(bold); // depends on control dependency: [if], data = [none] return bold; // depends on control dependency: [if], data = [none] } } }
public class class_name { public ConnectionFactoryResourceType<WebAppType<T>> getOrCreateConnectionFactory() { List<Node> nodeList = childNode.get("connection-factory"); if (nodeList != null && nodeList.size() > 0) { return new ConnectionFactoryResourceTypeImpl<WebAppType<T>>(this, "connection-factory", childNode, nodeList.get(0)); } return createConnectionFactory(); } }
public class class_name { public ConnectionFactoryResourceType<WebAppType<T>> getOrCreateConnectionFactory() { List<Node> nodeList = childNode.get("connection-factory"); if (nodeList != null && nodeList.size() > 0) { return new ConnectionFactoryResourceTypeImpl<WebAppType<T>>(this, "connection-factory", childNode, nodeList.get(0)); // depends on control dependency: [if], data = [none] } return createConnectionFactory(); } }
public class class_name { public void subRow(int i, double[] arr, int offset) { int n = cols; for (int j=0;j<n;j++) { sub(i, j, arr[j+offset]); } } }
public class class_name { public void subRow(int i, double[] arr, int offset) { int n = cols; for (int j=0;j<n;j++) { sub(i, j, arr[j+offset]); // depends on control dependency: [for], data = [j] } } }
public class class_name { @Override public void receiveHeartbeat(ResourceID heartbeatOrigin, I heartbeatPayload) { if (!stopped) { log.debug("Received heartbeat from {}.", heartbeatOrigin); reportHeartbeat(heartbeatOrigin); if (heartbeatPayload != null) { heartbeatListener.reportPayload(heartbeatOrigin, heartbeatPayload); } } } }
public class class_name { @Override public void receiveHeartbeat(ResourceID heartbeatOrigin, I heartbeatPayload) { if (!stopped) { log.debug("Received heartbeat from {}.", heartbeatOrigin); // depends on control dependency: [if], data = [none] reportHeartbeat(heartbeatOrigin); // depends on control dependency: [if], data = [none] if (heartbeatPayload != null) { heartbeatListener.reportPayload(heartbeatOrigin, heartbeatPayload); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public ContainerDefinition withUlimits(Ulimit... ulimits) { if (this.ulimits == null) { setUlimits(new com.amazonaws.internal.SdkInternalList<Ulimit>(ulimits.length)); } for (Ulimit ele : ulimits) { this.ulimits.add(ele); } return this; } }
public class class_name { public ContainerDefinition withUlimits(Ulimit... ulimits) { if (this.ulimits == null) { setUlimits(new com.amazonaws.internal.SdkInternalList<Ulimit>(ulimits.length)); // depends on control dependency: [if], data = [none] } for (Ulimit ele : ulimits) { this.ulimits.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { static String toHex(byte[] data) { StringBuffer sb = new StringBuffer(data.length*2); for (int i=0; i<data.length; i++) { sb.append(hexc[(data[i] >>4) & 0x0f]); sb.append(hexc[data[i] & 0x0f]); } return sb.toString(); } }
public class class_name { static String toHex(byte[] data) { StringBuffer sb = new StringBuffer(data.length*2); for (int i=0; i<data.length; i++) { sb.append(hexc[(data[i] >>4) & 0x0f]); // depends on control dependency: [for], data = [i] sb.append(hexc[data[i] & 0x0f]); // depends on control dependency: [for], data = [i] } return sb.toString(); } }
public class class_name { private UsernamePasswordAuthenticationToken createSwitchUserToken( HttpServletRequest request, UserDetails targetUser) { UsernamePasswordAuthenticationToken targetUserRequest; // grant an additional authority that contains the original Authentication object // which will be used to 'exit' from the current switched user. Authentication currentAuth; try { // SEC-1763. Check first if we are already switched. currentAuth = attemptExitUser(request); } catch (AuthenticationCredentialsNotFoundException e) { currentAuth = SecurityContextHolder.getContext().getAuthentication(); } GrantedAuthority switchAuthority = new SwitchUserGrantedAuthority( this.switchAuthorityRole, currentAuth); // get the original authorities Collection<? extends GrantedAuthority> orig = targetUser.getAuthorities(); // Allow subclasses to change the authorities to be granted if (this.switchUserAuthorityChanger != null) { orig = this.switchUserAuthorityChanger.modifyGrantedAuthorities(targetUser, currentAuth, orig); } // add the new switch user authority List<GrantedAuthority> newAuths = new ArrayList<>(orig); newAuths.add(switchAuthority); // create the new authentication token targetUserRequest = new UsernamePasswordAuthenticationToken(targetUser, targetUser.getPassword(), newAuths); // set details targetUserRequest .setDetails(this.authenticationDetailsSource.buildDetails(request)); return targetUserRequest; } }
public class class_name { private UsernamePasswordAuthenticationToken createSwitchUserToken( HttpServletRequest request, UserDetails targetUser) { UsernamePasswordAuthenticationToken targetUserRequest; // grant an additional authority that contains the original Authentication object // which will be used to 'exit' from the current switched user. Authentication currentAuth; try { // SEC-1763. Check first if we are already switched. currentAuth = attemptExitUser(request); // depends on control dependency: [try], data = [none] } catch (AuthenticationCredentialsNotFoundException e) { currentAuth = SecurityContextHolder.getContext().getAuthentication(); } // depends on control dependency: [catch], data = [none] GrantedAuthority switchAuthority = new SwitchUserGrantedAuthority( this.switchAuthorityRole, currentAuth); // get the original authorities Collection<? extends GrantedAuthority> orig = targetUser.getAuthorities(); // Allow subclasses to change the authorities to be granted if (this.switchUserAuthorityChanger != null) { orig = this.switchUserAuthorityChanger.modifyGrantedAuthorities(targetUser, currentAuth, orig); // depends on control dependency: [if], data = [none] } // add the new switch user authority List<GrantedAuthority> newAuths = new ArrayList<>(orig); newAuths.add(switchAuthority); // create the new authentication token targetUserRequest = new UsernamePasswordAuthenticationToken(targetUser, targetUser.getPassword(), newAuths); // set details targetUserRequest .setDetails(this.authenticationDetailsSource.buildDetails(request)); return targetUserRequest; } }
public class class_name { public void setSourceIdsList(java.util.Collection<String> sourceIdsList) { if (sourceIdsList == null) { this.sourceIdsList = null; return; } this.sourceIdsList = new java.util.ArrayList<String>(sourceIdsList); } }
public class class_name { public void setSourceIdsList(java.util.Collection<String> sourceIdsList) { if (sourceIdsList == null) { this.sourceIdsList = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.sourceIdsList = new java.util.ArrayList<String>(sourceIdsList); } }
public class class_name { public PendingCloudwatchLogsExports withLogTypesToDisable(String... logTypesToDisable) { if (this.logTypesToDisable == null) { setLogTypesToDisable(new java.util.ArrayList<String>(logTypesToDisable.length)); } for (String ele : logTypesToDisable) { this.logTypesToDisable.add(ele); } return this; } }
public class class_name { public PendingCloudwatchLogsExports withLogTypesToDisable(String... logTypesToDisable) { if (this.logTypesToDisable == null) { setLogTypesToDisable(new java.util.ArrayList<String>(logTypesToDisable.length)); // depends on control dependency: [if], data = [none] } for (String ele : logTypesToDisable) { this.logTypesToDisable.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { public static RESTCommand fromUNode(UNode rootNode) { String name = rootNode.getName(); Utils.require(!Utils.isEmpty(name), "Missing command name: " + rootNode.toString()); RESTCommand cmd = new RESTCommand(); cmd.setName(name); for (UNode childNode : rootNode.getMemberList()) { String nodeValue = childNode.getValue(); switch (childNode.getName()) { case "input-entity": cmd.setInputEntity(nodeValue); break; case "methods": cmd.setMethods(nodeValue); break; case "output-entity": cmd.setOutputEntity(nodeValue); break; case "parameters": for (UNode paramNode : childNode.getMemberList()) { RESTParameter param = RESTParameter.fromUNode(paramNode); cmd.addParameter(param); } break; case "privileged": cmd.setPrivileged(Boolean.parseBoolean(nodeValue)); break; case "summary": cmd.setSummary(nodeValue); break; case "uri": cmd.setURI(nodeValue); break; default: Utils.require(false, "Unknown command property: " + childNode); } } return cmd; } }
public class class_name { public static RESTCommand fromUNode(UNode rootNode) { String name = rootNode.getName(); Utils.require(!Utils.isEmpty(name), "Missing command name: " + rootNode.toString()); RESTCommand cmd = new RESTCommand(); cmd.setName(name); for (UNode childNode : rootNode.getMemberList()) { String nodeValue = childNode.getValue(); switch (childNode.getName()) { case "input-entity": cmd.setInputEntity(nodeValue); // depends on control dependency: [for], data = [none] break; case "methods": cmd.setMethods(nodeValue); // depends on control dependency: [for], data = [none] break; case "output-entity": cmd.setOutputEntity(nodeValue); // depends on control dependency: [for], data = [none] break; case "parameters": for (UNode paramNode : childNode.getMemberList()) { RESTParameter param = RESTParameter.fromUNode(paramNode); cmd.addParameter(param); // depends on control dependency: [for], data = [none] } break; case "privileged": cmd.setPrivileged(Boolean.parseBoolean(nodeValue)); // depends on control dependency: [for], data = [none] break; case "summary": cmd.setSummary(nodeValue); // depends on control dependency: [for], data = [none] break; case "uri": cmd.setURI(nodeValue); // depends on control dependency: [for], data = [none] break; default: Utils.require(false, "Unknown command property: " + childNode); } } return cmd; } }
public class class_name { private void collectStartVertices(final ExecutionStage stage) { for (int i = 0; i < stage.getNumberOfStageMembers(); i++) { final ExecutionGroupVertex groupVertex = stage.getStageMember(i); if (forward) { if ((groupVertex.getNumberOfBackwardLinks() == 0) || ((this.stage >= 0) && allConnectionsFromOtherStage(groupVertex, true))) { this.entryVertices.add(groupVertex); } } else { if ((groupVertex.getNumberOfForwardLinks() == 0) || ((this.stage >= 0) && allConnectionsFromOtherStage(groupVertex, false))) { this.entryVertices.add(groupVertex); } } } } }
public class class_name { private void collectStartVertices(final ExecutionStage stage) { for (int i = 0; i < stage.getNumberOfStageMembers(); i++) { final ExecutionGroupVertex groupVertex = stage.getStageMember(i); if (forward) { if ((groupVertex.getNumberOfBackwardLinks() == 0) || ((this.stage >= 0) && allConnectionsFromOtherStage(groupVertex, true))) { this.entryVertices.add(groupVertex); // depends on control dependency: [if], data = [none] } } else { if ((groupVertex.getNumberOfForwardLinks() == 0) || ((this.stage >= 0) && allConnectionsFromOtherStage(groupVertex, false))) { this.entryVertices.add(groupVertex); // depends on control dependency: [if], data = [none] } } } } }
public class class_name { private void setupFormat(final ConditionNumberFormatter formatter) { if(formatter.containsSymbolTerm(Token.SYMBOL_SLASH)) { // 分数として処理する setupFormatAsFraction(formatter); } else { // 数値として処理する setupFormatAsDecimal(formatter); } } }
public class class_name { private void setupFormat(final ConditionNumberFormatter formatter) { if(formatter.containsSymbolTerm(Token.SYMBOL_SLASH)) { // 分数として処理する setupFormatAsFraction(formatter); // depends on control dependency: [if], data = [none] } else { // 数値として処理する setupFormatAsDecimal(formatter); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void queueBuffers (Buffer... buffers) { IntBuffer idbuf = BufferUtils.createIntBuffer(buffers.length); for (int ii = 0; ii < buffers.length; ii++) { Buffer buffer = buffers[ii]; _queue.add(buffer); idbuf.put(ii, buffer.getId()); } AL10.alSourceQueueBuffers(_id, idbuf); } }
public class class_name { public void queueBuffers (Buffer... buffers) { IntBuffer idbuf = BufferUtils.createIntBuffer(buffers.length); for (int ii = 0; ii < buffers.length; ii++) { Buffer buffer = buffers[ii]; _queue.add(buffer); // depends on control dependency: [for], data = [none] idbuf.put(ii, buffer.getId()); // depends on control dependency: [for], data = [ii] } AL10.alSourceQueueBuffers(_id, idbuf); } }
public class class_name { private void applyFilter(){ filteredItems.clear(); Filter<M> filter = getFilter(); if(filter == null){ filteredItems.addAll(items); }else{ for (int i = 0; i < items.size(); i++) { M item = items.get(i); if(filter.filter(item, query)){ filteredItems.add(item); } } } onFiltered(); } }
public class class_name { private void applyFilter(){ filteredItems.clear(); Filter<M> filter = getFilter(); if(filter == null){ filteredItems.addAll(items); // depends on control dependency: [if], data = [none] }else{ for (int i = 0; i < items.size(); i++) { M item = items.get(i); if(filter.filter(item, query)){ filteredItems.add(item); // depends on control dependency: [if], data = [none] } } } onFiltered(); } }
public class class_name { public void collectStackTraces( int sampleId, ExecutionAttemptID executionId, List<StackTraceElement[]> stackTraces) { synchronized (lock) { if (isShutDown) { return; } if (LOG.isDebugEnabled()) { LOG.debug("Collecting stack trace sample {} of task {}", sampleId, executionId); } PendingStackTraceSample pending = pendingSamples.get(sampleId); if (pending != null) { pending.collectStackTraces(executionId, stackTraces); // Publish the sample if (pending.isComplete()) { pendingSamples.remove(sampleId); rememberRecentSampleId(sampleId); pending.completePromiseAndDiscard(); } } else if (recentPendingSamples.contains(sampleId)) { if (LOG.isDebugEnabled()) { LOG.debug("Received late stack trace sample {} of task {}", sampleId, executionId); } } else { if (LOG.isDebugEnabled()) { LOG.debug("Unknown sample ID " + sampleId); } } } } }
public class class_name { public void collectStackTraces( int sampleId, ExecutionAttemptID executionId, List<StackTraceElement[]> stackTraces) { synchronized (lock) { if (isShutDown) { return; // depends on control dependency: [if], data = [none] } if (LOG.isDebugEnabled()) { LOG.debug("Collecting stack trace sample {} of task {}", sampleId, executionId); // depends on control dependency: [if], data = [none] } PendingStackTraceSample pending = pendingSamples.get(sampleId); if (pending != null) { pending.collectStackTraces(executionId, stackTraces); // Publish the sample if (pending.isComplete()) { pendingSamples.remove(sampleId); // depends on control dependency: [if], data = [none] rememberRecentSampleId(sampleId); // depends on control dependency: [if], data = [none] pending.completePromiseAndDiscard(); // depends on control dependency: [if], data = [none] } } else if (recentPendingSamples.contains(sampleId)) { if (LOG.isDebugEnabled()) { LOG.debug("Received late stack trace sample {} of task {}", sampleId, executionId); // depends on control dependency: [if], data = [none] } } else { if (LOG.isDebugEnabled()) { LOG.debug("Unknown sample ID " + sampleId); } } } } }
public class class_name { public void openDialogWithFiles(List<CmsFileInfo> files) { if (m_uploadDialog == null) { try { m_uploadDialog = GWT.create(CmsUploadDialogImpl.class); I_CmsUploadContext context = m_contextFactory.get(); m_uploadDialog.setContext(context); updateDialog(); if (m_button != null) { // the current upload button is located outside the dialog, reinitialize it with a new button handler instance m_button.reinitButton( new CmsDialogUploadButtonHandler(m_contextFactory, m_targetFolder, m_isTargetRootPath)); } } catch (Exception e) { CmsErrorDialog.handleException( new Exception( "Deserialization of dialog data failed. This may be caused by expired java-script resources, please clear your browser cache and try again.", e)); return; } } m_uploadDialog.addFiles(files); if (m_button != null) { m_button.createFileInput(); } } }
public class class_name { public void openDialogWithFiles(List<CmsFileInfo> files) { if (m_uploadDialog == null) { try { m_uploadDialog = GWT.create(CmsUploadDialogImpl.class); // depends on control dependency: [try], data = [none] I_CmsUploadContext context = m_contextFactory.get(); m_uploadDialog.setContext(context); // depends on control dependency: [try], data = [none] updateDialog(); // depends on control dependency: [try], data = [none] if (m_button != null) { // the current upload button is located outside the dialog, reinitialize it with a new button handler instance m_button.reinitButton( new CmsDialogUploadButtonHandler(m_contextFactory, m_targetFolder, m_isTargetRootPath)); // depends on control dependency: [if], data = [none] } } catch (Exception e) { CmsErrorDialog.handleException( new Exception( "Deserialization of dialog data failed. This may be caused by expired java-script resources, please clear your browser cache and try again.", e)); return; } // depends on control dependency: [catch], data = [none] } m_uploadDialog.addFiles(files); if (m_button != null) { m_button.createFileInput(); // depends on control dependency: [if], data = [none] } } }
public class class_name { public JspConfigType<WebAppDescriptor> getOrCreateJspConfig() { List<Node> nodeList = model.get("jsp-config"); if (nodeList != null && nodeList.size() > 0) { return new JspConfigTypeImpl<WebAppDescriptor>(this, "jsp-config", model, nodeList.get(0)); } return createJspConfig(); } }
public class class_name { public JspConfigType<WebAppDescriptor> getOrCreateJspConfig() { List<Node> nodeList = model.get("jsp-config"); if (nodeList != null && nodeList.size() > 0) { return new JspConfigTypeImpl<WebAppDescriptor>(this, "jsp-config", model, nodeList.get(0)); // depends on control dependency: [if], data = [none] } return createJspConfig(); } }
public class class_name { public void addRMC( RMCSentence rmc ) { try { if (rmc.isValid()) { date = rmc.getDate(); time = rmc.getTime(); // correctedCourse = rmc.getCorrectedCourse(); faaMode = rmc.getMode(); position = rmc.getPosition(); dataStatus = rmc.getStatus(); kmHSpeed = rmc.getSpeed(); fieldCount = rmc.getFieldCount(); } } catch (Exception e) { // ignore it, this should be handled in the isValid, // if an exception is thrown, we can't deal with it here. } } }
public class class_name { public void addRMC( RMCSentence rmc ) { try { if (rmc.isValid()) { date = rmc.getDate(); // depends on control dependency: [if], data = [none] time = rmc.getTime(); // depends on control dependency: [if], data = [none] // correctedCourse = rmc.getCorrectedCourse(); faaMode = rmc.getMode(); // depends on control dependency: [if], data = [none] position = rmc.getPosition(); // depends on control dependency: [if], data = [none] dataStatus = rmc.getStatus(); // depends on control dependency: [if], data = [none] kmHSpeed = rmc.getSpeed(); // depends on control dependency: [if], data = [none] fieldCount = rmc.getFieldCount(); // depends on control dependency: [if], data = [none] } } catch (Exception e) { // ignore it, this should be handled in the isValid, // if an exception is thrown, we can't deal with it here. } // depends on control dependency: [catch], data = [none] } }
public class class_name { public T executeWithLoadBalancer(final S request, final IClientConfig requestConfig) throws ClientException { LoadBalancerCommand<T> command = buildLoadBalancerCommand(request, requestConfig); try { return command.submit( new ServerOperation<T>() { @Override public Observable<T> call(Server server) { URI finalUri = reconstructURIWithServer(server, request.getUri()); S requestForServer = (S) request.replaceUri(finalUri); try { return Observable.just(AbstractLoadBalancerAwareClient.this.execute(requestForServer, requestConfig)); } catch (Exception e) { return Observable.error(e); } } }) .toBlocking() .single(); } catch (Exception e) { Throwable t = e.getCause(); if (t instanceof ClientException) { throw (ClientException) t; } else { throw new ClientException(e); } } } }
public class class_name { public T executeWithLoadBalancer(final S request, final IClientConfig requestConfig) throws ClientException { LoadBalancerCommand<T> command = buildLoadBalancerCommand(request, requestConfig); try { return command.submit( new ServerOperation<T>() { @Override public Observable<T> call(Server server) { URI finalUri = reconstructURIWithServer(server, request.getUri()); S requestForServer = (S) request.replaceUri(finalUri); try { return Observable.just(AbstractLoadBalancerAwareClient.this.execute(requestForServer, requestConfig)); // depends on control dependency: [try], data = [none] } catch (Exception e) { return Observable.error(e); } // depends on control dependency: [catch], data = [none] } }) .toBlocking() .single(); } catch (Exception e) { Throwable t = e.getCause(); if (t instanceof ClientException) { throw (ClientException) t; } else { throw new ClientException(e); } } } }
public class class_name { public static void loadPluginPath(final String plugin_path) { if (plugin_path != null && !plugin_path.isEmpty()) { try { PluginLoader.loadJARs(plugin_path); } catch (Exception e) { LOG.error("Error loading plugins from plugin path: " + plugin_path, e); throw new RuntimeException("Error loading plugins from plugin path: " + plugin_path, e); } } } }
public class class_name { public static void loadPluginPath(final String plugin_path) { if (plugin_path != null && !plugin_path.isEmpty()) { try { PluginLoader.loadJARs(plugin_path); // depends on control dependency: [try], data = [none] } catch (Exception e) { LOG.error("Error loading plugins from plugin path: " + plugin_path, e); throw new RuntimeException("Error loading plugins from plugin path: " + plugin_path, e); } // depends on control dependency: [catch], data = [none] } } }
public class class_name { protected String getObjectId(IPersistable object) { // The format of the object id is <type>/<path>/<objectName> String result = object.getType(); if (object.getPath().charAt(0) != '/') { result += '/'; } result += object.getPath(); if (!result.endsWith("/")) { result += '/'; } String name = object.getName(); if (name == null) { name = PERSISTENCE_NO_NAME; } if (name.charAt(0) == '/') { // "result" already ends with a slash name = name.substring(1); } return result + name; } }
public class class_name { protected String getObjectId(IPersistable object) { // The format of the object id is <type>/<path>/<objectName> String result = object.getType(); if (object.getPath().charAt(0) != '/') { result += '/'; // depends on control dependency: [if], data = [none] } result += object.getPath(); if (!result.endsWith("/")) { result += '/'; // depends on control dependency: [if], data = [none] } String name = object.getName(); if (name == null) { name = PERSISTENCE_NO_NAME; // depends on control dependency: [if], data = [none] } if (name.charAt(0) == '/') { // "result" already ends with a slash name = name.substring(1); // depends on control dependency: [if], data = [none] } return result + name; } }
public class class_name { @Deprecated public static String parseServiceName(URI endpoint) { String host = endpoint.getHost(); // If we don't recognize the domain, throw an exception. if (!host.endsWith(".amazonaws.com")) { throw new IllegalArgumentException( "Cannot parse a service name from an unrecognized endpoint (" + host + ")."); } String serviceAndRegion = host.substring(0, host.indexOf(".amazonaws.com")); // Special cases for S3 endpoints with bucket names embedded. if (serviceAndRegion.endsWith(".s3") || S3_ENDPOINT_PATTERN.matcher(serviceAndRegion).matches()) { return "s3"; } char separator = '.'; // If we don't detect a separator between service name and region, then // assume that the region is not included in the hostname, and it's only // the service name (ex: "http://iam.amazonaws.com"). if (serviceAndRegion.indexOf(separator) == -1) { return serviceAndRegion; } String service = serviceAndRegion.substring(0, serviceAndRegion.indexOf(separator)); return service; } }
public class class_name { @Deprecated public static String parseServiceName(URI endpoint) { String host = endpoint.getHost(); // If we don't recognize the domain, throw an exception. if (!host.endsWith(".amazonaws.com")) { throw new IllegalArgumentException( "Cannot parse a service name from an unrecognized endpoint (" + host + ")."); } String serviceAndRegion = host.substring(0, host.indexOf(".amazonaws.com")); // Special cases for S3 endpoints with bucket names embedded. if (serviceAndRegion.endsWith(".s3") || S3_ENDPOINT_PATTERN.matcher(serviceAndRegion).matches()) { return "s3"; // depends on control dependency: [if], data = [none] } char separator = '.'; // If we don't detect a separator between service name and region, then // assume that the region is not included in the hostname, and it's only // the service name (ex: "http://iam.amazonaws.com"). if (serviceAndRegion.indexOf(separator) == -1) { return serviceAndRegion; // depends on control dependency: [if], data = [none] } String service = serviceAndRegion.substring(0, serviceAndRegion.indexOf(separator)); return service; } }
public class class_name { private String getUserBindDN(String username) throws GuacamoleException { // If a search DN is provided, search the LDAP directory for the DN // corresponding to the given username String searchBindDN = confService.getSearchBindDN(); if (searchBindDN != null) { // Create an LDAP connection using the search account LDAPConnection searchConnection = ldapService.bindAs( searchBindDN, confService.getSearchBindPassword() ); // Warn of failure to find if (searchConnection == null) { logger.error("Unable to bind using search DN \"{}\"", searchBindDN); return null; } try { // Retrieve all DNs associated with the given username List<String> userDNs = userService.getUserDNs(searchConnection, username); if (userDNs.isEmpty()) return null; // Warn if multiple DNs exist for the same user if (userDNs.size() != 1) { logger.warn("Multiple DNs possible for user \"{}\": {}", username, userDNs); return null; } // Return the single possible DN return userDNs.get(0); } // Always disconnect finally { ldapService.disconnect(searchConnection); } } // Otherwise, derive user DN from base DN return userService.deriveUserDN(username); } }
public class class_name { private String getUserBindDN(String username) throws GuacamoleException { // If a search DN is provided, search the LDAP directory for the DN // corresponding to the given username String searchBindDN = confService.getSearchBindDN(); if (searchBindDN != null) { // Create an LDAP connection using the search account LDAPConnection searchConnection = ldapService.bindAs( searchBindDN, confService.getSearchBindPassword() ); // Warn of failure to find if (searchConnection == null) { logger.error("Unable to bind using search DN \"{}\"", searchBindDN); return null; } try { // Retrieve all DNs associated with the given username List<String> userDNs = userService.getUserDNs(searchConnection, username); if (userDNs.isEmpty()) return null; // Warn if multiple DNs exist for the same user if (userDNs.size() != 1) { logger.warn("Multiple DNs possible for user \"{}\": {}", username, userDNs); // depends on control dependency: [if], data = [none] return null; // depends on control dependency: [if], data = [none] } // Return the single possible DN return userDNs.get(0); } // Always disconnect finally { ldapService.disconnect(searchConnection); } } // Otherwise, derive user DN from base DN return userService.deriveUserDN(username); } }
public class class_name { static List<String> queryStringToNamesAndValues(String encodedQuery) { List<String> result = new ArrayList<>(); for (int pos = 0; pos <= encodedQuery.length(); ) { int ampersandOffset = encodedQuery.indexOf('&', pos); if (ampersandOffset == -1) ampersandOffset = encodedQuery.length(); int equalsOffset = encodedQuery.indexOf('=', pos); if (equalsOffset == -1 || equalsOffset > ampersandOffset) { result.add(encodedQuery.substring(pos, ampersandOffset)); result.add(null); // No value for this name. } else { result.add(encodedQuery.substring(pos, equalsOffset)); result.add(encodedQuery.substring(equalsOffset + 1, ampersandOffset)); } pos = ampersandOffset + 1; } return result; } }
public class class_name { static List<String> queryStringToNamesAndValues(String encodedQuery) { List<String> result = new ArrayList<>(); for (int pos = 0; pos <= encodedQuery.length(); ) { int ampersandOffset = encodedQuery.indexOf('&', pos); if (ampersandOffset == -1) ampersandOffset = encodedQuery.length(); int equalsOffset = encodedQuery.indexOf('=', pos); if (equalsOffset == -1 || equalsOffset > ampersandOffset) { result.add(encodedQuery.substring(pos, ampersandOffset)); // depends on control dependency: [if], data = [none] result.add(null); // No value for this name. // depends on control dependency: [if], data = [none] } else { result.add(encodedQuery.substring(pos, equalsOffset)); // depends on control dependency: [if], data = [none] result.add(encodedQuery.substring(equalsOffset + 1, ampersandOffset)); // depends on control dependency: [if], data = [(equalsOffset] } pos = ampersandOffset + 1; // depends on control dependency: [for], data = [pos] } return result; } }
public class class_name { void closeSocket(boolean tryReconnectIfConnected) throws InterruptedException { boolean wasConnected = false; statusLock.lock(); try { if (isDisconnectingOrClosed()) { waitForDisconnectOrClose(this.options.getConnectionTimeout()); return; } else { this.disconnecting = true; this.exceptionDuringConnectChange = null; wasConnected = (this.status == Status.CONNECTED); statusChanged.signalAll(); } } finally { statusLock.unlock(); } closeSocketImpl(); statusLock.lock(); try { updateStatus(Status.DISCONNECTED); this.exceptionDuringConnectChange = null; // Ignore IOExceptions during closeSocketImpl() this.disconnecting = false; statusChanged.signalAll(); } finally { statusLock.unlock(); } if (isClosing()) { // Bit of a misname, but closing means we are in the close method or were asked // to be close(); } else if (wasConnected && tryReconnectIfConnected) { reconnect(); } } }
public class class_name { void closeSocket(boolean tryReconnectIfConnected) throws InterruptedException { boolean wasConnected = false; statusLock.lock(); try { if (isDisconnectingOrClosed()) { waitForDisconnectOrClose(this.options.getConnectionTimeout()); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } else { this.disconnecting = true; // depends on control dependency: [if], data = [none] this.exceptionDuringConnectChange = null; // depends on control dependency: [if], data = [none] wasConnected = (this.status == Status.CONNECTED); // depends on control dependency: [if], data = [none] statusChanged.signalAll(); // depends on control dependency: [if], data = [none] } } finally { statusLock.unlock(); } closeSocketImpl(); statusLock.lock(); try { updateStatus(Status.DISCONNECTED); this.exceptionDuringConnectChange = null; // Ignore IOExceptions during closeSocketImpl() this.disconnecting = false; statusChanged.signalAll(); } finally { statusLock.unlock(); } if (isClosing()) { // Bit of a misname, but closing means we are in the close method or were asked // to be close(); } else if (wasConnected && tryReconnectIfConnected) { reconnect(); } } }
public class class_name { public String declareVariable(/* @NonNull */ Object key, /* @NonNull */ String proposedName, boolean synthetic, boolean withUniqueName) { if (scopes.isEmpty()) throw new IllegalArgumentException("No scope has been opened yet."); Scope currentScope = scopes.peek(); if (internalGet(proposedName) == null) { currentScope.addVariable(proposedName, synthetic, key); return proposedName; } final Set<String> names = newHashSet(); boolean scopeClosed = false; // add only the non-synthetic variables, since they could be referenced from nested scopes. for (Scope scope : reverse(newArrayList(scopes))) { for (Variable variable : scope.variables()) { if (withUniqueName || !scopeClosed || !variable.synthetic) names.add(variable.name); } scopeClosed = scopeClosed || !scope.pseudoScope; // If we left the current scope (incl. pseudo scopes) and the variable is not synthetic or unique, // we can stop collecting names. Overriding names from outside is ok in that case. if (scopeClosed && !(synthetic || withUniqueName)) break; } String newName = findNewName(names, proposedName); currentScope.addVariable(newName, synthetic, key); return newName; } }
public class class_name { public String declareVariable(/* @NonNull */ Object key, /* @NonNull */ String proposedName, boolean synthetic, boolean withUniqueName) { if (scopes.isEmpty()) throw new IllegalArgumentException("No scope has been opened yet."); Scope currentScope = scopes.peek(); if (internalGet(proposedName) == null) { currentScope.addVariable(proposedName, synthetic, key); // depends on control dependency: [if], data = [none] return proposedName; // depends on control dependency: [if], data = [none] } final Set<String> names = newHashSet(); boolean scopeClosed = false; // add only the non-synthetic variables, since they could be referenced from nested scopes. for (Scope scope : reverse(newArrayList(scopes))) { for (Variable variable : scope.variables()) { if (withUniqueName || !scopeClosed || !variable.synthetic) names.add(variable.name); } scopeClosed = scopeClosed || !scope.pseudoScope; // depends on control dependency: [for], data = [scope] // If we left the current scope (incl. pseudo scopes) and the variable is not synthetic or unique, // we can stop collecting names. Overriding names from outside is ok in that case. if (scopeClosed && !(synthetic || withUniqueName)) break; } String newName = findNewName(names, proposedName); currentScope.addVariable(newName, synthetic, key); return newName; } }
public class class_name { @Override public void discard() { final boolean isTraceOn = TraceComponent.isAnyTracingEnabled(); if (isTraceOn && tc.isEntryEnabled()) Tr.entry(tc, "discard: " + getStateName(state)); // d639281 - Singleton instances are never actually discarded unless a // failure occurs during initialize(). if (state == PRE_CREATE || state == CREATING) { setState(DESTROYED); // Release any JCDI creational contexts that may exist. F743-29174 this.releaseManagedObjectContext(); if (pmiBean != null) { pmiBean.discardCount(); // F743-27070 pmiBean.beanDestroyed(); } } if (isTraceOn && tc.isEntryEnabled()) Tr.exit(tc, "discard"); } }
public class class_name { @Override public void discard() { final boolean isTraceOn = TraceComponent.isAnyTracingEnabled(); if (isTraceOn && tc.isEntryEnabled()) Tr.entry(tc, "discard: " + getStateName(state)); // d639281 - Singleton instances are never actually discarded unless a // failure occurs during initialize(). if (state == PRE_CREATE || state == CREATING) { setState(DESTROYED); // depends on control dependency: [if], data = [none] // Release any JCDI creational contexts that may exist. F743-29174 this.releaseManagedObjectContext(); // depends on control dependency: [if], data = [none] if (pmiBean != null) { pmiBean.discardCount(); // F743-27070 // depends on control dependency: [if], data = [none] pmiBean.beanDestroyed(); // depends on control dependency: [if], data = [none] } } if (isTraceOn && tc.isEntryEnabled()) Tr.exit(tc, "discard"); } }
public class class_name { @Override public void compute2() { if(Job.isRunning(_jobKey)) { Timer timer = new Timer(); _stats[0] = new ThreadLocal<hex.singlenoderf.Statistic>(); _stats[1] = new ThreadLocal<hex.singlenoderf.Statistic>(); Data d = _sampler.sample(_data, _seed, _modelKey, _local_mode); hex.singlenoderf.Statistic left = getStatistic(0, d, _seed, _exclusiveSplitLimit); // calculate the split for( Row r : d ) left.addQ(r, _regression); if (!_regression) left.applyClassWeights(); // Weight the distributions hex.singlenoderf.Statistic.Split spl = left.split(d, false); if(spl.isLeafNode()) { if(_regression) { float av = d.computeAverage(); _tree = new LeafNode(-1, d.rows(), av); } else { _tree = new LeafNode(_data.unmapClass(spl._split), d.rows(),-1); } } else { _tree = new FJBuild (spl, d, 0, _seed).compute(); } _stats = null; // GC if(_jobKey != null && !Job.isRunning(_jobKey)) throw new Job.JobCancelledException(); // Atomically improve the Model as well Key tkey = toKey(); Key dtreeKey = null; if (_score_pojo) dtreeKey = toCompressedKey(); appendKey(_modelKey, tkey, dtreeKey, _verbose > 10 ? _tree.toString(new StringBuilder(""), Integer.MAX_VALUE).toString() : "", _data_id); // appendKey(_modelKey, tkey, _verbose > 10 ? _tree.toString(new StringBuilder(""), Integer.MAX_VALUE).toString() : "", _data_id); StringBuilder sb = new StringBuilder("[RF] Tree : ").append(_data_id+1); sb.append(" d=").append(_tree.depth()).append(" leaves=").append(_tree.leaves()).append(" done in ").append(timer).append('\n'); Log.info(sb.toString()); if (_verbose > 10) { // Log.info(Sys.RANDF, _tree.toString(sb, Integer.MAX_VALUE).toString()); // Log.info(Sys.RANDF, _tree.toJava(sb, Integer.MAX_VALUE).toString()); } } else throw new Job.JobCancelledException(); // Wait for completion tryComplete(); } }
public class class_name { @Override public void compute2() { if(Job.isRunning(_jobKey)) { Timer timer = new Timer(); _stats[0] = new ThreadLocal<hex.singlenoderf.Statistic>(); // depends on control dependency: [if], data = [none] _stats[1] = new ThreadLocal<hex.singlenoderf.Statistic>(); // depends on control dependency: [if], data = [none] Data d = _sampler.sample(_data, _seed, _modelKey, _local_mode); hex.singlenoderf.Statistic left = getStatistic(0, d, _seed, _exclusiveSplitLimit); // calculate the split for( Row r : d ) left.addQ(r, _regression); if (!_regression) left.applyClassWeights(); // Weight the distributions hex.singlenoderf.Statistic.Split spl = left.split(d, false); if(spl.isLeafNode()) { if(_regression) { float av = d.computeAverage(); _tree = new LeafNode(-1, d.rows(), av); // depends on control dependency: [if], data = [none] } else { _tree = new LeafNode(_data.unmapClass(spl._split), d.rows(),-1); // depends on control dependency: [if], data = [none] } } else { _tree = new FJBuild (spl, d, 0, _seed).compute(); // depends on control dependency: [if], data = [none] } _stats = null; // GC // depends on control dependency: [if], data = [none] if(_jobKey != null && !Job.isRunning(_jobKey)) throw new Job.JobCancelledException(); // Atomically improve the Model as well Key tkey = toKey(); Key dtreeKey = null; if (_score_pojo) dtreeKey = toCompressedKey(); appendKey(_modelKey, tkey, dtreeKey, _verbose > 10 ? _tree.toString(new StringBuilder(""), Integer.MAX_VALUE).toString() : "", _data_id); // depends on control dependency: [if], data = [none] // appendKey(_modelKey, tkey, _verbose > 10 ? _tree.toString(new StringBuilder(""), Integer.MAX_VALUE).toString() : "", _data_id); StringBuilder sb = new StringBuilder("[RF] Tree : ").append(_data_id+1); sb.append(" d=").append(_tree.depth()).append(" leaves=").append(_tree.leaves()).append(" done in ").append(timer).append('\n'); // depends on control dependency: [if], data = [none] Log.info(sb.toString()); // depends on control dependency: [if], data = [none] if (_verbose > 10) { // Log.info(Sys.RANDF, _tree.toString(sb, Integer.MAX_VALUE).toString()); // Log.info(Sys.RANDF, _tree.toJava(sb, Integer.MAX_VALUE).toString()); } } else throw new Job.JobCancelledException(); // Wait for completion tryComplete(); } }
public class class_name { public boolean getNotificationsEnabled(String paramName) { Boolean areNotificationsEnabled = paramNames.get(paramName); if(!isSlee11) { if (areNotificationsEnabled == null || areNotificationsEnabled.booleanValue()) { // considering that notifications are enabled, by default, for each // param return true; } else { return false; } }else { if (areNotificationsEnabled != null && areNotificationsEnabled.booleanValue()) { // considering that notifications are enabled, by default, for each // param return true; } else { return false; } } } }
public class class_name { public boolean getNotificationsEnabled(String paramName) { Boolean areNotificationsEnabled = paramNames.get(paramName); if(!isSlee11) { if (areNotificationsEnabled == null || areNotificationsEnabled.booleanValue()) { // considering that notifications are enabled, by default, for each // param return true; // depends on control dependency: [if], data = [none] } else { return false; // depends on control dependency: [if], data = [none] } }else { if (areNotificationsEnabled != null && areNotificationsEnabled.booleanValue()) { // considering that notifications are enabled, by default, for each // param return true; // depends on control dependency: [if], data = [none] } else { return false; // depends on control dependency: [if], data = [none] } } } }
public class class_name { private UUID nextUUID(boolean secure) { byte[] raw = new byte[UUID_BYTE_LENGTH]; if (secure) { //Initialize the secure random if null. if (secureRandom == null) { try { if (usePRNGPackage != null) { secureRandom = SecureRandom.getInstance(usePRNG, usePRNGPackage); } else { secureRandom = SecureRandom.getInstance(usePRNG); } } catch (NoSuchAlgorithmException nsae) { secure = false; //Fail back to default PRNG/Random } catch (NoSuchProviderException nspe) { secure = false; //Fail back to default PRNG/Random } } if (secureRandom != null) { secureRandom.nextBytes(raw); } } else { regularRandom.nextBytes(raw); } raw[TIME_HI_AND_VERSION_BYTE_6] &= 0x0F; raw[TIME_HI_AND_VERSION_BYTE_6] |= (UUID.VERSION_FOUR << 4); raw[CLOCK_SEQ_HI_AND_RESERVED_BYTE_8] &= 0x3F; //0011 1111 raw[CLOCK_SEQ_HI_AND_RESERVED_BYTE_8] |= 0x80; //1000 0000 return new UUID(raw); } }
public class class_name { private UUID nextUUID(boolean secure) { byte[] raw = new byte[UUID_BYTE_LENGTH]; if (secure) { //Initialize the secure random if null. if (secureRandom == null) { try { if (usePRNGPackage != null) { secureRandom = SecureRandom.getInstance(usePRNG, usePRNGPackage); // depends on control dependency: [if], data = [none] } else { secureRandom = SecureRandom.getInstance(usePRNG); // depends on control dependency: [if], data = [none] } } catch (NoSuchAlgorithmException nsae) { secure = false; //Fail back to default PRNG/Random } catch (NoSuchProviderException nspe) { // depends on control dependency: [catch], data = [none] secure = false; //Fail back to default PRNG/Random } // depends on control dependency: [catch], data = [none] } if (secureRandom != null) { secureRandom.nextBytes(raw); // depends on control dependency: [if], data = [none] } } else { regularRandom.nextBytes(raw); // depends on control dependency: [if], data = [none] } raw[TIME_HI_AND_VERSION_BYTE_6] &= 0x0F; raw[TIME_HI_AND_VERSION_BYTE_6] |= (UUID.VERSION_FOUR << 4); raw[CLOCK_SEQ_HI_AND_RESERVED_BYTE_8] &= 0x3F; //0011 1111 raw[CLOCK_SEQ_HI_AND_RESERVED_BYTE_8] |= 0x80; //1000 0000 return new UUID(raw); } }
public class class_name { private int getSrcColor(int x, int y) { int argb = srcColorModel.getRGB(srcRaster.getDataElements(x, y, null)); if (transparency == Transparency.OPAQUE) { argb = 0xff000000 | argb; } return argb; } }
public class class_name { private int getSrcColor(int x, int y) { int argb = srcColorModel.getRGB(srcRaster.getDataElements(x, y, null)); if (transparency == Transparency.OPAQUE) { argb = 0xff000000 | argb; // depends on control dependency: [if], data = [none] } return argb; } }
public class class_name { @Override public void register(CareWebShell shell, ElementBase owner, boolean register) { if (register) { shell.registerHelpResource(this); } } }
public class class_name { @Override public void register(CareWebShell shell, ElementBase owner, boolean register) { if (register) { shell.registerHelpResource(this); // depends on control dependency: [if], data = [none] } } }
public class class_name { public String getPath() { // FIXME: This is sloppy/icky if (isRoot()) { return ROOT; } if (getParent().isRoot()) { return String.format("%s%s", ROOT, getName()); } return String.format("%s%s%s", getParent().getPath(), SEPARATOR, getName()); } }
public class class_name { public String getPath() { // FIXME: This is sloppy/icky if (isRoot()) { return ROOT; // depends on control dependency: [if], data = [none] } if (getParent().isRoot()) { return String.format("%s%s", ROOT, getName()); // depends on control dependency: [if], data = [none] } return String.format("%s%s%s", getParent().getPath(), SEPARATOR, getName()); } }
public class class_name { private void drawLine(BufferedImage image) { Random r = new Random(); Graphics2D g2 = (Graphics2D) image.getGraphics(); int max = this.textLength * this.linePower; for (int i = 0; i < max; i++) { int x1 = r.nextInt(w); int y1 = r.nextInt(h); int x2 = r.nextInt(w); int y2 = r.nextInt(h); g2.setStroke(new BasicStroke(1.5F)); g2.setColor(this.randomColor()); g2.drawLine(x1, y1, x2, y2); } g2.dispose(); } }
public class class_name { private void drawLine(BufferedImage image) { Random r = new Random(); Graphics2D g2 = (Graphics2D) image.getGraphics(); int max = this.textLength * this.linePower; for (int i = 0; i < max; i++) { int x1 = r.nextInt(w); int y1 = r.nextInt(h); int x2 = r.nextInt(w); int y2 = r.nextInt(h); g2.setStroke(new BasicStroke(1.5F)); // depends on control dependency: [for], data = [none] g2.setColor(this.randomColor()); // depends on control dependency: [for], data = [none] g2.drawLine(x1, y1, x2, y2); // depends on control dependency: [for], data = [none] } g2.dispose(); } }
public class class_name { public static String escapeXMLComment(String content) { StringBuffer str = new StringBuffer(content.length()); char[] buff = content.toCharArray(); char lastChar = 0; for (char c : buff) { if (c == '\\') { str.append('\\'); } else if (c == '-' && lastChar == '-') { str.append('\\'); } str.append(c); lastChar = c; } if (lastChar == '-') { str.append('\\'); } return str.toString(); } }
public class class_name { public static String escapeXMLComment(String content) { StringBuffer str = new StringBuffer(content.length()); char[] buff = content.toCharArray(); char lastChar = 0; for (char c : buff) { if (c == '\\') { str.append('\\'); // depends on control dependency: [if], data = ['\\')] } else if (c == '-' && lastChar == '-') { str.append('\\'); // depends on control dependency: [if], data = [none] } str.append(c); // depends on control dependency: [for], data = [c] lastChar = c; // depends on control dependency: [for], data = [c] } if (lastChar == '-') { str.append('\\'); // depends on control dependency: [if], data = [none] } return str.toString(); } }
public class class_name { private CipherHolder build() { Algorithms algorithms = getAlgorithms(); Key priKey = getPrivateKey(); Key pubKey = getPublicKey(); log.debug("构建key成功,开始构建Cipher"); try { Cipher encrypt = Cipher.getInstance(algorithms.toString()); encrypt.init(Cipher.ENCRYPT_MODE, pubKey); Cipher decrypt = Cipher.getInstance(algorithms.toString()); decrypt.init(Cipher.DECRYPT_MODE, priKey); log.debug("Cipher构建成功"); return new CipherHolder(algorithms, encrypt, decrypt, pubKey, priKey); } catch (NoSuchAlgorithmException | NoSuchPaddingException | InvalidKeyException e) { throw new SecureException("构建CipherHolder[" + algorithms + "]失败", e); } } }
public class class_name { private CipherHolder build() { Algorithms algorithms = getAlgorithms(); Key priKey = getPrivateKey(); Key pubKey = getPublicKey(); log.debug("构建key成功,开始构建Cipher"); try { Cipher encrypt = Cipher.getInstance(algorithms.toString()); encrypt.init(Cipher.ENCRYPT_MODE, pubKey); // depends on control dependency: [try], data = [none] Cipher decrypt = Cipher.getInstance(algorithms.toString()); decrypt.init(Cipher.DECRYPT_MODE, priKey); // depends on control dependency: [try], data = [none] log.debug("Cipher构建成功"); // depends on control dependency: [try], data = [none] return new CipherHolder(algorithms, encrypt, decrypt, pubKey, priKey); // depends on control dependency: [try], data = [none] } catch (NoSuchAlgorithmException | NoSuchPaddingException | InvalidKeyException e) { throw new SecureException("构建CipherHolder[" + algorithms + "]失败", e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { protected boolean exportWithMinimalMetaData(String path) { String checkPath = path.startsWith("/") ? path + "/" : "/" + path + "/"; for (String p : m_parameters.getResourcesToExportWithMetaData()) { if (checkPath.startsWith(p)) { return false; } } return true; } }
public class class_name { protected boolean exportWithMinimalMetaData(String path) { String checkPath = path.startsWith("/") ? path + "/" : "/" + path + "/"; for (String p : m_parameters.getResourcesToExportWithMetaData()) { if (checkPath.startsWith(p)) { return false; // depends on control dependency: [if], data = [none] } } return true; } }
public class class_name { public void emitLiteral(int keep_nl, Pointer _str, int len) { byte[] bstr = _str.buffer; int str = _str.start; int mark = str; int start = str; int end = str; write(PIPE, 1); if(keep_nl == YAML.NL_CHOMP) { write(MINUS, 1); } else if(keep_nl == YAML.NL_KEEP) { write(PLUS, 1); } emitIndent(); while(mark < str + len) { if(bstr[mark] == '\n') { end = mark; if( bstr[start] != ' ' && bstr[start] != '\n' && bstr[end] != '\n' && bstr[end] != ' ' ) end += 1; write(_str.withStart(start), end - start); if(mark + 1 == str + len) { if(keep_nl != YAML.NL_KEEP) write(NEWLINE, 1); } else { emitIndent(); } start = mark + 1; } mark++; } end = str + len; if( start < end ) { write(_str.withStart(start), end - start); } } }
public class class_name { public void emitLiteral(int keep_nl, Pointer _str, int len) { byte[] bstr = _str.buffer; int str = _str.start; int mark = str; int start = str; int end = str; write(PIPE, 1); if(keep_nl == YAML.NL_CHOMP) { write(MINUS, 1); // depends on control dependency: [if], data = [none] } else if(keep_nl == YAML.NL_KEEP) { write(PLUS, 1); // depends on control dependency: [if], data = [none] } emitIndent(); while(mark < str + len) { if(bstr[mark] == '\n') { end = mark; // depends on control dependency: [if], data = [none] if( bstr[start] != ' ' && bstr[start] != '\n' && bstr[end] != '\n' && bstr[end] != ' ' ) end += 1; write(_str.withStart(start), end - start); // depends on control dependency: [if], data = [none] if(mark + 1 == str + len) { if(keep_nl != YAML.NL_KEEP) write(NEWLINE, 1); } else { emitIndent(); // depends on control dependency: [if], data = [none] } start = mark + 1; // depends on control dependency: [if], data = [none] } mark++; // depends on control dependency: [while], data = [none] } end = str + len; if( start < end ) { write(_str.withStart(start), end - start); // depends on control dependency: [if], data = [none] } } }
public class class_name { public EnvironmentConfig setEnvMonitorTxnsTimeout(final int timeout) { if (timeout != 0 && timeout < 1000) { throw new InvalidSettingException("Transaction timeout should be greater than a second"); } setSetting(ENV_MONITOR_TXNS_TIMEOUT, timeout); if (timeout > 0 && timeout < getEnvMonitorTxnsCheckFreq()) { setEnvMonitorTxnsCheckFreq(timeout); } return this; } }
public class class_name { public EnvironmentConfig setEnvMonitorTxnsTimeout(final int timeout) { if (timeout != 0 && timeout < 1000) { throw new InvalidSettingException("Transaction timeout should be greater than a second"); } setSetting(ENV_MONITOR_TXNS_TIMEOUT, timeout); if (timeout > 0 && timeout < getEnvMonitorTxnsCheckFreq()) { setEnvMonitorTxnsCheckFreq(timeout); // depends on control dependency: [if], data = [(timeout] } return this; } }
public class class_name { public static String unescapeLeniently(String s) { StringBuilder buf = new StringBuilder(); int[] pos = new int[1]; for (int i=0; i<s.length(); ) { char c = s.charAt(i++); if (c == '\\') { pos[0] = i; int e = unescapeAt(s, pos); if (e < 0) { buf.append(c); } else { buf.appendCodePoint(e); i = pos[0]; } } else { buf.append(c); } } return buf.toString(); } }
public class class_name { public static String unescapeLeniently(String s) { StringBuilder buf = new StringBuilder(); int[] pos = new int[1]; for (int i=0; i<s.length(); ) { char c = s.charAt(i++); if (c == '\\') { pos[0] = i; // depends on control dependency: [if], data = [none] int e = unescapeAt(s, pos); if (e < 0) { buf.append(c); // depends on control dependency: [if], data = [none] } else { buf.appendCodePoint(e); // depends on control dependency: [if], data = [(e] i = pos[0]; // depends on control dependency: [if], data = [none] } } else { buf.append(c); // depends on control dependency: [if], data = [(c] } } return buf.toString(); } }
public class class_name { public static I_CmsCoreServiceAsync getService() { if (SERVICE == null) { SERVICE = GWT.create(I_CmsCoreService.class); String serviceUrl = CmsCoreProvider.get().link("org.opencms.gwt.CmsCoreService.gwt"); ((ServiceDefTarget)SERVICE).setServiceEntryPoint(serviceUrl); } return SERVICE; } }
public class class_name { public static I_CmsCoreServiceAsync getService() { if (SERVICE == null) { SERVICE = GWT.create(I_CmsCoreService.class); // depends on control dependency: [if], data = [none] String serviceUrl = CmsCoreProvider.get().link("org.opencms.gwt.CmsCoreService.gwt"); ((ServiceDefTarget)SERVICE).setServiceEntryPoint(serviceUrl); // depends on control dependency: [if], data = [none] } return SERVICE; } }
public class class_name { @Nullable private static String getPropertyDeprecationInfo(ObjectType type, String prop) { String depReason = getDeprecationReason(type.getOwnPropertyJSDocInfo(prop)); if (depReason != null) { return depReason; } ObjectType implicitProto = type.getImplicitPrototype(); if (implicitProto != null) { return getPropertyDeprecationInfo(implicitProto, prop); } return null; } }
public class class_name { @Nullable private static String getPropertyDeprecationInfo(ObjectType type, String prop) { String depReason = getDeprecationReason(type.getOwnPropertyJSDocInfo(prop)); if (depReason != null) { return depReason; // depends on control dependency: [if], data = [none] } ObjectType implicitProto = type.getImplicitPrototype(); if (implicitProto != null) { return getPropertyDeprecationInfo(implicitProto, prop); // depends on control dependency: [if], data = [(implicitProto] } return null; } }
public class class_name { public static Point getSize(ContentResolver resolver, Uri uri) { InputStream is = null; try { BitmapFactory.Options options = new BitmapFactory.Options(); options.inJustDecodeBounds = true; is = resolver.openInputStream(uri); BitmapFactory.decodeStream(is, null, options); int width = options.outWidth; int height = options.outHeight; return new Point(width, height); } catch (FileNotFoundException e) { Log.e(TAG, "target file (" + uri + ") does not exist.", e); return null; } finally { CloseableUtils.close(is); } } }
public class class_name { public static Point getSize(ContentResolver resolver, Uri uri) { InputStream is = null; try { BitmapFactory.Options options = new BitmapFactory.Options(); options.inJustDecodeBounds = true; // depends on control dependency: [try], data = [none] is = resolver.openInputStream(uri); // depends on control dependency: [try], data = [none] BitmapFactory.decodeStream(is, null, options); // depends on control dependency: [try], data = [none] int width = options.outWidth; int height = options.outHeight; return new Point(width, height); // depends on control dependency: [try], data = [none] } catch (FileNotFoundException e) { Log.e(TAG, "target file (" + uri + ") does not exist.", e); return null; } finally { // depends on control dependency: [catch], data = [none] CloseableUtils.close(is); } } }
public class class_name { protected static void fireOnThrowable(int type, Throwable t) { Object[] list = listeners.toArray(); for (int i=0; i<list.length; i++) { ((ThrowableListener)list[i]).onThrowable(type, t); } } }
public class class_name { protected static void fireOnThrowable(int type, Throwable t) { Object[] list = listeners.toArray(); for (int i=0; i<list.length; i++) { ((ThrowableListener)list[i]).onThrowable(type, t); // depends on control dependency: [for], data = [i] } } }
public class class_name { public String getOnlineDocumentation(){ final CommunityConfig communityConfig = getConfig().getCommunityConfiguration(); if(communityConfig == null){ return null; } return communityConfig.getOnlineHelp(); } }
public class class_name { public String getOnlineDocumentation(){ final CommunityConfig communityConfig = getConfig().getCommunityConfiguration(); if(communityConfig == null){ return null; // depends on control dependency: [if], data = [none] } return communityConfig.getOnlineHelp(); } }
public class class_name { public static Integer[] getSuspiciouslyNotMatchingArgsIndexes(List<ArgumentMatcher> matchers, Object[] arguments) { if (matchers.size() != arguments.length) { return new Integer[0]; } List<Integer> suspicious = new LinkedList<Integer>(); int i = 0; for (ArgumentMatcher m : matchers) { if (m instanceof ContainsExtraTypeInfo && !safelyMatches(m, arguments[i]) && toStringEquals(m, arguments[i]) && !((ContainsExtraTypeInfo) m).typeMatches(arguments[i])) { suspicious.add(i); } i++; } return suspicious.toArray(new Integer[0]); } }
public class class_name { public static Integer[] getSuspiciouslyNotMatchingArgsIndexes(List<ArgumentMatcher> matchers, Object[] arguments) { if (matchers.size() != arguments.length) { return new Integer[0]; // depends on control dependency: [if], data = [none] } List<Integer> suspicious = new LinkedList<Integer>(); int i = 0; for (ArgumentMatcher m : matchers) { if (m instanceof ContainsExtraTypeInfo && !safelyMatches(m, arguments[i]) && toStringEquals(m, arguments[i]) && !((ContainsExtraTypeInfo) m).typeMatches(arguments[i])) { suspicious.add(i); // depends on control dependency: [if], data = [none] } i++; // depends on control dependency: [for], data = [none] } return suspicious.toArray(new Integer[0]); } }
public class class_name { public static String makeLinear (String text) { if (text == null) { return text; } // handle both line ending formats text = text.replace("\n", "<br>\n"); return text; } }
public class class_name { public static String makeLinear (String text) { if (text == null) { return text; // depends on control dependency: [if], data = [none] } // handle both line ending formats text = text.replace("\n", "<br>\n"); return text; } }
public class class_name { public void load( ServletContext servletContext ) { _urlTemplates = new URLTemplates(); InputStream xmlInputStream = null; InputStream xsdInputStream = null; try { xmlInputStream = servletContext.getResourceAsStream( _configFilePath ); if ( xmlInputStream != null ) { /* load the XSD input stream */ xsdInputStream = SCHEMA_RESOLVER.getInputStream(); final String W3C_XML_SCHEMA = "http://www.w3.org/2001/XMLSchema"; final String JAXP_SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage"; final String JAXP_SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource"; DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setValidating(true); dbf.setNamespaceAware(true); dbf.setAttribute(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA); dbf.setAttribute(JAXP_SCHEMA_SOURCE, xsdInputStream); DocumentBuilder db = dbf.newDocumentBuilder(); /* add an ErrorHandler that just logs validation problems */ db.setErrorHandler(new ErrorHandler() { public void warning(SAXParseException exception) { _log.info("Validation warning validating config file \"" + _configFilePath + "\" against XML Schema \"" + SCHEMA_RESOLVER.getResourcePath()); } public void error(SAXParseException exception) { _log.error("Validation errors occurred parsing the config file \"" + _configFilePath + "\". Cause: " + exception, exception); } public void fatalError(SAXParseException exception) { _log.error("Validation errors occurred parsing the config file \"" + _configFilePath + "\". Cause: " + exception, exception); } }); db.setEntityResolver(new EntityResolver() { public InputSource resolveEntity(String publicId, String systemId) { if(systemId.endsWith("/url-template-config.xsd")) { InputStream inputStream = DefaultURLTemplatesFactory.class.getClassLoader().getResourceAsStream(CONFIG_SCHEMA); return new InputSource(inputStream); } else return null; } }); Document document = db.parse(xmlInputStream); Element root = document.getDocumentElement(); loadTemplates( root ); loadTemplateRefGroups( root ); } else { if ( _log.isInfoEnabled() ) _log.info( "Running without URL template descriptor, " + _configFilePath ); } } catch ( ParserConfigurationException pce ) { _log.error( "Problem loading URL template descriptor file " + _configFilePath, pce ); } catch ( SAXException se ) { _log.error( "Problem parsing URL template descriptor in " + _configFilePath, se ); } catch ( IOException ioe ) { _log.error( "Problem reading URL template descriptor file " + _configFilePath, ioe ); } finally { // Close the streams try { if ( xmlInputStream != null ) xmlInputStream.close(); } catch ( Exception ignore ) {} try { if ( xsdInputStream != null ) xsdInputStream.close(); } catch( IOException ignore ) {} } } }
public class class_name { public void load( ServletContext servletContext ) { _urlTemplates = new URLTemplates(); InputStream xmlInputStream = null; InputStream xsdInputStream = null; try { xmlInputStream = servletContext.getResourceAsStream( _configFilePath ); // depends on control dependency: [try], data = [none] if ( xmlInputStream != null ) { /* load the XSD input stream */ xsdInputStream = SCHEMA_RESOLVER.getInputStream(); // depends on control dependency: [if], data = [none] final String W3C_XML_SCHEMA = "http://www.w3.org/2001/XMLSchema"; final String JAXP_SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage"; final String JAXP_SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource"; DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setValidating(true); // depends on control dependency: [if], data = [none] dbf.setNamespaceAware(true); // depends on control dependency: [if], data = [none] dbf.setAttribute(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA); // depends on control dependency: [if], data = [none] dbf.setAttribute(JAXP_SCHEMA_SOURCE, xsdInputStream); // depends on control dependency: [if], data = [none] DocumentBuilder db = dbf.newDocumentBuilder(); /* add an ErrorHandler that just logs validation problems */ db.setErrorHandler(new ErrorHandler() { public void warning(SAXParseException exception) { _log.info("Validation warning validating config file \"" + _configFilePath + "\" against XML Schema \"" + SCHEMA_RESOLVER.getResourcePath()); } public void error(SAXParseException exception) { _log.error("Validation errors occurred parsing the config file \"" + _configFilePath + "\". Cause: " + exception, exception); } public void fatalError(SAXParseException exception) { _log.error("Validation errors occurred parsing the config file \"" + _configFilePath + "\". Cause: " + exception, exception); } }); // depends on control dependency: [if], data = [none] db.setEntityResolver(new EntityResolver() { public InputSource resolveEntity(String publicId, String systemId) { if(systemId.endsWith("/url-template-config.xsd")) { InputStream inputStream = DefaultURLTemplatesFactory.class.getClassLoader().getResourceAsStream(CONFIG_SCHEMA); return new InputSource(inputStream); } else return null; } }); // depends on control dependency: [if], data = [none] Document document = db.parse(xmlInputStream); Element root = document.getDocumentElement(); loadTemplates( root ); // depends on control dependency: [if], data = [none] loadTemplateRefGroups( root ); // depends on control dependency: [if], data = [none] } else { if ( _log.isInfoEnabled() ) _log.info( "Running without URL template descriptor, " + _configFilePath ); } } catch ( ParserConfigurationException pce ) { _log.error( "Problem loading URL template descriptor file " + _configFilePath, pce ); } // depends on control dependency: [catch], data = [none] catch ( SAXException se ) { _log.error( "Problem parsing URL template descriptor in " + _configFilePath, se ); } // depends on control dependency: [catch], data = [none] catch ( IOException ioe ) { _log.error( "Problem reading URL template descriptor file " + _configFilePath, ioe ); } // depends on control dependency: [catch], data = [none] finally { // Close the streams try { if ( xmlInputStream != null ) xmlInputStream.close(); } catch ( Exception ignore ) {} // depends on control dependency: [catch], data = [none] try { if ( xsdInputStream != null ) xsdInputStream.close(); } catch( IOException ignore ) {} // depends on control dependency: [catch], data = [none] } } }
public class class_name { @com.fasterxml.jackson.annotation.JsonProperty("MutuallyExclusiveParameters") public void setMutuallyExclusiveParameters(java.util.Collection<String> mutuallyExclusiveParameters) { if (mutuallyExclusiveParameters == null) { this.mutuallyExclusiveParameters = null; return; } this.mutuallyExclusiveParameters = new java.util.ArrayList<String>(mutuallyExclusiveParameters); } }
public class class_name { @com.fasterxml.jackson.annotation.JsonProperty("MutuallyExclusiveParameters") public void setMutuallyExclusiveParameters(java.util.Collection<String> mutuallyExclusiveParameters) { if (mutuallyExclusiveParameters == null) { this.mutuallyExclusiveParameters = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.mutuallyExclusiveParameters = new java.util.ArrayList<String>(mutuallyExclusiveParameters); } }
public class class_name { public static int parseInt(byte[] b, int offset, int length, int base) { int value = 0; //CHECKSTYLE:OFF if (length < 0) { length = b.length - offset; } //CHECKSTYLE:ON for (int i = 0; i < length; i++) { char c = (char) (_0XFF & b[offset + i]); int digit = c - '0'; if (digit < 0 || digit >= base || digit >= TEN) { digit = TEN + c - 'A'; if (digit < TEN || digit >= base) { digit = TEN + c - 'a'; } } if (digit < 0 || digit >= base) { throw new NumberFormatException(new String(b, offset, length)); } value = value * base + digit; } return value; } }
public class class_name { public static int parseInt(byte[] b, int offset, int length, int base) { int value = 0; //CHECKSTYLE:OFF if (length < 0) { length = b.length - offset; // depends on control dependency: [if], data = [none] } //CHECKSTYLE:ON for (int i = 0; i < length; i++) { char c = (char) (_0XFF & b[offset + i]); int digit = c - '0'; if (digit < 0 || digit >= base || digit >= TEN) { digit = TEN + c - 'A'; // depends on control dependency: [if], data = [none] if (digit < TEN || digit >= base) { digit = TEN + c - 'a'; // depends on control dependency: [if], data = [none] } } if (digit < 0 || digit >= base) { throw new NumberFormatException(new String(b, offset, length)); } value = value * base + digit; // depends on control dependency: [for], data = [none] } return value; } }
public class class_name { public void marshall(UpdateTaskRequest updateTaskRequest, ProtocolMarshaller protocolMarshaller) { if (updateTaskRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(updateTaskRequest.getTaskArn(), TASKARN_BINDING); protocolMarshaller.marshall(updateTaskRequest.getOptions(), OPTIONS_BINDING); protocolMarshaller.marshall(updateTaskRequest.getName(), NAME_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(UpdateTaskRequest updateTaskRequest, ProtocolMarshaller protocolMarshaller) { if (updateTaskRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(updateTaskRequest.getTaskArn(), TASKARN_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(updateTaskRequest.getOptions(), OPTIONS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(updateTaskRequest.getName(), NAME_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 static <T> ElementDescriptor<T> registerWithParents(QualifiedName qname, IObjectBuilder<T> builder, ElementDescriptor<?>... parentElements) { if (parentElements == null || parentElements.length == 0) { throw new IllegalArgumentException("no parent elements provided"); } // create the new descriptor with the context of the first parent ElementDescriptor<T> descriptor = new ElementDescriptor<T>(qname, builder, parentElements[0].getContext()); // register the descriptor with all parents for (ElementDescriptor<?> parentElement : parentElements) { if (descriptor.getContext() != parentElement.getContext()) { throw new IllegalArgumentException("Parent descriptors don't belong to the same XmlContext"); } Map<QualifiedName, ElementDescriptor<?>> descriptorMap = parentElement.mElementContext; if (descriptorMap == null) { descriptorMap = parentElement.mElementContext = Collections.synchronizedMap(new HashMap<QualifiedName, ElementDescriptor<?>>(8)); } else if (descriptorMap.containsKey(qname)) { throw new IllegalStateException("descriptor for " + qname + " already exists in parent " + parentElement.qualifiedName); } descriptorMap.put(qname, descriptor); } return descriptor; } }
public class class_name { public static <T> ElementDescriptor<T> registerWithParents(QualifiedName qname, IObjectBuilder<T> builder, ElementDescriptor<?>... parentElements) { if (parentElements == null || parentElements.length == 0) { throw new IllegalArgumentException("no parent elements provided"); } // create the new descriptor with the context of the first parent ElementDescriptor<T> descriptor = new ElementDescriptor<T>(qname, builder, parentElements[0].getContext()); // register the descriptor with all parents for (ElementDescriptor<?> parentElement : parentElements) { if (descriptor.getContext() != parentElement.getContext()) { throw new IllegalArgumentException("Parent descriptors don't belong to the same XmlContext"); } Map<QualifiedName, ElementDescriptor<?>> descriptorMap = parentElement.mElementContext; // depends on control dependency: [for], data = [parentElement] if (descriptorMap == null) { descriptorMap = parentElement.mElementContext = Collections.synchronizedMap(new HashMap<QualifiedName, ElementDescriptor<?>>(8)); // depends on control dependency: [if], data = [none] } else if (descriptorMap.containsKey(qname)) { throw new IllegalStateException("descriptor for " + qname + " already exists in parent " + parentElement.qualifiedName); } descriptorMap.put(qname, descriptor); // depends on control dependency: [for], data = [none] } return descriptor; } }
public class class_name { public Logger getLogger(String loggerName) { Logger logger; //lookup in the cache first logger = (Logger) cache.get(loggerName); if(logger == null) { try { // get the configuration (not from the configurator because this is independent) logger = createLoggerInstance(loggerName); if(getBootLogger().isDebugEnabled()) { getBootLogger().debug("Using logger class '" + (getConfiguration() != null ? getConfiguration().getLoggerClass() : null) + "' for " + loggerName); } // configure the logger getBootLogger().debug("Initializing logger instance " + loggerName); logger.configure(conf); } catch(Throwable t) { // do reassign check and signal logger creation failure reassignBootLogger(true); logger = getBootLogger(); getBootLogger().error("[" + this.getClass().getName() + "] Could not initialize logger " + (conf != null ? conf.getLoggerClass() : null), t); } //cache it so we can get it faster the next time cache.put(loggerName, logger); // do reassign check reassignBootLogger(false); } return logger; } }
public class class_name { public Logger getLogger(String loggerName) { Logger logger; //lookup in the cache first logger = (Logger) cache.get(loggerName); if(logger == null) { try { // get the configuration (not from the configurator because this is independent) logger = createLoggerInstance(loggerName); // depends on control dependency: [try], data = [none] if(getBootLogger().isDebugEnabled()) { getBootLogger().debug("Using logger class '" + (getConfiguration() != null ? getConfiguration().getLoggerClass() : null) + "' for " + loggerName); // depends on control dependency: [if], data = [none] } // configure the logger getBootLogger().debug("Initializing logger instance " + loggerName); // depends on control dependency: [try], data = [none] logger.configure(conf); // depends on control dependency: [try], data = [none] } catch(Throwable t) { // do reassign check and signal logger creation failure reassignBootLogger(true); logger = getBootLogger(); getBootLogger().error("[" + this.getClass().getName() + "] Could not initialize logger " + (conf != null ? conf.getLoggerClass() : null), t); } // depends on control dependency: [catch], data = [none] //cache it so we can get it faster the next time cache.put(loggerName, logger); // depends on control dependency: [if], data = [(logger] // do reassign check reassignBootLogger(false); // depends on control dependency: [if], data = [none] } return logger; } }
public class class_name { private static String normalizeDpmBaseURL(String url) { if (url.endsWith("/")) { url = url.substring(0, url.length() - 1); } return url; } }
public class class_name { private static String normalizeDpmBaseURL(String url) { if (url.endsWith("/")) { url = url.substring(0, url.length() - 1); // depends on control dependency: [if], data = [none] } return url; } }
public class class_name { private void appendReadParameters(StringBuffer pRet) { if (isMultiAttributeMode()) { pRet.append("attribute=["); for (int i = 0;i<attributeNames.size();i++) { pRet.append(attributeNames.get(i)); if (i < attributeNames.size() - 1) { pRet.append(","); } } pRet.append("]"); } else { pRet.append("attribute=").append(getAttributeName()); } } }
public class class_name { private void appendReadParameters(StringBuffer pRet) { if (isMultiAttributeMode()) { pRet.append("attribute=["); // depends on control dependency: [if], data = [none] for (int i = 0;i<attributeNames.size();i++) { pRet.append(attributeNames.get(i)); // depends on control dependency: [for], data = [i] if (i < attributeNames.size() - 1) { pRet.append(","); // depends on control dependency: [if], data = [none] } } pRet.append("]"); // depends on control dependency: [if], data = [none] } else { pRet.append("attribute=").append(getAttributeName()); // depends on control dependency: [if], data = [none] } } }
public class class_name { public String[] getMetaKeywords(PackageDoc packageDoc) { if( configuration.keywords ) { String pkgName = Util.getPackageName(packageDoc); return new String[] { pkgName + " " + "package" }; } else { return new String[] {}; } } }
public class class_name { public String[] getMetaKeywords(PackageDoc packageDoc) { if( configuration.keywords ) { String pkgName = Util.getPackageName(packageDoc); return new String[] { pkgName + " " + "package" }; // depends on control dependency: [if], data = [none] } else { return new String[] {}; // depends on control dependency: [if], data = [none] } } }
public class class_name { @Deprecated public static String encodePostBody(Bundle parameters, String boundary) { if (parameters == null) return ""; StringBuilder sb = new StringBuilder(); for (String key : parameters.keySet()) { Object parameter = parameters.get(key); if (!(parameter instanceof String)) { continue; } sb.append("Content-Disposition: form-data; name=\"" + key + "\"\r\n\r\n" + (String)parameter); sb.append("\r\n" + "--" + boundary + "\r\n"); } return sb.toString(); } }
public class class_name { @Deprecated public static String encodePostBody(Bundle parameters, String boundary) { if (parameters == null) return ""; StringBuilder sb = new StringBuilder(); for (String key : parameters.keySet()) { Object parameter = parameters.get(key); if (!(parameter instanceof String)) { continue; } sb.append("Content-Disposition: form-data; name=\"" + key + // depends on control dependency: [for], data = [none] "\"\r\n\r\n" + (String)parameter); // depends on control dependency: [for], data = [none] sb.append("\r\n" + "--" + boundary + "\r\n"); // depends on control dependency: [for], data = [none] } return sb.toString(); } }
public class class_name { public boolean overlaps(TimecodeRange that) { if (this.within(that.getStart()) || this.within(that.getEnd())) { return true; // we contain one of their timecodes } else if (that.within(this.getStart()) || that.within(this.getEnd())) { return true; // they contain one of our timecodes } else { return false; } } }
public class class_name { public boolean overlaps(TimecodeRange that) { if (this.within(that.getStart()) || this.within(that.getEnd())) { return true; // we contain one of their timecodes // depends on control dependency: [if], data = [none] } else if (that.within(this.getStart()) || that.within(this.getEnd())) { return true; // they contain one of our timecodes // depends on control dependency: [if], data = [none] } else { return false; // depends on control dependency: [if], data = [none] } } }