code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { public static File mkdir(String dirPath) { if (dirPath == null) { return null; } final File dir = file(dirPath); return mkdir(dir); } }
public class class_name { public static File mkdir(String dirPath) { if (dirPath == null) { return null; // depends on control dependency: [if], data = [none] } final File dir = file(dirPath); return mkdir(dir); } }
public class class_name { private void updateDataType(EntityType entityType, Attribute attr, Attribute updatedAttr) { Attribute idAttr = entityType.getIdAttribute(); if (idAttr != null && idAttr.getName().equals(attr.getName())) { throw new MolgenisDataException( format( "Data type of entity [%s] attribute [%s] cannot be modified, because [%s] is an ID attribute.", entityType.getId(), attr.getName(), attr.getName())); } // do nothing on representation changes XREF --> CATEGORICAL if (isSingleReferenceType(attr) && isSingleReferenceType(updatedAttr)) { return; } // do nothing on representation changes MREF --> CATEGORICAL_MREF if (isMultipleReferenceType(attr) && isMultipleReferenceType(updatedAttr)) { return; } // remove foreign key on data type updates such as XREF --> STRING if (isSingleReferenceType(attr) && !isReferenceType(updatedAttr)) { dropForeignKey(entityType, attr); } if (isSingleReferenceType(attr) && isMultipleReferenceType(updatedAttr)) { updateManyToOneToManyToMany(entityType, attr, updatedAttr); } else if (isMultipleReferenceType(attr) && isSingleReferenceType(updatedAttr)) { updateManyToManyToManyToOne(entityType, attr, updatedAttr); } else { updateColumnDataType(entityType, updatedAttr); } // add foreign key on data type updates such as STRING --> XREF if (!isReferenceType(attr) && isSingleReferenceType(updatedAttr)) { createForeignKey(entityType, updatedAttr); } } }
public class class_name { private void updateDataType(EntityType entityType, Attribute attr, Attribute updatedAttr) { Attribute idAttr = entityType.getIdAttribute(); if (idAttr != null && idAttr.getName().equals(attr.getName())) { throw new MolgenisDataException( format( "Data type of entity [%s] attribute [%s] cannot be modified, because [%s] is an ID attribute.", entityType.getId(), attr.getName(), attr.getName())); } // do nothing on representation changes XREF --> CATEGORICAL if (isSingleReferenceType(attr) && isSingleReferenceType(updatedAttr)) { return; // depends on control dependency: [if], data = [none] } // do nothing on representation changes MREF --> CATEGORICAL_MREF if (isMultipleReferenceType(attr) && isMultipleReferenceType(updatedAttr)) { return; // depends on control dependency: [if], data = [none] } // remove foreign key on data type updates such as XREF --> STRING if (isSingleReferenceType(attr) && !isReferenceType(updatedAttr)) { dropForeignKey(entityType, attr); // depends on control dependency: [if], data = [none] } if (isSingleReferenceType(attr) && isMultipleReferenceType(updatedAttr)) { updateManyToOneToManyToMany(entityType, attr, updatedAttr); // depends on control dependency: [if], data = [none] } else if (isMultipleReferenceType(attr) && isSingleReferenceType(updatedAttr)) { updateManyToManyToManyToOne(entityType, attr, updatedAttr); // depends on control dependency: [if], data = [none] } else { updateColumnDataType(entityType, updatedAttr); // depends on control dependency: [if], data = [none] } // add foreign key on data type updates such as STRING --> XREF if (!isReferenceType(attr) && isSingleReferenceType(updatedAttr)) { createForeignKey(entityType, updatedAttr); // depends on control dependency: [if], data = [none] } } }
public class class_name { private double getMCEntropy(int[][] mat, ArrayList<int[]> partsx, ArrayList<int[]> partsy, int size, int gridsize, double loggrid) { // Margin entropies: double[] mx = new double[gridsize]; double[] my = new double[gridsize]; for(int i = 0; i < gridsize; i++) { // Note: indexes are a bit tricky here, because we compute both margin // entropies at the same time! final double sumx = (double) partsx.get(i).length; final double sumy = (double) partsy.get(i).length; for(int j = 0; j < gridsize; j++) { double px = mat[i][j] / sumx; double py = mat[j][i] / sumy; if(px > 0.) { mx[i] -= px * FastMath.log(px); } if(py > 0.) { my[i] -= py * FastMath.log(py); } } } // Weighted sums of margin entropies. double sumx = 0., sumy = 0.; for(int i = 0; i < gridsize; i++) { sumx += mx[i] * partsx.get(i).length; sumy += my[i] * partsy.get(i).length; } double max = ((sumx > sumy) ? sumx : sumy); return max / (size * loggrid); } }
public class class_name { private double getMCEntropy(int[][] mat, ArrayList<int[]> partsx, ArrayList<int[]> partsy, int size, int gridsize, double loggrid) { // Margin entropies: double[] mx = new double[gridsize]; double[] my = new double[gridsize]; for(int i = 0; i < gridsize; i++) { // Note: indexes are a bit tricky here, because we compute both margin // entropies at the same time! final double sumx = (double) partsx.get(i).length; final double sumy = (double) partsy.get(i).length; for(int j = 0; j < gridsize; j++) { double px = mat[i][j] / sumx; double py = mat[j][i] / sumy; if(px > 0.) { mx[i] -= px * FastMath.log(px); // depends on control dependency: [if], data = [(px] } if(py > 0.) { my[i] -= py * FastMath.log(py); // depends on control dependency: [if], data = [(py] } } } // Weighted sums of margin entropies. double sumx = 0., sumy = 0.; for(int i = 0; i < gridsize; i++) { sumx += mx[i] * partsx.get(i).length; // depends on control dependency: [for], data = [i] sumy += my[i] * partsy.get(i).length; // depends on control dependency: [for], data = [i] } double max = ((sumx > sumy) ? sumx : sumy); return max / (size * loggrid); } }
public class class_name { public OptionConfiguration withDBSecurityGroupMemberships(String... dBSecurityGroupMemberships) { if (this.dBSecurityGroupMemberships == null) { setDBSecurityGroupMemberships(new com.amazonaws.internal.SdkInternalList<String>(dBSecurityGroupMemberships.length)); } for (String ele : dBSecurityGroupMemberships) { this.dBSecurityGroupMemberships.add(ele); } return this; } }
public class class_name { public OptionConfiguration withDBSecurityGroupMemberships(String... dBSecurityGroupMemberships) { if (this.dBSecurityGroupMemberships == null) { setDBSecurityGroupMemberships(new com.amazonaws.internal.SdkInternalList<String>(dBSecurityGroupMemberships.length)); // depends on control dependency: [if], data = [none] } for (String ele : dBSecurityGroupMemberships) { this.dBSecurityGroupMemberships.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { public static Object readObjectFromFile(File f) { Object obj = null; try { FileInputStream fin = new FileInputStream(f); ObjectInputStream ois = new ObjectInputStream(fin); obj = ois.readObject(); ois.close(); } catch (Exception e) { System.out.println("Error reading Object from file: " + e.getMessage()); return null; } return obj; } }
public class class_name { public static Object readObjectFromFile(File f) { Object obj = null; try { FileInputStream fin = new FileInputStream(f); ObjectInputStream ois = new ObjectInputStream(fin); obj = ois.readObject(); // depends on control dependency: [try], data = [none] ois.close(); // depends on control dependency: [try], data = [none] } catch (Exception e) { System.out.println("Error reading Object from file: " + e.getMessage()); return null; } // depends on control dependency: [catch], data = [none] return obj; } }
public class class_name { public void marshall(PipelineExecutionSummary pipelineExecutionSummary, ProtocolMarshaller protocolMarshaller) { if (pipelineExecutionSummary == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(pipelineExecutionSummary.getPipelineExecutionId(), PIPELINEEXECUTIONID_BINDING); protocolMarshaller.marshall(pipelineExecutionSummary.getStatus(), STATUS_BINDING); protocolMarshaller.marshall(pipelineExecutionSummary.getStartTime(), STARTTIME_BINDING); protocolMarshaller.marshall(pipelineExecutionSummary.getLastUpdateTime(), LASTUPDATETIME_BINDING); protocolMarshaller.marshall(pipelineExecutionSummary.getSourceRevisions(), SOURCEREVISIONS_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(PipelineExecutionSummary pipelineExecutionSummary, ProtocolMarshaller protocolMarshaller) { if (pipelineExecutionSummary == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(pipelineExecutionSummary.getPipelineExecutionId(), PIPELINEEXECUTIONID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(pipelineExecutionSummary.getStatus(), STATUS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(pipelineExecutionSummary.getStartTime(), STARTTIME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(pipelineExecutionSummary.getLastUpdateTime(), LASTUPDATETIME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(pipelineExecutionSummary.getSourceRevisions(), SOURCEREVISIONS_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 ChronoHistory with(EraPreference eraPreference) { if (eraPreference.equals(this.eraPreference) || !this.hasGregorianCutOverDate()) { return this; } return new ChronoHistory(this.variant, this.events, this.ajly, this.nys, eraPreference); } }
public class class_name { public ChronoHistory with(EraPreference eraPreference) { if (eraPreference.equals(this.eraPreference) || !this.hasGregorianCutOverDate()) { return this; // depends on control dependency: [if], data = [none] } return new ChronoHistory(this.variant, this.events, this.ajly, this.nys, eraPreference); } }
public class class_name { public static void fire(final HasSummernoteChangeHandlers source) { if (TYPE != null) { SummernoteChangeEvent event = new SummernoteChangeEvent(); source.fireEvent(event); } } }
public class class_name { public static void fire(final HasSummernoteChangeHandlers source) { if (TYPE != null) { SummernoteChangeEvent event = new SummernoteChangeEvent(); source.fireEvent(event); // depends on control dependency: [if], data = [none] } } }
public class class_name { public List<Field> getRouteFieldValuesBy(FluidItem fluidItemParam) { if(this.serviceTicket != null && fluidItemParam != null) { fluidItemParam.setServiceTicket(this.serviceTicket); } return new RouteFieldListing(this.postJson( fluidItemParam, Version1.getValuesBy())).getListing(); } }
public class class_name { public List<Field> getRouteFieldValuesBy(FluidItem fluidItemParam) { if(this.serviceTicket != null && fluidItemParam != null) { fluidItemParam.setServiceTicket(this.serviceTicket); // depends on control dependency: [if], data = [(this.serviceTicket] } return new RouteFieldListing(this.postJson( fluidItemParam, Version1.getValuesBy())).getListing(); } }
public class class_name { public static ScopedResponse getScopedResponse( HttpServletResponse realResponse, ScopedRequest scopedRequest ) { assert ! ( realResponse instanceof ScopedResponse ); String responseAttr = getScopedName( OVERRIDE_RESPONSE_ATTR, scopedRequest.getScopeKey() ); HttpServletRequest outerRequest = scopedRequest.getOuterRequest(); ScopedResponse scopedResponse = ( ScopedResponse ) outerRequest.getAttribute( responseAttr ); // // If it doesn't exist, create it and cache it. // if ( scopedResponse == null ) { scopedResponse = new ScopedResponseImpl( realResponse ); outerRequest.setAttribute( responseAttr, scopedResponse ); } return scopedResponse; } }
public class class_name { public static ScopedResponse getScopedResponse( HttpServletResponse realResponse, ScopedRequest scopedRequest ) { assert ! ( realResponse instanceof ScopedResponse ); String responseAttr = getScopedName( OVERRIDE_RESPONSE_ATTR, scopedRequest.getScopeKey() ); HttpServletRequest outerRequest = scopedRequest.getOuterRequest(); ScopedResponse scopedResponse = ( ScopedResponse ) outerRequest.getAttribute( responseAttr ); // // If it doesn't exist, create it and cache it. // if ( scopedResponse == null ) { scopedResponse = new ScopedResponseImpl( realResponse ); // depends on control dependency: [if], data = [none] outerRequest.setAttribute( responseAttr, scopedResponse ); // depends on control dependency: [if], data = [none] } return scopedResponse; } }
public class class_name { public static String extractDDLTableName(String sql) { Matcher matcher = PAT_TABLE_DDL_PREAMBLE.matcher(sql); if (matcher.find()) { return matcher.group(2).toLowerCase(); } return null; } }
public class class_name { public static String extractDDLTableName(String sql) { Matcher matcher = PAT_TABLE_DDL_PREAMBLE.matcher(sql); if (matcher.find()) { return matcher.group(2).toLowerCase(); // depends on control dependency: [if], data = [none] } return null; } }
public class class_name { public static ULocale addLikelySubtags(ULocale loc) { String[] tags = new String[3]; String trailing = null; int trailingIndex = parseTagString( loc.localeID, tags); if (trailingIndex < loc.localeID.length()) { trailing = loc.localeID.substring(trailingIndex); } String newLocaleID = createLikelySubtagsString( tags[0], tags[1], tags[2], trailing); return newLocaleID == null ? loc : new ULocale(newLocaleID); } }
public class class_name { public static ULocale addLikelySubtags(ULocale loc) { String[] tags = new String[3]; String trailing = null; int trailingIndex = parseTagString( loc.localeID, tags); if (trailingIndex < loc.localeID.length()) { trailing = loc.localeID.substring(trailingIndex); // depends on control dependency: [if], data = [(trailingIndex] } String newLocaleID = createLikelySubtagsString( tags[0], tags[1], tags[2], trailing); return newLocaleID == null ? loc : new ULocale(newLocaleID); } }
public class class_name { public static final boolean isValid(final String value) { if (value == null) { return true; } if (value.length() != 36) { return false; } try { UUID.fromString(value); return true; } catch (final RuntimeException ex) { return false; } } }
public class class_name { public static final boolean isValid(final String value) { if (value == null) { return true; // depends on control dependency: [if], data = [none] } if (value.length() != 36) { return false; // depends on control dependency: [if], data = [none] } try { UUID.fromString(value); // depends on control dependency: [try], data = [none] return true; // depends on control dependency: [try], data = [none] } catch (final RuntimeException ex) { return false; } // depends on control dependency: [catch], data = [none] } }
public class class_name { private String buildCondition(LogicalOperator logicalOperator, Condition... conditions) { if (ArrayUtil.isEmpty(conditions)) { return StrUtil.EMPTY; } if (null == logicalOperator) { logicalOperator = LogicalOperator.AND; } final StringBuilder conditionStrBuilder = new StringBuilder(); boolean isFirst = true; for (Condition condition : conditions) { // 添加逻辑运算符 if (isFirst) { isFirst = false; } else { // " AND " 或者 " OR " conditionStrBuilder.append(StrUtil.SPACE).append(logicalOperator).append(StrUtil.SPACE); } // 构建条件部分:"name = ?"、"name IN (?,?,?)"、"name BETWEEN ?AND ?"、"name LIKE ?" conditionStrBuilder.append(condition.toString(this.paramValues)); } return conditionStrBuilder.toString(); } }
public class class_name { private String buildCondition(LogicalOperator logicalOperator, Condition... conditions) { if (ArrayUtil.isEmpty(conditions)) { return StrUtil.EMPTY; // depends on control dependency: [if], data = [none] } if (null == logicalOperator) { logicalOperator = LogicalOperator.AND; // depends on control dependency: [if], data = [none] } final StringBuilder conditionStrBuilder = new StringBuilder(); boolean isFirst = true; for (Condition condition : conditions) { // 添加逻辑运算符 if (isFirst) { isFirst = false; // depends on control dependency: [if], data = [none] } else { // " AND " 或者 " OR " conditionStrBuilder.append(StrUtil.SPACE).append(logicalOperator).append(StrUtil.SPACE); // depends on control dependency: [if], data = [none] } // 构建条件部分:"name = ?"、"name IN (?,?,?)"、"name BETWEEN ?AND ?"、"name LIKE ?" conditionStrBuilder.append(condition.toString(this.paramValues)); // depends on control dependency: [for], data = [condition] } return conditionStrBuilder.toString(); } }
public class class_name { public SessionID createSessionRemote() { ControlPoint controlPoint = getControlPoint(); if(controlPoint == null) { return createSession(); } else { try { RunResult result = controlPoint.beginRequest(); if (result == RunResult.REJECTED) { throw EjbLogger.ROOT_LOGGER.containerSuspended(); } try { return createSession(); } finally { controlPoint.requestComplete(); } } catch (EJBComponentUnavailableException | ComponentIsStoppedException e) { throw e; } catch (Exception e) { throw new EJBException(e); } } } }
public class class_name { public SessionID createSessionRemote() { ControlPoint controlPoint = getControlPoint(); if(controlPoint == null) { return createSession(); // depends on control dependency: [if], data = [none] } else { try { RunResult result = controlPoint.beginRequest(); if (result == RunResult.REJECTED) { throw EjbLogger.ROOT_LOGGER.containerSuspended(); } try { return createSession(); // depends on control dependency: [try], data = [none] } finally { controlPoint.requestComplete(); } } catch (EJBComponentUnavailableException | ComponentIsStoppedException e) { throw e; } catch (Exception e) { // depends on control dependency: [catch], data = [none] throw new EJBException(e); } // depends on control dependency: [catch], data = [none] } } }
public class class_name { public DeregisterInstancesFromLoadBalancerRequest withInstances(Instance... instances) { if (this.instances == null) { setInstances(new com.amazonaws.internal.SdkInternalList<Instance>(instances.length)); } for (Instance ele : instances) { this.instances.add(ele); } return this; } }
public class class_name { public DeregisterInstancesFromLoadBalancerRequest withInstances(Instance... instances) { if (this.instances == null) { setInstances(new com.amazonaws.internal.SdkInternalList<Instance>(instances.length)); // depends on control dependency: [if], data = [none] } for (Instance ele : instances) { this.instances.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { protected boolean setupPruneList(GrowQueue_I32 regionMemberCount) { segmentPruneFlag.resize(regionMemberCount.size); pruneGraph.reset(); segmentToPruneID.resize(regionMemberCount.size); for( int i = 0; i < regionMemberCount.size; i++ ) { if( regionMemberCount.get(i) < minimumSize ) { segmentToPruneID.set(i, pruneGraph.size()); Node n = pruneGraph.grow(); n.init(i); segmentPruneFlag.set(i, true); } else { segmentPruneFlag.set(i, false); } } return pruneGraph.size() != 0; } }
public class class_name { protected boolean setupPruneList(GrowQueue_I32 regionMemberCount) { segmentPruneFlag.resize(regionMemberCount.size); pruneGraph.reset(); segmentToPruneID.resize(regionMemberCount.size); for( int i = 0; i < regionMemberCount.size; i++ ) { if( regionMemberCount.get(i) < minimumSize ) { segmentToPruneID.set(i, pruneGraph.size()); // depends on control dependency: [if], data = [none] Node n = pruneGraph.grow(); n.init(i); // depends on control dependency: [if], data = [none] segmentPruneFlag.set(i, true); // depends on control dependency: [if], data = [none] } else { segmentPruneFlag.set(i, false); // depends on control dependency: [if], data = [none] } } return pruneGraph.size() != 0; } }
public class class_name { public boolean calculateInsideBeamSingleThreaded(CcgChart chart, LogFunction log, long maxParseTimeMillis) { int chartSize = chart.size(); long currentTime = 0; long endTime = System.currentTimeMillis() + maxParseTimeMillis; for (int spanSize = 1; spanSize < chartSize; spanSize++) { for (int spanStart = 0; spanStart + spanSize < chartSize; spanStart++) { int spanEnd = spanStart + spanSize; calculateInsideBeam(spanStart, spanEnd, chart, log); if (maxParseTimeMillis >= 0) { currentTime = System.currentTimeMillis(); if (currentTime > endTime) { return false; } } if (chart.getTotalNumChartEntries() > chart.getMaxChartEntries()) { return false; } // System.out.println(spanStart + "." + spanEnd + " : " + // chart.getNumChartEntriesForSpan(spanStart, spanEnd)); } } return true; } }
public class class_name { public boolean calculateInsideBeamSingleThreaded(CcgChart chart, LogFunction log, long maxParseTimeMillis) { int chartSize = chart.size(); long currentTime = 0; long endTime = System.currentTimeMillis() + maxParseTimeMillis; for (int spanSize = 1; spanSize < chartSize; spanSize++) { for (int spanStart = 0; spanStart + spanSize < chartSize; spanStart++) { int spanEnd = spanStart + spanSize; calculateInsideBeam(spanStart, spanEnd, chart, log); // depends on control dependency: [for], data = [spanStart] if (maxParseTimeMillis >= 0) { currentTime = System.currentTimeMillis(); // depends on control dependency: [if], data = [none] if (currentTime > endTime) { return false; // depends on control dependency: [if], data = [none] } } if (chart.getTotalNumChartEntries() > chart.getMaxChartEntries()) { return false; // depends on control dependency: [if], data = [none] } // System.out.println(spanStart + "." + spanEnd + " : " + // chart.getNumChartEntriesForSpan(spanStart, spanEnd)); } } return true; } }
public class class_name { @Override public final Iterable<TrailerDocument> findAll(final String filename) { final Query searchQuery = new Query(Criteria.where("filename").is(filename)); final List<TrailerDocumentMongo> trailerDocumentsMongo = mongoTemplate.find(searchQuery, TrailerDocumentMongo.class); if (trailerDocumentsMongo == null) { return null; } final List<TrailerDocument> trailerDocuments = new ArrayList<>(); for (final TrailerDocument trailerDocument : trailerDocumentsMongo) { final Trailer trailer = (Trailer) toObjConverter.createGedObject( null, trailerDocument); trailerDocument.setGedObject(trailer); trailerDocuments.add(trailerDocument); } return trailerDocuments; } }
public class class_name { @Override public final Iterable<TrailerDocument> findAll(final String filename) { final Query searchQuery = new Query(Criteria.where("filename").is(filename)); final List<TrailerDocumentMongo> trailerDocumentsMongo = mongoTemplate.find(searchQuery, TrailerDocumentMongo.class); if (trailerDocumentsMongo == null) { return null; // depends on control dependency: [if], data = [none] } final List<TrailerDocument> trailerDocuments = new ArrayList<>(); for (final TrailerDocument trailerDocument : trailerDocumentsMongo) { final Trailer trailer = (Trailer) toObjConverter.createGedObject( null, trailerDocument); trailerDocument.setGedObject(trailer); // depends on control dependency: [for], data = [trailerDocument] trailerDocuments.add(trailerDocument); // depends on control dependency: [for], data = [trailerDocument] } return trailerDocuments; } }
public class class_name { public void marshall(Schedule schedule, ProtocolMarshaller protocolMarshaller) { if (schedule == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(schedule.getScheduleExpression(), SCHEDULEEXPRESSION_BINDING); protocolMarshaller.marshall(schedule.getState(), STATE_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(Schedule schedule, ProtocolMarshaller protocolMarshaller) { if (schedule == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(schedule.getScheduleExpression(), SCHEDULEEXPRESSION_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(schedule.getState(), STATE_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 void fixImageSourceUrls(Map<String, Object> fileContents, JBakeConfiguration configuration) { String htmlContent = fileContents.get(Attributes.BODY).toString(); boolean prependSiteHost = configuration.getImgPathPrependHost(); String siteHost = configuration.getSiteHost(); String uri = getDocumentUri(fileContents); Document document = Jsoup.parseBodyFragment(htmlContent); Elements allImgs = document.getElementsByTag("img"); for (Element img : allImgs) { transformImageSource(img, uri, siteHost, prependSiteHost); } //Use body().html() to prevent adding <body></body> from parsed fragment. fileContents.put(Attributes.BODY, document.body().html()); } }
public class class_name { public static void fixImageSourceUrls(Map<String, Object> fileContents, JBakeConfiguration configuration) { String htmlContent = fileContents.get(Attributes.BODY).toString(); boolean prependSiteHost = configuration.getImgPathPrependHost(); String siteHost = configuration.getSiteHost(); String uri = getDocumentUri(fileContents); Document document = Jsoup.parseBodyFragment(htmlContent); Elements allImgs = document.getElementsByTag("img"); for (Element img : allImgs) { transformImageSource(img, uri, siteHost, prependSiteHost); // depends on control dependency: [for], data = [img] } //Use body().html() to prevent adding <body></body> from parsed fragment. fileContents.put(Attributes.BODY, document.body().html()); } }
public class class_name { public Object getProperty(String property) { if (isValidExpandoProperty(property)) { if (property.equals(STATIC_QUALIFIER)) { return new ExpandoMetaProperty(property, true); } else if (property.equals(CONSTRUCTOR)) { return new ExpandoMetaConstructor(); } else { if (myMetaClass.hasProperty(this, property) == null) return new ExpandoMetaProperty(property); else return myMetaClass.getProperty(this, property); } } else { return myMetaClass.getProperty(this, property); } } }
public class class_name { public Object getProperty(String property) { if (isValidExpandoProperty(property)) { if (property.equals(STATIC_QUALIFIER)) { return new ExpandoMetaProperty(property, true); // depends on control dependency: [if], data = [none] } else if (property.equals(CONSTRUCTOR)) { return new ExpandoMetaConstructor(); // depends on control dependency: [if], data = [none] } else { if (myMetaClass.hasProperty(this, property) == null) return new ExpandoMetaProperty(property); else return myMetaClass.getProperty(this, property); } } else { return myMetaClass.getProperty(this, property); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static boolean isUpperTriangle(DMatrixRMaj A , int hessenberg , double tol ) { for( int i = hessenberg+1; i < A.numRows; i++ ) { int maxCol = Math.min(i-hessenberg, A.numCols); for( int j = 0; j < maxCol; j++ ) { if( !(Math.abs(A.unsafe_get(i,j)) <= tol) ) { return false; } } } return true; } }
public class class_name { public static boolean isUpperTriangle(DMatrixRMaj A , int hessenberg , double tol ) { for( int i = hessenberg+1; i < A.numRows; i++ ) { int maxCol = Math.min(i-hessenberg, A.numCols); for( int j = 0; j < maxCol; j++ ) { if( !(Math.abs(A.unsafe_get(i,j)) <= tol) ) { return false; // depends on control dependency: [if], data = [none] } } } return true; } }
public class class_name { private boolean convertRecord2Link(final int iIndex) { if (contentType == MULTIVALUE_CONTENT_TYPE.ALL_RIDS) // PRECONDITIONS return true; final Object o = super.get(iIndex); if (o != null) { if (o instanceof ORecord<?> && !((ORecord<?>) o).isDirty()) { marshalling = true; try { super.set(iIndex, ((ORecord<?>) o).getIdentity()); // CONVERTED return true; } catch (ORecordNotFoundException e) { // IGNORE THIS } finally { marshalling = false; } } else if (o instanceof ORID) // ALREADY CONVERTED return true; } return false; } }
public class class_name { private boolean convertRecord2Link(final int iIndex) { if (contentType == MULTIVALUE_CONTENT_TYPE.ALL_RIDS) // PRECONDITIONS return true; final Object o = super.get(iIndex); if (o != null) { if (o instanceof ORecord<?> && !((ORecord<?>) o).isDirty()) { marshalling = true; // depends on control dependency: [if], data = [none] try { super.set(iIndex, ((ORecord<?>) o).getIdentity()); // depends on control dependency: [try], data = [none] // CONVERTED return true; // depends on control dependency: [try], data = [none] } catch (ORecordNotFoundException e) { // IGNORE THIS } finally { // depends on control dependency: [catch], data = [none] marshalling = false; } } else if (o instanceof ORID) // ALREADY CONVERTED return true; } return false; } }
public class class_name { public static Class<?> getPrimitiveType(Class<?> wrapperType) { // does anyone know a better strategy than comparing names? if (Boolean.class.equals(wrapperType)) { return boolean.class; } else if (Float.class.equals(wrapperType)) { return float.class; } else if (Long.class.equals(wrapperType)) { return long.class; } else if (Integer.class.equals(wrapperType)) { return int.class; } else if (Short.class.equals(wrapperType)) { return short.class; } else if (Byte.class.equals(wrapperType)) { return byte.class; } else if (Double.class.equals(wrapperType)) { return double.class; } else if (Character.class.equals(wrapperType)) { return char.class; } else { // Log log = LogFactory.getLog(MethodUtils.class); if (log.isDebugEnabled()) { log.debug("Not a known primitive wrapper class: " + wrapperType); } return null; } } }
public class class_name { public static Class<?> getPrimitiveType(Class<?> wrapperType) { // does anyone know a better strategy than comparing names? if (Boolean.class.equals(wrapperType)) { return boolean.class; } else if (Float.class.equals(wrapperType)) { return float.class; } else if (Long.class.equals(wrapperType)) { return long.class; } else if (Integer.class.equals(wrapperType)) { return int.class; } else if (Short.class.equals(wrapperType)) { return short.class; } else if (Byte.class.equals(wrapperType)) { return byte.class; } else if (Double.class.equals(wrapperType)) { return double.class; } else if (Character.class.equals(wrapperType)) { return char.class; } else { // Log log = LogFactory.getLog(MethodUtils.class); if (log.isDebugEnabled()) { log.debug("Not a known primitive wrapper class: " + wrapperType); // depends on control dependency: [if], data = [none] } return null; } } }
public class class_name { @Inject public void setup(ViewConfigExtension extension) { for (Entry<String, Set<Annotation>> e : extension.getData().entrySet()) { for (Annotation i : e.getValue()) { addAnnotationData(e.getKey(), i); } } } }
public class class_name { @Inject public void setup(ViewConfigExtension extension) { for (Entry<String, Set<Annotation>> e : extension.getData().entrySet()) { for (Annotation i : e.getValue()) { addAnnotationData(e.getKey(), i); // depends on control dependency: [for], data = [i] } } } }
public class class_name { private void toggleSelection(TreePath path) { Object node = path.getLastPathComponent(); State state = getSelectionState(node); if (state == null) { return; } if (state == State.SELECTED) { setSelectionState(node, State.UNSELECTED); updateSelection(node); } else if (state == State.UNSELECTED) { setSelectionState(node, State.SELECTED); updateSelection(node); } else { setSelectionState(node, State.SELECTED); updateSelection(node); } } }
public class class_name { private void toggleSelection(TreePath path) { Object node = path.getLastPathComponent(); State state = getSelectionState(node); if (state == null) { return; // depends on control dependency: [if], data = [none] } if (state == State.SELECTED) { setSelectionState(node, State.UNSELECTED); // depends on control dependency: [if], data = [none] updateSelection(node); // depends on control dependency: [if], data = [none] } else if (state == State.UNSELECTED) { setSelectionState(node, State.SELECTED); // depends on control dependency: [if], data = [none] updateSelection(node); // depends on control dependency: [if], data = [none] } else { setSelectionState(node, State.SELECTED); // depends on control dependency: [if], data = [none] updateSelection(node); // depends on control dependency: [if], data = [none] } } }
public class class_name { public Observable<ServiceResponse<ClusterConfigurationsInner>> listWithServiceResponseAsync(String resourceGroupName, String clusterName) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (clusterName == null) { throw new IllegalArgumentException("Parameter clusterName is required and cannot be null."); } if (this.client.apiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } return service.list(this.client.subscriptionId(), resourceGroupName, clusterName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<ClusterConfigurationsInner>>>() { @Override public Observable<ServiceResponse<ClusterConfigurationsInner>> call(Response<ResponseBody> response) { try { ServiceResponse<ClusterConfigurationsInner> clientResponse = listDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } }
public class class_name { public Observable<ServiceResponse<ClusterConfigurationsInner>> listWithServiceResponseAsync(String resourceGroupName, String clusterName) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (clusterName == null) { throw new IllegalArgumentException("Parameter clusterName is required and cannot be null."); } if (this.client.apiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } return service.list(this.client.subscriptionId(), resourceGroupName, clusterName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<ClusterConfigurationsInner>>>() { @Override public Observable<ServiceResponse<ClusterConfigurationsInner>> call(Response<ResponseBody> response) { try { ServiceResponse<ClusterConfigurationsInner> clientResponse = listDelegate(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 <T> T getSubAttr(String attrName, String dPath, Class<T> clazz) { Lock lock = lockForRead(); try { return JacksonUtils.getValue(getAttribute(attrName), dPath, clazz); } finally { lock.unlock(); } } }
public class class_name { public <T> T getSubAttr(String attrName, String dPath, Class<T> clazz) { Lock lock = lockForRead(); try { return JacksonUtils.getValue(getAttribute(attrName), dPath, clazz); // depends on control dependency: [try], data = [none] } finally { lock.unlock(); } } }
public class class_name { @Override protected void initialize() throws Exception { super.initialize(); // check if the driver is resettable if (this.driver instanceof ResettablePactDriver) { final ResettablePactDriver<?, ?> resDriver = (ResettablePactDriver<?, ?>) this.driver; // make sure that the according inputs are not reseted for (int i = 0; i < resDriver.getNumberOfInputs(); i++) { if (resDriver.isInputResettable(i)) { excludeFromReset(i); } } } TaskConfig config = getLastTasksConfig(); isWorksetIteration = config.getIsWorksetIteration(); isWorksetUpdate = config.getIsWorksetUpdate(); isSolutionSetUpdate = config.getIsSolutionSetUpdate(); if (isWorksetUpdate) { worksetBackChannel = BlockingBackChannelBroker.instance().getAndRemove(brokerKey()); if (isWorksetIteration) { worksetAggregator = getIterationAggregators().getAggregator(WorksetEmptyConvergenceCriterion.AGGREGATOR_NAME); if (worksetAggregator == null) { throw new RuntimeException("Missing workset elements count aggregator."); } } } } }
public class class_name { @Override protected void initialize() throws Exception { super.initialize(); // check if the driver is resettable if (this.driver instanceof ResettablePactDriver) { final ResettablePactDriver<?, ?> resDriver = (ResettablePactDriver<?, ?>) this.driver; // make sure that the according inputs are not reseted for (int i = 0; i < resDriver.getNumberOfInputs(); i++) { if (resDriver.isInputResettable(i)) { excludeFromReset(i); // depends on control dependency: [if], data = [none] } } } TaskConfig config = getLastTasksConfig(); isWorksetIteration = config.getIsWorksetIteration(); isWorksetUpdate = config.getIsWorksetUpdate(); isSolutionSetUpdate = config.getIsSolutionSetUpdate(); if (isWorksetUpdate) { worksetBackChannel = BlockingBackChannelBroker.instance().getAndRemove(brokerKey()); if (isWorksetIteration) { worksetAggregator = getIterationAggregators().getAggregator(WorksetEmptyConvergenceCriterion.AGGREGATOR_NAME); // depends on control dependency: [if], data = [none] if (worksetAggregator == null) { throw new RuntimeException("Missing workset elements count aggregator."); } } } } }
public class class_name { public static void main(final String arg[]) { final int l = Integer.parseInt(arg[0]); final int n = Integer.parseInt(arg[1]); final LongArrayBitVector bv = LongArrayBitVector.ofLength(l); final ProgressLogger pl = new ProgressLogger(); long t = 0; final long h[] = new long[3]; for (int k = 4; k-- != 0;) { pl.start("Timing MurmurHash..."); for (int i = n; i-- != 0;) t += murmur(bv, 0); if (t == 0) System.err.println(t); pl.done(n); pl.start("Timing MurmurHash3..."); for (int i = n; i-- != 0;) { murmur3(bv, 0, h); t += h[0]; } if (t == 0) System.err.println(t); pl.done(n); pl.start("Timing Jenkins's hash..."); for (int i = n; i-- != 0;) { jenkins(bv, 0, h); t += h[0]; } if (t == 0) System.err.println(t); pl.done(n); pl.start("Timing SpookyHash4..."); for (int i = n; i-- != 0;) { spooky4(bv, 0, h); t += h[0]; } if (t == 0) System.err.println(t); pl.done(n); pl.start("Timing SpookyHash12..."); for (int i = n; i-- != 0;) { spooky12(bv, 0, h); t += h[0]; } if (t == 0) System.err.println(t); pl.done(n); final long[] preprocessMurmur = preprocessMurmur(bv, 0); pl.start("Timing preprocessed MurmurHash..."); for (int i = n; i-- != 0;) t += murmur(bv, l - 1, preprocessMurmur); if (t == 0) System.err.println(t); pl.done(n); final long[][] preprocessMurmur3 = preprocessMurmur3(bv, 0); final long[] hh1 = preprocessMurmur3[0]; final long[] hh2 = preprocessMurmur3[1]; final long[] cc1 = preprocessMurmur3[2]; final long[] cc2 = preprocessMurmur3[3]; pl.start("Timing preprocessed MurmurHash3..."); for (int i = n / l; i-- != 0;) for (int j = l; j-- != 0;) t += murmur3(bv, j, hh1, hh2, cc1, cc2); if (t == 0) System.err.println(t); pl.done(n); final long[][] preprocessJenkins = preprocessJenkins(bv, 0); final long[] aa = preprocessJenkins[0]; final long[] bb = preprocessJenkins[1]; final long[] cc = preprocessJenkins[2]; pl.start("Timing preprocessed Jenkins's hash..."); for (int i = n / l; i-- != 0;) for (int j = l; j-- != 0;) t += jenkins(bv, j, aa, bb, cc); if (t == 0) System.err.println(t); pl.done(n); final long[] preprocessSpooky4 = preprocessSpooky4(bv, 0); pl.start("Timing preprocessed SpookyHash..."); for (int i = n / l; i-- != 0;) for (int j = l; j-- != 0;) t += spooky4(bv, j, 0, preprocessSpooky4); if (t == 0) System.err.println(t); pl.done(n); } } }
public class class_name { public static void main(final String arg[]) { final int l = Integer.parseInt(arg[0]); final int n = Integer.parseInt(arg[1]); final LongArrayBitVector bv = LongArrayBitVector.ofLength(l); final ProgressLogger pl = new ProgressLogger(); long t = 0; final long h[] = new long[3]; for (int k = 4; k-- != 0;) { pl.start("Timing MurmurHash..."); // depends on control dependency: [for], data = [none] for (int i = n; i-- != 0;) t += murmur(bv, 0); if (t == 0) System.err.println(t); pl.done(n); // depends on control dependency: [for], data = [none] pl.start("Timing MurmurHash3..."); // depends on control dependency: [for], data = [none] for (int i = n; i-- != 0;) { murmur3(bv, 0, h); // depends on control dependency: [for], data = [none] t += h[0]; // depends on control dependency: [for], data = [none] } if (t == 0) System.err.println(t); pl.done(n); // depends on control dependency: [for], data = [none] pl.start("Timing Jenkins's hash..."); for (int i = n; i-- != 0;) { jenkins(bv, 0, h); t += h[0]; } if (t == 0) System.err.println(t); pl.done(n); pl.start("Timing SpookyHash4..."); for (int i = n; i-- != 0;) { spooky4(bv, 0, h); t += h[0]; } if (t == 0) System.err.println(t); pl.done(n); pl.start("Timing SpookyHash12..."); for (int i = n; i-- != 0;) { spooky12(bv, 0, h); t += h[0]; } if (t == 0) System.err.println(t); pl.done(n); final long[] preprocessMurmur = preprocessMurmur(bv, 0); pl.start("Timing preprocessed MurmurHash..."); for (int i = n; i-- != 0;) t += murmur(bv, l - 1, preprocessMurmur); if (t == 0) System.err.println(t); pl.done(n); final long[][] preprocessMurmur3 = preprocessMurmur3(bv, 0); final long[] hh1 = preprocessMurmur3[0]; final long[] hh2 = preprocessMurmur3[1]; final long[] cc1 = preprocessMurmur3[2]; final long[] cc2 = preprocessMurmur3[3]; pl.start("Timing preprocessed MurmurHash3..."); for (int i = n / l; i-- != 0;) for (int j = l; j-- != 0;) t += murmur3(bv, j, hh1, hh2, cc1, cc2); if (t == 0) System.err.println(t); pl.done(n); final long[][] preprocessJenkins = preprocessJenkins(bv, 0); final long[] aa = preprocessJenkins[0]; final long[] bb = preprocessJenkins[1]; final long[] cc = preprocessJenkins[2]; pl.start("Timing preprocessed Jenkins's hash..."); // depends on control dependency: [for], data = [none] for (int i = n / l; i-- != 0;) for (int j = l; j-- != 0;) t += jenkins(bv, j, aa, bb, cc); if (t == 0) System.err.println(t); pl.done(n); // depends on control dependency: [for], data = [none] final long[] preprocessSpooky4 = preprocessSpooky4(bv, 0); pl.start("Timing preprocessed SpookyHash..."); // depends on control dependency: [for], data = [none] for (int i = n / l; i-- != 0;) for (int j = l; j-- != 0;) t += spooky4(bv, j, 0, preprocessSpooky4); if (t == 0) System.err.println(t); pl.done(n); // depends on control dependency: [for], data = [none] } } }
public class class_name { @Deprecated public ClientVpnEndpoint withAssociatedTargetNetworks(AssociatedTargetNetwork... associatedTargetNetworks) { if (this.associatedTargetNetworks == null) { setAssociatedTargetNetworks(new com.amazonaws.internal.SdkInternalList<AssociatedTargetNetwork>(associatedTargetNetworks.length)); } for (AssociatedTargetNetwork ele : associatedTargetNetworks) { this.associatedTargetNetworks.add(ele); } return this; } }
public class class_name { @Deprecated public ClientVpnEndpoint withAssociatedTargetNetworks(AssociatedTargetNetwork... associatedTargetNetworks) { if (this.associatedTargetNetworks == null) { setAssociatedTargetNetworks(new com.amazonaws.internal.SdkInternalList<AssociatedTargetNetwork>(associatedTargetNetworks.length)); // depends on control dependency: [if], data = [none] } for (AssociatedTargetNetwork ele : associatedTargetNetworks) { this.associatedTargetNetworks.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { public int read() { while (rleRepeat < 1) { if (bwtBytesDecoded == bwtBlockLength) { return -1; } int nextByte = decodeNextBWTByte(); if (nextByte != rleLastDecodedByte) { // New byte, restart accumulation rleLastDecodedByte = nextByte; rleRepeat = 1; rleAccumulator = 1; crc.updateCRC(nextByte); } else { if (++rleAccumulator == 4) { // Accumulation complete, start repetition int rleRepeat = decodeNextBWTByte() + 1; this.rleRepeat = rleRepeat; rleAccumulator = 0; crc.updateCRC(nextByte, rleRepeat); } else { rleRepeat = 1; crc.updateCRC(nextByte); } } } rleRepeat--; return rleLastDecodedByte; } }
public class class_name { public int read() { while (rleRepeat < 1) { if (bwtBytesDecoded == bwtBlockLength) { return -1; // depends on control dependency: [if], data = [none] } int nextByte = decodeNextBWTByte(); if (nextByte != rleLastDecodedByte) { // New byte, restart accumulation rleLastDecodedByte = nextByte; // depends on control dependency: [if], data = [none] rleRepeat = 1; // depends on control dependency: [if], data = [none] rleAccumulator = 1; // depends on control dependency: [if], data = [none] crc.updateCRC(nextByte); // depends on control dependency: [if], data = [(nextByte] } else { if (++rleAccumulator == 4) { // Accumulation complete, start repetition int rleRepeat = decodeNextBWTByte() + 1; this.rleRepeat = rleRepeat; // depends on control dependency: [if], data = [none] rleAccumulator = 0; // depends on control dependency: [if], data = [none] crc.updateCRC(nextByte, rleRepeat); // depends on control dependency: [if], data = [none] } else { rleRepeat = 1; // depends on control dependency: [if], data = [none] crc.updateCRC(nextByte); // depends on control dependency: [if], data = [none] } } } rleRepeat--; return rleLastDecodedByte; } }
public class class_name { private String replaceChoose(SqlObject sqlObj, Map<String, Object> parameters) { String query = null; if (sqlObj != null) { query = sqlObj.getValue(); if (StringUtils.isNotEmpty(query)) { try { // 执行子句构建 子句格式为{statement} List<Choose> chooseList = sqlObj.getChoose(); if (chooseList != null && parameters != null) { for (Choose choose : chooseList) { String condition = choose.getWhen(); if (parameters.containsKey(condition)) { String statement = choose.getBlock(); // 如果不存在statement参数,则使用when参数代替 if (StringUtils.isEmpty(statement)) { statement = condition; } statement = "{" + statement + "}"; if (StringUtils.contains(query, statement)) { query = query.replace(statement, choose.getValue()); } else { query = query + " " + choose.getValue(); } } } } // 清理没有被替换的子句 String regexs = "[{](\\w*)[}]"; // 子句替换模式 Pattern regex = Pattern.compile(regexs); Matcher regexMatcher = regex.matcher(query); while (regexMatcher.find()) { query = query.replace(regexMatcher.group(0), ""); } } catch (Exception e) { } } } return query; } }
public class class_name { private String replaceChoose(SqlObject sqlObj, Map<String, Object> parameters) { String query = null; if (sqlObj != null) { query = sqlObj.getValue(); // depends on control dependency: [if], data = [none] if (StringUtils.isNotEmpty(query)) { try { // 执行子句构建 子句格式为{statement} List<Choose> chooseList = sqlObj.getChoose(); if (chooseList != null && parameters != null) { for (Choose choose : chooseList) { String condition = choose.getWhen(); if (parameters.containsKey(condition)) { String statement = choose.getBlock(); // 如果不存在statement参数,则使用when参数代替 if (StringUtils.isEmpty(statement)) { statement = condition; // depends on control dependency: [if], data = [none] } statement = "{" + statement + "}"; // depends on control dependency: [if], data = [none] if (StringUtils.contains(query, statement)) { query = query.replace(statement, choose.getValue()); // depends on control dependency: [if], data = [none] } else { query = query + " " + choose.getValue(); // depends on control dependency: [if], data = [none] } } } } // 清理没有被替换的子句 String regexs = "[{](\\w*)[}]"; // 子句替换模式 Pattern regex = Pattern.compile(regexs); Matcher regexMatcher = regex.matcher(query); while (regexMatcher.find()) { query = query.replace(regexMatcher.group(0), ""); // depends on control dependency: [while], data = [none] } } catch (Exception e) { } // depends on control dependency: [catch], data = [none] } } return query; } }
public class class_name { public boolean set(final Object value) { AccessibilityChanger changer = new AccessibilityChanger(); Method writeMethod = null; try { writeMethod = target.getClass().getMethod(setterName(field.getName()), field.getType()); changer.enableAccess(writeMethod); writeMethod.invoke(target, value); return true; } catch (InvocationTargetException e) { throw new RuntimeException("Setter '" + writeMethod + "' of '" + target + "' with value '" + value + "' threw exception : '" + e.getTargetException() + "'", e); } catch (IllegalAccessException e) { throw new RuntimeException("Access not authorized on field '" + field + "' of object '" + target + "' with value: '" + value + "'", e); } catch (NoSuchMethodException e) { reportNoSetterFound(); } finally { if(writeMethod != null) { changer.safelyDisableAccess(writeMethod); } } reportNoSetterFound(); return false; } }
public class class_name { public boolean set(final Object value) { AccessibilityChanger changer = new AccessibilityChanger(); Method writeMethod = null; try { writeMethod = target.getClass().getMethod(setterName(field.getName()), field.getType()); // depends on control dependency: [try], data = [none] changer.enableAccess(writeMethod); // depends on control dependency: [try], data = [none] writeMethod.invoke(target, value); // depends on control dependency: [try], data = [none] return true; // depends on control dependency: [try], data = [none] } catch (InvocationTargetException e) { throw new RuntimeException("Setter '" + writeMethod + "' of '" + target + "' with value '" + value + "' threw exception : '" + e.getTargetException() + "'", e); } catch (IllegalAccessException e) { // depends on control dependency: [catch], data = [none] throw new RuntimeException("Access not authorized on field '" + field + "' of object '" + target + "' with value: '" + value + "'", e); } catch (NoSuchMethodException e) { // depends on control dependency: [catch], data = [none] reportNoSetterFound(); } finally { // depends on control dependency: [catch], data = [none] if(writeMethod != null) { changer.safelyDisableAccess(writeMethod); // depends on control dependency: [if], data = [(writeMethod] } } reportNoSetterFound(); return false; } }
public class class_name { @Override public Dataset convert(Object s) { if (s instanceof Dataset) { return (Dataset) s; } else { throw new VectorPrintRuntimeException(String.format( "override this method to convert %s (value: %s) to a Dataset", (s != null) ? s.getClass().getName() : null, String.valueOf(s) )); } } }
public class class_name { @Override public Dataset convert(Object s) { if (s instanceof Dataset) { return (Dataset) s; // depends on control dependency: [if], data = [none] } else { throw new VectorPrintRuntimeException(String.format( "override this method to convert %s (value: %s) to a Dataset", (s != null) ? s.getClass().getName() : null, String.valueOf(s) )); } } }
public class class_name { private void fillDetailField(CmsListItem item, String detailId) { StringBuffer html = new StringBuffer(); // search for the corresponding A_CmsSearchIndex: String idxFieldName = (String)item.get(LIST_COLUMN_NAME); List<CmsSearchField> fields = OpenCms.getSearchManager().getFieldConfiguration( m_paramFieldconfiguration).getFields(); Iterator<CmsSearchField> itFields = fields.iterator(); CmsLuceneField idxField = null; while (itFields.hasNext()) { CmsLuceneField curField = (CmsLuceneField)itFields.next(); if (curField.getName().equals(idxFieldName)) { idxField = curField; } } if (idxField != null) { html.append("<ul>\n"); Iterator<I_CmsSearchFieldMapping> itMappings = idxField.getMappings().iterator(); while (itMappings.hasNext()) { CmsSearchFieldMapping mapping = (CmsSearchFieldMapping)itMappings.next(); html.append(" <li>\n").append(" "); html.append(mapping.getType().toString()); if (CmsStringUtil.isNotEmpty(mapping.getParam())) { html.append("=").append(mapping.getParam()).append("\n"); } html.append(" </li>"); } html.append("</ul>\n"); } item.set(detailId, html.toString()); } }
public class class_name { private void fillDetailField(CmsListItem item, String detailId) { StringBuffer html = new StringBuffer(); // search for the corresponding A_CmsSearchIndex: String idxFieldName = (String)item.get(LIST_COLUMN_NAME); List<CmsSearchField> fields = OpenCms.getSearchManager().getFieldConfiguration( m_paramFieldconfiguration).getFields(); Iterator<CmsSearchField> itFields = fields.iterator(); CmsLuceneField idxField = null; while (itFields.hasNext()) { CmsLuceneField curField = (CmsLuceneField)itFields.next(); if (curField.getName().equals(idxFieldName)) { idxField = curField; // depends on control dependency: [if], data = [none] } } if (idxField != null) { html.append("<ul>\n"); // depends on control dependency: [if], data = [none] Iterator<I_CmsSearchFieldMapping> itMappings = idxField.getMappings().iterator(); while (itMappings.hasNext()) { CmsSearchFieldMapping mapping = (CmsSearchFieldMapping)itMappings.next(); html.append(" <li>\n").append(" "); // depends on control dependency: [while], data = [none] html.append(mapping.getType().toString()); // depends on control dependency: [while], data = [none] if (CmsStringUtil.isNotEmpty(mapping.getParam())) { html.append("=").append(mapping.getParam()).append("\n"); // depends on control dependency: [if], data = [none] } html.append(" </li>"); // depends on control dependency: [while], data = [none] } html.append("</ul>\n"); // depends on control dependency: [if], data = [none] } item.set(detailId, html.toString()); } }
public class class_name { @Override public Response toResponse(Throwable exception) { int status = parseHttpStatus(exception); ErrorMessage message = new ErrorMessage(); if (exception instanceof MappableException && exception.getCause() != null) { exception = exception.getCause(); } message.setCode(Hashing.murmur3_32().hashUnencodedChars(exception.getClass().getName()).toString()); message.setStatus(status); message.setThrowable(exception); message.setMessage(parseMessage(exception, status)); message.setDescription(parseDescription(exception, status)); message.setErrors(parseErrors(exception, status)); MediaType type = ExceptionMapperUtils.getResponseType(status); if (status == 500) { String uri = ""; if (Requests.getRequest() != null) { uri = " > " + Requests.getUriInfo().getRequestUri(); } logger.error(message.getMessage() + uri, exception); } else if (status == 404) { Requests.setProperty(BEFORE_EXCEPTION_KEY, exception); } return Response.status(status) .type(type) .entity(message).build(); } }
public class class_name { @Override public Response toResponse(Throwable exception) { int status = parseHttpStatus(exception); ErrorMessage message = new ErrorMessage(); if (exception instanceof MappableException && exception.getCause() != null) { exception = exception.getCause(); // depends on control dependency: [if], data = [none] } message.setCode(Hashing.murmur3_32().hashUnencodedChars(exception.getClass().getName()).toString()); message.setStatus(status); message.setThrowable(exception); message.setMessage(parseMessage(exception, status)); message.setDescription(parseDescription(exception, status)); message.setErrors(parseErrors(exception, status)); MediaType type = ExceptionMapperUtils.getResponseType(status); if (status == 500) { String uri = ""; if (Requests.getRequest() != null) { uri = " > " + Requests.getUriInfo().getRequestUri(); // depends on control dependency: [if], data = [none] } logger.error(message.getMessage() + uri, exception); // depends on control dependency: [if], data = [none] } else if (status == 404) { Requests.setProperty(BEFORE_EXCEPTION_KEY, exception); // depends on control dependency: [if], data = [none] } return Response.status(status) .type(type) .entity(message).build(); } }
public class class_name { static String depr(String since, boolean forRemoval) { String d = "@Deprecated"; if (since.isEmpty() && !forRemoval) { return d; } StringBuilder sb = new StringBuilder(d).append('('); if (!since.isEmpty()) { sb.append("since=\"") .append(since.replace("\"", "\\\"")) .append('"'); } if (forRemoval) { if (!since.isEmpty()) { sb.append(", "); } sb.append("forRemoval=true"); } sb.append(')'); return sb.toString(); } }
public class class_name { static String depr(String since, boolean forRemoval) { String d = "@Deprecated"; if (since.isEmpty() && !forRemoval) { return d; // depends on control dependency: [if], data = [none] } StringBuilder sb = new StringBuilder(d).append('('); if (!since.isEmpty()) { sb.append("since=\"") .append(since.replace("\"", "\\\"")) .append('"'); // depends on control dependency: [if], data = [none] } if (forRemoval) { if (!since.isEmpty()) { sb.append(", "); // depends on control dependency: [if], data = [none] } sb.append("forRemoval=true"); // depends on control dependency: [if], data = [none] } sb.append(')'); return sb.toString(); } }
public class class_name { public void purge() { long startTime=System.currentTimeMillis(); long objectPurged=0; Set<Map.Entry<String, T>> set=map.entrySet(); long time=System.currentTimeMillis()-minUnactiveTime; for (Iterator<Map.Entry<String, T>> i=set.iterator();i.hasNext();){ Map.Entry<String, T> entry=i.next(); T object=entry.getValue(); // Check if the object has to be removed from the cache if (object.getLastAccess()<time && object.canPurge() ){ i.remove(); objectPurged++; } } if (log.isInfoEnabled()){ if (objectPurged==0){ if (log.isDebugEnabled()){ log.info("Cache:"+name+ " Purged:"+objectPurged+ " Time:"+(System.currentTimeMillis()-startTime)); } } else { log.info("Cache:"+name+ " Purged:"+objectPurged+ " Time:"+(System.currentTimeMillis()-startTime)); } } } }
public class class_name { public void purge() { long startTime=System.currentTimeMillis(); long objectPurged=0; Set<Map.Entry<String, T>> set=map.entrySet(); long time=System.currentTimeMillis()-minUnactiveTime; for (Iterator<Map.Entry<String, T>> i=set.iterator();i.hasNext();){ Map.Entry<String, T> entry=i.next(); T object=entry.getValue(); // Check if the object has to be removed from the cache if (object.getLastAccess()<time && object.canPurge() ){ i.remove(); // depends on control dependency: [if], data = [none] objectPurged++; // depends on control dependency: [if], data = [none] } } if (log.isInfoEnabled()){ if (objectPurged==0){ if (log.isDebugEnabled()){ log.info("Cache:"+name+ " Purged:"+objectPurged+ " Time:"+(System.currentTimeMillis()-startTime)); // depends on control dependency: [if], data = [none] } } else { log.info("Cache:"+name+ " Purged:"+objectPurged+ " Time:"+(System.currentTimeMillis()-startTime)); // depends on control dependency: [if], data = [none] } } } }
public class class_name { private static GrammaticalRelation determinePrepRelation(Map<TreeGraphNode, ? extends Set<TypedDependency>> map, List<TreeGraphNode> partmod, TypedDependency pc, TypedDependency topPrep, boolean pobj) { // handling the case of an "agent": // the governor of a "by" preposition must have an "auxpass" dependency // or be the dependent of a "partmod" relation // if it is the case, the "agent" variable becomes true boolean agent = false; String preposition = pc.dep().value().toLowerCase(); if (preposition.equals("by")) { // look if we have an auxpass Set<TypedDependency> aux_pass_poss = map.get(topPrep.gov()); if (aux_pass_poss != null) { for (TypedDependency td_pass : aux_pass_poss) { if (td_pass.reln() == AUX_PASSIVE_MODIFIER) { agent = true; } } } // look if we have a partmod if (!partmod.isEmpty() && partmod.contains(topPrep.gov())) { agent = true; } } GrammaticalRelation reln; if (agent) { reln = AGENT; } else if (pc.reln() == RELATIVE) { reln = RELATIVE; } else { // for prepositions, use the preposition // for pobj: we collapse into "prep"; for pcomp: we collapse into "prepc" if (pobj) { reln = EnglishGrammaticalRelations.getPrep(preposition); } else { reln = EnglishGrammaticalRelations.getPrepC(preposition); } } return reln; } }
public class class_name { private static GrammaticalRelation determinePrepRelation(Map<TreeGraphNode, ? extends Set<TypedDependency>> map, List<TreeGraphNode> partmod, TypedDependency pc, TypedDependency topPrep, boolean pobj) { // handling the case of an "agent": // the governor of a "by" preposition must have an "auxpass" dependency // or be the dependent of a "partmod" relation // if it is the case, the "agent" variable becomes true boolean agent = false; String preposition = pc.dep().value().toLowerCase(); if (preposition.equals("by")) { // look if we have an auxpass Set<TypedDependency> aux_pass_poss = map.get(topPrep.gov()); if (aux_pass_poss != null) { for (TypedDependency td_pass : aux_pass_poss) { if (td_pass.reln() == AUX_PASSIVE_MODIFIER) { agent = true; // depends on control dependency: [if], data = [none] } } } // look if we have a partmod if (!partmod.isEmpty() && partmod.contains(topPrep.gov())) { agent = true; // depends on control dependency: [if], data = [none] } } GrammaticalRelation reln; if (agent) { reln = AGENT; // depends on control dependency: [if], data = [none] } else if (pc.reln() == RELATIVE) { reln = RELATIVE; // depends on control dependency: [if], data = [none] } else { // for prepositions, use the preposition // for pobj: we collapse into "prep"; for pcomp: we collapse into "prepc" if (pobj) { reln = EnglishGrammaticalRelations.getPrep(preposition); // depends on control dependency: [if], data = [none] } else { reln = EnglishGrammaticalRelations.getPrepC(preposition); // depends on control dependency: [if], data = [none] } } return reln; } }
public class class_name { private SemanticStatus argumentsMatch(final String arg1, final String arg2) { if (arg1.startsWith(ENCODE_PREFIX)) { if (arg2.startsWith(FUNC_PREFIX)) { return INVALID_RETURN_TYPE_ARGUMENT; } if (!arg2.startsWith(ENCODE_PREFIX)) { return INVALID_ENCODING_ARGUMENT; } final String[] tokens1 = PARAMS_REGEX.split(arg1); if (tokens1.length != 2) { return INVALID_ENCODING_ARGUMENT; } final String[] tokens2 = PARAMS_REGEX.split(arg2); if (tokens2.length != 2) { return INVALID_ENCODING_ARGUMENT; } // If either token is the wildcard, any encoding is valid. if (isWildcard(tokens1[1]) || isWildcard(tokens2[1])) { return VALID; } final ValueEncoding ve1 = getValueEncoding(tokens1[1]); ValueEncoding ve2 = getValueEncoding(tokens2[1]); if (ve2 != null) { if (ve1.isAssignableFrom(ve2)) { return VALID; } return INVALID_ENCODING_ARGUMENT; } // Fallback to verification based on all character discriminators for (final Character c : tokens2[1].toCharArray()) { ve2 = getValueEncoding(c); if (ve1.isAssignableFrom(ve2)) { return VALID; } } return INVALID_ENCODING_ARGUMENT; } if (arg1.startsWith(FUNC_PREFIX)) { if (arg2.startsWith(ENCODE_PREFIX)) return INVALID_RETURN_TYPE_ARGUMENT; if (!arg2.startsWith(FUNC_PREFIX)) return INVALID_RETURN_TYPE_ARGUMENT; final String[] tokens1 = PARAMS_REGEX.split(arg1); if (tokens1.length != 2) return INVALID_RETURN_TYPE_ARGUMENT; final String[] tokens2 = PARAMS_REGEX.split(arg2); if (tokens2.length != 2) return INVALID_RETURN_TYPE_ARGUMENT; final ReturnType re1 = ReturnType.getReturnType(tokens1[1]); final ReturnType re2 = ReturnType.getReturnType(tokens2[1]); if (re1 != re2 && !re1.isAssignableFrom(re2)) return INVALID_RETURN_TYPE_ARGUMENT; return VALID; } return null; } }
public class class_name { private SemanticStatus argumentsMatch(final String arg1, final String arg2) { if (arg1.startsWith(ENCODE_PREFIX)) { if (arg2.startsWith(FUNC_PREFIX)) { return INVALID_RETURN_TYPE_ARGUMENT; // depends on control dependency: [if], data = [none] } if (!arg2.startsWith(ENCODE_PREFIX)) { return INVALID_ENCODING_ARGUMENT; // depends on control dependency: [if], data = [none] } final String[] tokens1 = PARAMS_REGEX.split(arg1); if (tokens1.length != 2) { return INVALID_ENCODING_ARGUMENT; // depends on control dependency: [if], data = [none] } final String[] tokens2 = PARAMS_REGEX.split(arg2); if (tokens2.length != 2) { return INVALID_ENCODING_ARGUMENT; // depends on control dependency: [if], data = [none] } // If either token is the wildcard, any encoding is valid. if (isWildcard(tokens1[1]) || isWildcard(tokens2[1])) { return VALID; // depends on control dependency: [if], data = [none] } final ValueEncoding ve1 = getValueEncoding(tokens1[1]); ValueEncoding ve2 = getValueEncoding(tokens2[1]); if (ve2 != null) { if (ve1.isAssignableFrom(ve2)) { return VALID; // depends on control dependency: [if], data = [none] } return INVALID_ENCODING_ARGUMENT; // depends on control dependency: [if], data = [none] } // Fallback to verification based on all character discriminators for (final Character c : tokens2[1].toCharArray()) { ve2 = getValueEncoding(c); // depends on control dependency: [for], data = [c] if (ve1.isAssignableFrom(ve2)) { return VALID; // depends on control dependency: [if], data = [none] } } return INVALID_ENCODING_ARGUMENT; // depends on control dependency: [if], data = [none] } if (arg1.startsWith(FUNC_PREFIX)) { if (arg2.startsWith(ENCODE_PREFIX)) return INVALID_RETURN_TYPE_ARGUMENT; if (!arg2.startsWith(FUNC_PREFIX)) return INVALID_RETURN_TYPE_ARGUMENT; final String[] tokens1 = PARAMS_REGEX.split(arg1); if (tokens1.length != 2) return INVALID_RETURN_TYPE_ARGUMENT; final String[] tokens2 = PARAMS_REGEX.split(arg2); if (tokens2.length != 2) return INVALID_RETURN_TYPE_ARGUMENT; final ReturnType re1 = ReturnType.getReturnType(tokens1[1]); final ReturnType re2 = ReturnType.getReturnType(tokens2[1]); if (re1 != re2 && !re1.isAssignableFrom(re2)) return INVALID_RETURN_TYPE_ARGUMENT; return VALID; // depends on control dependency: [if], data = [none] } return null; } }
public class class_name { public void render() { if ((engine.usePoints() && (usePoints == INHERIT_POINTS)) || (usePoints == USE_POINTS)) { TextureImpl.bindNone(); GL.glEnable(SGL.GL_POINT_SMOOTH); GL.glPointSize(size / 2); color.bind(); GL.glBegin(SGL.GL_POINTS); GL.glVertex2f(x, y); GL.glEnd(); } else if (oriented || scaleY != 1.0f) { GL.glPushMatrix(); GL.glTranslatef(x, y, 0f); if (oriented) { float angle = (float) (Math.atan2(y, x) * 180 / Math.PI); GL.glRotatef(angle, 0f, 0f, 1.0f); } // scale GL.glScalef(1.0f, scaleY, 1.0f); image.draw((int) (-(size / 2)), (int) (-(size / 2)), (int) size, (int) size, color); GL.glPopMatrix(); } else { color.bind(); image.drawEmbedded((int) (x - (size / 2)), (int) (y - (size / 2)), (int) size, (int) size); } } }
public class class_name { public void render() { if ((engine.usePoints() && (usePoints == INHERIT_POINTS)) || (usePoints == USE_POINTS)) { TextureImpl.bindNone(); // depends on control dependency: [if], data = [none] GL.glEnable(SGL.GL_POINT_SMOOTH); // depends on control dependency: [if], data = [none] GL.glPointSize(size / 2); // depends on control dependency: [if], data = [none] color.bind(); // depends on control dependency: [if], data = [none] GL.glBegin(SGL.GL_POINTS); // depends on control dependency: [if], data = [none] GL.glVertex2f(x, y); // depends on control dependency: [if], data = [none] GL.glEnd(); // depends on control dependency: [if], data = [none] } else if (oriented || scaleY != 1.0f) { GL.glPushMatrix(); // depends on control dependency: [if], data = [none] GL.glTranslatef(x, y, 0f); // depends on control dependency: [if], data = [none] if (oriented) { float angle = (float) (Math.atan2(y, x) * 180 / Math.PI); GL.glRotatef(angle, 0f, 0f, 1.0f); // depends on control dependency: [if], data = [none] } // scale GL.glScalef(1.0f, scaleY, 1.0f); // depends on control dependency: [if], data = [1.0f)] image.draw((int) (-(size / 2)), (int) (-(size / 2)), (int) size, (int) size, color); // depends on control dependency: [if], data = [none] GL.glPopMatrix(); // depends on control dependency: [if], data = [none] } else { color.bind(); // depends on control dependency: [if], data = [none] image.drawEmbedded((int) (x - (size / 2)), (int) (y - (size / 2)), (int) size, (int) size); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static Set<String> getAvailableLocaleSuffixes() { Set<String> availableLocaleSuffixes = new HashSet<String>(); Locale[] availableLocales = Locale.getAvailableLocales(); for (int i = 0; i < availableLocales.length; i++) { Locale locale = availableLocales[i]; StringBuffer sb = new StringBuffer(); if (locale != null) { String language = locale.getLanguage(); String country = locale.getCountry(); String variant = locale.getVariant(); if (variant != "") { sb.append(language).append('_').append(country).append('_') .append(variant); } else if (country != "") { sb.append(language).append('_').append(country); } else { sb.append(language); } } availableLocaleSuffixes.add(sb.toString()); } return availableLocaleSuffixes; } }
public class class_name { public static Set<String> getAvailableLocaleSuffixes() { Set<String> availableLocaleSuffixes = new HashSet<String>(); Locale[] availableLocales = Locale.getAvailableLocales(); for (int i = 0; i < availableLocales.length; i++) { Locale locale = availableLocales[i]; StringBuffer sb = new StringBuffer(); if (locale != null) { String language = locale.getLanguage(); String country = locale.getCountry(); String variant = locale.getVariant(); if (variant != "") { sb.append(language).append('_').append(country).append('_') .append(variant); // depends on control dependency: [if], data = [none] } else if (country != "") { sb.append(language).append('_').append(country); // depends on control dependency: [if], data = [(country] } else { sb.append(language); // depends on control dependency: [if], data = [none] } } availableLocaleSuffixes.add(sb.toString()); // depends on control dependency: [for], data = [none] } return availableLocaleSuffixes; } }
public class class_name { protected void setCookie(String[] tokens, int maxAge, HttpServletRequest request, HttpServletResponse response) { String cookieValue = encodeCookie(tokens); Cookie cookie = new Cookie(cookieName, cookieValue); cookie.setMaxAge(maxAge); cookie.setPath(getCookiePath(request)); if (cookieDomain != null) { cookie.setDomain(cookieDomain); } if (maxAge < 1) { cookie.setVersion(1); } if (useSecureCookie == null) { cookie.setSecure(request.isSecure()); } else { cookie.setSecure(useSecureCookie); } cookie.setHttpOnly(true); response.addCookie(cookie); } }
public class class_name { protected void setCookie(String[] tokens, int maxAge, HttpServletRequest request, HttpServletResponse response) { String cookieValue = encodeCookie(tokens); Cookie cookie = new Cookie(cookieName, cookieValue); cookie.setMaxAge(maxAge); cookie.setPath(getCookiePath(request)); if (cookieDomain != null) { cookie.setDomain(cookieDomain); // depends on control dependency: [if], data = [(cookieDomain] } if (maxAge < 1) { cookie.setVersion(1); // depends on control dependency: [if], data = [1)] } if (useSecureCookie == null) { cookie.setSecure(request.isSecure()); // depends on control dependency: [if], data = [none] } else { cookie.setSecure(useSecureCookie); // depends on control dependency: [if], data = [(useSecureCookie] } cookie.setHttpOnly(true); response.addCookie(cookie); } }
public class class_name { public static Bitmap readBitmap(String path) { if (!TextUtils.isEmpty(path)) { final File file = new File(path); if (file.exists()) { return BitmapFactory.decodeFile(file.getAbsolutePath()); } } return null; } }
public class class_name { public static Bitmap readBitmap(String path) { if (!TextUtils.isEmpty(path)) { final File file = new File(path); if (file.exists()) { return BitmapFactory.decodeFile(file.getAbsolutePath()); // depends on control dependency: [if], data = [none] } } return null; } }
public class class_name { public void setType(String type) { if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(type)) { m_type = Type.parse(type.trim()); } } }
public class class_name { public void setType(String type) { if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(type)) { m_type = Type.parse(type.trim()); // depends on control dependency: [if], data = [none] } } }
public class class_name { private void ensureColumn(FieldDescriptorDef fieldDef, String checkLevel) { if (!fieldDef.hasProperty(PropertyHelper.OJB_PROPERTY_COLUMN)) { String javaname = fieldDef.getName(); if (fieldDef.isNested()) { int pos = javaname.indexOf("::"); // we convert nested names ('_' for '::') if (pos > 0) { StringBuffer newJavaname = new StringBuffer(javaname.substring(0, pos)); int lastPos = pos + 2; do { pos = javaname.indexOf("::", lastPos); newJavaname.append("_"); if (pos > 0) { newJavaname.append(javaname.substring(lastPos, pos)); lastPos = pos + 2; } else { newJavaname.append(javaname.substring(lastPos)); } } while (pos > 0); javaname = newJavaname.toString(); } } fieldDef.setProperty(PropertyHelper.OJB_PROPERTY_COLUMN, javaname); } } }
public class class_name { private void ensureColumn(FieldDescriptorDef fieldDef, String checkLevel) { if (!fieldDef.hasProperty(PropertyHelper.OJB_PROPERTY_COLUMN)) { String javaname = fieldDef.getName(); if (fieldDef.isNested()) { int pos = javaname.indexOf("::"); // we convert nested names ('_' for '::') if (pos > 0) { StringBuffer newJavaname = new StringBuffer(javaname.substring(0, pos)); int lastPos = pos + 2; do { pos = javaname.indexOf("::", lastPos); newJavaname.append("_"); if (pos > 0) { newJavaname.append(javaname.substring(lastPos, pos)); // depends on control dependency: [if], data = [none] lastPos = pos + 2; // depends on control dependency: [if], data = [none] } else { newJavaname.append(javaname.substring(lastPos)); // depends on control dependency: [if], data = [none] } } while (pos > 0); javaname = newJavaname.toString(); // depends on control dependency: [if], data = [none] } } fieldDef.setProperty(PropertyHelper.OJB_PROPERTY_COLUMN, javaname); // depends on control dependency: [if], data = [none] } } }
public class class_name { public EClass getIfcProductsOfCombustionProperties() { if (ifcProductsOfCombustionPropertiesEClass == null) { ifcProductsOfCombustionPropertiesEClass = (EClass) EPackage.Registry.INSTANCE .getEPackage(Ifc2x3tc1Package.eNS_URI).getEClassifiers().get(389); } return ifcProductsOfCombustionPropertiesEClass; } }
public class class_name { public EClass getIfcProductsOfCombustionProperties() { if (ifcProductsOfCombustionPropertiesEClass == null) { ifcProductsOfCombustionPropertiesEClass = (EClass) EPackage.Registry.INSTANCE .getEPackage(Ifc2x3tc1Package.eNS_URI).getEClassifiers().get(389); // depends on control dependency: [if], data = [none] } return ifcProductsOfCombustionPropertiesEClass; } }
public class class_name { public void setSpotInstanceRequestIds(java.util.Collection<String> spotInstanceRequestIds) { if (spotInstanceRequestIds == null) { this.spotInstanceRequestIds = null; return; } this.spotInstanceRequestIds = new com.amazonaws.internal.SdkInternalList<String>(spotInstanceRequestIds); } }
public class class_name { public void setSpotInstanceRequestIds(java.util.Collection<String> spotInstanceRequestIds) { if (spotInstanceRequestIds == null) { this.spotInstanceRequestIds = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.spotInstanceRequestIds = new com.amazonaws.internal.SdkInternalList<String>(spotInstanceRequestIds); } }
public class class_name { public static String outputNestedList(NestedList nl, int depth){ String result = ""; if(nl == null) { return result; // If null return empty string } for(int i = 0; i<depth; i++) { result += " "; // insert indentation according to depth } if(nl.getClass() == NestedListElement.class){ // If it is a NestedListElement, // we reached a leaf, return its contents result += nl.getText(); }else{ result += "---"; // If it is not a NestedListElement, it is a NestedListContainer // print out all its childs, increment depth for(NestedList nl2 : ((NestedListContainer)nl).getNestedLists()) { result += "\n"+outputNestedList(nl2, depth+1); } } return result; } }
public class class_name { public static String outputNestedList(NestedList nl, int depth){ String result = ""; if(nl == null) { return result; // If null return empty string // depends on control dependency: [if], data = [none] } for(int i = 0; i<depth; i++) { result += " "; // insert indentation according to depth // depends on control dependency: [for], data = [none] } if(nl.getClass() == NestedListElement.class){ // If it is a NestedListElement, // we reached a leaf, return its contents result += nl.getText(); // depends on control dependency: [if], data = [none] }else{ result += "---"; // If it is not a NestedListElement, it is a NestedListContainer // depends on control dependency: [if], data = [none] // print out all its childs, increment depth for(NestedList nl2 : ((NestedListContainer)nl).getNestedLists()) { result += "\n"+outputNestedList(nl2, depth+1); // depends on control dependency: [for], data = [nl2] } } return result; } }
public class class_name { public static void solveL( double L[] , double []b , int n ) { // for( int i = 0; i < n; i++ ) { // double sum = b[i]; // for( int k=0; k<i; k++ ) { // sum -= L[i*n+k]* b[k]; // } // b[i] = sum / L[i*n+i]; // } for( int i = 0; i < n; i++ ) { double sum = b[i]; int indexL = i*n; for( int k=0; k<i; k++ ) { sum -= L[indexL++]* b[k]; } b[i] = sum / L[indexL]; } } }
public class class_name { public static void solveL( double L[] , double []b , int n ) { // for( int i = 0; i < n; i++ ) { // double sum = b[i]; // for( int k=0; k<i; k++ ) { // sum -= L[i*n+k]* b[k]; // } // b[i] = sum / L[i*n+i]; // } for( int i = 0; i < n; i++ ) { double sum = b[i]; int indexL = i*n; for( int k=0; k<i; k++ ) { sum -= L[indexL++]* b[k]; // depends on control dependency: [for], data = [k] } b[i] = sum / L[indexL]; // depends on control dependency: [for], data = [i] } } }
public class class_name { protected static InputReader getInput(InputSource input, int size, Charset cs, Set<ParserFeature> fea) throws IOException { EnumSet<ParserFeature> features = EnumSet.of(UseInclude, UsePushback, UseModifiableCharset); InputReader inputReader = null; Reader reader = input.getCharacterStream(); if (reader != null) { inputReader = new ReadableInput(getFeaturedReader(reader, size, features), size, features); } else { InputStream is = input.getByteStream(); String encoding = input.getEncoding(); if (is != null) { if (encoding != null) { inputReader = getInstance(is, size, encoding, features); } else { inputReader = getInstance(is, size, StandardCharsets.US_ASCII, features); } } else { String sysId = input.getSystemId(); try { URI uri = new URI(sysId); if (encoding != null) { inputReader = getInstance(uri, size, encoding, features); } else { inputReader = getInstance(uri, size, StandardCharsets.US_ASCII, features); } } catch (URISyntaxException ex) { throw new IOException(ex); } } } inputReader.setSource(input.getSystemId()); return inputReader; } }
public class class_name { protected static InputReader getInput(InputSource input, int size, Charset cs, Set<ParserFeature> fea) throws IOException { EnumSet<ParserFeature> features = EnumSet.of(UseInclude, UsePushback, UseModifiableCharset); InputReader inputReader = null; Reader reader = input.getCharacterStream(); if (reader != null) { inputReader = new ReadableInput(getFeaturedReader(reader, size, features), size, features); } else { InputStream is = input.getByteStream(); String encoding = input.getEncoding(); if (is != null) { if (encoding != null) { inputReader = getInstance(is, size, encoding, features); // depends on control dependency: [if], data = [none] } else { inputReader = getInstance(is, size, StandardCharsets.US_ASCII, features); // depends on control dependency: [if], data = [none] } } else { String sysId = input.getSystemId(); try { URI uri = new URI(sysId); if (encoding != null) { inputReader = getInstance(uri, size, encoding, features); // depends on control dependency: [if], data = [none] } else { inputReader = getInstance(uri, size, StandardCharsets.US_ASCII, features); // depends on control dependency: [if], data = [none] } } catch (URISyntaxException ex) { throw new IOException(ex); } // depends on control dependency: [catch], data = [none] } } inputReader.setSource(input.getSystemId()); return inputReader; } }
public class class_name { @Override public final void close() { try { doClose(); isClosed = true; } catch (Exception e) { Throwables.propagate(e); } } }
public class class_name { @Override public final void close() { try { doClose(); // depends on control dependency: [try], data = [none] isClosed = true; // depends on control dependency: [try], data = [none] } catch (Exception e) { Throwables.propagate(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { protected void generalHelp(IsInfoSetFT info){ //collect all commands belonging to a particular category String defKey = "__standard"; Map<String, TreeMap<String, SkbShellCommand>> cat2Cmd = new TreeMap<>(); for(CommandInterpreter ci : this.skbShell.getCommandMap().values()){ for(SkbShellCommand ssc : ci.getCommands().values()){ String cat = defKey; if(ssc.getCategory()!=null){ cat = ssc.getCategory().getCategory(); } if(!cat2Cmd.containsKey(cat)){ cat2Cmd.put(cat, new TreeMap<>()); } cat2Cmd.get(cat).put(ssc.getCommand(), ssc); } } //no argument, means general help info.addInfo(""); info.addInfo("{} {}", this.skbShell.getDisplayName(), this.skbShell.getDescription()); info.addInfo(""); //do the commands per category, starting with "__standard" for(String cat : cat2Cmd.keySet()){ String catDescr = cat; if(defKey.equals(cat)){ catDescr = "standard commands"; } info.addInfo("- {}: {}", new Object[]{catDescr, cat2Cmd.get(cat).keySet()}); } info.addInfo(" try: 'help <command>' for more details"); } }
public class class_name { protected void generalHelp(IsInfoSetFT info){ //collect all commands belonging to a particular category String defKey = "__standard"; Map<String, TreeMap<String, SkbShellCommand>> cat2Cmd = new TreeMap<>(); for(CommandInterpreter ci : this.skbShell.getCommandMap().values()){ for(SkbShellCommand ssc : ci.getCommands().values()){ String cat = defKey; if(ssc.getCategory()!=null){ cat = ssc.getCategory().getCategory(); // depends on control dependency: [if], data = [none] } if(!cat2Cmd.containsKey(cat)){ cat2Cmd.put(cat, new TreeMap<>()); // depends on control dependency: [if], data = [none] } cat2Cmd.get(cat).put(ssc.getCommand(), ssc); // depends on control dependency: [for], data = [ssc] } } //no argument, means general help info.addInfo(""); info.addInfo("{} {}", this.skbShell.getDisplayName(), this.skbShell.getDescription()); info.addInfo(""); //do the commands per category, starting with "__standard" for(String cat : cat2Cmd.keySet()){ String catDescr = cat; if(defKey.equals(cat)){ catDescr = "standard commands"; // depends on control dependency: [if], data = [none] } info.addInfo("- {}: {}", new Object[]{catDescr, cat2Cmd.get(cat).keySet()}); // depends on control dependency: [for], data = [cat] } info.addInfo(" try: 'help <command>' for more details"); } }
public class class_name { void initialize() { // Cancel any running tasks Timer oldTimer = timer; timer = new Timer(true); if (Objects.nonNull(oldTimer)) { oldTimer.cancel(); } // (re)initialize LoaderConfigurator configurator = new LoaderConfigurator(this); defaultLoaderServiceFacade = new DefaultLoaderServiceFacade(timer, listener, resources); configurator.load(); } }
public class class_name { void initialize() { // Cancel any running tasks Timer oldTimer = timer; timer = new Timer(true); if (Objects.nonNull(oldTimer)) { oldTimer.cancel(); // depends on control dependency: [if], data = [none] } // (re)initialize LoaderConfigurator configurator = new LoaderConfigurator(this); defaultLoaderServiceFacade = new DefaultLoaderServiceFacade(timer, listener, resources); configurator.load(); } }
public class class_name { Item newConstItem(final Object cst) { if (cst instanceof Integer) { int val = ((Integer) cst).intValue(); return newInteger(val); } else if (cst instanceof Byte) { int val = ((Byte) cst).intValue(); return newInteger(val); } else if (cst instanceof Character) { int val = ((Character) cst).charValue(); return newInteger(val); } else if (cst instanceof Short) { int val = ((Short) cst).intValue(); return newInteger(val); } else if (cst instanceof Boolean) { int val = ((Boolean) cst).booleanValue() ? 1 : 0; return newInteger(val); } else if (cst instanceof Float) { float val = ((Float) cst).floatValue(); return newFloat(val); } else if (cst instanceof Long) { long val = ((Long) cst).longValue(); return newLong(val); } else if (cst instanceof Double) { double val = ((Double) cst).doubleValue(); return newDouble(val); } else if (cst instanceof String) { return newStringishItem(STR, (String) cst); } else if (cst instanceof Type) { Type t = (Type) cst; int s = t.getSort(); if (s == Type.OBJECT) { return newStringishItem(CLASS, t.getInternalName()); } else if (s == Type.METHOD) { return newStringishItem(MTYPE, t.getDescriptor()); } else { // s == primitive type or array return newStringishItem(CLASS, t.getDescriptor()); } } else if (cst instanceof Handle) { Handle h = (Handle) cst; return newHandleItem(h.tag, h.owner, h.name, h.desc, h.itf); } else { throw new IllegalArgumentException("value " + cst); } } }
public class class_name { Item newConstItem(final Object cst) { if (cst instanceof Integer) { int val = ((Integer) cst).intValue(); return newInteger(val); // depends on control dependency: [if], data = [none] } else if (cst instanceof Byte) { int val = ((Byte) cst).intValue(); return newInteger(val); // depends on control dependency: [if], data = [none] } else if (cst instanceof Character) { int val = ((Character) cst).charValue(); return newInteger(val); // depends on control dependency: [if], data = [none] } else if (cst instanceof Short) { int val = ((Short) cst).intValue(); return newInteger(val); // depends on control dependency: [if], data = [none] } else if (cst instanceof Boolean) { int val = ((Boolean) cst).booleanValue() ? 1 : 0; return newInteger(val); // depends on control dependency: [if], data = [none] } else if (cst instanceof Float) { float val = ((Float) cst).floatValue(); return newFloat(val); // depends on control dependency: [if], data = [none] } else if (cst instanceof Long) { long val = ((Long) cst).longValue(); return newLong(val); // depends on control dependency: [if], data = [none] } else if (cst instanceof Double) { double val = ((Double) cst).doubleValue(); return newDouble(val); // depends on control dependency: [if], data = [none] } else if (cst instanceof String) { return newStringishItem(STR, (String) cst); // depends on control dependency: [if], data = [none] } else if (cst instanceof Type) { Type t = (Type) cst; int s = t.getSort(); if (s == Type.OBJECT) { return newStringishItem(CLASS, t.getInternalName()); // depends on control dependency: [if], data = [none] } else if (s == Type.METHOD) { return newStringishItem(MTYPE, t.getDescriptor()); // depends on control dependency: [if], data = [none] } else { // s == primitive type or array return newStringishItem(CLASS, t.getDescriptor()); // depends on control dependency: [if], data = [none] } } else if (cst instanceof Handle) { Handle h = (Handle) cst; return newHandleItem(h.tag, h.owner, h.name, h.desc, h.itf); // depends on control dependency: [if], data = [none] } else { throw new IllegalArgumentException("value " + cst); } } }
public class class_name { @Override public boolean implies(ProtectionDomain protectionDomain, Permission permission) { // this should never happen if (protectionDomain == null) { return false; } // everything is granted in this case if (protectionDomain.getCodeSource() == null) { return true; } if (Priority.GRANT.equals(priority)) { // branch for grant priority if (debug) { ProGradePolicyDebugger.log("Searching for granting for permission: " + permission + " ..."); } if (grantEntriesImplies(protectionDomain, permission)) { if (debug) { ProGradePolicyDebugger.log("Granting permission found, grant access."); } return true; } else { if (debug) { ProGradePolicyDebugger.log("Granting permission wasn't found, searching for denying..."); } boolean toReturn = !denyEntriesImplies(protectionDomain, permission); if (debug) { if (toReturn) { ProGradePolicyDebugger.log("Denying permission wasn't found, grant access."); } else { ProGradePolicyDebugger.log("Denying permission found, deny access."); } } return toReturn; } } else { // branch for deny priority if (debug) { ProGradePolicyDebugger.log("Searching for denying for permission: " + permission + " ..."); } if (denyEntriesImplies(protectionDomain, permission)) { if (debug) { ProGradePolicyDebugger.log("Denying permission found, deny access."); } return false; } else { if (debug) { ProGradePolicyDebugger.log("Denying permission wasn't found, searching for granting..."); } boolean toReturn = grantEntriesImplies(protectionDomain, permission); if (debug) { if (toReturn) { ProGradePolicyDebugger.log("Granting permission found, grant access."); } else { ProGradePolicyDebugger.log("Granting permission wasn't found, deny access."); } } return toReturn; } } } }
public class class_name { @Override public boolean implies(ProtectionDomain protectionDomain, Permission permission) { // this should never happen if (protectionDomain == null) { return false; // depends on control dependency: [if], data = [none] } // everything is granted in this case if (protectionDomain.getCodeSource() == null) { return true; // depends on control dependency: [if], data = [none] } if (Priority.GRANT.equals(priority)) { // branch for grant priority if (debug) { ProGradePolicyDebugger.log("Searching for granting for permission: " + permission + " ..."); // depends on control dependency: [if], data = [none] } if (grantEntriesImplies(protectionDomain, permission)) { if (debug) { ProGradePolicyDebugger.log("Granting permission found, grant access."); // depends on control dependency: [if], data = [none] } return true; // depends on control dependency: [if], data = [none] } else { if (debug) { ProGradePolicyDebugger.log("Granting permission wasn't found, searching for denying..."); // depends on control dependency: [if], data = [none] } boolean toReturn = !denyEntriesImplies(protectionDomain, permission); if (debug) { if (toReturn) { ProGradePolicyDebugger.log("Denying permission wasn't found, grant access."); // depends on control dependency: [if], data = [none] } else { ProGradePolicyDebugger.log("Denying permission found, deny access."); // depends on control dependency: [if], data = [none] } } return toReturn; // depends on control dependency: [if], data = [none] } } else { // branch for deny priority if (debug) { ProGradePolicyDebugger.log("Searching for denying for permission: " + permission + " ..."); // depends on control dependency: [if], data = [none] } if (denyEntriesImplies(protectionDomain, permission)) { if (debug) { ProGradePolicyDebugger.log("Denying permission found, deny access."); // depends on control dependency: [if], data = [none] } return false; // depends on control dependency: [if], data = [none] } else { if (debug) { ProGradePolicyDebugger.log("Denying permission wasn't found, searching for granting..."); // depends on control dependency: [if], data = [none] } boolean toReturn = grantEntriesImplies(protectionDomain, permission); if (debug) { if (toReturn) { ProGradePolicyDebugger.log("Granting permission found, grant access."); // depends on control dependency: [if], data = [none] } else { ProGradePolicyDebugger.log("Granting permission wasn't found, deny access."); // depends on control dependency: [if], data = [none] } } return toReturn; // depends on control dependency: [if], data = [none] } } } }
public class class_name { private void evaluateExpressions() throws JspException { Integer tempInt = null; if (dataSourceEL != null) { rawDataSource = (Object) ExpressionEvaluatorManager.evaluate( "dataSource", dataSourceEL, Object.class, this, pageContext); } if (sqlEL != null) { sql = (String) ExpressionEvaluatorManager.evaluate("sql", sqlEL, String.class, this, pageContext); } if (startRowEL != null) { tempInt = (Integer) ExpressionEvaluatorManager.evaluate( "startRow", startRowEL, Integer.class, this, pageContext); if (tempInt != null) { startRow = tempInt.intValue(); } } if (maxRowsEL != null) { tempInt = (Integer) ExpressionEvaluatorManager.evaluate( "maxRows", maxRowsEL, Integer.class, this, pageContext); if (tempInt != null) { maxRows = tempInt.intValue(); } } } }
public class class_name { private void evaluateExpressions() throws JspException { Integer tempInt = null; if (dataSourceEL != null) { rawDataSource = (Object) ExpressionEvaluatorManager.evaluate( "dataSource", dataSourceEL, Object.class, this, pageContext); } if (sqlEL != null) { sql = (String) ExpressionEvaluatorManager.evaluate("sql", sqlEL, String.class, this, pageContext); } if (startRowEL != null) { tempInt = (Integer) ExpressionEvaluatorManager.evaluate( "startRow", startRowEL, Integer.class, this, pageContext); if (tempInt != null) { startRow = tempInt.intValue(); } } if (maxRowsEL != null) { tempInt = (Integer) ExpressionEvaluatorManager.evaluate( "maxRows", maxRowsEL, Integer.class, this, pageContext); if (tempInt != null) { maxRows = tempInt.intValue(); // depends on control dependency: [if], data = [none] } } } }
public class class_name { private static synchronized MarshallerBuilder getMarshallerBuilder() { ServiceLoader<MarshallerBuilder> builders = ServiceLoader.load(MarshallerBuilder.class); Iterator<MarshallerBuilder> it = builders.iterator(); if (it.hasNext()) { MarshallerBuilder marshallerBuilder = it.next(); logger.debug("Found custom marshaller builder {} that is going to be used instead of the default", marshallerBuilder); return marshallerBuilder; } return new BaseMarshallerBuilder(); } }
public class class_name { private static synchronized MarshallerBuilder getMarshallerBuilder() { ServiceLoader<MarshallerBuilder> builders = ServiceLoader.load(MarshallerBuilder.class); Iterator<MarshallerBuilder> it = builders.iterator(); if (it.hasNext()) { MarshallerBuilder marshallerBuilder = it.next(); logger.debug("Found custom marshaller builder {} that is going to be used instead of the default", marshallerBuilder); // depends on control dependency: [if], data = [none] return marshallerBuilder; // depends on control dependency: [if], data = [none] } return new BaseMarshallerBuilder(); } }
public class class_name { public static Authenticator buildAuthenticatorWithSharedSecret(final String key) { if (key != null && !key.isEmpty()) { return new JwtAuthenticator(hmacShaKeyFor(key.getBytes(UTF_8))); } return null; } }
public class class_name { public static Authenticator buildAuthenticatorWithSharedSecret(final String key) { if (key != null && !key.isEmpty()) { return new JwtAuthenticator(hmacShaKeyFor(key.getBytes(UTF_8))); // depends on control dependency: [if], data = [(key] } return null; } }
public class class_name { @Override public Splittable getSerializedProxyId(final SimpleProxyId<?> stableId) { final AutoBean<IdMessage> bean = MessageFactoryHolder.FACTORY.id(); final IdMessage ref = bean.as(); ref.setServerId(stableId.getServerId()); ref.setTypeToken(this.getRequestFactory().getTypeToken(stableId.getProxyClass())); if (stableId.isSynthetic()) { ref.setStrength(Strength.SYNTHETIC); ref.setSyntheticId(stableId.getSyntheticId()); } else if (stableId.isEphemeral()) { ref.setStrength(Strength.EPHEMERAL); ref.setClientId(stableId.getClientId()); } return AutoBeanCodex.encode(bean); } }
public class class_name { @Override public Splittable getSerializedProxyId(final SimpleProxyId<?> stableId) { final AutoBean<IdMessage> bean = MessageFactoryHolder.FACTORY.id(); final IdMessage ref = bean.as(); ref.setServerId(stableId.getServerId()); ref.setTypeToken(this.getRequestFactory().getTypeToken(stableId.getProxyClass())); if (stableId.isSynthetic()) { ref.setStrength(Strength.SYNTHETIC); // depends on control dependency: [if], data = [none] ref.setSyntheticId(stableId.getSyntheticId()); // depends on control dependency: [if], data = [none] } else if (stableId.isEphemeral()) { ref.setStrength(Strength.EPHEMERAL); // depends on control dependency: [if], data = [none] ref.setClientId(stableId.getClientId()); // depends on control dependency: [if], data = [none] } return AutoBeanCodex.encode(bean); } }
public class class_name { public static String toMD5hash(final String s) { String hash = null; if (null != s) { try { final MessageDigest digest = MessageDigest.getInstance("MD5"); digest.update(s.getBytes(Charset.forName("utf-8"))); final byte[] md5sum = digest.digest(); final BigInteger bigInt = new BigInteger(1, md5sum); hash = bigInt.toString(16); } catch (final NoSuchAlgorithmException e) { throw new RuntimeException("MD5 digest algorithm implementation not found", e); } } return hash; } }
public class class_name { public static String toMD5hash(final String s) { String hash = null; if (null != s) { try { final MessageDigest digest = MessageDigest.getInstance("MD5"); digest.update(s.getBytes(Charset.forName("utf-8"))); // depends on control dependency: [try], data = [none] final byte[] md5sum = digest.digest(); final BigInteger bigInt = new BigInteger(1, md5sum); hash = bigInt.toString(16); // depends on control dependency: [try], data = [none] } catch (final NoSuchAlgorithmException e) { throw new RuntimeException("MD5 digest algorithm implementation not found", e); } // depends on control dependency: [catch], data = [none] } return hash; } }
public class class_name { public static String getPrincipalNameFromACE(CmsObject cms, CmsAccessControlEntry entry) { if (entry.isAllOthers()) { return CmsAccessControlEntry.PRINCIPAL_ALL_OTHERS_NAME; } if (entry.isOverwriteAll()) { return CmsAccessControlEntry.PRINCIPAL_OVERWRITE_ALL_NAME; } CmsRole role = CmsRole.valueOfId(entry.getPrincipal()); if (role != null) { return role.getRoleName(); } else { try { return CmsPrincipal.readPrincipal(cms, entry.getPrincipal()).getName(); } catch (CmsException e) { // } } return ""; } }
public class class_name { public static String getPrincipalNameFromACE(CmsObject cms, CmsAccessControlEntry entry) { if (entry.isAllOthers()) { return CmsAccessControlEntry.PRINCIPAL_ALL_OTHERS_NAME; // depends on control dependency: [if], data = [none] } if (entry.isOverwriteAll()) { return CmsAccessControlEntry.PRINCIPAL_OVERWRITE_ALL_NAME; // depends on control dependency: [if], data = [none] } CmsRole role = CmsRole.valueOfId(entry.getPrincipal()); if (role != null) { return role.getRoleName(); // depends on control dependency: [if], data = [none] } else { try { return CmsPrincipal.readPrincipal(cms, entry.getPrincipal()).getName(); // depends on control dependency: [try], data = [none] } catch (CmsException e) { // } // depends on control dependency: [catch], data = [none] } return ""; } }
public class class_name { protected void initExtractors() { Parameter[] parameters = controllerMethod.getParameters(); extractors = new MethodParameterExtractor[parameters.length]; for (int i = 0; i < parameters.length; i++) { MethodParameter parameter = new MethodParameter(controllerMethod, i); MethodParameterExtractor extractor = application.getExtractors().stream() .filter(e -> e.isApplicable(parameter)) .findFirst() .orElse(null); if (extractor == null) { throw new PippoRuntimeException( "Method '{}' parameter {} of type '{}' does not specify a extractor", LangUtils.toString(controllerMethod), i + 1, parameter.getParameterType()); } extractors[i] = extractor; } } }
public class class_name { protected void initExtractors() { Parameter[] parameters = controllerMethod.getParameters(); extractors = new MethodParameterExtractor[parameters.length]; for (int i = 0; i < parameters.length; i++) { MethodParameter parameter = new MethodParameter(controllerMethod, i); MethodParameterExtractor extractor = application.getExtractors().stream() .filter(e -> e.isApplicable(parameter)) .findFirst() .orElse(null); if (extractor == null) { throw new PippoRuntimeException( "Method '{}' parameter {} of type '{}' does not specify a extractor", LangUtils.toString(controllerMethod), i + 1, parameter.getParameterType()); } extractors[i] = extractor; // depends on control dependency: [for], data = [i] } } }
public class class_name { public synchronized void setSynced(boolean sync) { if (synced.get() != sync) { // We are changing sync state, so add or remove our master listener as appropriate. if (sync && isSendingStatus()) { addMasterListener(ourSyncMasterListener); } else { removeMasterListener(ourSyncMasterListener); } // Also, if there is a tempo master, and we just got synced, adopt its tempo. if (!isTempoMaster() && getTempoMaster() != null) { setTempo(getMasterTempo()); } } synced.set(sync); } }
public class class_name { public synchronized void setSynced(boolean sync) { if (synced.get() != sync) { // We are changing sync state, so add or remove our master listener as appropriate. if (sync && isSendingStatus()) { addMasterListener(ourSyncMasterListener); // depends on control dependency: [if], data = [none] } else { removeMasterListener(ourSyncMasterListener); // depends on control dependency: [if], data = [none] } // Also, if there is a tempo master, and we just got synced, adopt its tempo. if (!isTempoMaster() && getTempoMaster() != null) { setTempo(getMasterTempo()); // depends on control dependency: [if], data = [none] } } synced.set(sync); } }
public class class_name { @SuppressWarnings("unchecked") @Override public Collection<MonetaryAmountFactory<?>> getAmountFactories(MonetaryAmountFactoryQuery factoryQuery){ Objects.requireNonNull(factoryQuery); List<MonetaryAmountFactory<?>> factories = new ArrayList<>(); // first check for explicit type for(@SuppressWarnings("unchecked") MonetaryAmountFactoryProviderSpi<? extends MonetaryAmount> prov : Bootstrap .getServices(MonetaryAmountFactoryProviderSpi.class)){ if(prov.getQueryInclusionPolicy() == QueryInclusionPolicy.NEVER){ continue; } if(factoryQuery.getTargetType() == prov.getAmountType()){ if(isPrecisionOK(factoryQuery, prov.getMaximalMonetaryContext())){ factories.add(createFactory(prov, factoryQuery)); }else{ throw new MonetaryException("Incompatible context required=" + factoryQuery + ", maximal=" + prov.getMaximalMonetaryContext()); } } } List<MonetaryAmountFactoryProviderSpi<? extends MonetaryAmount>> selection = new ArrayList<>(); for(@SuppressWarnings("unchecked") MonetaryAmountFactoryProviderSpi<? extends MonetaryAmount> f : Bootstrap .getServices(MonetaryAmountFactoryProviderSpi.class)){ if(f.getQueryInclusionPolicy() == QueryInclusionPolicy.DIRECT_REFERENCE_ONLY || f.getQueryInclusionPolicy() == QueryInclusionPolicy.NEVER){ continue; } if(isPrecisionOK(factoryQuery, f.getMaximalMonetaryContext())){ selection.add(f); } } if(selection.isEmpty()){ // fall back, add all selections, ignore flavor for(@SuppressWarnings("unchecked") MonetaryAmountFactoryProviderSpi<? extends MonetaryAmount> f : Bootstrap .getServices(MonetaryAmountFactoryProviderSpi.class)){ if(f.getQueryInclusionPolicy() == QueryInclusionPolicy.DIRECT_REFERENCE_ONLY || f.getQueryInclusionPolicy() == QueryInclusionPolicy.NEVER){ continue; } if(isPrecisionOK(factoryQuery, f.getMaximalMonetaryContext())){ selection.add(f); } } } if(selection.size() == 1){ factories.add(createFactory(selection.get(0), factoryQuery)); } Collections.sort(selection, CONTEXT_COMPARATOR); factories.add(createFactory(selection.get(0), factoryQuery)); return factories; } }
public class class_name { @SuppressWarnings("unchecked") @Override public Collection<MonetaryAmountFactory<?>> getAmountFactories(MonetaryAmountFactoryQuery factoryQuery){ Objects.requireNonNull(factoryQuery); List<MonetaryAmountFactory<?>> factories = new ArrayList<>(); // first check for explicit type for(@SuppressWarnings("unchecked") MonetaryAmountFactoryProviderSpi<? extends MonetaryAmount> prov : Bootstrap .getServices(MonetaryAmountFactoryProviderSpi.class)){ if(prov.getQueryInclusionPolicy() == QueryInclusionPolicy.NEVER){ continue; } if(factoryQuery.getTargetType() == prov.getAmountType()){ if(isPrecisionOK(factoryQuery, prov.getMaximalMonetaryContext())){ factories.add(createFactory(prov, factoryQuery)); // depends on control dependency: [if], data = [none] }else{ throw new MonetaryException("Incompatible context required=" + factoryQuery + ", maximal=" + prov.getMaximalMonetaryContext()); } } } List<MonetaryAmountFactoryProviderSpi<? extends MonetaryAmount>> selection = new ArrayList<>(); for(@SuppressWarnings("unchecked") MonetaryAmountFactoryProviderSpi<? extends MonetaryAmount> f : Bootstrap .getServices(MonetaryAmountFactoryProviderSpi.class)){ if(f.getQueryInclusionPolicy() == QueryInclusionPolicy.DIRECT_REFERENCE_ONLY || f.getQueryInclusionPolicy() == QueryInclusionPolicy.NEVER){ continue; } if(isPrecisionOK(factoryQuery, f.getMaximalMonetaryContext())){ selection.add(f); // depends on control dependency: [if], data = [none] } } if(selection.isEmpty()){ // fall back, add all selections, ignore flavor for(@SuppressWarnings("unchecked") MonetaryAmountFactoryProviderSpi<? extends MonetaryAmount> f : Bootstrap .getServices(MonetaryAmountFactoryProviderSpi.class)){ if(f.getQueryInclusionPolicy() == QueryInclusionPolicy.DIRECT_REFERENCE_ONLY || f.getQueryInclusionPolicy() == QueryInclusionPolicy.NEVER){ continue; } if(isPrecisionOK(factoryQuery, f.getMaximalMonetaryContext())){ selection.add(f); // depends on control dependency: [if], data = [none] } } } if(selection.size() == 1){ factories.add(createFactory(selection.get(0), factoryQuery)); // depends on control dependency: [if], data = [none] } Collections.sort(selection, CONTEXT_COMPARATOR); factories.add(createFactory(selection.get(0), factoryQuery)); return factories; } }
public class class_name { public List<Parameter> getAllParameters() { List<Parameter> ret = new ArrayList<Parameter>(); if (parameters != null) ret.addAll(parameters); if (terms != null) { for (final Term t : terms) { ret.addAll(t.getAllParameters()); } } return ret; } }
public class class_name { public List<Parameter> getAllParameters() { List<Parameter> ret = new ArrayList<Parameter>(); if (parameters != null) ret.addAll(parameters); if (terms != null) { for (final Term t : terms) { ret.addAll(t.getAllParameters()); // depends on control dependency: [for], data = [t] } } return ret; } }
public class class_name { public static Map<String, PropertyIndex> getIndexesOnEmbeddable(Class<?> entityClazz) { Map<String, PropertyIndex> pis = new HashMap<String, PropertyIndex>(); IndexCollection indexes = entityClazz.getAnnotation(IndexCollection.class); List<String> columnsNameToBeIndexed = null; Map<String, com.impetus.kundera.index.Index> columnsToBeIndexed = null; if (null != indexes) { columnsToBeIndexed = new HashMap<String, com.impetus.kundera.index.Index>(); if (indexes.columns() != null && indexes.columns().length != 0) { for (com.impetus.kundera.index.Index indexedColumn : indexes.columns()) { columnsToBeIndexed.put(indexedColumn.name(), indexedColumn); } } } getPropertyIndexes(entityClazz, pis, columnsNameToBeIndexed, columnsToBeIndexed); return pis; } }
public class class_name { public static Map<String, PropertyIndex> getIndexesOnEmbeddable(Class<?> entityClazz) { Map<String, PropertyIndex> pis = new HashMap<String, PropertyIndex>(); IndexCollection indexes = entityClazz.getAnnotation(IndexCollection.class); List<String> columnsNameToBeIndexed = null; Map<String, com.impetus.kundera.index.Index> columnsToBeIndexed = null; if (null != indexes) { columnsToBeIndexed = new HashMap<String, com.impetus.kundera.index.Index>(); // depends on control dependency: [if], data = [none] if (indexes.columns() != null && indexes.columns().length != 0) { for (com.impetus.kundera.index.Index indexedColumn : indexes.columns()) { columnsToBeIndexed.put(indexedColumn.name(), indexedColumn); // depends on control dependency: [for], data = [indexedColumn] } } } getPropertyIndexes(entityClazz, pis, columnsNameToBeIndexed, columnsToBeIndexed); return pis; } }
public class class_name { public static <K, V, A> A ifPresentApply( Map<K, V> map, K key, Function<? super V, ? extends A> function) { if (map instanceof UnsortedMapIterable) { return ((MapIterable<K, V>) map).ifPresentApply(key, function); } V result = map.get(key); return MapIterate.isAbsent(result, map, key) ? null : function.valueOf(result); } }
public class class_name { public static <K, V, A> A ifPresentApply( Map<K, V> map, K key, Function<? super V, ? extends A> function) { if (map instanceof UnsortedMapIterable) { return ((MapIterable<K, V>) map).ifPresentApply(key, function); // depends on control dependency: [if], data = [none] } V result = map.get(key); return MapIterate.isAbsent(result, map, key) ? null : function.valueOf(result); } }
public class class_name { private void newPermissions( final ApplicationPermissionRule rule, final ApplicationPermissionMode mode, final ApplicationFeatureType featureType, final Iterable<String> featureFqns) { if(featureFqns == null) { return; } ApplicationRole securityRole = applicationRoleRepository.findByName(roleName); if(securityRole == null) { securityRole = applicationRoleRepository.newRole(roleName, roleDescription); } for (String featureFqn : featureFqns) { // can't use role#addPackage because that does a check for existence of the package, which is // not guaranteed to exist yet (the SecurityFeatures#init() may not have run). applicationPermissionRepository.newPermissionNoCheck( securityRole, rule, mode, featureType, featureFqn); } } }
public class class_name { private void newPermissions( final ApplicationPermissionRule rule, final ApplicationPermissionMode mode, final ApplicationFeatureType featureType, final Iterable<String> featureFqns) { if(featureFqns == null) { return; // depends on control dependency: [if], data = [none] } ApplicationRole securityRole = applicationRoleRepository.findByName(roleName); if(securityRole == null) { securityRole = applicationRoleRepository.newRole(roleName, roleDescription); // depends on control dependency: [if], data = [none] } for (String featureFqn : featureFqns) { // can't use role#addPackage because that does a check for existence of the package, which is // not guaranteed to exist yet (the SecurityFeatures#init() may not have run). applicationPermissionRepository.newPermissionNoCheck( securityRole, rule, mode, featureType, featureFqn); // depends on control dependency: [for], data = [none] } } }
public class class_name { public boolean recordUnrestricted() { if (hasAnySingletonTypeTags() || currentInfo.isInterface() || currentInfo.makesDicts() || currentInfo.makesStructs() || currentInfo.makesUnrestricted()) { return false; } currentInfo.setUnrestricted(); populated = true; return true; } }
public class class_name { public boolean recordUnrestricted() { if (hasAnySingletonTypeTags() || currentInfo.isInterface() || currentInfo.makesDicts() || currentInfo.makesStructs() || currentInfo.makesUnrestricted()) { return false; // depends on control dependency: [if], data = [none] } currentInfo.setUnrestricted(); populated = true; return true; } }
public class class_name { public static final boolean xor(boolean b1, boolean b2) { if (b1 == false && b2 == false) { return false; } else if (b1 == false && b2 == true) { return true; } else if (b1 == true && b2 == false) { return true; } else { return false; } } }
public class class_name { public static final boolean xor(boolean b1, boolean b2) { if (b1 == false && b2 == false) { return false; // depends on control dependency: [if], data = [none] } else if (b1 == false && b2 == true) { return true; // depends on control dependency: [if], data = [none] } else if (b1 == true && b2 == false) { return true; // depends on control dependency: [if], data = [none] } else { return false; // depends on control dependency: [if], data = [none] } } }
public class class_name { public static String randomString(int length) { if (length < 1) { return null; } // Create a char buffer to put random letters and numbers in. char[] randBuffer = new char[length]; for (int i = 0; i < randBuffer.length; i++) { randBuffer[i] = numbersAndLetters[randGen.nextInt(71)]; } return new String(randBuffer); } }
public class class_name { public static String randomString(int length) { if (length < 1) { return null; // depends on control dependency: [if], data = [none] } // Create a char buffer to put random letters and numbers in. char[] randBuffer = new char[length]; for (int i = 0; i < randBuffer.length; i++) { randBuffer[i] = numbersAndLetters[randGen.nextInt(71)]; // depends on control dependency: [for], data = [i] } return new String(randBuffer); } }
public class class_name { public final Optional<T> findFirstByQuery(String query, String sort, Object... params) { Find find = this.collection.find(query, params); if((sort != null) && !sort.isEmpty()) { find.sort(sort); } Iterable<T> as = find.limit(1).as(this.entityClass); Iterator<T> iterator = as.iterator(); if(iterator.hasNext()) { return Optional.of(iterator.next()); } return Optional.empty(); } }
public class class_name { public final Optional<T> findFirstByQuery(String query, String sort, Object... params) { Find find = this.collection.find(query, params); if((sort != null) && !sort.isEmpty()) { find.sort(sort); // depends on control dependency: [if], data = [none] } Iterable<T> as = find.limit(1).as(this.entityClass); Iterator<T> iterator = as.iterator(); if(iterator.hasNext()) { return Optional.of(iterator.next()); // depends on control dependency: [if], data = [none] } return Optional.empty(); } }
public class class_name { static public LoginOutput openSession(LoginInput loginInput) throws SFException, SnowflakeSQLException { AssertUtil.assertTrue(loginInput.getServerUrl() != null, "missing server URL for opening session"); AssertUtil.assertTrue(loginInput.getAppId() != null, "missing app id for opening session"); AssertUtil.assertTrue(loginInput.getLoginTimeout() >= 0, "negative login timeout for opening session"); final ClientAuthnDTO.AuthenticatorType authenticator = getAuthenticator( loginInput); if (!authenticator.equals(ClientAuthnDTO.AuthenticatorType.OAUTH)) { // OAuth does not require a username AssertUtil.assertTrue(loginInput.getUserName() != null, "missing user name for opening session"); } if (authenticator.equals(ClientAuthnDTO.AuthenticatorType.EXTERNALBROWSER)) { // force to set the flag. loginInput.sessionParameters.put(CLIENT_STORE_TEMPORARY_CREDENTIAL, true); } else { // TODO: patch for now. We should update mergeProperteis // to normalize all parameters using STRING_PARAMS, INT_PARAMS and // BOOLEAN_PARAMS. Object value = loginInput.sessionParameters.get( CLIENT_STORE_TEMPORARY_CREDENTIAL); if (value != null) { loginInput.sessionParameters.put( CLIENT_STORE_TEMPORARY_CREDENTIAL, asBoolean(value)); } } boolean isClientStoreTemporaryCredential = asBoolean( loginInput.sessionParameters.get(CLIENT_STORE_TEMPORARY_CREDENTIAL)); LoginOutput loginOutput; if (isClientStoreTemporaryCredential && (loginOutput = readTemporaryCredential(loginInput)) != null) { return loginOutput; } return newSession(loginInput); } }
public class class_name { static public LoginOutput openSession(LoginInput loginInput) throws SFException, SnowflakeSQLException { AssertUtil.assertTrue(loginInput.getServerUrl() != null, "missing server URL for opening session"); AssertUtil.assertTrue(loginInput.getAppId() != null, "missing app id for opening session"); AssertUtil.assertTrue(loginInput.getLoginTimeout() >= 0, "negative login timeout for opening session"); final ClientAuthnDTO.AuthenticatorType authenticator = getAuthenticator( loginInput); if (!authenticator.equals(ClientAuthnDTO.AuthenticatorType.OAUTH)) { // OAuth does not require a username AssertUtil.assertTrue(loginInput.getUserName() != null, "missing user name for opening session"); } if (authenticator.equals(ClientAuthnDTO.AuthenticatorType.EXTERNALBROWSER)) { // force to set the flag. loginInput.sessionParameters.put(CLIENT_STORE_TEMPORARY_CREDENTIAL, true); } else { // TODO: patch for now. We should update mergeProperteis // to normalize all parameters using STRING_PARAMS, INT_PARAMS and // BOOLEAN_PARAMS. Object value = loginInput.sessionParameters.get( CLIENT_STORE_TEMPORARY_CREDENTIAL); if (value != null) { loginInput.sessionParameters.put( CLIENT_STORE_TEMPORARY_CREDENTIAL, asBoolean(value)); // depends on control dependency: [if], data = [none] } } boolean isClientStoreTemporaryCredential = asBoolean( loginInput.sessionParameters.get(CLIENT_STORE_TEMPORARY_CREDENTIAL)); LoginOutput loginOutput; if (isClientStoreTemporaryCredential && (loginOutput = readTemporaryCredential(loginInput)) != null) { return loginOutput; } return newSession(loginInput); } }
public class class_name { private void skipWhitespace() { while (ivPos < ivString.length() && Character.isWhitespace(ivString.charAt(ivPos))) { ivPos++; } } }
public class class_name { private void skipWhitespace() { while (ivPos < ivString.length() && Character.isWhitespace(ivString.charAt(ivPos))) { ivPos++; // depends on control dependency: [while], data = [none] } } }
public class class_name { private void fireRosterChangedEvent(Collection<String> addedEntries, Collection<String> updatedEntries, Collection<String> deletedEntries) { for (RosterListener listener : rosterListeners) { if (!addedEntries.isEmpty()) { listener.entriesAdded(addedEntries); } if (!updatedEntries.isEmpty()) { listener.entriesUpdated(updatedEntries); } if (!deletedEntries.isEmpty()) { listener.entriesDeleted(deletedEntries); } } } }
public class class_name { private void fireRosterChangedEvent(Collection<String> addedEntries, Collection<String> updatedEntries, Collection<String> deletedEntries) { for (RosterListener listener : rosterListeners) { if (!addedEntries.isEmpty()) { listener.entriesAdded(addedEntries); // depends on control dependency: [if], data = [none] } if (!updatedEntries.isEmpty()) { listener.entriesUpdated(updatedEntries); // depends on control dependency: [if], data = [none] } if (!deletedEntries.isEmpty()) { listener.entriesDeleted(deletedEntries); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public void link(Object source, CollectionDescriptor cds, List referencesToLink) { for(int i = 0; i < referencesToLink.size(); i++) { link(source, cds, referencesToLink.get(i)); } } }
public class class_name { public void link(Object source, CollectionDescriptor cds, List referencesToLink) { for(int i = 0; i < referencesToLink.size(); i++) { link(source, cds, referencesToLink.get(i)); // depends on control dependency: [for], data = [i] } } }
public class class_name { @Override public Object next() { try { mEvent = nextEvent(); } catch (final XMLStreamException exc) { exc.printStackTrace(); } return mEvent; } }
public class class_name { @Override public Object next() { try { mEvent = nextEvent(); // depends on control dependency: [try], data = [none] } catch (final XMLStreamException exc) { exc.printStackTrace(); } // depends on control dependency: [catch], data = [none] return mEvent; } }
public class class_name { public final String formatFinish(Format format) { if (format != null) { Long minFinish = interval.getMinFinish(); if (minFinish != null) { return format.format(minFinish); } else { return null; } } else { Long minFinish = interval.getMinFinish(); if (minFinish != null) { return numberFormat.get().format(minFinish); } else { return null; } } } }
public class class_name { public final String formatFinish(Format format) { if (format != null) { Long minFinish = interval.getMinFinish(); if (minFinish != null) { return format.format(minFinish); // depends on control dependency: [if], data = [(minFinish] } else { return null; // depends on control dependency: [if], data = [none] } } else { Long minFinish = interval.getMinFinish(); if (minFinish != null) { return numberFormat.get().format(minFinish); // depends on control dependency: [if], data = [(minFinish] } else { return null; // depends on control dependency: [if], data = [none] } } } }
public class class_name { @Override public boolean parseArguments(final PrintStream messageStream, String[] args) { final OptionSet parsedArguments; final OptionParser parser = getOptionParser(); try { // Preprocess the arguments before the parser sees them, replacing any tagged options // and their values with raw option names and surrogate key values, so that tagged // options can be recognized by the parser. The actual values will be retrieved using // the key when the fields's values are set. parsedArguments = parser.parse(tagParser.preprocessTaggedOptions(args)); } catch (final OptionException e) { throw new CommandLineException(e.getMessage()); } // Check if special short circuiting arguments were set if (isSpecialFlagSet(parsedArguments, SpecialArgumentsCollection.HELP_FULLNAME)) { messageStream.print(usage(true, isSpecialFlagSet(parsedArguments, SpecialArgumentsCollection.SHOW_HIDDEN_FULLNAME))); return false; } else if (isSpecialFlagSet(parsedArguments, SpecialArgumentsCollection.VERSION_FULLNAME)) { messageStream.println(getVersion()); return false; } else if (parsedArguments.has(SpecialArgumentsCollection.ARGUMENTS_FILE_FULLNAME)) { // If a special arguments file was specified, read arguments from it and recursively call parseArguments() final List<String> newArgs = expandFromArgumentFile(parsedArguments); if (!newArgs.isEmpty()) { // If we've expanded any argument files, we need to do another pass on the entire list post-expansion, // so clear any tag surrogates created in this pass (they'll be regenerated in the next pass). tagParser.resetTagSurrogates(); newArgs.addAll(Arrays.asList(args)); return parseArguments(messageStream, newArgs.toArray(new String[newArgs.size()])); } } return propagateParsedValues(parsedArguments); } }
public class class_name { @Override public boolean parseArguments(final PrintStream messageStream, String[] args) { final OptionSet parsedArguments; final OptionParser parser = getOptionParser(); try { // Preprocess the arguments before the parser sees them, replacing any tagged options // and their values with raw option names and surrogate key values, so that tagged // options can be recognized by the parser. The actual values will be retrieved using // the key when the fields's values are set. parsedArguments = parser.parse(tagParser.preprocessTaggedOptions(args)); // depends on control dependency: [try], data = [none] } catch (final OptionException e) { throw new CommandLineException(e.getMessage()); } // depends on control dependency: [catch], data = [none] // Check if special short circuiting arguments were set if (isSpecialFlagSet(parsedArguments, SpecialArgumentsCollection.HELP_FULLNAME)) { messageStream.print(usage(true, isSpecialFlagSet(parsedArguments, SpecialArgumentsCollection.SHOW_HIDDEN_FULLNAME))); // depends on control dependency: [if], data = [none] return false; // depends on control dependency: [if], data = [none] } else if (isSpecialFlagSet(parsedArguments, SpecialArgumentsCollection.VERSION_FULLNAME)) { messageStream.println(getVersion()); // depends on control dependency: [if], data = [none] return false; // depends on control dependency: [if], data = [none] } else if (parsedArguments.has(SpecialArgumentsCollection.ARGUMENTS_FILE_FULLNAME)) { // If a special arguments file was specified, read arguments from it and recursively call parseArguments() final List<String> newArgs = expandFromArgumentFile(parsedArguments); if (!newArgs.isEmpty()) { // If we've expanded any argument files, we need to do another pass on the entire list post-expansion, // so clear any tag surrogates created in this pass (they'll be regenerated in the next pass). tagParser.resetTagSurrogates(); // depends on control dependency: [if], data = [none] newArgs.addAll(Arrays.asList(args)); // depends on control dependency: [if], data = [none] return parseArguments(messageStream, newArgs.toArray(new String[newArgs.size()])); // depends on control dependency: [if], data = [none] } } return propagateParsedValues(parsedArguments); } }
public class class_name { public static String subtractSeq(String first, String second, String delimiter) { if (isEmpty(first)) { return ""; } if (isEmpty(second)) { StringBuilder builder = new StringBuilder(); if (!first.startsWith(delimiter)) builder.append(delimiter).append(first); if (!first.endsWith(delimiter)) builder.append(first).append(delimiter); return builder.toString(); } List<String> firstSeq = Arrays.asList(split(first, delimiter)); List<String> secondSeq = Arrays.asList(split(second, delimiter)); Collection<String> rs = CollectUtils.subtract(firstSeq, secondSeq); StringBuilder buf = new StringBuilder(); for (final String ele : rs) buf.append(delimiter).append(ele); if (buf.length() > 0) buf.append(delimiter); return buf.toString(); } }
public class class_name { public static String subtractSeq(String first, String second, String delimiter) { if (isEmpty(first)) { return ""; } // depends on control dependency: [if], data = [none] if (isEmpty(second)) { StringBuilder builder = new StringBuilder(); if (!first.startsWith(delimiter)) builder.append(delimiter).append(first); if (!first.endsWith(delimiter)) builder.append(first).append(delimiter); return builder.toString(); // depends on control dependency: [if], data = [none] } List<String> firstSeq = Arrays.asList(split(first, delimiter)); List<String> secondSeq = Arrays.asList(split(second, delimiter)); Collection<String> rs = CollectUtils.subtract(firstSeq, secondSeq); StringBuilder buf = new StringBuilder(); for (final String ele : rs) buf.append(delimiter).append(ele); if (buf.length() > 0) buf.append(delimiter); return buf.toString(); } }
public class class_name { private void validateNamesUnique(List<String> names) { List<String> seenNames = new ArrayList<>(names.size()); for (int i = 0; i < names.size(); i++) { String lowerCaseName = names.get(i).toLowerCase(); int index = seenNames.indexOf(lowerCaseName); if (index != -1) { throw new IllegalArgumentException("Duplicate field: " + lowerCaseName + " found at positions " + i + "and" + index + ". Field names are case insensitive and must be unique."); } seenNames.add(lowerCaseName); } } }
public class class_name { private void validateNamesUnique(List<String> names) { List<String> seenNames = new ArrayList<>(names.size()); for (int i = 0; i < names.size(); i++) { String lowerCaseName = names.get(i).toLowerCase(); int index = seenNames.indexOf(lowerCaseName); if (index != -1) { throw new IllegalArgumentException("Duplicate field: " + lowerCaseName + " found at positions " + i + "and" + index + ". Field names are case insensitive and must be unique."); } seenNames.add(lowerCaseName); // depends on control dependency: [for], data = [none] } } }
public class class_name { private String exWithQuery(String message, PrepareResult serverPrepareResult, ParameterHolder[] parameters) { if (options.dumpQueriesOnException) { StringBuilder sql = new StringBuilder(serverPrepareResult.getSql()); if (serverPrepareResult.getParamCount() > 0) { sql.append(", parameters ["); if (parameters.length > 0) { for (int i = 0; i < Math.min(parameters.length, serverPrepareResult.getParamCount()); i++) { sql.append(parameters[i].toString()).append(","); } sql = new StringBuilder(sql.substring(0, sql.length() - 1)); } sql.append("]"); } if (options.maxQuerySizeToLog != 0 && sql.length() > options.maxQuerySizeToLog - 3) { return message + "\nQuery is: " + sql.substring(0, options.maxQuerySizeToLog - 3) + "..." + "\njava thread: " + Thread.currentThread().getName(); } else { return message + "\nQuery is: " + sql + "\njava thread: " + Thread.currentThread().getName(); } } return message; } }
public class class_name { private String exWithQuery(String message, PrepareResult serverPrepareResult, ParameterHolder[] parameters) { if (options.dumpQueriesOnException) { StringBuilder sql = new StringBuilder(serverPrepareResult.getSql()); if (serverPrepareResult.getParamCount() > 0) { sql.append(", parameters ["); // depends on control dependency: [if], data = [none] if (parameters.length > 0) { for (int i = 0; i < Math.min(parameters.length, serverPrepareResult.getParamCount()); i++) { sql.append(parameters[i].toString()).append(","); // depends on control dependency: [for], data = [i] } sql = new StringBuilder(sql.substring(0, sql.length() - 1)); // depends on control dependency: [if], data = [none] } sql.append("]"); // depends on control dependency: [if], data = [none] } if (options.maxQuerySizeToLog != 0 && sql.length() > options.maxQuerySizeToLog - 3) { return message + "\nQuery is: " + sql.substring(0, options.maxQuerySizeToLog - 3) + "..." // depends on control dependency: [if], data = [none] + "\njava thread: " + Thread.currentThread().getName(); } else { return message + "\nQuery is: " + sql // depends on control dependency: [if], data = [none] + "\njava thread: " + Thread.currentThread().getName(); } } return message; } }
public class class_name { @Override public Long slCount(byte[] key, byte[] field, byte[] name) { try { if (isPipelined()) { pipeline(new JedisResult(pipeline.slcount(key, field, name))); return null; } return this.client.slcount(key, field, name); } catch (Exception ex) { throw convertException(ex); } } }
public class class_name { @Override public Long slCount(byte[] key, byte[] field, byte[] name) { try { if (isPipelined()) { pipeline(new JedisResult(pipeline.slcount(key, field, name))); // depends on control dependency: [if], data = [none] return null; // depends on control dependency: [if], data = [none] } return this.client.slcount(key, field, name); // depends on control dependency: [try], data = [none] } catch (Exception ex) { throw convertException(ex); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public synchronized void updateDeployMode(DeployMode mode) { mDeployMode = mode; if (mDeployMode == DeployMode.EMBEDDED) { // Ensure that the journal properties are set correctly. for (int i = 0; i < mMasters.size(); i++) { Master master = mMasters.get(i); MasterNetAddress address = mMasterAddresses.get(i); master.updateConf(PropertyKey.MASTER_EMBEDDED_JOURNAL_PORT, Integer.toString(address.getEmbeddedJournalPort())); File journalDir = new File(mWorkDir, "journal" + i); journalDir.mkdirs(); master.updateConf(PropertyKey.MASTER_JOURNAL_FOLDER, journalDir.getAbsolutePath()); } } } }
public class class_name { public synchronized void updateDeployMode(DeployMode mode) { mDeployMode = mode; if (mDeployMode == DeployMode.EMBEDDED) { // Ensure that the journal properties are set correctly. for (int i = 0; i < mMasters.size(); i++) { Master master = mMasters.get(i); MasterNetAddress address = mMasterAddresses.get(i); master.updateConf(PropertyKey.MASTER_EMBEDDED_JOURNAL_PORT, Integer.toString(address.getEmbeddedJournalPort())); // depends on control dependency: [for], data = [none] File journalDir = new File(mWorkDir, "journal" + i); journalDir.mkdirs(); // depends on control dependency: [for], data = [none] master.updateConf(PropertyKey.MASTER_JOURNAL_FOLDER, journalDir.getAbsolutePath()); // depends on control dependency: [for], data = [none] } } } }
public class class_name { public static Path subPath(Path path, int fromIndex, int toIndex) { if (null == path) { return null; } final int len = path.getNameCount(); if (fromIndex < 0) { fromIndex = len + fromIndex; if (fromIndex < 0) { fromIndex = 0; } } else if (fromIndex > len) { fromIndex = len; } if (toIndex < 0) { toIndex = len + toIndex; if (toIndex < 0) { toIndex = len; } } else if (toIndex > len) { toIndex = len; } if (toIndex < fromIndex) { int tmp = fromIndex; fromIndex = toIndex; toIndex = tmp; } if (fromIndex == toIndex) { return null; } return path.subpath(fromIndex, toIndex); } }
public class class_name { public static Path subPath(Path path, int fromIndex, int toIndex) { if (null == path) { return null; // depends on control dependency: [if], data = [none] } final int len = path.getNameCount(); if (fromIndex < 0) { fromIndex = len + fromIndex; // depends on control dependency: [if], data = [none] if (fromIndex < 0) { fromIndex = 0; // depends on control dependency: [if], data = [none] } } else if (fromIndex > len) { fromIndex = len; // depends on control dependency: [if], data = [none] } if (toIndex < 0) { toIndex = len + toIndex; // depends on control dependency: [if], data = [none] if (toIndex < 0) { toIndex = len; // depends on control dependency: [if], data = [none] } } else if (toIndex > len) { toIndex = len; // depends on control dependency: [if], data = [none] } if (toIndex < fromIndex) { int tmp = fromIndex; fromIndex = toIndex; // depends on control dependency: [if], data = [none] toIndex = tmp; // depends on control dependency: [if], data = [none] } if (fromIndex == toIndex) { return null; // depends on control dependency: [if], data = [none] } return path.subpath(fromIndex, toIndex); } }
public class class_name { public Observable<ServiceResponseWithHeaders<Page<CloudPool>, PoolListHeaders>> listWithServiceResponseAsync() { return listSinglePageAsync() .concatMap(new Func1<ServiceResponseWithHeaders<Page<CloudPool>, PoolListHeaders>, Observable<ServiceResponseWithHeaders<Page<CloudPool>, PoolListHeaders>>>() { @Override public Observable<ServiceResponseWithHeaders<Page<CloudPool>, PoolListHeaders>> call(ServiceResponseWithHeaders<Page<CloudPool>, PoolListHeaders> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink, null)); } }); } }
public class class_name { public Observable<ServiceResponseWithHeaders<Page<CloudPool>, PoolListHeaders>> listWithServiceResponseAsync() { return listSinglePageAsync() .concatMap(new Func1<ServiceResponseWithHeaders<Page<CloudPool>, PoolListHeaders>, Observable<ServiceResponseWithHeaders<Page<CloudPool>, PoolListHeaders>>>() { @Override public Observable<ServiceResponseWithHeaders<Page<CloudPool>, PoolListHeaders>> call(ServiceResponseWithHeaders<Page<CloudPool>, PoolListHeaders> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); // depends on control dependency: [if], data = [none] } return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink, null)); } }); } }
public class class_name { private void setTaskStagingDir() { if (this.jobState.contains(ConfigurationKeys.WRITER_STAGING_DIR)) { LOG.warn(String.format("Property %s is deprecated. No need to use it if %s is specified.", ConfigurationKeys.WRITER_STAGING_DIR, ConfigurationKeys.TASK_DATA_ROOT_DIR_KEY)); } else { String workingDir = this.jobState.getProp(ConfigurationKeys.TASK_DATA_ROOT_DIR_KEY); this.jobState .setProp(ConfigurationKeys.WRITER_STAGING_DIR, new Path(workingDir, TASK_STAGING_DIR_NAME).toString()); LOG.info(String.format("Writer Staging Directory is set to %s.", this.jobState.getProp(ConfigurationKeys.WRITER_STAGING_DIR))); } } }
public class class_name { private void setTaskStagingDir() { if (this.jobState.contains(ConfigurationKeys.WRITER_STAGING_DIR)) { LOG.warn(String.format("Property %s is deprecated. No need to use it if %s is specified.", ConfigurationKeys.WRITER_STAGING_DIR, ConfigurationKeys.TASK_DATA_ROOT_DIR_KEY)); // depends on control dependency: [if], data = [none] } else { String workingDir = this.jobState.getProp(ConfigurationKeys.TASK_DATA_ROOT_DIR_KEY); this.jobState .setProp(ConfigurationKeys.WRITER_STAGING_DIR, new Path(workingDir, TASK_STAGING_DIR_NAME).toString()); // depends on control dependency: [if], data = [none] LOG.info(String.format("Writer Staging Directory is set to %s.", this.jobState.getProp(ConfigurationKeys.WRITER_STAGING_DIR))); // depends on control dependency: [if], data = [none] } } }
public class class_name { void refresh(final DFSContent content) { if (this.sviewer != null) { Display.getDefault().asyncExec(new Runnable() { public void run() { DFSContentProvider.this.sviewer.refresh(content); } }); } else { refresh(); } } }
public class class_name { void refresh(final DFSContent content) { if (this.sviewer != null) { Display.getDefault().asyncExec(new Runnable() { public void run() { DFSContentProvider.this.sviewer.refresh(content); } }); // depends on control dependency: [if], data = [none] } else { refresh(); // depends on control dependency: [if], data = [none] } } }
public class class_name { public INameable get(String name) { if (name == null) throw new IllegalStateException("name must not be null"); if (_nameMap == null) return null; TrackingObject to = (TrackingObject) _nameMap.get(name); // The object wasn't found if (to == null) return null; // If the object has been reclaimed, then we remove the named object from the map. WeakReference wr = to.getWeakINameable(); INameable o = (INameable) wr.get(); if (o == null) { synchronized (_nameMap) { _nameMap.remove(name); } return null; } return o; } }
public class class_name { public INameable get(String name) { if (name == null) throw new IllegalStateException("name must not be null"); if (_nameMap == null) return null; TrackingObject to = (TrackingObject) _nameMap.get(name); // The object wasn't found if (to == null) return null; // If the object has been reclaimed, then we remove the named object from the map. WeakReference wr = to.getWeakINameable(); INameable o = (INameable) wr.get(); if (o == null) { synchronized (_nameMap) { _nameMap.remove(name); } // depends on control dependency: [if], data = [none] return null; // depends on control dependency: [if], data = [none] } return o; } }
public class class_name { private void generateGroupProperties( final StringBuilder sb, final List<Token> tokens, final String prefix) { for (int i = 0, size = tokens.size(); i < size; i++) { final Token token = tokens.get(i); if (token.signal() == Signal.BEGIN_GROUP) { final String propertyName = formatPropertyName(token.name()); generateId(sb, prefix, propertyName, token); generateSinceActingDeprecated(sb, prefix, propertyName, token); generateExtensibilityMethods(sb, prefix + propertyName, token); // Look inside for nested groups with extra prefix generateGroupProperties( sb, tokens.subList(i + 1, i + token.componentTokenCount() - 1), prefix + propertyName); i += token.componentTokenCount() - 1; } } } }
public class class_name { private void generateGroupProperties( final StringBuilder sb, final List<Token> tokens, final String prefix) { for (int i = 0, size = tokens.size(); i < size; i++) { final Token token = tokens.get(i); if (token.signal() == Signal.BEGIN_GROUP) { final String propertyName = formatPropertyName(token.name()); generateId(sb, prefix, propertyName, token); // depends on control dependency: [if], data = [none] generateSinceActingDeprecated(sb, prefix, propertyName, token); // depends on control dependency: [if], data = [none] generateExtensibilityMethods(sb, prefix + propertyName, token); // depends on control dependency: [if], data = [none] // Look inside for nested groups with extra prefix generateGroupProperties( sb, tokens.subList(i + 1, i + token.componentTokenCount() - 1), prefix + propertyName); // depends on control dependency: [if], data = [none] i += token.componentTokenCount() - 1; // depends on control dependency: [if], data = [none] } } } }
public class class_name { private BusHandler createForeignBus( String linkName, String stringLinkUuid, ForeignBusDefinition foreignBusDefinition) throws SINotPossibleInCurrentConfigurationException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "createForeignBus", new Object[] { linkName, stringLinkUuid, foreignBusDefinition }); SIBUuid12 linkUuid = new SIBUuid12(stringLinkUuid); BusHandler busHandler = null; synchronized (linkIndex) { LinkTypeFilter filter = new LinkTypeFilter(); filter.VISIBLE = Boolean.TRUE; DestinationHandler linkHandler = linkIndex.findByUuid(linkUuid, filter); if (linkHandler == null) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit( tc, "createForeignBus", "Link not found"); SIMPNotPossibleInCurrentConfigurationException e = new SIMPNotPossibleInCurrentConfigurationException( nls_cwsik.getFormattedMessage( "DELIVERY_ERROR_SIRC_30", // LINK_NOT_FOUND_ERROR_CWSIP0047 new Object[] { linkName, stringLinkUuid, foreignBusDefinition.getName() }, null)); e.setExceptionReason(SIRCConstants.SIRC0030_LINK_NOT_FOUND_ERROR); e.setExceptionInserts(new String[] { linkName, stringLinkUuid, foreignBusDefinition.getName() }); throw e; } // Create a new BusHandler, which is created locked busHandler = new BusHandler( foreignBusDefinition, messageProcessor, this, durableSubscriptions, (LinkHandler) linkHandler); ForeignBusIndex.Type type = new ForeignBusIndex.Type(); type.state = State.ACTIVE; foreignBusIndex.put(busHandler, type); // As a Bus is an extension of an Alias destination, register control adapter here busHandler.registerControlAdapters(); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "createForeignBus", busHandler); return busHandler; } }
public class class_name { private BusHandler createForeignBus( String linkName, String stringLinkUuid, ForeignBusDefinition foreignBusDefinition) throws SINotPossibleInCurrentConfigurationException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "createForeignBus", new Object[] { linkName, stringLinkUuid, foreignBusDefinition }); SIBUuid12 linkUuid = new SIBUuid12(stringLinkUuid); BusHandler busHandler = null; synchronized (linkIndex) { LinkTypeFilter filter = new LinkTypeFilter(); filter.VISIBLE = Boolean.TRUE; DestinationHandler linkHandler = linkIndex.findByUuid(linkUuid, filter); if (linkHandler == null) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit( tc, "createForeignBus", "Link not found"); SIMPNotPossibleInCurrentConfigurationException e = new SIMPNotPossibleInCurrentConfigurationException( nls_cwsik.getFormattedMessage( "DELIVERY_ERROR_SIRC_30", // LINK_NOT_FOUND_ERROR_CWSIP0047 new Object[] { linkName, stringLinkUuid, foreignBusDefinition.getName() }, null)); e.setExceptionReason(SIRCConstants.SIRC0030_LINK_NOT_FOUND_ERROR); // depends on control dependency: [if], data = [none] e.setExceptionInserts(new String[] { linkName, stringLinkUuid, foreignBusDefinition.getName() }); // depends on control dependency: [if], data = [none] throw e; } // Create a new BusHandler, which is created locked busHandler = new BusHandler( foreignBusDefinition, messageProcessor, this, durableSubscriptions, (LinkHandler) linkHandler); ForeignBusIndex.Type type = new ForeignBusIndex.Type(); type.state = State.ACTIVE; foreignBusIndex.put(busHandler, type); // As a Bus is an extension of an Alias destination, register control adapter here busHandler.registerControlAdapters(); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "createForeignBus", busHandler); return busHandler; } }
public class class_name { @Override public synchronized void controllerUpdate(ControllerEvent ce) { Player p = (Player) ce.getSourceController(); if (p == null) return; // Get this when the internal players are realized. if (ce instanceof RealizeCompleteEvent) { p.start(); } if (ce instanceof ControllerErrorEvent) { p.removeControllerListener(this); LOGGER.severe("Receiver internal error: " + ce); } } }
public class class_name { @Override public synchronized void controllerUpdate(ControllerEvent ce) { Player p = (Player) ce.getSourceController(); if (p == null) return; // Get this when the internal players are realized. if (ce instanceof RealizeCompleteEvent) { p.start(); // depends on control dependency: [if], data = [none] } if (ce instanceof ControllerErrorEvent) { p.removeControllerListener(this); // depends on control dependency: [if], data = [none] LOGGER.severe("Receiver internal error: " + ce); // depends on control dependency: [if], data = [none] } } }
public class class_name { private CoordTile getClosestAvailableTile(Pathfindable mover, int stx, int sty, int stw, int sth, int dtx, int dty, int dtw, int dth, int radius) { int closestX = 0; int closestY = 0; double dist = Double.MAX_VALUE; int size = 1; boolean found = false; while (!found) { for (int tx = stx - size; tx <= stx + size; tx++) { for (int ty = sty - size; ty <= sty + size; ty++) { if (isAreaAvailable(mover, tx, ty, stw, sth, null)) { final double d = UtilMath.getDistance(tx, ty, stw, sth, dtx, dty, dtw, dth); if (d < dist) { dist = d; closestX = tx; closestY = ty; found = true; } } } } size++; if (size >= radius) { return null; } } return new CoordTile(closestX, closestY); } }
public class class_name { private CoordTile getClosestAvailableTile(Pathfindable mover, int stx, int sty, int stw, int sth, int dtx, int dty, int dtw, int dth, int radius) { int closestX = 0; int closestY = 0; double dist = Double.MAX_VALUE; int size = 1; boolean found = false; while (!found) { for (int tx = stx - size; tx <= stx + size; tx++) { for (int ty = sty - size; ty <= sty + size; ty++) { if (isAreaAvailable(mover, tx, ty, stw, sth, null)) { final double d = UtilMath.getDistance(tx, ty, stw, sth, dtx, dty, dtw, dth); if (d < dist) { dist = d; // depends on control dependency: [if], data = [none] closestX = tx; // depends on control dependency: [if], data = [none] closestY = ty; // depends on control dependency: [if], data = [none] found = true; // depends on control dependency: [if], data = [none] } } } } size++; // depends on control dependency: [while], data = [none] if (size >= radius) { return null; // depends on control dependency: [if], data = [none] } } return new CoordTile(closestX, closestY); } }
public class class_name { static Completable wrap( CompletableSource source, Collection<ReactiveInstrumenter> instrumentations) { if (source instanceof Callable) { return new RxInstrumentedCallableCompletable<>(source, instrumentations); } return new RxInstrumentedCompletable(source, instrumentations); } }
public class class_name { static Completable wrap( CompletableSource source, Collection<ReactiveInstrumenter> instrumentations) { if (source instanceof Callable) { return new RxInstrumentedCallableCompletable<>(source, instrumentations); // depends on control dependency: [if], data = [none] } return new RxInstrumentedCompletable(source, instrumentations); } }
public class class_name { public AbstractStreamParameters track(String track) { if (this.track.length() > 0) { this.track.append(','); } this.track.append(track); return this; } }
public class class_name { public AbstractStreamParameters track(String track) { if (this.track.length() > 0) { this.track.append(','); // depends on control dependency: [if], data = [none] } this.track.append(track); return this; } }
public class class_name { @Override public boolean matches(final CharSequence rawPassword, final String encodedPassword) { if (StringUtils.isBlank(encodedPassword)) { LOGGER.warn("The encoded password provided for matching is null. Returning false"); return false; } var providedSalt = StringUtils.EMPTY; val lastDollarIndex = encodedPassword.lastIndexOf('$'); if (lastDollarIndex == -1) { providedSalt = encodedPassword.substring(0, 2); LOGGER.debug("Assuming DES UnixCrypt as no delimiter could be found in the encoded password provided"); } else { providedSalt = encodedPassword.substring(0, lastDollarIndex); LOGGER.debug("Encoded password uses algorithm [{}]", providedSalt.charAt(1)); } var encodedRawPassword = Crypt.crypt(rawPassword.toString(), providedSalt); var matched = StringUtils.equals(encodedRawPassword, encodedPassword); LOGGER.debug("Provided password does {}match the encoded password", BooleanUtils.toString(matched, StringUtils.EMPTY, "not ")); return matched; } }
public class class_name { @Override public boolean matches(final CharSequence rawPassword, final String encodedPassword) { if (StringUtils.isBlank(encodedPassword)) { LOGGER.warn("The encoded password provided for matching is null. Returning false"); // depends on control dependency: [if], data = [none] return false; // depends on control dependency: [if], data = [none] } var providedSalt = StringUtils.EMPTY; val lastDollarIndex = encodedPassword.lastIndexOf('$'); if (lastDollarIndex == -1) { providedSalt = encodedPassword.substring(0, 2); // depends on control dependency: [if], data = [none] LOGGER.debug("Assuming DES UnixCrypt as no delimiter could be found in the encoded password provided"); // depends on control dependency: [if], data = [none] } else { providedSalt = encodedPassword.substring(0, lastDollarIndex); // depends on control dependency: [if], data = [none] LOGGER.debug("Encoded password uses algorithm [{}]", providedSalt.charAt(1)); // depends on control dependency: [if], data = [none] } var encodedRawPassword = Crypt.crypt(rawPassword.toString(), providedSalt); var matched = StringUtils.equals(encodedRawPassword, encodedPassword); LOGGER.debug("Provided password does {}match the encoded password", BooleanUtils.toString(matched, StringUtils.EMPTY, "not ")); return matched; } }
public class class_name { protected void add(GroupMember member) { Assert.notNull(member, "member"); if (members.add(member)) { member.onAdded(); } } }
public class class_name { protected void add(GroupMember member) { Assert.notNull(member, "member"); if (members.add(member)) { member.onAdded(); // depends on control dependency: [if], data = [none] } } }