code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { public static String encryptToBase64Url(String url) { url = encryptToBase64(url); if (url.indexOf("+") != -1) { url = url.replaceAll("\\+", "*"); } if (url.indexOf("/") != -1) { url = url.replaceAll("/", "_"); } return url; } }
public class class_name { public static String encryptToBase64Url(String url) { url = encryptToBase64(url); if (url.indexOf("+") != -1) { url = url.replaceAll("\\+", "*"); // depends on control dependency: [if], data = [none] } if (url.indexOf("/") != -1) { url = url.replaceAll("/", "_"); // depends on control dependency: [if], data = [none] } return url; } }
public class class_name { public static void endSfsbCreation() { SFSBCallStackThreadData data = CURRENT.get(); int no = data.creationBeanNestingLevel; no--; data.creationBeanNestingLevel = no; if (no == 0) { // Completed creating top level bean, remove 'xpc creation tracking' thread local data.creationTimeXPCRegistration = null; data.creationTimeInjectedXPCs = null; } else { // finished creating a sub-bean, switch to parent level 'xpc creation tracking' data.creationTimeInjectedXPCs = data.creationTimeInjectedXPCs.getParent(); } } }
public class class_name { public static void endSfsbCreation() { SFSBCallStackThreadData data = CURRENT.get(); int no = data.creationBeanNestingLevel; no--; data.creationBeanNestingLevel = no; if (no == 0) { // Completed creating top level bean, remove 'xpc creation tracking' thread local data.creationTimeXPCRegistration = null; // depends on control dependency: [if], data = [none] data.creationTimeInjectedXPCs = null; // depends on control dependency: [if], data = [none] } else { // finished creating a sub-bean, switch to parent level 'xpc creation tracking' data.creationTimeInjectedXPCs = data.creationTimeInjectedXPCs.getParent(); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static int getPeriodDays(Date start, Date end) { try { start = FORMAT_DATE_.parse(FORMAT_DATE_.format(start)); end = FORMAT_DATE_.parse(FORMAT_DATE_.format(end)); Calendar cal = Calendar.getInstance(); cal.setTime(start); long time1 = cal.getTimeInMillis(); cal.setTime(end); long time2 = cal.getTimeInMillis(); long between_days = (time2 - time1) / (1000 * 3600 * 24); return Integer.parseInt(String.valueOf(between_days)); } catch (Exception e) { throw new KnifeUtilsException(e); } } }
public class class_name { public static int getPeriodDays(Date start, Date end) { try { start = FORMAT_DATE_.parse(FORMAT_DATE_.format(start)); // depends on control dependency: [try], data = [none] end = FORMAT_DATE_.parse(FORMAT_DATE_.format(end)); // depends on control dependency: [try], data = [none] Calendar cal = Calendar.getInstance(); cal.setTime(start); // depends on control dependency: [try], data = [none] long time1 = cal.getTimeInMillis(); cal.setTime(end); // depends on control dependency: [try], data = [none] long time2 = cal.getTimeInMillis(); long between_days = (time2 - time1) / (1000 * 3600 * 24); return Integer.parseInt(String.valueOf(between_days)); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new KnifeUtilsException(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static Optional<String> substringBetween(String str, int exclusiveBeginIndex, int exclusiveEndIndex) { if (exclusiveBeginIndex < 0 || exclusiveEndIndex < 0 || exclusiveBeginIndex >= exclusiveEndIndex) { return Optional.<String> empty(); } return Optional.of(str.substring(exclusiveBeginIndex + 1, exclusiveEndIndex)); } }
public class class_name { public static Optional<String> substringBetween(String str, int exclusiveBeginIndex, int exclusiveEndIndex) { if (exclusiveBeginIndex < 0 || exclusiveEndIndex < 0 || exclusiveBeginIndex >= exclusiveEndIndex) { return Optional.<String> empty(); // depends on control dependency: [if], data = [none] } return Optional.of(str.substring(exclusiveBeginIndex + 1, exclusiveEndIndex)); } }
public class class_name { public void addComment(Comment comment) { assertNotNull(comment); if (comments == null) { comments = new TreeSet<Comment>(new AstNode.PositionComparator()); } comments.add(comment); comment.setParent(this); } }
public class class_name { public void addComment(Comment comment) { assertNotNull(comment); if (comments == null) { comments = new TreeSet<Comment>(new AstNode.PositionComparator()); // depends on control dependency: [if], data = [none] } comments.add(comment); comment.setParent(this); } }
public class class_name { private void _addActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event__addActionPerformed JFileChooser fc = new JFileChooser(); fc.setMultiSelectionEnabled(true); fc.setFileSelectionMode(JFileChooser.FILES_ONLY); fc.setFileFilter(new FileFilter() { @Override public boolean accept(File f) { return f.isDirectory() || f.getName().endsWith(".R") || f.getName().endsWith(".Rdata"); } @Override public String getDescription() { return "R object file"; } }); if (fc.showOpenDialog(this) == JFileChooser.APPROVE_OPTION && fc.getSelectedFiles() != null) { File[] files = fc.getSelectedFiles(); for (File file : files) { if (file.getName().endsWith(".R")) { if (R != null) { R.source(file); } } else if (file.getName().endsWith(".Rdata")) { if (R != null) { R.load(file); } } else { Log.Out.println("Not loading/sourcing " + file.getName()); } } } update(); } }
public class class_name { private void _addActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event__addActionPerformed JFileChooser fc = new JFileChooser(); fc.setMultiSelectionEnabled(true); fc.setFileSelectionMode(JFileChooser.FILES_ONLY); fc.setFileFilter(new FileFilter() { @Override public boolean accept(File f) { return f.isDirectory() || f.getName().endsWith(".R") || f.getName().endsWith(".Rdata"); } @Override public String getDescription() { return "R object file"; } }); if (fc.showOpenDialog(this) == JFileChooser.APPROVE_OPTION && fc.getSelectedFiles() != null) { File[] files = fc.getSelectedFiles(); for (File file : files) { if (file.getName().endsWith(".R")) { if (R != null) { R.source(file); // depends on control dependency: [if], data = [none] } } else if (file.getName().endsWith(".Rdata")) { if (R != null) { R.load(file); // depends on control dependency: [if], data = [none] } } else { Log.Out.println("Not loading/sourcing " + file.getName()); // depends on control dependency: [if], data = [none] } } } update(); } }
public class class_name { public static String concat(String mainUrl, String... relativeUrls) { String concatenatedUrl = mainUrl; if (ArrayUtils.isNotEmpty(relativeUrls)) { for (String relativeUrl : relativeUrls) { concatenatedUrl = concat(concatenatedUrl, relativeUrl); } } return concatenatedUrl; } }
public class class_name { public static String concat(String mainUrl, String... relativeUrls) { String concatenatedUrl = mainUrl; if (ArrayUtils.isNotEmpty(relativeUrls)) { for (String relativeUrl : relativeUrls) { concatenatedUrl = concat(concatenatedUrl, relativeUrl); // depends on control dependency: [for], data = [relativeUrl] } } return concatenatedUrl; } }
public class class_name { public MockInjectionStrategy thenTry(MockInjectionStrategy strategy) { if(nextStrategy != null) { nextStrategy.thenTry(strategy); } else { nextStrategy = strategy; } return strategy; } }
public class class_name { public MockInjectionStrategy thenTry(MockInjectionStrategy strategy) { if(nextStrategy != null) { nextStrategy.thenTry(strategy); // depends on control dependency: [if], data = [none] } else { nextStrategy = strategy; // depends on control dependency: [if], data = [none] } return strategy; } }
public class class_name { public List<String> toList() { List<String> list = new LinkedList<String>(); if (authority != null) { list.add(authority); } for (Term t : terms) { list.add(t.toString()); } return list; } }
public class class_name { public List<String> toList() { List<String> list = new LinkedList<String>(); if (authority != null) { list.add(authority); // depends on control dependency: [if], data = [(authority] } for (Term t : terms) { list.add(t.toString()); // depends on control dependency: [for], data = [t] } return list; } }
public class class_name { public static double getRefRMSD(List<Atom[]> transformed, int reference) { double sumSqDist = 0; int totalLength = 0; for (int c = 0; c < transformed.get(reference).length; c++) { Atom refAtom = transformed.get(reference)[c]; if (refAtom == null) continue; double nonNullSqDist = 0; int nonNullLength = 0; for (int r = 0; r < transformed.size(); r++) { if (r == reference) continue; Atom atom = transformed.get(r)[c]; if (atom != null) { nonNullSqDist += Calc.getDistanceFast(refAtom, atom); nonNullLength++; } } if (nonNullLength > 0) { totalLength++; sumSqDist += nonNullSqDist / nonNullLength; } } return Math.sqrt(sumSqDist / totalLength); } }
public class class_name { public static double getRefRMSD(List<Atom[]> transformed, int reference) { double sumSqDist = 0; int totalLength = 0; for (int c = 0; c < transformed.get(reference).length; c++) { Atom refAtom = transformed.get(reference)[c]; if (refAtom == null) continue; double nonNullSqDist = 0; int nonNullLength = 0; for (int r = 0; r < transformed.size(); r++) { if (r == reference) continue; Atom atom = transformed.get(r)[c]; if (atom != null) { nonNullSqDist += Calc.getDistanceFast(refAtom, atom); // depends on control dependency: [if], data = [none] nonNullLength++; // depends on control dependency: [if], data = [none] } } if (nonNullLength > 0) { totalLength++; // depends on control dependency: [if], data = [none] sumSqDist += nonNullSqDist / nonNullLength; // depends on control dependency: [if], data = [none] } } return Math.sqrt(sumSqDist / totalLength); } }
public class class_name { public JsonNode getSubAttr(String attrName, String dPath) { Lock lock = lockForRead(); try { return JacksonUtils.getValue(getAttribute(attrName), dPath); } finally { lock.unlock(); } } }
public class class_name { public JsonNode getSubAttr(String attrName, String dPath) { Lock lock = lockForRead(); try { return JacksonUtils.getValue(getAttribute(attrName), dPath); // depends on control dependency: [try], data = [none] } finally { lock.unlock(); } } }
public class class_name { public void marshall(GetLoadBalancerMetricDataRequest getLoadBalancerMetricDataRequest, ProtocolMarshaller protocolMarshaller) { if (getLoadBalancerMetricDataRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(getLoadBalancerMetricDataRequest.getLoadBalancerName(), LOADBALANCERNAME_BINDING); protocolMarshaller.marshall(getLoadBalancerMetricDataRequest.getMetricName(), METRICNAME_BINDING); protocolMarshaller.marshall(getLoadBalancerMetricDataRequest.getPeriod(), PERIOD_BINDING); protocolMarshaller.marshall(getLoadBalancerMetricDataRequest.getStartTime(), STARTTIME_BINDING); protocolMarshaller.marshall(getLoadBalancerMetricDataRequest.getEndTime(), ENDTIME_BINDING); protocolMarshaller.marshall(getLoadBalancerMetricDataRequest.getUnit(), UNIT_BINDING); protocolMarshaller.marshall(getLoadBalancerMetricDataRequest.getStatistics(), STATISTICS_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(GetLoadBalancerMetricDataRequest getLoadBalancerMetricDataRequest, ProtocolMarshaller protocolMarshaller) { if (getLoadBalancerMetricDataRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(getLoadBalancerMetricDataRequest.getLoadBalancerName(), LOADBALANCERNAME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(getLoadBalancerMetricDataRequest.getMetricName(), METRICNAME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(getLoadBalancerMetricDataRequest.getPeriod(), PERIOD_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(getLoadBalancerMetricDataRequest.getStartTime(), STARTTIME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(getLoadBalancerMetricDataRequest.getEndTime(), ENDTIME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(getLoadBalancerMetricDataRequest.getUnit(), UNIT_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(getLoadBalancerMetricDataRequest.getStatistics(), STATISTICS_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private void setRenderArgs(ITemplate t, Object... args) { if (null == args) { t.__setRenderArg(0, null); } else if (1 == args.length) { Object o0 = args[0]; if (o0 instanceof Map) { t.__setRenderArgs((Map<String, Object>) args[0]); } else if (o0 instanceof JSONWrapper) { t.__setRenderArg((JSONWrapper) o0); } else { t.__setRenderArgs(args); } } else { t.__setRenderArgs(args); } //if (mode.isDev()) cceCounter.remove(); } }
public class class_name { private void setRenderArgs(ITemplate t, Object... args) { if (null == args) { t.__setRenderArg(0, null); // depends on control dependency: [if], data = [none] } else if (1 == args.length) { Object o0 = args[0]; if (o0 instanceof Map) { t.__setRenderArgs((Map<String, Object>) args[0]); // depends on control dependency: [if], data = [none] } else if (o0 instanceof JSONWrapper) { t.__setRenderArg((JSONWrapper) o0); // depends on control dependency: [if], data = [none] } else { t.__setRenderArgs(args); // depends on control dependency: [if], data = [none] } } else { t.__setRenderArgs(args); // depends on control dependency: [if], data = [none] } //if (mode.isDev()) cceCounter.remove(); } }
public class class_name { public void setValues( final Collection<?> values ) { if (values != _values) { clear(); if (values == null || values.size() == 0) { return; } for (Object value : values) { addValue( value ); } } } }
public class class_name { public void setValues( final Collection<?> values ) { if (values != _values) { clear(); // depends on control dependency: [if], data = [none] if (values == null || values.size() == 0) { return; // depends on control dependency: [if], data = [none] } for (Object value : values) { addValue( value ); // depends on control dependency: [for], data = [value] } } } }
public class class_name { private DBObject parseObject(TableDefinition tableDef, UNode docNode) { assert tableDef != null; assert docNode != null; assert docNode.getName().equals("doc"); // Create the DBObject that we will return and parse the child nodes into it. DBObject dbObj = new DBObject(); for (UNode childNode: docNode.getMemberList()) { // Extract field name and characterize what we expect. String fieldName = childNode.getName(); FieldDefinition fieldDef = tableDef.getFieldDef(fieldName); boolean isLinkField = fieldDef == null ? false : fieldDef.isLinkField(); boolean isGroupField = fieldDef == null ? false : fieldDef.isGroupField(); boolean isCollection = fieldDef == null ? false : fieldDef.isCollection(); Utils.require(!isGroupField, // we currently don't expect group fields in query results "Unexpected group field in query results: " + fieldName); // Parse value based on what we expect. if (isLinkField) { parseLinkValue(dbObj, childNode, fieldDef); } else if (isCollection) { parseMVScalarValue(dbObj, childNode, fieldDef); } else { // Simple SV scalar value. Utils.require(childNode.isValue(), "Value of an SV scalar must be a value: " + childNode); dbObj.addFieldValue(fieldName, childNode.getValue()); } } // Our object is complete return dbObj; } }
public class class_name { private DBObject parseObject(TableDefinition tableDef, UNode docNode) { assert tableDef != null; assert docNode != null; assert docNode.getName().equals("doc"); // Create the DBObject that we will return and parse the child nodes into it. DBObject dbObj = new DBObject(); for (UNode childNode: docNode.getMemberList()) { // Extract field name and characterize what we expect. String fieldName = childNode.getName(); FieldDefinition fieldDef = tableDef.getFieldDef(fieldName); boolean isLinkField = fieldDef == null ? false : fieldDef.isLinkField(); boolean isGroupField = fieldDef == null ? false : fieldDef.isGroupField(); boolean isCollection = fieldDef == null ? false : fieldDef.isCollection(); Utils.require(!isGroupField, // we currently don't expect group fields in query results "Unexpected group field in query results: " + fieldName); // depends on control dependency: [for], data = [none] // Parse value based on what we expect. if (isLinkField) { parseLinkValue(dbObj, childNode, fieldDef); // depends on control dependency: [if], data = [none] } else if (isCollection) { parseMVScalarValue(dbObj, childNode, fieldDef); // depends on control dependency: [if], data = [none] } else { // Simple SV scalar value. Utils.require(childNode.isValue(), "Value of an SV scalar must be a value: " + childNode); // depends on control dependency: [if], data = [none] dbObj.addFieldValue(fieldName, childNode.getValue()); // depends on control dependency: [if], data = [none] } } // Our object is complete return dbObj; } }
public class class_name { synchronized void add(PoolImplBase p) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, "add: " + p); if (!ivIsCanceled) { if (pools.isEmpty()) { startAlarm(); } pools.add(p); } } }
public class class_name { synchronized void add(PoolImplBase p) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, "add: " + p); if (!ivIsCanceled) { if (pools.isEmpty()) { startAlarm(); // depends on control dependency: [if], data = [none] } pools.add(p); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static void process(GrayI input, GrayI output, int radius , int[] storage ) { int w = 2*radius+1; if( storage == null ) { storage = new int[ w*w ]; } else if( storage.length < w*w ) { throw new IllegalArgumentException("'storage' must be at least of length "+(w*w)); } for( int y = 0; y < input.height; y++ ) { int minI = y - radius; int maxI = y + radius+1; // bound the y-axius inside the image if( minI < 0 ) minI = 0; if( maxI > input.height ) maxI = input.height; for( int x = 0; x < input.width; x++ ) { int minJ = x - radius; int maxJ = x + radius+1; // bound the x-axis to be inside the image if( minJ < 0 ) minJ = 0; if( maxJ > input.width ) maxJ = input.width; int index = 0; for( int i = minI; i < maxI; i++ ) { for( int j = minJ; j < maxJ; j++ ) { storage[index++] = input.get(j,i); } } // use quick select to avoid sorting the whole list int median = QuickSelect.select(storage, index / 2, index); output.set(x,y, median ); } } } }
public class class_name { public static void process(GrayI input, GrayI output, int radius , int[] storage ) { int w = 2*radius+1; if( storage == null ) { storage = new int[ w*w ]; // depends on control dependency: [if], data = [none] } else if( storage.length < w*w ) { throw new IllegalArgumentException("'storage' must be at least of length "+(w*w)); } for( int y = 0; y < input.height; y++ ) { int minI = y - radius; int maxI = y + radius+1; // bound the y-axius inside the image if( minI < 0 ) minI = 0; if( maxI > input.height ) maxI = input.height; for( int x = 0; x < input.width; x++ ) { int minJ = x - radius; int maxJ = x + radius+1; // bound the x-axis to be inside the image if( minJ < 0 ) minJ = 0; if( maxJ > input.width ) maxJ = input.width; int index = 0; for( int i = minI; i < maxI; i++ ) { for( int j = minJ; j < maxJ; j++ ) { storage[index++] = input.get(j,i); // depends on control dependency: [for], data = [j] } } // use quick select to avoid sorting the whole list int median = QuickSelect.select(storage, index / 2, index); output.set(x,y, median ); // depends on control dependency: [for], data = [x] } } } }
public class class_name { private void merger(Term fromTerm, int to, Map<String, Double> relationMap) { Term term = null; if (terms[to] != null) { term = terms[to]; while (term != null) { // 关系式to.set(from) term.setPathScore(fromTerm, relationMap); term = term.next(); } } else { char c = chars[to]; TermNatures tn = DATDictionary.getItem(c).termNatures; if (tn == null || tn == TermNatures.NULL) { tn = TermNatures.NULL; } terms[to] = new Term(String.valueOf(c), to, tn); terms[to].setPathScore(fromTerm, relationMap); } } }
public class class_name { private void merger(Term fromTerm, int to, Map<String, Double> relationMap) { Term term = null; if (terms[to] != null) { term = terms[to]; // depends on control dependency: [if], data = [none] while (term != null) { // 关系式to.set(from) term.setPathScore(fromTerm, relationMap); // depends on control dependency: [while], data = [none] term = term.next(); // depends on control dependency: [while], data = [none] } } else { char c = chars[to]; TermNatures tn = DATDictionary.getItem(c).termNatures; if (tn == null || tn == TermNatures.NULL) { tn = TermNatures.NULL; // depends on control dependency: [if], data = [none] } terms[to] = new Term(String.valueOf(c), to, tn); // depends on control dependency: [if], data = [none] terms[to].setPathScore(fromTerm, relationMap); // depends on control dependency: [if], data = [none] } } }
public class class_name { protected void closeLogExc(@Nullable final Closeable closeable) { if (closeable == null) { return; } try { closeable.close(); } catch (IOException e) { e.printStackTrace(); } } }
public class class_name { protected void closeLogExc(@Nullable final Closeable closeable) { if (closeable == null) { return; // depends on control dependency: [if], data = [none] } try { closeable.close(); // depends on control dependency: [try], data = [none] } catch (IOException e) { e.printStackTrace(); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static void sort(float[] floatArray) { int index = 0; float value = 0f; for(int i = 1; i < floatArray.length; i++) { index = i; value = floatArray[index]; while(index > 0 && value < floatArray[index - 1]) { floatArray[index] = floatArray[index - 1]; index--; } floatArray[index] = value; } } }
public class class_name { public static void sort(float[] floatArray) { int index = 0; float value = 0f; for(int i = 1; i < floatArray.length; i++) { index = i; // depends on control dependency: [for], data = [i] value = floatArray[index]; // depends on control dependency: [for], data = [none] while(index > 0 && value < floatArray[index - 1]) { floatArray[index] = floatArray[index - 1]; // depends on control dependency: [while], data = [none] index--; // depends on control dependency: [while], data = [none] } floatArray[index] = value; // depends on control dependency: [for], data = [none] } } }
public class class_name { private void loadExtDict() { // 加载扩展词典配置 List<String> extDictFiles = getExtDictionarys(); if (extDictFiles != null) { for (String extDictName : extDictFiles) { // 读取扩展词典文件 logger.info("[Dict Loading] " + extDictName); Path file = PathUtils.get(extDictName); loadDictFile(_MainDict, file, false, "Extra Dict"); } } } }
public class class_name { private void loadExtDict() { // 加载扩展词典配置 List<String> extDictFiles = getExtDictionarys(); if (extDictFiles != null) { for (String extDictName : extDictFiles) { // 读取扩展词典文件 logger.info("[Dict Loading] " + extDictName); // depends on control dependency: [for], data = [extDictName] Path file = PathUtils.get(extDictName); loadDictFile(_MainDict, file, false, "Extra Dict"); // depends on control dependency: [for], data = [none] } } } }
public class class_name { public void setClasspath(Path classpath) { if (taskClasspath == null) { taskClasspath = classpath; } else { taskClasspath.append(classpath); } } }
public class class_name { public void setClasspath(Path classpath) { if (taskClasspath == null) { taskClasspath = classpath; // depends on control dependency: [if], data = [none] } else { taskClasspath.append(classpath); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void marshall(CreateScalingPlanRequest createScalingPlanRequest, ProtocolMarshaller protocolMarshaller) { if (createScalingPlanRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(createScalingPlanRequest.getScalingPlanName(), SCALINGPLANNAME_BINDING); protocolMarshaller.marshall(createScalingPlanRequest.getApplicationSource(), APPLICATIONSOURCE_BINDING); protocolMarshaller.marshall(createScalingPlanRequest.getScalingInstructions(), SCALINGINSTRUCTIONS_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(CreateScalingPlanRequest createScalingPlanRequest, ProtocolMarshaller protocolMarshaller) { if (createScalingPlanRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(createScalingPlanRequest.getScalingPlanName(), SCALINGPLANNAME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(createScalingPlanRequest.getApplicationSource(), APPLICATIONSOURCE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(createScalingPlanRequest.getScalingInstructions(), SCALINGINSTRUCTIONS_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 MessageDigest getStrongestMessageDigest() { if (digestExists("SHA-512") && caps.contains(Capability.SHA_512)) { return getDigest("SHA-512"); } else if (digestExists("SHA-256") && caps.contains(Capability.SHA_256)) { return getDigest("SHA-256"); } else if (digestExists("SHA-1") && caps.contains(Capability.SHA_1)) { return getDigest("SHA-1"); } else if (digestExists("MD5")) { return getDigest("MD5"); } return null; } }
public class class_name { public MessageDigest getStrongestMessageDigest() { if (digestExists("SHA-512") && caps.contains(Capability.SHA_512)) { return getDigest("SHA-512"); // depends on control dependency: [if], data = [none] } else if (digestExists("SHA-256") && caps.contains(Capability.SHA_256)) { return getDigest("SHA-256"); // depends on control dependency: [if], data = [none] } else if (digestExists("SHA-1") && caps.contains(Capability.SHA_1)) { return getDigest("SHA-1"); // depends on control dependency: [if], data = [none] } else if (digestExists("MD5")) { return getDigest("MD5"); // depends on control dependency: [if], data = [none] } return null; } }
public class class_name { public void writeMucStyleCoref(Writer writer) throws IOException { require(prefs.readWord && prefs.readCoref, "AgigaPrefs.{readWord,readCoref} must be true for writeMucStyleCoref()"); assignMucStyleIdsAndRefsToMentions(); AgigaMention[] mentionArray = getAllMentions().toArray(new AgigaMention[0]); Arrays.sort(mentionArray, new StartMentionComparator()); LinkedList<AgigaMention> mentionStarts = new LinkedList<AgigaMention>(Arrays.asList(mentionArray)); log.finer("Total number of mentions: " + mentionStarts.size()); PriorityQueue<AgigaMention> mentionEnds = new PriorityQueue<AgigaMention>(11, new EndMentionComparator()); log.finer("Number of sentences: " + sents.size()); for (int s=0; s<sents.size(); s++) { AgigaSentence sent = sents.get(s); List<AgigaToken> tokens = sent.getTokens(); log.finer("Number of tokens: " + tokens.size()); for (int i=0; i<tokens.size()+1; i++) { while (mentionEnds.size() > 0 && mentionEnds.peek().getSentenceIdx() == s && mentionEnds.peek().getEndTokenIdx() == i) { mentionEnds.remove(); writer.write("</COREF>"); } if (i > 0 && i < tokens.size()) { writer.write(" "); } if (mentionEnds.size() > 0 && (mentionEnds.peek().getSentenceIdx() < s || (mentionEnds.peek().getSentenceIdx() == s && mentionEnds.peek().getEndTokenIdx() < i))) { writer.flush(); log.severe("mentionEnds: " + mentionEnds); throw new RuntimeException(String.format("Overlapping coref elements. s=%d i=%d", s, i)); } while (mentionStarts.size() > 0 && mentionStarts.peek().getSentenceIdx() == s && mentionStarts.peek().getStartTokenIdx() == i) { AgigaMention head = mentionStarts.pop(); if (head.isRepresentative()) { writer.write(String.format("<COREF ID=%d>", head.getMucId())); } else { writer.write(String.format("<COREF ID=%d REF=%d>", head.getMucId(), head.getMucRef())); } mentionEnds.add(head); } if (i >= tokens.size()) { break; } AgigaToken tok = tokens.get(i); writer.write(tok.getWord()); } require(mentionEnds.size() == 0); writer.write("\n"); } writer.write("\n"); } }
public class class_name { public void writeMucStyleCoref(Writer writer) throws IOException { require(prefs.readWord && prefs.readCoref, "AgigaPrefs.{readWord,readCoref} must be true for writeMucStyleCoref()"); assignMucStyleIdsAndRefsToMentions(); AgigaMention[] mentionArray = getAllMentions().toArray(new AgigaMention[0]); Arrays.sort(mentionArray, new StartMentionComparator()); LinkedList<AgigaMention> mentionStarts = new LinkedList<AgigaMention>(Arrays.asList(mentionArray)); log.finer("Total number of mentions: " + mentionStarts.size()); PriorityQueue<AgigaMention> mentionEnds = new PriorityQueue<AgigaMention>(11, new EndMentionComparator()); log.finer("Number of sentences: " + sents.size()); for (int s=0; s<sents.size(); s++) { AgigaSentence sent = sents.get(s); List<AgigaToken> tokens = sent.getTokens(); log.finer("Number of tokens: " + tokens.size()); for (int i=0; i<tokens.size()+1; i++) { while (mentionEnds.size() > 0 && mentionEnds.peek().getSentenceIdx() == s && mentionEnds.peek().getEndTokenIdx() == i) { mentionEnds.remove(); writer.write("</COREF>"); } if (i > 0 && i < tokens.size()) { writer.write(" "); } if (mentionEnds.size() > 0 && (mentionEnds.peek().getSentenceIdx() < s || (mentionEnds.peek().getSentenceIdx() == s && mentionEnds.peek().getEndTokenIdx() < i))) { writer.flush(); log.severe("mentionEnds: " + mentionEnds); throw new RuntimeException(String.format("Overlapping coref elements. s=%d i=%d", s, i)); } while (mentionStarts.size() > 0 && mentionStarts.peek().getSentenceIdx() == s && mentionStarts.peek().getStartTokenIdx() == i) { AgigaMention head = mentionStarts.pop(); if (head.isRepresentative()) { writer.write(String.format("<COREF ID=%d>", head.getMucId())); // depends on control dependency: [if], data = [none] } else { writer.write(String.format("<COREF ID=%d REF=%d>", head.getMucId(), head.getMucRef())); // depends on control dependency: [if], data = [none] } mentionEnds.add(head); } if (i >= tokens.size()) { break; } AgigaToken tok = tokens.get(i); writer.write(tok.getWord()); } require(mentionEnds.size() == 0); writer.write("\n"); } writer.write("\n"); } }
public class class_name { private static Object getChildWith(Object node, Object userObject, BiPredicate<Object, Object> equality) { DefaultMutableTreeNode treeNode = (DefaultMutableTreeNode)node; for (int j=0; j<treeNode.getChildCount(); j++) { TreeNode child = treeNode.getChildAt(j); Object childUserObject = getUserObjectFromTreeNode(child); if (equality.test(userObject, childUserObject)) { return child; } } return null; } }
public class class_name { private static Object getChildWith(Object node, Object userObject, BiPredicate<Object, Object> equality) { DefaultMutableTreeNode treeNode = (DefaultMutableTreeNode)node; for (int j=0; j<treeNode.getChildCount(); j++) { TreeNode child = treeNode.getChildAt(j); Object childUserObject = getUserObjectFromTreeNode(child); if (equality.test(userObject, childUserObject)) { return child; // depends on control dependency: [if], data = [none] } } return null; } }
public class class_name { public void highlightTemporarily(int duration, final Background background) { int blinkInterval = 300; final int blinkCount = duration / blinkInterval; Scheduler.get().scheduleFixedPeriod(new RepeatingCommand() { private int m_counter; /** * @see com.google.gwt.core.client.Scheduler.RepeatingCommand#execute() */ public boolean execute() { boolean finish = m_counter > blinkCount; highlight(((m_counter % 2) == 0) && !finish); m_counter += 1; if (finish) { setBackgroundColor(background); } return !finish; } }, blinkInterval); } }
public class class_name { public void highlightTemporarily(int duration, final Background background) { int blinkInterval = 300; final int blinkCount = duration / blinkInterval; Scheduler.get().scheduleFixedPeriod(new RepeatingCommand() { private int m_counter; /** * @see com.google.gwt.core.client.Scheduler.RepeatingCommand#execute() */ public boolean execute() { boolean finish = m_counter > blinkCount; highlight(((m_counter % 2) == 0) && !finish); m_counter += 1; if (finish) { setBackgroundColor(background); // depends on control dependency: [if], data = [none] } return !finish; } }, blinkInterval); } }
public class class_name { @CheckReturnValue protected Builder build(Object object) { if (object instanceof Concept) { return concept((Concept) object); } else if (object instanceof Boolean) { return bool((boolean) object); } else if (object instanceof Collection) { return collection((Collection<?>) object); } else if (object instanceof AnswerGroup<?>) { return answerGroup((AnswerGroup<?>) object); } else if (object instanceof ConceptList) { return conceptList((ConceptList) object); } else if (object instanceof ConceptMap) { return conceptMap((ConceptMap) object); } else if (object instanceof ConceptSet) { if (object instanceof ConceptSetMeasure) { return conceptSetMeasure((ConceptSetMeasure) object); } else { return conceptSet((ConceptSet) object); } } else if (object instanceof Numeric) { return value((Numeric) object); } else if (object instanceof Map) { return map((Map<?, ?>) object); } else { return object(object); } } }
public class class_name { @CheckReturnValue protected Builder build(Object object) { if (object instanceof Concept) { return concept((Concept) object); // depends on control dependency: [if], data = [none] } else if (object instanceof Boolean) { return bool((boolean) object); // depends on control dependency: [if], data = [none] } else if (object instanceof Collection) { return collection((Collection<?>) object); // depends on control dependency: [if], data = [none] } else if (object instanceof AnswerGroup<?>) { return answerGroup((AnswerGroup<?>) object); // depends on control dependency: [if], data = [)] } else if (object instanceof ConceptList) { return conceptList((ConceptList) object); // depends on control dependency: [if], data = [none] } else if (object instanceof ConceptMap) { return conceptMap((ConceptMap) object); // depends on control dependency: [if], data = [none] } else if (object instanceof ConceptSet) { if (object instanceof ConceptSetMeasure) { return conceptSetMeasure((ConceptSetMeasure) object); // depends on control dependency: [if], data = [none] } else { return conceptSet((ConceptSet) object); // depends on control dependency: [if], data = [none] } } else if (object instanceof Numeric) { return value((Numeric) object); // depends on control dependency: [if], data = [none] } else if (object instanceof Map) { return map((Map<?, ?>) object); // depends on control dependency: [if], data = [none] } else { return object(object); // depends on control dependency: [if], data = [none] } } }
public class class_name { public int hcode() { final int prime = 31; int result = 1; Table table = this.table(); Set<Entry<String, Object>> attrsEntrySet = this._getAttrsEntrySet(); for (Entry<String, Object> entry : attrsEntrySet) { String key = entry.getKey(); Object value = entry.getValue(); Class<?> clazz = table.getColumnType(key); if (clazz == Integer.class) { result = prime * result + (Integer) value; } else if (clazz == Short.class) { result = prime * result + (Short) value; } else if (clazz == Long.class) { result = prime * result + (int) ((Long) value ^ ((Long) value >>> 32)); } else if (clazz == Float.class) { result = prime * result + Float.floatToIntBits((Float) value); } else if (clazz == Double.class) { long temp = Double.doubleToLongBits((Double) value); result = prime * result + (int) (temp ^ (temp >>> 32)); } else if (clazz == Boolean.class) { result = prime * result + ((Boolean) value ? 1231 : 1237); } else if (clazz == Model.class) { result = this.hcode(); } else { result = prime * result + ((value == null) ? 0 : value.hashCode()); } } return result; } }
public class class_name { public int hcode() { final int prime = 31; int result = 1; Table table = this.table(); Set<Entry<String, Object>> attrsEntrySet = this._getAttrsEntrySet(); for (Entry<String, Object> entry : attrsEntrySet) { String key = entry.getKey(); Object value = entry.getValue(); Class<?> clazz = table.getColumnType(key); if (clazz == Integer.class) { result = prime * result + (Integer) value; // depends on control dependency: [if], data = [none] } else if (clazz == Short.class) { result = prime * result + (Short) value; // depends on control dependency: [if], data = [none] } else if (clazz == Long.class) { result = prime * result + (int) ((Long) value ^ ((Long) value >>> 32)); // depends on control dependency: [if], data = [none] } else if (clazz == Float.class) { result = prime * result + Float.floatToIntBits((Float) value); // depends on control dependency: [if], data = [none] } else if (clazz == Double.class) { long temp = Double.doubleToLongBits((Double) value); result = prime * result + (int) (temp ^ (temp >>> 32)); // depends on control dependency: [if], data = [none] } else if (clazz == Boolean.class) { result = prime * result + ((Boolean) value ? 1231 : 1237); // depends on control dependency: [if], data = [none] } else if (clazz == Model.class) { result = this.hcode(); // depends on control dependency: [if], data = [none] } else { result = prime * result + ((value == null) ? 0 : value.hashCode()); // depends on control dependency: [if], data = [none] } } return result; } }
public class class_name { public View getItemView(MenuItemImpl item, View convertView, ViewGroup parent) { MenuView.ItemView itemView; if (convertView instanceof MenuView.ItemView) { itemView = (MenuView.ItemView) convertView; } else { itemView = createItemView(parent); } bindItemView(item, itemView); return (View) itemView; } }
public class class_name { public View getItemView(MenuItemImpl item, View convertView, ViewGroup parent) { MenuView.ItemView itemView; if (convertView instanceof MenuView.ItemView) { itemView = (MenuView.ItemView) convertView; // depends on control dependency: [if], data = [none] } else { itemView = createItemView(parent); // depends on control dependency: [if], data = [none] } bindItemView(item, itemView); return (View) itemView; } }
public class class_name { protected String getSourcesMappingEpilogue() { String root = ""; //$NON-NLS-1$ String contextPath = request.getRequestURI(); if (contextPath != null) { // We may be re-building a layer for a source map request where the layer // has been flushed from the cache. If that's the case, then the context // path will already include the source map path component, so just remove it. if (contextPath.endsWith(ILayer.SOURCEMAP_RESOURCE_PATH)) { contextPath = contextPath.substring(0, contextPath.length()-(ILayer.SOURCEMAP_RESOURCE_PATHCOMP.length()+1)); } // Because we're specifying a relative URL that is relative to the request for the // layer and aggregator paths are assumed to NOT include a trailing '/', then we // need to start the relative path with the last path component of the context // path so that the relative URL will be resolved correctly by the browser. For // more details, see refer to the behavior of URI.resolve(); int idx = contextPath.lastIndexOf("/"); //$NON-NLS-1$ root = contextPath.substring(idx!=-1 ? idx+1 : 0); if (root.length() > 0 && !root.endsWith("/")) { //$NON-NLS-1$ root += "/"; //$NON-NLS-1$ } } StringBuffer sb = new StringBuffer(); sb.append("//# sourceMappingURL=") //$NON-NLS-1$ .append(root) .append(ILayer.SOURCEMAP_RESOURCE_PATHCOMP); String queryString = request.getQueryString(); if (queryString != null) { sb.append("?").append(queryString); //$NON-NLS-1$ } return sb.toString(); } }
public class class_name { protected String getSourcesMappingEpilogue() { String root = ""; //$NON-NLS-1$ String contextPath = request.getRequestURI(); if (contextPath != null) { // We may be re-building a layer for a source map request where the layer // has been flushed from the cache. If that's the case, then the context // path will already include the source map path component, so just remove it. if (contextPath.endsWith(ILayer.SOURCEMAP_RESOURCE_PATH)) { contextPath = contextPath.substring(0, contextPath.length()-(ILayer.SOURCEMAP_RESOURCE_PATHCOMP.length()+1)); // depends on control dependency: [if], data = [none] } // Because we're specifying a relative URL that is relative to the request for the // layer and aggregator paths are assumed to NOT include a trailing '/', then we // need to start the relative path with the last path component of the context // path so that the relative URL will be resolved correctly by the browser. For // more details, see refer to the behavior of URI.resolve(); int idx = contextPath.lastIndexOf("/"); //$NON-NLS-1$ root = contextPath.substring(idx!=-1 ? idx+1 : 0); // depends on control dependency: [if], data = [none] if (root.length() > 0 && !root.endsWith("/")) { //$NON-NLS-1$ root += "/"; //$NON-NLS-1$ // depends on control dependency: [if], data = [none] } } StringBuffer sb = new StringBuffer(); sb.append("//# sourceMappingURL=") //$NON-NLS-1$ .append(root) .append(ILayer.SOURCEMAP_RESOURCE_PATHCOMP); String queryString = request.getQueryString(); if (queryString != null) { sb.append("?").append(queryString); //$NON-NLS-1$ // depends on control dependency: [if], data = [(queryString] } return sb.toString(); } }
public class class_name { @Override public void draw(Canvas c, Projection pProjection) { if (isCompassEnabled() && !Float.isNaN(mAzimuth)) { drawCompass(c, mMode * (mAzimuth + mAzimuthOffset + getDisplayOrientation()), pProjection .getScreenRect()); } } }
public class class_name { @Override public void draw(Canvas c, Projection pProjection) { if (isCompassEnabled() && !Float.isNaN(mAzimuth)) { drawCompass(c, mMode * (mAzimuth + mAzimuthOffset + getDisplayOrientation()), pProjection .getScreenRect()); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static boolean isXmlPage(CmsResource resource) { boolean result = false; if (resource != null) { result = resource.getTypeId() == m_staticTypeId; } return result; } }
public class class_name { public static boolean isXmlPage(CmsResource resource) { boolean result = false; if (resource != null) { result = resource.getTypeId() == m_staticTypeId; // depends on control dependency: [if], data = [none] } return result; } }
public class class_name { public void marshall(AlgorithmValidationSpecification algorithmValidationSpecification, ProtocolMarshaller protocolMarshaller) { if (algorithmValidationSpecification == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(algorithmValidationSpecification.getValidationRole(), VALIDATIONROLE_BINDING); protocolMarshaller.marshall(algorithmValidationSpecification.getValidationProfiles(), VALIDATIONPROFILES_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(AlgorithmValidationSpecification algorithmValidationSpecification, ProtocolMarshaller protocolMarshaller) { if (algorithmValidationSpecification == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(algorithmValidationSpecification.getValidationRole(), VALIDATIONROLE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(algorithmValidationSpecification.getValidationProfiles(), VALIDATIONPROFILES_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void scrollTo(int x, int y) { // we rely on the fact the View.scrollBy calls scrollTo. if (getChildCount() > 0) { View child = getChildAt(0); x = clamp(x, getWidth() - getPaddingRight() - getPaddingLeft(), child.getWidth()); y = clamp(y, getHeight() - getPaddingBottom() - getPaddingTop(), child.getHeight()); if (x != getScrollX() || y != getScrollY()) { super.scrollTo(x, y); } } } }
public class class_name { public void scrollTo(int x, int y) { // we rely on the fact the View.scrollBy calls scrollTo. if (getChildCount() > 0) { View child = getChildAt(0); x = clamp(x, getWidth() - getPaddingRight() - getPaddingLeft(), child.getWidth()); // depends on control dependency: [if], data = [none] y = clamp(y, getHeight() - getPaddingBottom() - getPaddingTop(), child.getHeight()); // depends on control dependency: [if], data = [none] if (x != getScrollX() || y != getScrollY()) { super.scrollTo(x, y); // depends on control dependency: [if], data = [(x] } } } }
public class class_name { protected final void updateAuthenticationDefaults() { if (loginProcessingUrl == null) { loginProcessingUrl(loginPage); } if (failureHandler == null) { failureUrl(loginPage + "?error"); } final LogoutConfigurer<B> logoutConfigurer = getBuilder().getConfigurer( LogoutConfigurer.class); if (logoutConfigurer != null && !logoutConfigurer.isCustomLogoutSuccess()) { logoutConfigurer.logoutSuccessUrl(loginPage + "?logout"); } } }
public class class_name { protected final void updateAuthenticationDefaults() { if (loginProcessingUrl == null) { loginProcessingUrl(loginPage); // depends on control dependency: [if], data = [none] } if (failureHandler == null) { failureUrl(loginPage + "?error"); // depends on control dependency: [if], data = [none] } final LogoutConfigurer<B> logoutConfigurer = getBuilder().getConfigurer( LogoutConfigurer.class); if (logoutConfigurer != null && !logoutConfigurer.isCustomLogoutSuccess()) { logoutConfigurer.logoutSuccessUrl(loginPage + "?logout"); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static String getContextRelativePath(ServletRequest request, String relativePath) { if (relativePath.startsWith("/")) return (relativePath); if (!(request instanceof HttpServletRequest)) return (relativePath); HttpServletRequest hrequest = (HttpServletRequest) request; String uri = (String) request.getAttribute("javax.servlet.include.servlet_path"); if (uri != null) { String pathInfo = (String) request.getAttribute("javax.servlet.include.path_info"); if (pathInfo == null) { if (uri.lastIndexOf('/') >= 0) { uri = uri.substring(0, uri.lastIndexOf('/')); } } } else { // STARTJR: fix improper handling of jsp:include uri = hrequest.getServletPath(); String pathInfo = hrequest.getPathInfo (); if ( pathInfo != null) { uri = uri + pathInfo; } if (uri.lastIndexOf('/') >= 0) { uri = uri.substring(0, uri.lastIndexOf('/')); } // ENDJR } return uri + '/' + relativePath; } }
public class class_name { public static String getContextRelativePath(ServletRequest request, String relativePath) { if (relativePath.startsWith("/")) return (relativePath); if (!(request instanceof HttpServletRequest)) return (relativePath); HttpServletRequest hrequest = (HttpServletRequest) request; String uri = (String) request.getAttribute("javax.servlet.include.servlet_path"); if (uri != null) { String pathInfo = (String) request.getAttribute("javax.servlet.include.path_info"); if (pathInfo == null) { if (uri.lastIndexOf('/') >= 0) { uri = uri.substring(0, uri.lastIndexOf('/')); // depends on control dependency: [if], data = [none] } } } else { // STARTJR: fix improper handling of jsp:include uri = hrequest.getServletPath(); // depends on control dependency: [if], data = [none] String pathInfo = hrequest.getPathInfo (); if ( pathInfo != null) { uri = uri + pathInfo; // depends on control dependency: [if], data = [none] } if (uri.lastIndexOf('/') >= 0) { uri = uri.substring(0, uri.lastIndexOf('/')); // depends on control dependency: [if], data = [none] } // ENDJR } return uri + '/' + relativePath; } }
public class class_name { protected boolean processActionOverride( HttpServletRequest request, HttpServletResponse response ) throws IOException, ServletException { // Only make this check if this is an initial (non-forwarded) request. // // TODO: performance? // PageFlowRequestWrapper wrapper = PageFlowRequestWrapper.get( request ); if ( ! wrapper.isForwardedByButton() && ! wrapper.isForwardedRequest() ) { // // First, since we need access to request parameters here, process a multipart request // if that's what we have. This puts the parameters (each in a MIME part) behind an // interface that makes them look like normal request parameters. // HttpServletRequest multipartAwareRequest = processMultipart( request ); for ( Enumeration e = multipartAwareRequest.getParameterNames(); e.hasMoreElements(); ) { String paramName = ( String ) e.nextElement(); if ( paramName.startsWith( ACTION_OVERRIDE_PARAM_PREFIX ) ) { String actionPath = paramName.substring( ACTION_OVERRIDE_PARAM_PREFIX_LEN ); ServletContext servletContext = getServletContext(); String qualifiedAction = InternalUtils.qualifyAction( servletContext,actionPath ); actionPath = InternalUtils.createActionPath(request, qualifiedAction ); if ( LOG.isDebugEnabled() ) { LOG.debug( "A request parameter overrode the action. Forwarding to: " + actionPath ); } wrapper.setForwardedByButton( true ); doForward( actionPath, request, response ); return true; } } } return false; } }
public class class_name { protected boolean processActionOverride( HttpServletRequest request, HttpServletResponse response ) throws IOException, ServletException { // Only make this check if this is an initial (non-forwarded) request. // // TODO: performance? // PageFlowRequestWrapper wrapper = PageFlowRequestWrapper.get( request ); if ( ! wrapper.isForwardedByButton() && ! wrapper.isForwardedRequest() ) { // // First, since we need access to request parameters here, process a multipart request // if that's what we have. This puts the parameters (each in a MIME part) behind an // interface that makes them look like normal request parameters. // HttpServletRequest multipartAwareRequest = processMultipart( request ); for ( Enumeration e = multipartAwareRequest.getParameterNames(); e.hasMoreElements(); ) { String paramName = ( String ) e.nextElement(); if ( paramName.startsWith( ACTION_OVERRIDE_PARAM_PREFIX ) ) { String actionPath = paramName.substring( ACTION_OVERRIDE_PARAM_PREFIX_LEN ); ServletContext servletContext = getServletContext(); String qualifiedAction = InternalUtils.qualifyAction( servletContext,actionPath ); actionPath = InternalUtils.createActionPath(request, qualifiedAction ); // depends on control dependency: [if], data = [none] if ( LOG.isDebugEnabled() ) { LOG.debug( "A request parameter overrode the action. Forwarding to: " + actionPath ); // depends on control dependency: [if], data = [none] } wrapper.setForwardedByButton( true ); // depends on control dependency: [if], data = [none] doForward( actionPath, request, response ); // depends on control dependency: [if], data = [none] return true; // depends on control dependency: [if], data = [none] } } } return false; } }
public class class_name { private void addPostParams(final Request request) { if (callbackUrl != null) { request.addPostParam("CallbackUrl", callbackUrl.toString()); } if (triggerValue != null) { request.addPostParam("TriggerValue", triggerValue); } if (usageCategory != null) { request.addPostParam("UsageCategory", usageCategory.toString()); } if (callbackMethod != null) { request.addPostParam("CallbackMethod", callbackMethod.toString()); } if (friendlyName != null) { request.addPostParam("FriendlyName", friendlyName); } if (recurring != null) { request.addPostParam("Recurring", recurring.toString()); } if (triggerBy != null) { request.addPostParam("TriggerBy", triggerBy.toString()); } } }
public class class_name { private void addPostParams(final Request request) { if (callbackUrl != null) { request.addPostParam("CallbackUrl", callbackUrl.toString()); // depends on control dependency: [if], data = [none] } if (triggerValue != null) { request.addPostParam("TriggerValue", triggerValue); // depends on control dependency: [if], data = [none] } if (usageCategory != null) { request.addPostParam("UsageCategory", usageCategory.toString()); // depends on control dependency: [if], data = [none] } if (callbackMethod != null) { request.addPostParam("CallbackMethod", callbackMethod.toString()); // depends on control dependency: [if], data = [none] } if (friendlyName != null) { request.addPostParam("FriendlyName", friendlyName); // depends on control dependency: [if], data = [none] } if (recurring != null) { request.addPostParam("Recurring", recurring.toString()); // depends on control dependency: [if], data = [none] } if (triggerBy != null) { request.addPostParam("TriggerBy", triggerBy.toString()); // depends on control dependency: [if], data = [none] } } }
public class class_name { private Map<String, Object> getContextAttributes( final BundleContext bundleContext) { final Map<String, Object> attributes = new HashMap<>(); if (contextAttributes != null) { attributes.putAll(contextAttributes); } attributes.put(WebContainerConstants.BUNDLE_CONTEXT_ATTRIBUTE, bundleContext); attributes .put("org.springframework.osgi.web.org.osgi.framework.BundleContext", bundleContext); return attributes; } }
public class class_name { private Map<String, Object> getContextAttributes( final BundleContext bundleContext) { final Map<String, Object> attributes = new HashMap<>(); if (contextAttributes != null) { attributes.putAll(contextAttributes); // depends on control dependency: [if], data = [(contextAttributes] } attributes.put(WebContainerConstants.BUNDLE_CONTEXT_ATTRIBUTE, bundleContext); attributes .put("org.springframework.osgi.web.org.osgi.framework.BundleContext", bundleContext); return attributes; } }
public class class_name { protected Object wrap(Object object) { if (object == null || object instanceof Proxy) { return object; } final Class<?> type = object.getClass(); return Proxy.newProxyInstance(type.getClassLoader(), type.getInterfaces(), new ProxyHandler(object)); } }
public class class_name { protected Object wrap(Object object) { if (object == null || object instanceof Proxy) { return object; // depends on control dependency: [if], data = [none] } final Class<?> type = object.getClass(); return Proxy.newProxyInstance(type.getClassLoader(), type.getInterfaces(), new ProxyHandler(object)); } }
public class class_name { public DescribeInstanceHealthResult withInstanceStates(InstanceState... instanceStates) { if (this.instanceStates == null) { setInstanceStates(new com.amazonaws.internal.SdkInternalList<InstanceState>(instanceStates.length)); } for (InstanceState ele : instanceStates) { this.instanceStates.add(ele); } return this; } }
public class class_name { public DescribeInstanceHealthResult withInstanceStates(InstanceState... instanceStates) { if (this.instanceStates == null) { setInstanceStates(new com.amazonaws.internal.SdkInternalList<InstanceState>(instanceStates.length)); // depends on control dependency: [if], data = [none] } for (InstanceState ele : instanceStates) { this.instanceStates.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { private boolean validateEncryptionKeyData(KeyData data) { if (data.getIv().length != ENCRYPTIONKEYCHAINMANAGER_AES_IV_SIZE) { LOGGER.warning("IV does not have the expected size: " + ENCRYPTIONKEYCHAINMANAGER_AES_IV_SIZE + " bytes"); return false; } return true; } }
public class class_name { private boolean validateEncryptionKeyData(KeyData data) { if (data.getIv().length != ENCRYPTIONKEYCHAINMANAGER_AES_IV_SIZE) { LOGGER.warning("IV does not have the expected size: " + ENCRYPTIONKEYCHAINMANAGER_AES_IV_SIZE + " bytes"); // depends on control dependency: [if], data = [none] return false; // depends on control dependency: [if], data = [none] } return true; } }
public class class_name { public void logout() { if (vimService != null) { try { serviceInstance.getSessionManager().logout(); } catch (Exception e) { System.err.println("Failed to disconnect..."); } vimService = null; serviceInstance = null; } } }
public class class_name { public void logout() { if (vimService != null) { try { serviceInstance.getSessionManager().logout(); // depends on control dependency: [try], data = [none] } catch (Exception e) { System.err.println("Failed to disconnect..."); } // depends on control dependency: [catch], data = [none] vimService = null; // depends on control dependency: [if], data = [none] serviceInstance = null; // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override protected void collectMetrics(final Metrics metrics) { for (final JvmMetricsCollector collector : _collectorsEnabled) { collector.collect(metrics, _managementFactory); } } }
public class class_name { @Override protected void collectMetrics(final Metrics metrics) { for (final JvmMetricsCollector collector : _collectorsEnabled) { collector.collect(metrics, _managementFactory); // depends on control dependency: [for], data = [collector] } } }
public class class_name { private void checkClient() { try { /** If the errorCount is greater than 0, make sure we are still connected. */ if (errorCount.get() > 0) { errorCount.set(0); if (backendServiceHttpClient == null || backendServiceHttpClient.isClosed()) { if (backendServiceHttpClient != null) { try { backendServiceHttpClient.stop(); } catch (Exception ex) { logger.debug("Was unable to stop the client connection", ex); } } backendServiceHttpClient = httpClientBuilder.buildAndStart(); lastHttpClientStart = time; } } /** If the ping builder is present, use it to ping the service. */ if (pingBuilder.isPresent()) { if (backendServiceHttpClient != null) { pingBuilder.get().setBinaryReceiver((code, contentType, body) -> { if (code >= 200 && code < 299) { pingCount.incrementAndGet(); } else { errorCount.incrementAndGet(); } }).setErrorHandler(e -> { logger.error("Error doing ping operation", e); errorCount.incrementAndGet(); }); final HttpRequest httpRequest = pingBuilder.get().build(); backendServiceHttpClient.sendHttpRequest(httpRequest); } } } catch (Exception ex) { errorHandler.accept(ex); logger.error("Unable to check connection"); } } }
public class class_name { private void checkClient() { try { /** If the errorCount is greater than 0, make sure we are still connected. */ if (errorCount.get() > 0) { errorCount.set(0); // depends on control dependency: [if], data = [0)] if (backendServiceHttpClient == null || backendServiceHttpClient.isClosed()) { if (backendServiceHttpClient != null) { try { backendServiceHttpClient.stop(); // depends on control dependency: [try], data = [none] } catch (Exception ex) { logger.debug("Was unable to stop the client connection", ex); } // depends on control dependency: [catch], data = [none] } backendServiceHttpClient = httpClientBuilder.buildAndStart(); // depends on control dependency: [if], data = [none] lastHttpClientStart = time; // depends on control dependency: [if], data = [none] } } /** If the ping builder is present, use it to ping the service. */ if (pingBuilder.isPresent()) { if (backendServiceHttpClient != null) { pingBuilder.get().setBinaryReceiver((code, contentType, body) -> { if (code >= 200 && code < 299) { pingCount.incrementAndGet(); // depends on control dependency: [if], data = [none] } else { errorCount.incrementAndGet(); // depends on control dependency: [if], data = [none] } }).setErrorHandler(e -> { logger.error("Error doing ping operation", e); errorCount.incrementAndGet(); }); final HttpRequest httpRequest = pingBuilder.get().build(); backendServiceHttpClient.sendHttpRequest(httpRequest); // depends on control dependency: [if], data = [none] } } } catch (Exception ex) { errorHandler.accept(ex); logger.error("Unable to check connection"); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public boolean removeToNextSeparator(Issue issue, IXtextDocument document, String separator) throws BadLocationException { // Skip spaces after the identifier until the separator int index = issue.getOffset() + issue.getLength(); char c = document.getChar(index); while (Character.isWhitespace(c)) { index++; c = document.getChar(index); } // Test if it next non-space character is the separator final boolean foundSeparator = document.getChar(index) == separator.charAt(0); if (foundSeparator) { index++; c = document.getChar(index); // Skip the previous spaces while (Character.isWhitespace(c)) { index++; c = document.getChar(index); } final int newLength = index - issue.getOffset(); document.replace(issue.getOffset(), newLength, ""); //$NON-NLS-1$ } return foundSeparator; } }
public class class_name { public boolean removeToNextSeparator(Issue issue, IXtextDocument document, String separator) throws BadLocationException { // Skip spaces after the identifier until the separator int index = issue.getOffset() + issue.getLength(); char c = document.getChar(index); while (Character.isWhitespace(c)) { index++; c = document.getChar(index); } // Test if it next non-space character is the separator final boolean foundSeparator = document.getChar(index) == separator.charAt(0); if (foundSeparator) { index++; c = document.getChar(index); // Skip the previous spaces while (Character.isWhitespace(c)) { index++; // depends on control dependency: [while], data = [none] c = document.getChar(index); // depends on control dependency: [while], data = [none] } final int newLength = index - issue.getOffset(); document.replace(issue.getOffset(), newLength, ""); //$NON-NLS-1$ } return foundSeparator; } }
public class class_name { private static String getStringAttributeFromWebServiceProviderAnnotation(AnnotationInfo annotationInfo, String attribute, String defaultForServiceProvider) { //the two values can not be found in webserviceProvider annotation so just return the default value to save time if (attribute.equals(JaxWsConstants.ENDPOINTINTERFACE_ATTRIBUTE) || attribute.equals(JaxWsConstants.NAME_ATTRIBUTE)) { return defaultForServiceProvider; } AnnotationValue attrValue = annotationInfo.getValue(attribute); String attrFromSP = attrValue == null ? null : attrValue.getStringValue().trim(); return StringUtils.isEmpty(attrFromSP) ? defaultForServiceProvider : attrFromSP; } }
public class class_name { private static String getStringAttributeFromWebServiceProviderAnnotation(AnnotationInfo annotationInfo, String attribute, String defaultForServiceProvider) { //the two values can not be found in webserviceProvider annotation so just return the default value to save time if (attribute.equals(JaxWsConstants.ENDPOINTINTERFACE_ATTRIBUTE) || attribute.equals(JaxWsConstants.NAME_ATTRIBUTE)) { return defaultForServiceProvider; // depends on control dependency: [if], data = [none] } AnnotationValue attrValue = annotationInfo.getValue(attribute); String attrFromSP = attrValue == null ? null : attrValue.getStringValue().trim(); return StringUtils.isEmpty(attrFromSP) ? defaultForServiceProvider : attrFromSP; } }
public class class_name { public static final BlockingMode toBlockingMode(String name) { BlockingMode mode = null; if( name == null ) { mode = null; } else if( name.equalsIgnoreCase("run") ) { mode = RUN; } else if( name.equalsIgnoreCase("wait") ) { mode = WAIT; } else if( name.equalsIgnoreCase("discard") ) { mode = DISCARD; } else if( name.equalsIgnoreCase("discardOldest") ) { mode = DISCARD_OLDEST; } else if( name.equalsIgnoreCase("abort") ) { mode = ABORT; } return mode; } }
public class class_name { public static final BlockingMode toBlockingMode(String name) { BlockingMode mode = null; if( name == null ) { mode = null; // depends on control dependency: [if], data = [none] } else if( name.equalsIgnoreCase("run") ) { mode = RUN; // depends on control dependency: [if], data = [none] } else if( name.equalsIgnoreCase("wait") ) { mode = WAIT; // depends on control dependency: [if], data = [none] } else if( name.equalsIgnoreCase("discard") ) { mode = DISCARD; // depends on control dependency: [if], data = [none] } else if( name.equalsIgnoreCase("discardOldest") ) { mode = DISCARD_OLDEST; // depends on control dependency: [if], data = [none] } else if( name.equalsIgnoreCase("abort") ) { mode = ABORT; // depends on control dependency: [if], data = [none] } return mode; } }
public class class_name { public static byte[] encypt(String str, byte[] key) { byte[] b = null; try { SecretKey secretKey = new SecretKeySpec(key, "AES"); Cipher cipher = Cipher.getInstance("AES"); cipher.init(Cipher.ENCRYPT_MODE, secretKey); b = cipher.doFinal(str.getBytes()); } catch (Exception e) { throw new RuntimeException(e); } return b; } }
public class class_name { public static byte[] encypt(String str, byte[] key) { byte[] b = null; try { SecretKey secretKey = new SecretKeySpec(key, "AES"); Cipher cipher = Cipher.getInstance("AES"); cipher.init(Cipher.ENCRYPT_MODE, secretKey); // depends on control dependency: [try], data = [none] b = cipher.doFinal(str.getBytes()); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new RuntimeException(e); } // depends on control dependency: [catch], data = [none] return b; } }
public class class_name { public synchronized void addChangeRequests(List<T> requests) { for (T request : requests) { changes.add(new Holder<>(request, getLastCounter().inc())); } singleThreadedExecutor.execute(resolveWaitingFuturesRunnable); } }
public class class_name { public synchronized void addChangeRequests(List<T> requests) { for (T request : requests) { changes.add(new Holder<>(request, getLastCounter().inc())); // depends on control dependency: [for], data = [request] } singleThreadedExecutor.execute(resolveWaitingFuturesRunnable); } }
public class class_name { String createButtonHtml(SocialLoginConfig config) { if (config == null) { return ""; } String uniqueId = config.getUniqueId(); String displayName = config.getDisplayName(); String buttonValue = WebUtils.htmlEncode(getObscuredConfigId(uniqueId)); StringBuilder buttonHtml = new StringBuilder(); buttonHtml.append("<button type=\"submit\" "); buttonHtml.append("class=\"" + HTML_CLASS_BUTTON + " " + HTML_CLASS_MEDIUM + "\" "); buttonHtml.append("value=\"" + buttonValue + "\" "); buttonHtml.append("onclick=\"" + createCookieFunctionName + "(" + buttonValue + ")\" "); buttonHtml.append(">"); if (displayName == null) { if (tc.isDebugEnabled()) { Tr.debug(tc, "displayName was not configured for this config, will use the id attribute instead"); } displayName = uniqueId; } buttonHtml.append(WebUtils.htmlEncode(displayName)); buttonHtml.append("</button>\n"); return buttonHtml.toString(); } }
public class class_name { String createButtonHtml(SocialLoginConfig config) { if (config == null) { return ""; // depends on control dependency: [if], data = [none] } String uniqueId = config.getUniqueId(); String displayName = config.getDisplayName(); String buttonValue = WebUtils.htmlEncode(getObscuredConfigId(uniqueId)); StringBuilder buttonHtml = new StringBuilder(); buttonHtml.append("<button type=\"submit\" "); buttonHtml.append("class=\"" + HTML_CLASS_BUTTON + " " + HTML_CLASS_MEDIUM + "\" "); buttonHtml.append("value=\"" + buttonValue + "\" "); buttonHtml.append("onclick=\"" + createCookieFunctionName + "(" + buttonValue + ")\" "); buttonHtml.append(">"); if (displayName == null) { if (tc.isDebugEnabled()) { Tr.debug(tc, "displayName was not configured for this config, will use the id attribute instead"); } displayName = uniqueId; } buttonHtml.append(WebUtils.htmlEncode(displayName)); buttonHtml.append("</button>\n"); return buttonHtml.toString(); } }
public class class_name { public void setNodeText(Node n, String text) { if (n == null) return; Node nc = null; while ((nc = n.getFirstChild()) != null) { n.removeChild(nc); } if (n.getAttributes().getNamedItemNS(XFA_DATA_SCHEMA, "dataNode") != null) n.getAttributes().removeNamedItemNS(XFA_DATA_SCHEMA, "dataNode"); n.appendChild(domDocument.createTextNode(text)); changed = true; } }
public class class_name { public void setNodeText(Node n, String text) { if (n == null) return; Node nc = null; while ((nc = n.getFirstChild()) != null) { n.removeChild(nc); // depends on control dependency: [while], data = [none] } if (n.getAttributes().getNamedItemNS(XFA_DATA_SCHEMA, "dataNode") != null) n.getAttributes().removeNamedItemNS(XFA_DATA_SCHEMA, "dataNode"); n.appendChild(domDocument.createTextNode(text)); changed = true; } }
public class class_name { @Override public MatchType match(int level, Node node) { if(! (node instanceof Element)) { return MatchType.NOT_A_MATCH; } Element element = (Element) node; if(this.level != level) { return MatchType.NOT_A_MATCH; } else if(nodename.equals(element.getName())) { return MatchType.NODE_MATCH; } return MatchType.NOT_A_MATCH; } }
public class class_name { @Override public MatchType match(int level, Node node) { if(! (node instanceof Element)) { return MatchType.NOT_A_MATCH; // depends on control dependency: [if], data = [none] } Element element = (Element) node; if(this.level != level) { return MatchType.NOT_A_MATCH; // depends on control dependency: [if], data = [none] } else if(nodename.equals(element.getName())) { return MatchType.NODE_MATCH; // depends on control dependency: [if], data = [none] } return MatchType.NOT_A_MATCH; } }
public class class_name { protected void debugFw(String msg, Object... args) { if (isFrameworkDebug()) { logger.info("#job #fw " + msg, args); // info level for production environment } } }
public class class_name { protected void debugFw(String msg, Object... args) { if (isFrameworkDebug()) { logger.info("#job #fw " + msg, args); // info level for production environment // depends on control dependency: [if], data = [none] } } }
public class class_name { public boolean adjustEntry(E entry) { final SpatialDirectoryEntry se = (SpatialDirectoryEntry) entry; final ModifiableHyperBoundingBox mbr = computeMBR(); boolean changed = false; if(se.hasMBR()) { final int dim = se.getDimensionality(); // Test for changes for(int i = 0; i < dim; i++) { if(Math.abs(se.getMin(i) - mbr.getMin(i)) > Float.MIN_NORMAL) { changed = true; break; } if(Math.abs(se.getMax(i) - mbr.getMax(i)) > Float.MIN_NORMAL) { changed = true; break; } } } else { // No preexisting MBR. changed = true; } if(changed) { se.setMBR(mbr); } return changed; } }
public class class_name { public boolean adjustEntry(E entry) { final SpatialDirectoryEntry se = (SpatialDirectoryEntry) entry; final ModifiableHyperBoundingBox mbr = computeMBR(); boolean changed = false; if(se.hasMBR()) { final int dim = se.getDimensionality(); // Test for changes for(int i = 0; i < dim; i++) { if(Math.abs(se.getMin(i) - mbr.getMin(i)) > Float.MIN_NORMAL) { changed = true; // depends on control dependency: [if], data = [none] break; } if(Math.abs(se.getMax(i) - mbr.getMax(i)) > Float.MIN_NORMAL) { changed = true; // depends on control dependency: [if], data = [none] break; } } } else { // No preexisting MBR. changed = true; // depends on control dependency: [if], data = [none] } if(changed) { se.setMBR(mbr); // depends on control dependency: [if], data = [none] } return changed; } }
public class class_name { protected void updateApp(String itemId) { I_CmsOuTreeType foundType = null; for (I_CmsOuTreeType type : m_app.getTreeTypeProvider().getTreeTypes()) { if (itemId.equals(type.getId())) { foundType = type; break; } } if (foundType != null) { m_app.update(m_parentOu, foundType, null); return; } m_app.update(itemId, CmsOuTreeType.OU, null, ""); } }
public class class_name { protected void updateApp(String itemId) { I_CmsOuTreeType foundType = null; for (I_CmsOuTreeType type : m_app.getTreeTypeProvider().getTreeTypes()) { if (itemId.equals(type.getId())) { foundType = type; // depends on control dependency: [if], data = [none] break; } } if (foundType != null) { m_app.update(m_parentOu, foundType, null); // depends on control dependency: [if], data = [null)] return; // depends on control dependency: [if], data = [none] } m_app.update(itemId, CmsOuTreeType.OU, null, ""); } }
public class class_name { private static <K, V> Map<K, V> synchronizedCopyMap(Map<K, V> map) { if (map == null) { return new HashMap<K, V>(); } synchronized (map) { return new HashMap<K, V>(map); } } }
public class class_name { private static <K, V> Map<K, V> synchronizedCopyMap(Map<K, V> map) { if (map == null) { return new HashMap<K, V>(); // depends on control dependency: [if], data = [none] } synchronized (map) { return new HashMap<K, V>(map); } } }
public class class_name { public void processFile(final Reader reader, final String delimiter, final char quoteChar, final Runnable command) { try { List<String> inputLines = CharStreams.readLines(reader); StrTokenizer st = StrTokenizer.getCSVInstance(); st.setDelimiterString(delimiter); if (quoteChar != '\0') { st.setQuoteChar(quoteChar); } else { st.setQuoteMatcher(StrMatcher.noneMatcher()); } // extract header String headerLine = inputLines.remove(0); List<Column> columns = initColumns(st, headerLine); for (String line : inputLines) { st.reset(line); String[] colArray = st.getTokenArray(); int len = colArray.length; checkState(len == columns.size(), "Mismatch between number of header columns and number of line columns."); DataSource dataSource = dataSourceProvider.get(); Configuration config = configProvider.get(); for (int i = 0; i < len; ++i) { String value = StringUtils.trimToEmpty(colArray[i]); String dataSetKey = columns.get(i).dataSetKey; String key = columns.get(i).key; if (dataSetKey != null) { if ("<auto>".equals(value)) { dataSource.resetFixedValue(dataSetKey, key); } else { log.debug("Setting data set entry for " + this + " to value=" + value); dataSource.setFixedValue(dataSetKey, key, value); } } else { log.debug("Setting property for " + this + " to value=" + value); config.put(key, value); } } command.run(); } } catch (IOException ex) { throw new JFunkException("Error processing CSV data", ex); } } }
public class class_name { public void processFile(final Reader reader, final String delimiter, final char quoteChar, final Runnable command) { try { List<String> inputLines = CharStreams.readLines(reader); StrTokenizer st = StrTokenizer.getCSVInstance(); st.setDelimiterString(delimiter); // depends on control dependency: [try], data = [none] if (quoteChar != '\0') { st.setQuoteChar(quoteChar); // depends on control dependency: [if], data = [(quoteChar] } else { st.setQuoteMatcher(StrMatcher.noneMatcher()); // depends on control dependency: [if], data = [none] } // extract header String headerLine = inputLines.remove(0); List<Column> columns = initColumns(st, headerLine); for (String line : inputLines) { st.reset(line); // depends on control dependency: [for], data = [line] String[] colArray = st.getTokenArray(); int len = colArray.length; checkState(len == columns.size(), "Mismatch between number of header columns and number of line columns."); // depends on control dependency: [for], data = [line] DataSource dataSource = dataSourceProvider.get(); Configuration config = configProvider.get(); for (int i = 0; i < len; ++i) { String value = StringUtils.trimToEmpty(colArray[i]); String dataSetKey = columns.get(i).dataSetKey; String key = columns.get(i).key; if (dataSetKey != null) { if ("<auto>".equals(value)) { dataSource.resetFixedValue(dataSetKey, key); // depends on control dependency: [if], data = [none] } else { log.debug("Setting data set entry for " + this + " to value=" + value); // depends on control dependency: [if], data = [none] dataSource.setFixedValue(dataSetKey, key, value); // depends on control dependency: [if], data = [none] } } else { log.debug("Setting property for " + this + " to value=" + value); // depends on control dependency: [if], data = [none] config.put(key, value); // depends on control dependency: [if], data = [none] } } command.run(); // depends on control dependency: [for], data = [none] } } catch (IOException ex) { throw new JFunkException("Error processing CSV data", ex); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public DateTime parseDateTime(String text) { InternalParser parser = requireParser(); Chronology chrono = selectChronology(null); DateTimeParserBucket bucket = new DateTimeParserBucket(0, chrono, iLocale, iPivotYear, iDefaultYear); int newPos = parser.parseInto(bucket, text, 0); if (newPos >= 0) { if (newPos >= text.length()) { long millis = bucket.computeMillis(true, text); if (iOffsetParsed && bucket.getOffsetInteger() != null) { int parsedOffset = bucket.getOffsetInteger(); DateTimeZone parsedZone = DateTimeZone.forOffsetMillis(parsedOffset); chrono = chrono.withZone(parsedZone); } else if (bucket.getZone() != null) { chrono = chrono.withZone(bucket.getZone()); } DateTime dt = new DateTime(millis, chrono); if (iZone != null) { dt = dt.withZone(iZone); } return dt; } } else { newPos = ~newPos; } throw new IllegalArgumentException(FormatUtils.createErrorMessage(text, newPos)); } }
public class class_name { public DateTime parseDateTime(String text) { InternalParser parser = requireParser(); Chronology chrono = selectChronology(null); DateTimeParserBucket bucket = new DateTimeParserBucket(0, chrono, iLocale, iPivotYear, iDefaultYear); int newPos = parser.parseInto(bucket, text, 0); if (newPos >= 0) { if (newPos >= text.length()) { long millis = bucket.computeMillis(true, text); if (iOffsetParsed && bucket.getOffsetInteger() != null) { int parsedOffset = bucket.getOffsetInteger(); DateTimeZone parsedZone = DateTimeZone.forOffsetMillis(parsedOffset); chrono = chrono.withZone(parsedZone); // depends on control dependency: [if], data = [none] } else if (bucket.getZone() != null) { chrono = chrono.withZone(bucket.getZone()); // depends on control dependency: [if], data = [(bucket.getZone()] } DateTime dt = new DateTime(millis, chrono); if (iZone != null) { dt = dt.withZone(iZone); // depends on control dependency: [if], data = [(iZone] } return dt; // depends on control dependency: [if], data = [none] } } else { newPos = ~newPos; // depends on control dependency: [if], data = [none] } throw new IllegalArgumentException(FormatUtils.createErrorMessage(text, newPos)); } }
public class class_name { protected double[] makeSample(int maxk) { final Random rnd = this.rnd.getSingleThreadedRandom(); double[] dists = new double[maxk + 1]; final double e = 1. / dim; for(int i = 0; i <= maxk; i++) { dists[i] = FastMath.pow(rnd.nextDouble(), e); } Arrays.sort(dists); return dists; } }
public class class_name { protected double[] makeSample(int maxk) { final Random rnd = this.rnd.getSingleThreadedRandom(); double[] dists = new double[maxk + 1]; final double e = 1. / dim; for(int i = 0; i <= maxk; i++) { dists[i] = FastMath.pow(rnd.nextDouble(), e); // depends on control dependency: [for], data = [i] } Arrays.sort(dists); return dists; } }
public class class_name { @Override public String[] segmentSentence() { if (DEBUG) { System.err.println("-> Build:" + this.text); } final String[] sentences = segment(this.text); return sentences; } }
public class class_name { @Override public String[] segmentSentence() { if (DEBUG) { System.err.println("-> Build:" + this.text); // depends on control dependency: [if], data = [none] } final String[] sentences = segment(this.text); return sentences; } }
public class class_name { public synchronized static TypeDesc forClass(Class<?> clazz) { if (clazz == null) { return null; } TypeDesc type = cClassesToInstances.get(clazz); if (type != null) { return type; } if (clazz.isArray()) { type = forClass(clazz.getComponentType()).toArrayType(); } else if (clazz.isPrimitive()) { if (clazz == int.class) { type = INT; } if (clazz == boolean.class) { type = BOOLEAN; } if (clazz == char.class) { type = CHAR; } if (clazz == byte.class) { type = BYTE; } if (clazz == long.class) { type = LONG; } if (clazz == float.class) { type = FLOAT; } if (clazz == double.class) { type = DOUBLE; } if (clazz == short.class) { type = SHORT; } if (clazz == void.class) { type = VOID; } } else { String name = clazz.getName(); type = intern(new ObjectType(generateDescriptor(name), name)); } cClassesToInstances.put(clazz, type); return type; } }
public class class_name { public synchronized static TypeDesc forClass(Class<?> clazz) { if (clazz == null) { return null; // depends on control dependency: [if], data = [none] } TypeDesc type = cClassesToInstances.get(clazz); if (type != null) { return type; // depends on control dependency: [if], data = [none] } if (clazz.isArray()) { type = forClass(clazz.getComponentType()).toArrayType(); // depends on control dependency: [if], data = [none] } else if (clazz.isPrimitive()) { if (clazz == int.class) { type = INT; // depends on control dependency: [if], data = [none] } if (clazz == boolean.class) { type = BOOLEAN; // depends on control dependency: [if], data = [none] } if (clazz == char.class) { type = CHAR; // depends on control dependency: [if], data = [none] } if (clazz == byte.class) { type = BYTE; // depends on control dependency: [if], data = [none] } if (clazz == long.class) { type = LONG; // depends on control dependency: [if], data = [none] } if (clazz == float.class) { type = FLOAT; // depends on control dependency: [if], data = [none] } if (clazz == double.class) { type = DOUBLE; // depends on control dependency: [if], data = [none] } if (clazz == short.class) { type = SHORT; // depends on control dependency: [if], data = [none] } if (clazz == void.class) { type = VOID; // depends on control dependency: [if], data = [none] } } else { String name = clazz.getName(); type = intern(new ObjectType(generateDescriptor(name), name)); // depends on control dependency: [if], data = [none] } cClassesToInstances.put(clazz, type); return type; } }
public class class_name { public static TailResults tailLog(String uri, TailResults previousResults, Function<String, Void> lineProcessor) throws IOException { URL logURL = new URL(uri); try (InputStream inputStream = logURL.openStream()) { BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream)); int count = 0; String lastLine = null; while (true) { String line = reader.readLine(); if (line == null) break; lastLine = line; if (previousResults.isNewLine(line, count)) { lineProcessor.apply(line); } count++; } return new TailResults(count, lastLine); } } }
public class class_name { public static TailResults tailLog(String uri, TailResults previousResults, Function<String, Void> lineProcessor) throws IOException { URL logURL = new URL(uri); try (InputStream inputStream = logURL.openStream()) { BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream)); int count = 0; String lastLine = null; while (true) { String line = reader.readLine(); if (line == null) break; lastLine = line; if (previousResults.isNewLine(line, count)) { lineProcessor.apply(line); // depends on control dependency: [if], data = [none] } count++; } return new TailResults(count, lastLine); } } }
public class class_name { private Map<String, TypeName> convertPropertiesToTypes(Map<String, ExecutableElement> properties) { Map<String, TypeName> types = new LinkedHashMap<>(); for (Map.Entry<String, ExecutableElement> entry : properties.entrySet()) { ExecutableElement el = entry.getValue(); types.put(entry.getKey(), TypeName.get(el.getReturnType())); } return types; } }
public class class_name { private Map<String, TypeName> convertPropertiesToTypes(Map<String, ExecutableElement> properties) { Map<String, TypeName> types = new LinkedHashMap<>(); for (Map.Entry<String, ExecutableElement> entry : properties.entrySet()) { ExecutableElement el = entry.getValue(); types.put(entry.getKey(), TypeName.get(el.getReturnType())); // depends on control dependency: [for], data = [entry] } return types; } }
public class class_name { public List<Clause> sentences() throws SourceCodeException { List<Clause> results = new LinkedList<Clause>(); // Loop consuming clauses until end of file is encounterd. while (true) { if (peekAndConsumeEof()) { break; } else { results.add(sentence()); } } return results; } }
public class class_name { public List<Clause> sentences() throws SourceCodeException { List<Clause> results = new LinkedList<Clause>(); // Loop consuming clauses until end of file is encounterd. while (true) { if (peekAndConsumeEof()) { break; } else { results.add(sentence()); // depends on control dependency: [if], data = [none] } } return results; } }
public class class_name { public boolean finish(GVRAnimationEngine engine) { if (mIsRunning) { stop(engine); getAnimation().animate(mTarget.getSceneObject(), 1); if (mOnFinish != null) { mOnFinish.finished((GVRAnimation) getAnimation()); } return true; } return false; } }
public class class_name { public boolean finish(GVRAnimationEngine engine) { if (mIsRunning) { stop(engine); // depends on control dependency: [if], data = [none] getAnimation().animate(mTarget.getSceneObject(), 1); // depends on control dependency: [if], data = [none] if (mOnFinish != null) { mOnFinish.finished((GVRAnimation) getAnimation()); // depends on control dependency: [if], data = [none] } return true; // depends on control dependency: [if], data = [none] } return false; } }
public class class_name { private View inflateMessageView() { if (getRootView() != null) { inflateMessageContainer(); if (customMessageView != null) { messageContainer.addView(customMessageView); } else if (customMessageViewId != -1) { LayoutInflater layoutInflater = LayoutInflater.from(getContext()); View view = layoutInflater.inflate(customMessageViewId, messageContainer, false); messageContainer.addView(view); } else { LayoutInflater layoutInflater = LayoutInflater.from(getContext()); View view = layoutInflater .inflate(R.layout.material_dialog_message, messageContainer, false); messageContainer.addView(view); } View messageView = messageContainer.findViewById(android.R.id.message); messageTextView = messageView instanceof TextView ? (TextView) messageView : null; return messageContainer; } return null; } }
public class class_name { private View inflateMessageView() { if (getRootView() != null) { inflateMessageContainer(); // depends on control dependency: [if], data = [none] if (customMessageView != null) { messageContainer.addView(customMessageView); // depends on control dependency: [if], data = [(customMessageView] } else if (customMessageViewId != -1) { LayoutInflater layoutInflater = LayoutInflater.from(getContext()); View view = layoutInflater.inflate(customMessageViewId, messageContainer, false); messageContainer.addView(view); // depends on control dependency: [if], data = [none] } else { LayoutInflater layoutInflater = LayoutInflater.from(getContext()); View view = layoutInflater .inflate(R.layout.material_dialog_message, messageContainer, false); messageContainer.addView(view); // depends on control dependency: [if], data = [none] } View messageView = messageContainer.findViewById(android.R.id.message); messageTextView = messageView instanceof TextView ? (TextView) messageView : null; // depends on control dependency: [if], data = [none] return messageContainer; // depends on control dependency: [if], data = [none] } return null; } }
public class class_name { protected void addAccessControl(AccessControl accessControl) { String id = accessControl.getId(); AccessControl existing = this.id2nodeMap.get(id); if (existing == null) { this.id2nodeMap.put(id, accessControl); LOG.debug("Registered access control {}", accessControl); } else if (existing == accessControl) { LOG.debug("Access control {} was already registered.", accessControl); } else { throw new IllegalStateException("Duplicate access control with ID '" + id + "'."); } } }
public class class_name { protected void addAccessControl(AccessControl accessControl) { String id = accessControl.getId(); AccessControl existing = this.id2nodeMap.get(id); if (existing == null) { this.id2nodeMap.put(id, accessControl); // depends on control dependency: [if], data = [none] LOG.debug("Registered access control {}", accessControl); // depends on control dependency: [if], data = [none] } else if (existing == accessControl) { LOG.debug("Access control {} was already registered.", accessControl); // depends on control dependency: [if], data = [accessControl)] } else { throw new IllegalStateException("Duplicate access control with ID '" + id + "'."); } } }
public class class_name { @Override public Iterable<BlockTemplateMatch> match(JCTree tree, Context context) { // TODO(lowasser): consider nonconsecutive matches? if (tree instanceof JCBlock) { JCBlock block = (JCBlock) tree; ImmutableList<JCStatement> targetStatements = ImmutableList.copyOf(block.getStatements()); return matchesStartingAnywhere(block, 0, targetStatements, context) .first() .or(List.<BlockTemplateMatch>nil()); } return ImmutableList.of(); } }
public class class_name { @Override public Iterable<BlockTemplateMatch> match(JCTree tree, Context context) { // TODO(lowasser): consider nonconsecutive matches? if (tree instanceof JCBlock) { JCBlock block = (JCBlock) tree; ImmutableList<JCStatement> targetStatements = ImmutableList.copyOf(block.getStatements()); return matchesStartingAnywhere(block, 0, targetStatements, context) .first() .or(List.<BlockTemplateMatch>nil()); // depends on control dependency: [if], data = [none] } return ImmutableList.of(); } }
public class class_name { private static boolean matchWildCards(String name, String template) { int wildcardIndex = template.indexOf("*"); if (wildcardIndex == -1) { return name.equals(template); } boolean isBeginning = true; String beforeWildcard; String afterWildcard = template; while (wildcardIndex != -1) { beforeWildcard = afterWildcard.substring(0, wildcardIndex); afterWildcard = afterWildcard.substring(wildcardIndex + 1); int beforeStartIndex = name.indexOf(beforeWildcard); if ((beforeStartIndex == -1) || (isBeginning && beforeStartIndex != 0)) { return false; } isBeginning = false; name = name.substring(beforeStartIndex + beforeWildcard.length()); wildcardIndex = afterWildcard.indexOf("*"); } return name.endsWith(afterWildcard); } }
public class class_name { private static boolean matchWildCards(String name, String template) { int wildcardIndex = template.indexOf("*"); if (wildcardIndex == -1) { return name.equals(template); // depends on control dependency: [if], data = [none] } boolean isBeginning = true; String beforeWildcard; String afterWildcard = template; while (wildcardIndex != -1) { beforeWildcard = afterWildcard.substring(0, wildcardIndex); // depends on control dependency: [while], data = [none] afterWildcard = afterWildcard.substring(wildcardIndex + 1); // depends on control dependency: [while], data = [(wildcardIndex] int beforeStartIndex = name.indexOf(beforeWildcard); if ((beforeStartIndex == -1) || (isBeginning && beforeStartIndex != 0)) { return false; // depends on control dependency: [if], data = [none] } isBeginning = false; // depends on control dependency: [while], data = [none] name = name.substring(beforeStartIndex + beforeWildcard.length()); // depends on control dependency: [while], data = [none] wildcardIndex = afterWildcard.indexOf("*"); // depends on control dependency: [while], data = [none] } return name.endsWith(afterWildcard); } }
public class class_name { public void end(String key) { if (key == null) { return; } TimingData data = executionInfo.get(key); if (data == null) { LOG.info("Called end with key: " + key + " without ever calling begin"); return; } data.end(); } }
public class class_name { public void end(String key) { if (key == null) { return; // depends on control dependency: [if], data = [none] } TimingData data = executionInfo.get(key); if (data == null) { LOG.info("Called end with key: " + key + " without ever calling begin"); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } data.end(); } }
public class class_name { public static Cookie[] getAllCookies(final HttpServletRequest request, final String cookieName) { Cookie[] cookies = request.getCookies(); if (cookies == null) { return null; } ArrayList<Cookie> list = new ArrayList<>(cookies.length); for (Cookie cookie : cookies) { if (cookie.getName().equals(cookieName)) { list.add(cookie); } } if (list.isEmpty()) { return null; } return list.toArray(new Cookie[0]); } }
public class class_name { public static Cookie[] getAllCookies(final HttpServletRequest request, final String cookieName) { Cookie[] cookies = request.getCookies(); if (cookies == null) { return null; // depends on control dependency: [if], data = [none] } ArrayList<Cookie> list = new ArrayList<>(cookies.length); for (Cookie cookie : cookies) { if (cookie.getName().equals(cookieName)) { list.add(cookie); // depends on control dependency: [if], data = [none] } } if (list.isEmpty()) { return null; // depends on control dependency: [if], data = [none] } return list.toArray(new Cookie[0]); } }
public class class_name { @Override public ConfigResponse<T> getConfigResponse() { T config = this.config.get(); config = withoutDefaultLogin(config); if (config instanceof PasswordsConfig<?>) { config = ((PasswordsConfig<T>) config).withoutPasswords(); } return new ConfigResponse<>(config, getConfigFileLocation(), configFileLocation); } }
public class class_name { @Override public ConfigResponse<T> getConfigResponse() { T config = this.config.get(); config = withoutDefaultLogin(config); if (config instanceof PasswordsConfig<?>) { config = ((PasswordsConfig<T>) config).withoutPasswords(); // depends on control dependency: [if], data = [)] } return new ConfigResponse<>(config, getConfigFileLocation(), configFileLocation); } }
public class class_name { public void entryRemoved (EntryRemovedEvent<OccupantInfo> event) { // bail if this isn't for the OCCUPANT_INFO field if (!event.getName().equals(PlaceObject.OCCUPANT_INFO)) { return; } // let the occupant observers know what's up final OccupantInfo oinfo = event.getOldEntry(); _observers.apply(new ObserverList.ObserverOp<OccupantObserver>() { public boolean apply (OccupantObserver observer) { observer.occupantLeft(oinfo); return true; } }); } }
public class class_name { public void entryRemoved (EntryRemovedEvent<OccupantInfo> event) { // bail if this isn't for the OCCUPANT_INFO field if (!event.getName().equals(PlaceObject.OCCUPANT_INFO)) { return; // depends on control dependency: [if], data = [none] } // let the occupant observers know what's up final OccupantInfo oinfo = event.getOldEntry(); _observers.apply(new ObserverList.ObserverOp<OccupantObserver>() { public boolean apply (OccupantObserver observer) { observer.occupantLeft(oinfo); return true; } }); } }
public class class_name { @Path("{snapshotId}/error") @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response error(@PathParam("snapshotId") String snapshotId, SnapshotErrorBridgeParameters params) { try { Snapshot snapshot = snapshotManager.transferError(snapshotId, params.getError()); log.info("Processed snapshot error notification: {}", snapshot); return Response.ok(new SnapshotErrorBridgeResult(snapshot.getStatus(), snapshot.getStatusText())) .build(); } catch (Exception ex) { log.error(ex.getMessage(), ex); return Response.serverError() .entity(new ResponseDetails(ex.getMessage())) .build(); } } }
public class class_name { @Path("{snapshotId}/error") @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response error(@PathParam("snapshotId") String snapshotId, SnapshotErrorBridgeParameters params) { try { Snapshot snapshot = snapshotManager.transferError(snapshotId, params.getError()); log.info("Processed snapshot error notification: {}", snapshot); // depends on control dependency: [try], data = [none] return Response.ok(new SnapshotErrorBridgeResult(snapshot.getStatus(), snapshot.getStatusText())) .build(); // depends on control dependency: [try], data = [none] } catch (Exception ex) { log.error(ex.getMessage(), ex); return Response.serverError() .entity(new ResponseDetails(ex.getMessage())) .build(); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private void addChangeSet(Build build, JSONObject changeSet, Set<String> commitIds, Set<String> revisions) { String scmType = getString(changeSet, "kind"); Map<String, RepoBranch> revisionToUrl = new HashMap<>(); // Build a map of revision to module (scm url). This is not always // provided by the Hudson API, but we can use it if available. // For git, this map is empty. for (Object revision : getJsonArray(changeSet, "revisions")) { JSONObject json = (JSONObject) revision; String revisionId = json.get("revision").toString(); if (StringUtils.isNotEmpty(revisionId) && !revisions.contains(revisionId)) { RepoBranch rb = new RepoBranch(); rb.setUrl(getString(json, "module")); rb.setType(RepoBranch.RepoType.fromString(scmType)); revisionToUrl.put(revisionId, rb); build.getCodeRepos().add(rb); } } for (Object item : getJsonArray(changeSet, "items")) { JSONObject jsonItem = (JSONObject) item; String commitId = getRevision(jsonItem); if (StringUtils.isNotEmpty(commitId) && !commitIds.contains(commitId)) { SCM scm = new SCM(); scm.setScmAuthor(getCommitAuthor(jsonItem)); scm.setScmCommitLog(getString(jsonItem, "msg")); scm.setScmCommitTimestamp(getCommitTimestamp(jsonItem)); scm.setScmRevisionNumber(commitId); RepoBranch repoBranch = revisionToUrl.get(scm.getScmRevisionNumber()); if (repoBranch != null) { scm.setScmUrl(repoBranch.getUrl()); scm.setScmBranch(repoBranch.getBranch()); } scm.setNumberOfChanges(getJsonArray(jsonItem, "paths").size()); build.getSourceChangeSet().add(scm); commitIds.add(commitId); } } } }
public class class_name { private void addChangeSet(Build build, JSONObject changeSet, Set<String> commitIds, Set<String> revisions) { String scmType = getString(changeSet, "kind"); Map<String, RepoBranch> revisionToUrl = new HashMap<>(); // Build a map of revision to module (scm url). This is not always // provided by the Hudson API, but we can use it if available. // For git, this map is empty. for (Object revision : getJsonArray(changeSet, "revisions")) { JSONObject json = (JSONObject) revision; String revisionId = json.get("revision").toString(); if (StringUtils.isNotEmpty(revisionId) && !revisions.contains(revisionId)) { RepoBranch rb = new RepoBranch(); rb.setUrl(getString(json, "module")); // depends on control dependency: [if], data = [none] rb.setType(RepoBranch.RepoType.fromString(scmType)); // depends on control dependency: [if], data = [none] revisionToUrl.put(revisionId, rb); // depends on control dependency: [if], data = [none] build.getCodeRepos().add(rb); // depends on control dependency: [if], data = [none] } } for (Object item : getJsonArray(changeSet, "items")) { JSONObject jsonItem = (JSONObject) item; String commitId = getRevision(jsonItem); if (StringUtils.isNotEmpty(commitId) && !commitIds.contains(commitId)) { SCM scm = new SCM(); scm.setScmAuthor(getCommitAuthor(jsonItem)); // depends on control dependency: [if], data = [none] scm.setScmCommitLog(getString(jsonItem, "msg")); // depends on control dependency: [if], data = [none] scm.setScmCommitTimestamp(getCommitTimestamp(jsonItem)); // depends on control dependency: [if], data = [none] scm.setScmRevisionNumber(commitId); // depends on control dependency: [if], data = [none] RepoBranch repoBranch = revisionToUrl.get(scm.getScmRevisionNumber()); if (repoBranch != null) { scm.setScmUrl(repoBranch.getUrl()); // depends on control dependency: [if], data = [(repoBranch] scm.setScmBranch(repoBranch.getBranch()); // depends on control dependency: [if], data = [(repoBranch] } scm.setNumberOfChanges(getJsonArray(jsonItem, "paths").size()); // depends on control dependency: [if], data = [none] build.getSourceChangeSet().add(scm); // depends on control dependency: [if], data = [none] commitIds.add(commitId); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public void setTickLabelSectionsVisible(final boolean VISIBLE) { if (null == tickLabelSectionsVisible) { _tickLabelSectionsVisible = VISIBLE; fireUpdateEvent(REDRAW_EVENT); } else { tickLabelSectionsVisible.set(VISIBLE); } } }
public class class_name { public void setTickLabelSectionsVisible(final boolean VISIBLE) { if (null == tickLabelSectionsVisible) { _tickLabelSectionsVisible = VISIBLE; // depends on control dependency: [if], data = [none] fireUpdateEvent(REDRAW_EVENT); // depends on control dependency: [if], data = [none] } else { tickLabelSectionsVisible.set(VISIBLE); // depends on control dependency: [if], data = [none] } } }
public class class_name { protected boolean populateBuffer (Buffer buffer) { if (_abuf == null) { _abuf = ByteBuffer.allocateDirect(getBufferSize()).order(ByteOrder.nativeOrder()); } _abuf.clear(); int read = 0; try { read = Math.max(populateBuffer(_abuf), 0); } catch (IOException e) { log.warning("Error reading audio stream [error=" + e + "]."); } if (read <= 0) { return false; } _abuf.rewind().limit(read); buffer.setData(getFormat(), _abuf, getFrequency()); return true; } }
public class class_name { protected boolean populateBuffer (Buffer buffer) { if (_abuf == null) { _abuf = ByteBuffer.allocateDirect(getBufferSize()).order(ByteOrder.nativeOrder()); // depends on control dependency: [if], data = [none] } _abuf.clear(); int read = 0; try { read = Math.max(populateBuffer(_abuf), 0); // depends on control dependency: [try], data = [none] } catch (IOException e) { log.warning("Error reading audio stream [error=" + e + "]."); } // depends on control dependency: [catch], data = [none] if (read <= 0) { return false; // depends on control dependency: [if], data = [none] } _abuf.rewind().limit(read); buffer.setData(getFormat(), _abuf, getFrequency()); return true; } }
public class class_name { private int getMaxElements(String requestUri) { String containerMaxElements = getMaxElements(); int maxElements = -1; if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(containerMaxElements)) { try { maxElements = Integer.parseInt(containerMaxElements); } catch (NumberFormatException e) { throw new CmsIllegalStateException( Messages.get().container( Messages.LOG_WRONG_CONTAINER_MAXELEMENTS_3, new Object[] {requestUri, getName(), containerMaxElements}), e); } } else { if (LOG.isWarnEnabled()) { LOG.warn( Messages.get().getBundle().key( Messages.LOG_MAXELEMENTS_NOT_SET_2, new Object[] {getName(), requestUri})); } } return maxElements; } }
public class class_name { private int getMaxElements(String requestUri) { String containerMaxElements = getMaxElements(); int maxElements = -1; if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(containerMaxElements)) { try { maxElements = Integer.parseInt(containerMaxElements); // depends on control dependency: [try], data = [none] } catch (NumberFormatException e) { throw new CmsIllegalStateException( Messages.get().container( Messages.LOG_WRONG_CONTAINER_MAXELEMENTS_3, new Object[] {requestUri, getName(), containerMaxElements}), e); } // depends on control dependency: [catch], data = [none] } else { if (LOG.isWarnEnabled()) { LOG.warn( Messages.get().getBundle().key( Messages.LOG_MAXELEMENTS_NOT_SET_2, new Object[] {getName(), requestUri})); // depends on control dependency: [if], data = [none] } } return maxElements; } }
public class class_name { public void setSupportedLicenses(java.util.Collection<String> supportedLicenses) { if (supportedLicenses == null) { this.supportedLicenses = null; return; } this.supportedLicenses = new java.util.ArrayList<String>(supportedLicenses); } }
public class class_name { public void setSupportedLicenses(java.util.Collection<String> supportedLicenses) { if (supportedLicenses == null) { this.supportedLicenses = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.supportedLicenses = new java.util.ArrayList<String>(supportedLicenses); } }
public class class_name { public List<User> getUsers() { Gson gson = gsonParser(); JsonObject object = (JsonObject) response; List<User> l = gson.fromJson(object.get("users"), new TypeToken<List<User>>() {}.getType()); for (User e : l) { e.setClient(client); } return l; } }
public class class_name { public List<User> getUsers() { Gson gson = gsonParser(); JsonObject object = (JsonObject) response; List<User> l = gson.fromJson(object.get("users"), new TypeToken<List<User>>() {}.getType()); for (User e : l) { e.setClient(client); } // depends on control dependency: [for], data = [e] return l; } }
public class class_name { public static DateTime gpsWeekTime2DateTime( double gpsWeekTime ) { double fpart, ipart, unixTime; fpart = gpsWeekTime % 1; ipart = Math.floor(gpsWeekTime); unixTime = ipart + 315964800 - countleaps(ipart, false); if (isleap(ipart + 1)) { unixTime = unixTime + fpart / 2; } else if (isleap(ipart)) { unixTime = unixTime + (fpart + 1) / 2; } else { unixTime = unixTime + fpart; } DateTime dt = new DateTime((long) unixTime * 1000); return dt; } }
public class class_name { public static DateTime gpsWeekTime2DateTime( double gpsWeekTime ) { double fpart, ipart, unixTime; fpart = gpsWeekTime % 1; ipart = Math.floor(gpsWeekTime); unixTime = ipart + 315964800 - countleaps(ipart, false); if (isleap(ipart + 1)) { unixTime = unixTime + fpart / 2; // depends on control dependency: [if], data = [none] } else if (isleap(ipart)) { unixTime = unixTime + (fpart + 1) / 2; // depends on control dependency: [if], data = [none] } else { unixTime = unixTime + fpart; // depends on control dependency: [if], data = [none] } DateTime dt = new DateTime((long) unixTime * 1000); return dt; } }
public class class_name { @SuppressWarnings("unchecked") public <T, E> RingbufferContainer<T, E> getOrCreateContainer(int partitionId, ObjectNamespace namespace, RingbufferConfig config) { if (config == null) { throw new NullPointerException("Ringbuffer config should not be null when ringbuffer is being created"); } final Map<ObjectNamespace, RingbufferContainer> partitionContainers = getOrCreateRingbufferContainers(partitionId); RingbufferContainer<T, E> ringbuffer = partitionContainers.get(namespace); if (ringbuffer != null) { return ringbuffer; } ringbuffer = new RingbufferContainer<T, E>(namespace, config, nodeEngine, partitionId); ringbuffer.getStore().instrument(nodeEngine); partitionContainers.put(namespace, ringbuffer); return ringbuffer; } }
public class class_name { @SuppressWarnings("unchecked") public <T, E> RingbufferContainer<T, E> getOrCreateContainer(int partitionId, ObjectNamespace namespace, RingbufferConfig config) { if (config == null) { throw new NullPointerException("Ringbuffer config should not be null when ringbuffer is being created"); } final Map<ObjectNamespace, RingbufferContainer> partitionContainers = getOrCreateRingbufferContainers(partitionId); RingbufferContainer<T, E> ringbuffer = partitionContainers.get(namespace); if (ringbuffer != null) { return ringbuffer; // depends on control dependency: [if], data = [none] } ringbuffer = new RingbufferContainer<T, E>(namespace, config, nodeEngine, partitionId); ringbuffer.getStore().instrument(nodeEngine); partitionContainers.put(namespace, ringbuffer); return ringbuffer; } }
public class class_name { public static int getInt ( Properties props, String key, int def ) { String s = props.getProperty(key); if ( s != null ) { try { def = Integer.parseInt(s); } catch ( NumberFormatException nfe ) { log.error("Not a number", nfe); } } return def; } }
public class class_name { public static int getInt ( Properties props, String key, int def ) { String s = props.getProperty(key); if ( s != null ) { try { def = Integer.parseInt(s); // depends on control dependency: [try], data = [none] } catch ( NumberFormatException nfe ) { log.error("Not a number", nfe); } // depends on control dependency: [catch], data = [none] } return def; } }
public class class_name { public Xdr sendAndWait(int timeout, Xdr xdrRequest) throws RpcException { // no lock is required here. // The status may be changed after the checking, // or there exists a small window that the status is not consistent to // the actual tcp connection state. // Both above cases will not cause any issues. if (_state.equals(State.CONNECTED) == false) { _channelFuture.awaitUninterruptibly(); if (_channelFuture.isSuccess() == false) { String msg = String.format("waiting for connection to be established, but failed %s", getRemoteAddress()); LOG.error(msg); // return RpcException, the exact reason should already be // logged in IOHandler::exceptionCaught() throw new RpcException(RpcStatus.NETWORK_ERROR, msg); } } // check whether the internal queue of netty has enough spaces to hold // the request // False means that the too many pending requests are in the queue or // the connection is closed. if (_channel.isWritable() == false) { String msg; if (_channel.isConnected()) { msg = String.format("too many pending requests for the connection: %s", getRemoteAddress()); } else { msg = String.format("the connection is broken: %s", getRemoteAddress()); } // too many pending request are in the queue, return error throw new RpcException(RpcStatus.NETWORK_ERROR, msg); } // put the request into a map for timeout management ChannelFuture timeoutFuture = Channels.future(_channel); Integer xid = Integer.valueOf(xdrRequest.getXid()); _futureMap.put(xid, timeoutFuture); // put the request into the queue of the netty, netty will send data // asynchronously RecordMarkingUtil.putRecordMarkingAndSend(_channel, xdrRequest); timeoutFuture.awaitUninterruptibly(timeout, TimeUnit.SECONDS); // remove the response from timeout maps Xdr response = _responseMap.remove(xid); _futureMap.remove(xid); if (timeoutFuture.isSuccess() == false) { LOG.warn("cause:", timeoutFuture.getCause()); if (timeoutFuture.isDone()) { String msg = String.format("tcp IO error on the connection: %s", getRemoteAddress()); throw new RpcException(RpcStatus.NETWORK_ERROR, msg); } else { String msg = String.format("rpc request timeout on the connection: %s", getRemoteAddress()); throw new RpcException(RpcStatus.NETWORK_ERROR, msg); } } return response; } }
public class class_name { public Xdr sendAndWait(int timeout, Xdr xdrRequest) throws RpcException { // no lock is required here. // The status may be changed after the checking, // or there exists a small window that the status is not consistent to // the actual tcp connection state. // Both above cases will not cause any issues. if (_state.equals(State.CONNECTED) == false) { _channelFuture.awaitUninterruptibly(); if (_channelFuture.isSuccess() == false) { String msg = String.format("waiting for connection to be established, but failed %s", getRemoteAddress()); LOG.error(msg); // depends on control dependency: [if], data = [none] // return RpcException, the exact reason should already be // logged in IOHandler::exceptionCaught() throw new RpcException(RpcStatus.NETWORK_ERROR, msg); } } // check whether the internal queue of netty has enough spaces to hold // the request // False means that the too many pending requests are in the queue or // the connection is closed. if (_channel.isWritable() == false) { String msg; if (_channel.isConnected()) { msg = String.format("too many pending requests for the connection: %s", getRemoteAddress()); } else { msg = String.format("the connection is broken: %s", getRemoteAddress()); } // too many pending request are in the queue, return error throw new RpcException(RpcStatus.NETWORK_ERROR, msg); } // put the request into a map for timeout management ChannelFuture timeoutFuture = Channels.future(_channel); Integer xid = Integer.valueOf(xdrRequest.getXid()); _futureMap.put(xid, timeoutFuture); // put the request into the queue of the netty, netty will send data // asynchronously RecordMarkingUtil.putRecordMarkingAndSend(_channel, xdrRequest); timeoutFuture.awaitUninterruptibly(timeout, TimeUnit.SECONDS); // remove the response from timeout maps Xdr response = _responseMap.remove(xid); _futureMap.remove(xid); if (timeoutFuture.isSuccess() == false) { LOG.warn("cause:", timeoutFuture.getCause()); if (timeoutFuture.isDone()) { String msg = String.format("tcp IO error on the connection: %s", getRemoteAddress()); throw new RpcException(RpcStatus.NETWORK_ERROR, msg); } else { String msg = String.format("rpc request timeout on the connection: %s", getRemoteAddress()); throw new RpcException(RpcStatus.NETWORK_ERROR, msg); } } return response; } }
public class class_name { public Map<String, String[]> addParameterMap(Map<String, String[]> map) { if (map == null) { return m_parameters; } if ((m_parameters == null) || (m_parameters.size() == 0)) { m_parameters = Collections.unmodifiableMap(map); } else { Map<String, String[]> parameters = new HashMap<String, String[]>(); parameters.putAll(m_parameters); Iterator<Map.Entry<String, String[]>> it = map.entrySet().iterator(); while (it.hasNext()) { Map.Entry<String, String[]> entry = it.next(); String key = entry.getKey(); // Check if the parameter name (key) exists if (parameters.containsKey(key)) { String[] oldValues = parameters.get(key); String[] newValues = entry.getValue(); String[] mergeValues = new String[oldValues.length + newValues.length]; System.arraycopy(newValues, 0, mergeValues, 0, newValues.length); System.arraycopy(oldValues, 0, mergeValues, newValues.length, oldValues.length); parameters.put(key, mergeValues); } else { // No: Add new value array parameters.put(key, entry.getValue()); } } m_parameters = Collections.unmodifiableMap(parameters); } return m_parameters; } }
public class class_name { public Map<String, String[]> addParameterMap(Map<String, String[]> map) { if (map == null) { return m_parameters; // depends on control dependency: [if], data = [none] } if ((m_parameters == null) || (m_parameters.size() == 0)) { m_parameters = Collections.unmodifiableMap(map); // depends on control dependency: [if], data = [none] } else { Map<String, String[]> parameters = new HashMap<String, String[]>(); parameters.putAll(m_parameters); // depends on control dependency: [if], data = [none] Iterator<Map.Entry<String, String[]>> it = map.entrySet().iterator(); while (it.hasNext()) { Map.Entry<String, String[]> entry = it.next(); String key = entry.getKey(); // Check if the parameter name (key) exists if (parameters.containsKey(key)) { String[] oldValues = parameters.get(key); String[] newValues = entry.getValue(); String[] mergeValues = new String[oldValues.length + newValues.length]; System.arraycopy(newValues, 0, mergeValues, 0, newValues.length); // depends on control dependency: [if], data = [none] System.arraycopy(oldValues, 0, mergeValues, newValues.length, oldValues.length); // depends on control dependency: [if], data = [none] parameters.put(key, mergeValues); // depends on control dependency: [if], data = [none] } else { // No: Add new value array parameters.put(key, entry.getValue()); // depends on control dependency: [if], data = [none] } } m_parameters = Collections.unmodifiableMap(parameters); // depends on control dependency: [if], data = [none] } return m_parameters; } }
public class class_name { public void marshall(DisassociateContactFromAddressBookRequest disassociateContactFromAddressBookRequest, ProtocolMarshaller protocolMarshaller) { if (disassociateContactFromAddressBookRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(disassociateContactFromAddressBookRequest.getContactArn(), CONTACTARN_BINDING); protocolMarshaller.marshall(disassociateContactFromAddressBookRequest.getAddressBookArn(), ADDRESSBOOKARN_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(DisassociateContactFromAddressBookRequest disassociateContactFromAddressBookRequest, ProtocolMarshaller protocolMarshaller) { if (disassociateContactFromAddressBookRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(disassociateContactFromAddressBookRequest.getContactArn(), CONTACTARN_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(disassociateContactFromAddressBookRequest.getAddressBookArn(), ADDRESSBOOKARN_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private Task readTask(ChildTaskContainer parent, Integer id) { Table a0 = getTable("A0TAB"); Table a1 = getTable("A1TAB"); Table a2 = getTable("A2TAB"); Table a3 = getTable("A3TAB"); Table a4 = getTable("A4TAB"); Task task = parent.addTask(); MapRow a1Row = a1.find(id); MapRow a2Row = a2.find(id); setFields(A0TAB_FIELDS, a0.find(id), task); setFields(A1TAB_FIELDS, a1Row, task); setFields(A2TAB_FIELDS, a2Row, task); setFields(A3TAB_FIELDS, a3.find(id), task); setFields(A5TAB_FIELDS, a4.find(id), task); task.setStart(task.getEarlyStart()); task.setFinish(task.getEarlyFinish()); if (task.getName() == null) { task.setName(task.getText(1)); } m_eventManager.fireTaskReadEvent(task); return task; } }
public class class_name { private Task readTask(ChildTaskContainer parent, Integer id) { Table a0 = getTable("A0TAB"); Table a1 = getTable("A1TAB"); Table a2 = getTable("A2TAB"); Table a3 = getTable("A3TAB"); Table a4 = getTable("A4TAB"); Task task = parent.addTask(); MapRow a1Row = a1.find(id); MapRow a2Row = a2.find(id); setFields(A0TAB_FIELDS, a0.find(id), task); setFields(A1TAB_FIELDS, a1Row, task); setFields(A2TAB_FIELDS, a2Row, task); setFields(A3TAB_FIELDS, a3.find(id), task); setFields(A5TAB_FIELDS, a4.find(id), task); task.setStart(task.getEarlyStart()); task.setFinish(task.getEarlyFinish()); if (task.getName() == null) { task.setName(task.getText(1)); // depends on control dependency: [if], data = [none] } m_eventManager.fireTaskReadEvent(task); return task; } }
public class class_name { @Override public I get() { I instance = _instance; if (instance == null || instance.isModified()) { _instance = instance = service().get(); } return instance; } }
public class class_name { @Override public I get() { I instance = _instance; if (instance == null || instance.isModified()) { _instance = instance = service().get(); // depends on control dependency: [if], data = [none] } return instance; } }
public class class_name { public static boolean isAlphaNumericOrContainsOnlyCharacters(String in, String chars) { char c = 0; for (int i = 0; i < in.length(); i++) { c = in.charAt(i); if (Character.isLetterOrDigit(c) == (chars.indexOf(c) != -1)) { return false; } } return true; } }
public class class_name { public static boolean isAlphaNumericOrContainsOnlyCharacters(String in, String chars) { char c = 0; for (int i = 0; i < in.length(); i++) { c = in.charAt(i); // depends on control dependency: [for], data = [i] if (Character.isLetterOrDigit(c) == (chars.indexOf(c) != -1)) { return false; // depends on control dependency: [if], data = [none] } } return true; } }
public class class_name { public Optional<Commit> getOptionalCommit(Object projectIdOrPath, String sha) { try { return (Optional.ofNullable(getCommit(projectIdOrPath, sha))); } catch (GitLabApiException glae) { return (GitLabApi.createOptionalFromException(glae)); } } }
public class class_name { public Optional<Commit> getOptionalCommit(Object projectIdOrPath, String sha) { try { return (Optional.ofNullable(getCommit(projectIdOrPath, sha))); // depends on control dependency: [try], data = [none] } catch (GitLabApiException glae) { return (GitLabApi.createOptionalFromException(glae)); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private void countClassAccess(final @DottedClassName String calledClass) { if (calledClass.equals(clsName) || isAssociatedClass(calledClass)) { if (getPrevOpcode(1) != Const.ALOAD_0) { thisClsAccessCount++; } } else { String calledPackage = SignatureUtils.getPackageName(calledClass); if (SignatureUtils.similarPackages(calledPackage, packageName, 2) && !generalPurpose(calledClass)) { BitSet lineNumbers = clsAccessCount.get(calledClass); if (lineNumbers == null) { lineNumbers = new BitSet(); addLineNumber(lineNumbers); clsAccessCount.put(calledClass, lineNumbers); } else { addLineNumber(lineNumbers); } } } } }
public class class_name { private void countClassAccess(final @DottedClassName String calledClass) { if (calledClass.equals(clsName) || isAssociatedClass(calledClass)) { if (getPrevOpcode(1) != Const.ALOAD_0) { thisClsAccessCount++; // depends on control dependency: [if], data = [none] } } else { String calledPackage = SignatureUtils.getPackageName(calledClass); if (SignatureUtils.similarPackages(calledPackage, packageName, 2) && !generalPurpose(calledClass)) { BitSet lineNumbers = clsAccessCount.get(calledClass); if (lineNumbers == null) { lineNumbers = new BitSet(); // depends on control dependency: [if], data = [none] addLineNumber(lineNumbers); // depends on control dependency: [if], data = [(lineNumbers] clsAccessCount.put(calledClass, lineNumbers); // depends on control dependency: [if], data = [none] } else { addLineNumber(lineNumbers); // depends on control dependency: [if], data = [(lineNumbers] } } } } }
public class class_name { @Override public T get() { try { latch.await(); return output.get(); } catch (InterruptedException e) { throw new RedisCommandInterruptedException(e); } } }
public class class_name { @Override public T get() { try { latch.await(); // depends on control dependency: [try], data = [none] return output.get(); // depends on control dependency: [try], data = [none] } catch (InterruptedException e) { throw new RedisCommandInterruptedException(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { @Override public final void unlock(final long lockID, final Transaction transaction, final boolean incrementUnlockCountIfNonpersistent) throws ProtocolException, TransactionException, SevereMessageStoreException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "unlock", new Object[] { Long.valueOf(lockID), transaction, Boolean.valueOf(incrementUnlockCountIfNonpersistent) }); boolean invokeUnlockedCallback = false; boolean linkHasBecomeAvailable = false; boolean linkHasBecomeReleasable = false; boolean linkHasBecomeNotReleasable = false; boolean requiresPersistUnlockTask = false; AbstractItem item = null; synchronized (this) { if (_itemLinkState == ItemLinkState.STATE_LOCKED) { if (_lockID != lockID) { if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) SibTr.event(this, tc, "LockID mismatch! LockID(Item): " + _lockID + ", LockID(New): " + lockID); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "unlock"); throw new LockIdMismatch(_lockID, lockID); } if (null != transaction) { _transactionId = transaction.getPersistentTranId(); } if (_lockID == Item.DELIVERY_DELAY_LOCK_ID) { // For Delivery delay messages // Fetch the item from persistance if not available // This is needed because we need to call item.eventUnlocked() // so that if there is any ready consumer we can deliver the // message immediately item = getItem(); ListStatistics stats = getParentStatistics(); synchronized (stats) { stats.decrementLocked(); stats.incrementAvailable(); } // we can make the item discardable // since we have fetched the item linkHasBecomeReleasable = _declareDiscardable(); _lockID = NO_LOCK_ID; _tuple.setLockID(AbstractItem.NO_LOCK_ID); if (incrementUnlockCountIfNonpersistent) { _unlockCount++; } _itemLinkState = ItemLinkState.STATE_AVAILABLE; invokeUnlockedCallback = true; linkHasBecomeAvailable = true; } else { item = _getAndAssertItem(); ListStatistics stats = getParentStatistics(); synchronized (stats) { stats.decrementLocked(); stats.incrementAvailable(); } linkHasBecomeReleasable = _declareDiscardable(); _lockID = NO_LOCK_ID; _tuple.setLockID(AbstractItem.NO_LOCK_ID); if (incrementUnlockCountIfNonpersistent) { _unlockCount++; } _itemLinkState = ItemLinkState.STATE_AVAILABLE; invokeUnlockedCallback = true; linkHasBecomeAvailable = true; } } else if (_itemLinkState == ItemLinkState.STATE_PERSISTENTLY_LOCKED) { if (_lockID != lockID) { if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) SibTr.event(this, tc, "LockID mismatch! LockID(Item): " + _lockID + ", LockID(New): " + lockID); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "unlock"); throw new LockIdMismatch(_lockID, lockID); } if (null == transaction) { if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) SibTr.event(this, tc, "No transaction supplied for persistent unlock!"); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "unlock"); throw new StateException("Unlock of Persistently locked requires transaction"); } _transactionId = transaction.getPersistentTranId(); linkHasBecomeNotReleasable = _declareNotDiscardable(_getItemNoRestore()); _tuple.setLockID(AbstractItem.NO_LOCK_ID); _itemLinkState = ItemLinkState.STATE_UNLOCKING_PERSISTENTLY_LOCKED; requiresPersistUnlockTask = true; } else { if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) SibTr.event(this, tc, "Invalid Item state: " + _itemLinkState); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "unlock"); throw new StateException(_itemLinkState.toString()); } } // this needs to be outside sync block if (linkHasBecomeReleasable) { _declareReleasable(_getItemNoRestore()); } if (linkHasBecomeNotReleasable) { _declareNotReleasable(); } if (requiresPersistUnlockTask) { Task task = new PersistUnlock(this); ((PersistentTransaction) transaction).addWork(task); } if (linkHasBecomeAvailable && isAvailable()) { if (null != _owningStreamLink) { _owningStreamLink.linkAvailable(this); } } // this needs to be outside sync block if (invokeUnlockedCallback) { if (item != null) { item.eventUnlocked(); } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "unlock"); } }
public class class_name { @Override public final void unlock(final long lockID, final Transaction transaction, final boolean incrementUnlockCountIfNonpersistent) throws ProtocolException, TransactionException, SevereMessageStoreException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "unlock", new Object[] { Long.valueOf(lockID), transaction, Boolean.valueOf(incrementUnlockCountIfNonpersistent) }); boolean invokeUnlockedCallback = false; boolean linkHasBecomeAvailable = false; boolean linkHasBecomeReleasable = false; boolean linkHasBecomeNotReleasable = false; boolean requiresPersistUnlockTask = false; AbstractItem item = null; synchronized (this) { if (_itemLinkState == ItemLinkState.STATE_LOCKED) { if (_lockID != lockID) { if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) SibTr.event(this, tc, "LockID mismatch! LockID(Item): " + _lockID + ", LockID(New): " + lockID); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "unlock"); throw new LockIdMismatch(_lockID, lockID); } if (null != transaction) { _transactionId = transaction.getPersistentTranId(); // depends on control dependency: [if], data = [none] } if (_lockID == Item.DELIVERY_DELAY_LOCK_ID) { // For Delivery delay messages // Fetch the item from persistance if not available // This is needed because we need to call item.eventUnlocked() // so that if there is any ready consumer we can deliver the // message immediately item = getItem(); // depends on control dependency: [if], data = [none] ListStatistics stats = getParentStatistics(); synchronized (stats) // depends on control dependency: [if], data = [none] { stats.decrementLocked(); stats.incrementAvailable(); } // we can make the item discardable // since we have fetched the item linkHasBecomeReleasable = _declareDiscardable(); // depends on control dependency: [if], data = [none] _lockID = NO_LOCK_ID; // depends on control dependency: [if], data = [none] _tuple.setLockID(AbstractItem.NO_LOCK_ID); // depends on control dependency: [if], data = [none] if (incrementUnlockCountIfNonpersistent) { _unlockCount++; // depends on control dependency: [if], data = [none] } _itemLinkState = ItemLinkState.STATE_AVAILABLE; // depends on control dependency: [if], data = [none] invokeUnlockedCallback = true; // depends on control dependency: [if], data = [none] linkHasBecomeAvailable = true; // depends on control dependency: [if], data = [none] } else { item = _getAndAssertItem(); // depends on control dependency: [if], data = [none] ListStatistics stats = getParentStatistics(); synchronized (stats) // depends on control dependency: [if], data = [none] { stats.decrementLocked(); stats.incrementAvailable(); } linkHasBecomeReleasable = _declareDiscardable(); // depends on control dependency: [if], data = [none] _lockID = NO_LOCK_ID; // depends on control dependency: [if], data = [none] _tuple.setLockID(AbstractItem.NO_LOCK_ID); // depends on control dependency: [if], data = [none] if (incrementUnlockCountIfNonpersistent) { _unlockCount++; // depends on control dependency: [if], data = [none] } _itemLinkState = ItemLinkState.STATE_AVAILABLE; // depends on control dependency: [if], data = [none] invokeUnlockedCallback = true; // depends on control dependency: [if], data = [none] linkHasBecomeAvailable = true; // depends on control dependency: [if], data = [none] } } else if (_itemLinkState == ItemLinkState.STATE_PERSISTENTLY_LOCKED) { if (_lockID != lockID) { if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) SibTr.event(this, tc, "LockID mismatch! LockID(Item): " + _lockID + ", LockID(New): " + lockID); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "unlock"); throw new LockIdMismatch(_lockID, lockID); } if (null == transaction) { if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) SibTr.event(this, tc, "No transaction supplied for persistent unlock!"); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "unlock"); throw new StateException("Unlock of Persistently locked requires transaction"); } _transactionId = transaction.getPersistentTranId(); // depends on control dependency: [if], data = [none] linkHasBecomeNotReleasable = _declareNotDiscardable(_getItemNoRestore()); // depends on control dependency: [if], data = [none] _tuple.setLockID(AbstractItem.NO_LOCK_ID); // depends on control dependency: [if], data = [none] _itemLinkState = ItemLinkState.STATE_UNLOCKING_PERSISTENTLY_LOCKED; // depends on control dependency: [if], data = [none] requiresPersistUnlockTask = true; // depends on control dependency: [if], data = [none] } else { if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) SibTr.event(this, tc, "Invalid Item state: " + _itemLinkState); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "unlock"); throw new StateException(_itemLinkState.toString()); } } // this needs to be outside sync block if (linkHasBecomeReleasable) { _declareReleasable(_getItemNoRestore()); } if (linkHasBecomeNotReleasable) { _declareNotReleasable(); } if (requiresPersistUnlockTask) { Task task = new PersistUnlock(this); ((PersistentTransaction) transaction).addWork(task); } if (linkHasBecomeAvailable && isAvailable()) { if (null != _owningStreamLink) { _owningStreamLink.linkAvailable(this); // depends on control dependency: [if], data = [none] } } // this needs to be outside sync block if (invokeUnlockedCallback) { if (item != null) { item.eventUnlocked(); // depends on control dependency: [if], data = [none] } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "unlock"); } }
public class class_name { public List<MavenBuild> getBuilds() { if (builds == null) { return Collections.emptyList(); } else { return builds.stream() .map(SET_CLIENT(this.client)) .collect(toList()); } } }
public class class_name { public List<MavenBuild> getBuilds() { if (builds == null) { return Collections.emptyList(); // depends on control dependency: [if], data = [none] } else { return builds.stream() .map(SET_CLIENT(this.client)) .collect(toList()); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static String removeLineComment(String sql) { // with removing CR! assertSqlNotNull(sql); final StringBuilder sb = new StringBuilder(); final List<String> lineList = splitList(sql, "\n"); for (String line : lineList) { if (line == null) { continue; } line = removeCR(line); // remove CR! if (line.trim().startsWith("--")) { continue; } final List<DelimiterInfo> delimiterList = extractDelimiterList(line, "--"); int realIndex = -1; indexLoop: for (DelimiterInfo delimiter : delimiterList) { final List<ScopeInfo> scopeList = extractScopeList(line, "/*", "*/"); final int delimiterIndex = delimiter.getBeginIndex(); for (ScopeInfo scope : scopeList) { if (scope.isBeforeScope(delimiterIndex)) { break; } if (scope.isInScope(delimiterIndex)) { continue indexLoop; } } // found realIndex = delimiterIndex; } if (realIndex >= 0) { line = line.substring(0, realIndex); } sb.append(line).append("\n"); } final String filtered = sb.toString(); return filtered.substring(0, filtered.length() - "\n".length()); } }
public class class_name { public static String removeLineComment(String sql) { // with removing CR! assertSqlNotNull(sql); final StringBuilder sb = new StringBuilder(); final List<String> lineList = splitList(sql, "\n"); for (String line : lineList) { if (line == null) { continue; } line = removeCR(line); // remove CR! // depends on control dependency: [for], data = [line] if (line.trim().startsWith("--")) { continue; } final List<DelimiterInfo> delimiterList = extractDelimiterList(line, "--"); int realIndex = -1; indexLoop: for (DelimiterInfo delimiter : delimiterList) { final List<ScopeInfo> scopeList = extractScopeList(line, "/*", "*/"); final int delimiterIndex = delimiter.getBeginIndex(); for (ScopeInfo scope : scopeList) { if (scope.isBeforeScope(delimiterIndex)) { break; } if (scope.isInScope(delimiterIndex)) { continue indexLoop; } } // found realIndex = delimiterIndex; // depends on control dependency: [for], data = [delimiter] } if (realIndex >= 0) { line = line.substring(0, realIndex); // depends on control dependency: [if], data = [none] } sb.append(line).append("\n"); // depends on control dependency: [for], data = [line] } final String filtered = sb.toString(); return filtered.substring(0, filtered.length() - "\n".length()); } }
public class class_name { public static Object getNewResourceHandler( String type, String defaultClassName, PageContext context, HttpServletRequest req, HttpServletResponse res) throws CmsRuntimeException { if (CmsStringUtil.isEmpty(type)) { // it's not possible to hardwire the resource type name on the JSP for Xml content types type = req.getParameter(PARAM_NEWRESOURCETYPE); } String className = defaultClassName; CmsExplorerTypeSettings settings = OpenCms.getWorkplaceManager().getExplorerTypeSetting(type); Class<?> clazz = null; try { clazz = Class.forName(className); } catch (ClassNotFoundException e) { if (LOG.isErrorEnabled()) { LOG.error(Messages.get().getBundle().key(Messages.ERR_NEW_RES_HANDLER_CLASS_NOT_FOUND_1, className), e); } throw new CmsIllegalArgumentException( Messages.get().container(Messages.ERR_NEW_RES_HANDLER_CLASS_NOT_FOUND_1, className)); } Object handler = null; try { Constructor<?> constructor = clazz.getConstructor( new Class[] {PageContext.class, HttpServletRequest.class, HttpServletResponse.class}); handler = constructor.newInstance(new Object[] {context, req, res}); } catch (Exception e) { throw new CmsIllegalArgumentException( Messages.get().container(Messages.ERR_NEW_RES_CONSTRUCTOR_NOT_FOUND_1, className)); } return handler; } }
public class class_name { public static Object getNewResourceHandler( String type, String defaultClassName, PageContext context, HttpServletRequest req, HttpServletResponse res) throws CmsRuntimeException { if (CmsStringUtil.isEmpty(type)) { // it's not possible to hardwire the resource type name on the JSP for Xml content types type = req.getParameter(PARAM_NEWRESOURCETYPE); } String className = defaultClassName; CmsExplorerTypeSettings settings = OpenCms.getWorkplaceManager().getExplorerTypeSetting(type); Class<?> clazz = null; try { clazz = Class.forName(className); } catch (ClassNotFoundException e) { if (LOG.isErrorEnabled()) { LOG.error(Messages.get().getBundle().key(Messages.ERR_NEW_RES_HANDLER_CLASS_NOT_FOUND_1, className), e); // depends on control dependency: [if], data = [none] } throw new CmsIllegalArgumentException( Messages.get().container(Messages.ERR_NEW_RES_HANDLER_CLASS_NOT_FOUND_1, className)); } Object handler = null; try { Constructor<?> constructor = clazz.getConstructor( new Class[] {PageContext.class, HttpServletRequest.class, HttpServletResponse.class}); handler = constructor.newInstance(new Object[] {context, req, res}); } catch (Exception e) { throw new CmsIllegalArgumentException( Messages.get().container(Messages.ERR_NEW_RES_CONSTRUCTOR_NOT_FOUND_1, className)); } return handler; } }
public class class_name { private static String lenientDecode(String string, Charset encoding, boolean decodePlus) { checkNotNull(string); checkNotNull(encoding); if (decodePlus) { string = string.replace('+', ' '); } int firstPercentPos = string.indexOf('%'); if (firstPercentPos < 0) { return string; } ByteAccumulator accumulator = new ByteAccumulator(string.length(), encoding); StringBuilder builder = new StringBuilder(string.length()); if (firstPercentPos > 0) { builder.append(string, 0, firstPercentPos); } for (int srcPos = firstPercentPos; srcPos < string.length(); srcPos++) { char c = string.charAt(srcPos); if (c < 0x80) { // ASCII boolean processed = false; if (c == '%' && string.length() >= srcPos + 3) { String hex = string.substring(srcPos + 1, srcPos + 3); try { int encoded = Integer.parseInt(hex, 16); if (encoded >= 0) { accumulator.append((byte) encoded); srcPos += 2; processed = true; } } catch (NumberFormatException ignore) { // Expected case (badly formatted % group) } } if (!processed) { if (accumulator.isEmpty()) { // We're not accumulating elements of a multibyte encoded // char, so just toss it right into the result string. builder.append(c); } else { accumulator.append((byte) c); } } } else { // Non-ASCII // A non-ASCII char marks the end of a multi-char encoding sequence, // if one is in progress. accumulator.dumpTo(builder); builder.append(c); } } accumulator.dumpTo(builder); return builder.toString(); } }
public class class_name { private static String lenientDecode(String string, Charset encoding, boolean decodePlus) { checkNotNull(string); checkNotNull(encoding); if (decodePlus) { string = string.replace('+', ' '); // depends on control dependency: [if], data = [none] } int firstPercentPos = string.indexOf('%'); if (firstPercentPos < 0) { return string; // depends on control dependency: [if], data = [none] } ByteAccumulator accumulator = new ByteAccumulator(string.length(), encoding); StringBuilder builder = new StringBuilder(string.length()); if (firstPercentPos > 0) { builder.append(string, 0, firstPercentPos); // depends on control dependency: [if], data = [none] } for (int srcPos = firstPercentPos; srcPos < string.length(); srcPos++) { char c = string.charAt(srcPos); if (c < 0x80) { // ASCII boolean processed = false; if (c == '%' && string.length() >= srcPos + 3) { String hex = string.substring(srcPos + 1, srcPos + 3); try { int encoded = Integer.parseInt(hex, 16); if (encoded >= 0) { accumulator.append((byte) encoded); // depends on control dependency: [if], data = [none] srcPos += 2; // depends on control dependency: [if], data = [none] processed = true; // depends on control dependency: [if], data = [none] } } catch (NumberFormatException ignore) { // Expected case (badly formatted % group) } // depends on control dependency: [catch], data = [none] } if (!processed) { if (accumulator.isEmpty()) { // We're not accumulating elements of a multibyte encoded // char, so just toss it right into the result string. builder.append(c); // depends on control dependency: [if], data = [none] } else { accumulator.append((byte) c); // depends on control dependency: [if], data = [none] } } } else { // Non-ASCII // A non-ASCII char marks the end of a multi-char encoding sequence, // if one is in progress. accumulator.dumpTo(builder); // depends on control dependency: [if], data = [none] builder.append(c); // depends on control dependency: [if], data = [(c] } } accumulator.dumpTo(builder); return builder.toString(); } }
public class class_name { private void setAllNode(String name, int offe, boolean skip) { AnsjItem item = DATDictionary.getItem(String.valueOf(name)); if (skip && item == AnsjItem.NULL || item.getStatus() < 2) { return; } Term term = new Term(name, offe, item); for (int j = 0; j < 11; j++) { setNode(term, j); } } }
public class class_name { private void setAllNode(String name, int offe, boolean skip) { AnsjItem item = DATDictionary.getItem(String.valueOf(name)); if (skip && item == AnsjItem.NULL || item.getStatus() < 2) { return; // depends on control dependency: [if], data = [none] } Term term = new Term(name, offe, item); for (int j = 0; j < 11; j++) { setNode(term, j); // depends on control dependency: [for], data = [j] } } }