code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { public DescribeSimulationJobResult withSimulationApplications(SimulationApplicationConfig... simulationApplications) { if (this.simulationApplications == null) { setSimulationApplications(new java.util.ArrayList<SimulationApplicationConfig>(simulationApplications.length)); } for (SimulationApplicationConfig ele : simulationApplications) { this.simulationApplications.add(ele); } return this; } }
public class class_name { public DescribeSimulationJobResult withSimulationApplications(SimulationApplicationConfig... simulationApplications) { if (this.simulationApplications == null) { setSimulationApplications(new java.util.ArrayList<SimulationApplicationConfig>(simulationApplications.length)); // depends on control dependency: [if], data = [none] } for (SimulationApplicationConfig ele : simulationApplications) { this.simulationApplications.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { private static String changeIdForRNA(MonomerNotation monomerNotation) { if (monomerNotation instanceof MonomerNotationUnitRNA) { StringBuilder changeid = new StringBuilder(); for (MonomerNotation not : ((MonomerNotationUnitRNA) monomerNotation).getContents()) { Monomer monomer = nucleotidesNaturalAnalog.get(not.getUnit().replace("[", "").replace("]", "")); String id = monomer.getNaturalAnalog(); if (monomer.getMonomerType().equals(Monomer.BRANCH_MOMONER_TYPE)) { id = "(" + id + ")"; } changeid.append(id); } return changeid.toString(); } else { Monomer monomer = nucleotidesNaturalAnalog.get(monomerNotation.getUnit().replace("[", "").replace("]", "")); String id = monomer.getNaturalAnalog(); if (monomer.getMonomerType().equals(Monomer.BRANCH_MOMONER_TYPE)) { id = "(" + id + ")"; } return id; } } }
public class class_name { private static String changeIdForRNA(MonomerNotation monomerNotation) { if (monomerNotation instanceof MonomerNotationUnitRNA) { StringBuilder changeid = new StringBuilder(); for (MonomerNotation not : ((MonomerNotationUnitRNA) monomerNotation).getContents()) { Monomer monomer = nucleotidesNaturalAnalog.get(not.getUnit().replace("[", "").replace("]", "")); String id = monomer.getNaturalAnalog(); if (monomer.getMonomerType().equals(Monomer.BRANCH_MOMONER_TYPE)) { id = "(" + id + ")"; } changeid.append(id); // depends on control dependency: [if], data = [none] } return changeid.toString(); // depends on control dependency: [for], data = [none] } else { // depends on control dependency: [if], data = [none] Monomer monomer = nucleotidesNaturalAnalog.get(monomerNotation.getUnit().replace("[", "").replace("]", "")); String id = monomer.getNaturalAnalog(); if (monomer.getMonomerType().equals(Monomer.BRANCH_MOMONER_TYPE)) { id = "(" + id + ")"; // depends on control dependency: [if], data = [none] } return id; } } }
public class class_name { @Override public void acknowledge() throws IllegalStateRuntimeException, JMSRuntimeException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "acknowledge"); try { if (jmsSession == null) { IllegalStateException ise = (javax.jms.IllegalStateException) JmsErrorUtils.newThrowable(javax.jms.IllegalStateException.class, "INVALID_FOR_UNCONSUMED_MSG_CWSIA0110", new Object[] { "acknowledge" }, tc ); throw (IllegalStateRuntimeException) JmsErrorUtils.getJMS2Exception(ise, IllegalStateRuntimeException.class); } synchronized (jmsSession.getSessionSyncLock()) { // lock on the jmssession's sessionSyncLock if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "got lock"); // Throw an exception if the session is closed. jmsSession.checkNotClosed(); // throw an exception if the acknowledge method conflicts with async usage jmsSession.checkSynchronousUsage("acknowledge"); // Perform the appropriate action for session's ack mode. The action for // a dups ok session in JMS1.1 was somewhat unspecified, so choose to commit. // But in JMS2.0 clearly commit is only for the client ack mode int sessAck = jmsSession.getAcknowledgeMode(); if ((sessAck == Session.CLIENT_ACKNOWLEDGE)) { jmsSession.commitTransaction(); } } } catch (IllegalStateException ise) { throw (IllegalStateRuntimeException) JmsErrorUtils.getJMS2Exception(ise, IllegalStateRuntimeException.class); } catch (JMSException jmse) { throw (JMSRuntimeException) JmsErrorUtils.getJMS2Exception(jmse, JMSRuntimeException.class); } finally { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "acknowledge"); } } }
public class class_name { @Override public void acknowledge() throws IllegalStateRuntimeException, JMSRuntimeException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "acknowledge"); try { if (jmsSession == null) { IllegalStateException ise = (javax.jms.IllegalStateException) JmsErrorUtils.newThrowable(javax.jms.IllegalStateException.class, "INVALID_FOR_UNCONSUMED_MSG_CWSIA0110", new Object[] { "acknowledge" }, tc ); throw (IllegalStateRuntimeException) JmsErrorUtils.getJMS2Exception(ise, IllegalStateRuntimeException.class); } synchronized (jmsSession.getSessionSyncLock()) { // lock on the jmssession's sessionSyncLock if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "got lock"); // Throw an exception if the session is closed. jmsSession.checkNotClosed(); // throw an exception if the acknowledge method conflicts with async usage jmsSession.checkSynchronousUsage("acknowledge"); // Perform the appropriate action for session's ack mode. The action for // a dups ok session in JMS1.1 was somewhat unspecified, so choose to commit. // But in JMS2.0 clearly commit is only for the client ack mode int sessAck = jmsSession.getAcknowledgeMode(); if ((sessAck == Session.CLIENT_ACKNOWLEDGE)) { jmsSession.commitTransaction(); // depends on control dependency: [if], data = [none] } } } catch (IllegalStateException ise) { throw (IllegalStateRuntimeException) JmsErrorUtils.getJMS2Exception(ise, IllegalStateRuntimeException.class); } catch (JMSException jmse) { throw (JMSRuntimeException) JmsErrorUtils.getJMS2Exception(jmse, JMSRuntimeException.class); } finally { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "acknowledge"); } } }
public class class_name { public Term createTerm(final String name, final String slug) throws SQLException { Connection conn = null; PreparedStatement stmt = null; ResultSet rs = null; Timer.Context ctx = metrics.createTermTimer.time(); try { conn = connectionSupplier.getConnection(); stmt = conn.prepareStatement(insertTermSQL, Statement.RETURN_GENERATED_KEYS); stmt.setString(1, name); stmt.setString(2, slug); stmt.executeUpdate(); rs = stmt.getGeneratedKeys(); if(rs.next()) { return new Term(rs.getLong(1), name, slug); } else { throw new SQLException("Problem creating term (no generated id)"); } } finally { ctx.stop(); closeQuietly(conn, stmt, rs); } } }
public class class_name { public Term createTerm(final String name, final String slug) throws SQLException { Connection conn = null; PreparedStatement stmt = null; ResultSet rs = null; Timer.Context ctx = metrics.createTermTimer.time(); try { conn = connectionSupplier.getConnection(); stmt = conn.prepareStatement(insertTermSQL, Statement.RETURN_GENERATED_KEYS); stmt.setString(1, name); stmt.setString(2, slug); stmt.executeUpdate(); rs = stmt.getGeneratedKeys(); if(rs.next()) { return new Term(rs.getLong(1), name, slug); // depends on control dependency: [if], data = [none] } else { throw new SQLException("Problem creating term (no generated id)"); } } finally { ctx.stop(); closeQuietly(conn, stmt, rs); } } }
public class class_name { public static PathImpl createPathFromString(final String propertyPath) { if (propertyPath == null) { throw new IllegalArgumentException("parameter propertyPath must not be null"); } if (propertyPath.length() == 0) { return createRootPath(); } return parseProperty(propertyPath); } }
public class class_name { public static PathImpl createPathFromString(final String propertyPath) { if (propertyPath == null) { throw new IllegalArgumentException("parameter propertyPath must not be null"); } if (propertyPath.length() == 0) { return createRootPath(); // depends on control dependency: [if], data = [none] } return parseProperty(propertyPath); } }
public class class_name { @Override public List<V> get(Object key) { if (key == null) { return null; } K[] keys = _keys; int size = _size; for (int i = size - 1; i >= 0; i--) { if (key.equals(keys[i])) { return _values[i]; } } return null; } }
public class class_name { @Override public List<V> get(Object key) { if (key == null) { return null; // depends on control dependency: [if], data = [none] } K[] keys = _keys; int size = _size; for (int i = size - 1; i >= 0; i--) { if (key.equals(keys[i])) { return _values[i]; // depends on control dependency: [if], data = [none] } } return null; } }
public class class_name { public INDArray computeGaussianPerplexity(final INDArray d, double u) { N = d.rows(); final int k = (int) (3 * u); if (u > k) throw new IllegalStateException("Illegal k value " + k + "greater than " + u); rows = zeros(1, N + 1); cols = zeros(1, N * k); vals = zeros(1, N * k); for (int n = 0; n < N; n++) rows.putScalar(n + 1, rows.getDouble(n) + k); final INDArray beta = ones(N, 1); final double logU = FastMath.log(u); VPTree tree = new VPTree(d, simiarlityFunction, vpTreeWorkers,invert); MemoryWorkspace workspace = workspaceMode == WorkspaceMode.NONE ? new DummyWorkspace() : Nd4j.getWorkspaceManager().getWorkspaceForCurrentThread( workspaceConfigurationExternal, workspaceExternal); try (MemoryWorkspace ws = workspace.notifyScopeEntered()) { log.info("Calculating probabilities of data similarities..."); for (int i = 0; i < N; i++) { if (i % 500 == 0) log.info("Handled " + i + " records"); double betaMin = -Double.MAX_VALUE; double betaMax = Double.MAX_VALUE; List<DataPoint> results = new ArrayList<>(); tree.search(d.slice(i), k + 1, results, new ArrayList<Double>()); double betas = beta.getDouble(i); if(results.size() == 0){ throw new IllegalStateException("Search returned no values for vector " + i + " - similarity \"" + simiarlityFunction + "\" may not be defined (for example, vector is" + " all zeros with cosine similarity)"); } INDArray cArr = VPTree.buildFromData(results); Pair<INDArray, Double> pair = computeGaussianKernel(cArr, beta.getDouble(i), k); INDArray currP = pair.getFirst(); double hDiff = pair.getSecond() - logU; int tries = 0; boolean found = false; //binary search while (!found && tries < 200) { if (hDiff < tolerance && -hDiff < tolerance) found = true; else { if (hDiff > 0) { betaMin = betas; if (betaMax == Double.MAX_VALUE || betaMax == -Double.MAX_VALUE) betas *= 2; else betas = (betas + betaMax) / 2.0; } else { betaMax = betas; if (betaMin == -Double.MAX_VALUE || betaMin == Double.MAX_VALUE) betas /= 2.0; else betas = (betas + betaMin) / 2.0; } pair = computeGaussianKernel(cArr, betas, k); hDiff = pair.getSecond() - logU; tries++; } } currP.divi(currP.sum(Integer.MAX_VALUE)); INDArray indices = Nd4j.create(1, k + 1); for (int j = 0; j < indices.length(); j++) { if (j >= results.size()) break; indices.putScalar(j, results.get(j).getIndex()); } for (int l = 0; l < k; l++) { cols.putScalar(rows.getInt(i) + l, indices.getDouble(l + 1)); vals.putScalar(rows.getInt(i) + l, currP.getDouble(l)); } } } return vals; } }
public class class_name { public INDArray computeGaussianPerplexity(final INDArray d, double u) { N = d.rows(); final int k = (int) (3 * u); if (u > k) throw new IllegalStateException("Illegal k value " + k + "greater than " + u); rows = zeros(1, N + 1); cols = zeros(1, N * k); vals = zeros(1, N * k); for (int n = 0; n < N; n++) rows.putScalar(n + 1, rows.getDouble(n) + k); final INDArray beta = ones(N, 1); final double logU = FastMath.log(u); VPTree tree = new VPTree(d, simiarlityFunction, vpTreeWorkers,invert); MemoryWorkspace workspace = workspaceMode == WorkspaceMode.NONE ? new DummyWorkspace() : Nd4j.getWorkspaceManager().getWorkspaceForCurrentThread( workspaceConfigurationExternal, workspaceExternal); try (MemoryWorkspace ws = workspace.notifyScopeEntered()) { log.info("Calculating probabilities of data similarities..."); for (int i = 0; i < N; i++) { if (i % 500 == 0) log.info("Handled " + i + " records"); double betaMin = -Double.MAX_VALUE; double betaMax = Double.MAX_VALUE; List<DataPoint> results = new ArrayList<>(); tree.search(d.slice(i), k + 1, results, new ArrayList<Double>()); // depends on control dependency: [for], data = [i] double betas = beta.getDouble(i); if(results.size() == 0){ throw new IllegalStateException("Search returned no values for vector " + i + " - similarity \"" + simiarlityFunction + "\" may not be defined (for example, vector is" + " all zeros with cosine similarity)"); } INDArray cArr = VPTree.buildFromData(results); Pair<INDArray, Double> pair = computeGaussianKernel(cArr, beta.getDouble(i), k); INDArray currP = pair.getFirst(); double hDiff = pair.getSecond() - logU; int tries = 0; boolean found = false; //binary search while (!found && tries < 200) { if (hDiff < tolerance && -hDiff < tolerance) found = true; else { if (hDiff > 0) { betaMin = betas; // depends on control dependency: [if], data = [none] if (betaMax == Double.MAX_VALUE || betaMax == -Double.MAX_VALUE) betas *= 2; else betas = (betas + betaMax) / 2.0; } else { betaMax = betas; // depends on control dependency: [if], data = [none] if (betaMin == -Double.MAX_VALUE || betaMin == Double.MAX_VALUE) betas /= 2.0; else betas = (betas + betaMin) / 2.0; } pair = computeGaussianKernel(cArr, betas, k); // depends on control dependency: [if], data = [none] hDiff = pair.getSecond() - logU; // depends on control dependency: [if], data = [none] tries++; // depends on control dependency: [if], data = [none] } } currP.divi(currP.sum(Integer.MAX_VALUE)); // depends on control dependency: [for], data = [none] INDArray indices = Nd4j.create(1, k + 1); for (int j = 0; j < indices.length(); j++) { if (j >= results.size()) break; indices.putScalar(j, results.get(j).getIndex()); // depends on control dependency: [for], data = [j] } for (int l = 0; l < k; l++) { cols.putScalar(rows.getInt(i) + l, indices.getDouble(l + 1)); // depends on control dependency: [for], data = [l] vals.putScalar(rows.getInt(i) + l, currP.getDouble(l)); // depends on control dependency: [for], data = [l] } } } return vals; } }
public class class_name { public String selectAggregationByExample(MappedStatement ms) { Class<?> entityClass = getEntityClass(ms); StringBuilder sql = new StringBuilder(); if (isCheckExampleEntityClass()) { sql.append(SqlHelper.exampleCheck(entityClass)); } sql.append("SELECT ${@tk.mybatis.mapper.additional.aggregation.AggregationProvider@aggregationSelectClause("); sql.append("@").append(entityClass.getCanonicalName()).append("@class"); sql.append(", '").append(getConfig().getWrapKeyword()).append("'"); sql.append(", aggregateCondition"); sql.append(")} "); sql.append(SqlHelper.fromTable(entityClass, tableName(entityClass))); sql.append(SqlHelper.updateByExampleWhereClause()); sql.append(" ${@tk.mybatis.mapper.additional.aggregation.AggregationProvider@aggregationGroupBy("); sql.append("@").append(entityClass.getCanonicalName()).append("@class"); sql.append(", '").append(getConfig().getWrapKeyword()).append("'"); sql.append(", aggregateCondition"); sql.append(")} "); sql.append(SqlHelper.exampleOrderBy("example", entityClass)); sql.append(SqlHelper.exampleForUpdate()); return sql.toString(); } }
public class class_name { public String selectAggregationByExample(MappedStatement ms) { Class<?> entityClass = getEntityClass(ms); StringBuilder sql = new StringBuilder(); if (isCheckExampleEntityClass()) { sql.append(SqlHelper.exampleCheck(entityClass)); // depends on control dependency: [if], data = [none] } sql.append("SELECT ${@tk.mybatis.mapper.additional.aggregation.AggregationProvider@aggregationSelectClause("); sql.append("@").append(entityClass.getCanonicalName()).append("@class"); sql.append(", '").append(getConfig().getWrapKeyword()).append("'"); sql.append(", aggregateCondition"); sql.append(")} "); sql.append(SqlHelper.fromTable(entityClass, tableName(entityClass))); sql.append(SqlHelper.updateByExampleWhereClause()); sql.append(" ${@tk.mybatis.mapper.additional.aggregation.AggregationProvider@aggregationGroupBy("); sql.append("@").append(entityClass.getCanonicalName()).append("@class"); sql.append(", '").append(getConfig().getWrapKeyword()).append("'"); sql.append(", aggregateCondition"); sql.append(")} "); sql.append(SqlHelper.exampleOrderBy("example", entityClass)); sql.append(SqlHelper.exampleForUpdate()); return sql.toString(); } }
public class class_name { public void setStreams(java.util.Collection<StreamSummary> streams) { if (streams == null) { this.streams = null; return; } this.streams = new java.util.ArrayList<StreamSummary>(streams); } }
public class class_name { public void setStreams(java.util.Collection<StreamSummary> streams) { if (streams == null) { this.streams = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.streams = new java.util.ArrayList<StreamSummary>(streams); } }
public class class_name { public void addAllBolts(List<BoltDef> bolts, boolean override){ for(BoltDef bolt : bolts){ String id = bolt.getId(); if(this.boltMap.get(id) == null || override) { this.boltMap.put(bolt.getId(), bolt); } else { LOG.warn("Ignoring attempt to create bolt '{}' with override == false.", id); } } } }
public class class_name { public void addAllBolts(List<BoltDef> bolts, boolean override){ for(BoltDef bolt : bolts){ String id = bolt.getId(); if(this.boltMap.get(id) == null || override) { this.boltMap.put(bolt.getId(), bolt); // depends on control dependency: [if], data = [none] } else { LOG.warn("Ignoring attempt to create bolt '{}' with override == false.", id); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public static ArrayList<String> filterPhrases (String INDEX_DIR, String A, String B, Synset[] A_prime, Synset[] B_prime) { HashMultiMap<Float,Pair<String>> phrase_frequencies = new HashMultiMap<Float,Pair<String>>(); //Search corpus... A:B //phrase_frequencies.put(new Float(countPhraseFrequencies(INDEX_DIR, A, B)),new Pair<String>(A,B)); //System.err.println("Top 10 Similar words:"); int count = 0; for (int i = 0; (i < NUM_SIM && i < A_prime.length); i++) { String[] wordForms = A_prime[i].getWordForms(); for (int j = 0; j < wordForms.length; j++) { if (wordForms[j].compareTo(A) != 0) { //Search corpus... A':B Float score = new Float(countPhraseFrequencies(INDEX_DIR, wordForms[j], B)); phrase_frequencies.put(score,new Pair<String>(wordForms[j],B)); count++; } if(count >= NUM_SIM) break; } if(count >= NUM_SIM) break; } count = 0; for (int i = 0; (i < NUM_SIM && i < B_prime.length); i++) { String[] wordForms = B_prime[i].getWordForms(); for (int j = 0; j < wordForms.length; j++) { if (wordForms[j].compareTo(B) != 0) { //Search corpus... A:B' Float score = new Float(countPhraseFrequencies(INDEX_DIR,A, wordForms[j])); phrase_frequencies.put(score,new Pair<String>(A,wordForms[j])); count++; } if(count >= NUM_SIM) break; } if(count >= NUM_SIM) break; } // filter out the phrases and add the top 3 to the ArrayList, and return it Iterator iter = phrase_frequencies.keySet().iterator(); //TODO: make number of filters dynamic //create Array with size = num filters ArrayList<String> filtered_phrases = new ArrayList<String>(); Float filter1 = new Float(0.0); Float filter2 = new Float(0.0); Float filter3 = new Float(0.0); while (iter.hasNext()) { Float curr_key = (Float)iter.next(); //this will bump the filters up each time a greater value comes along //so that filter1 will be the greatest key and filter3 the 3rd greatest if (curr_key > filter1) { filter3 = filter2; filter2 = filter1; filter1 = curr_key; } else if (curr_key > filter2) { filter3 = filter2; filter2 = curr_key; } else if (curr_key > filter3) { filter3 = curr_key; } } int filter_count = 0; Iterator val_iter = phrase_frequencies.get(filter1).iterator(); while (val_iter.hasNext() && filter_count < 3) { String alternative_pair = val_iter.next().toString(); String pair_arr[] = parsePair(alternative_pair); filtered_phrases.add(pair_arr[0]+":"+pair_arr[1]); filter_count++; } val_iter = phrase_frequencies.get(filter2).iterator(); while (val_iter.hasNext() && filter_count < 3) { String alternative_pair = val_iter.next().toString(); String pair_arr[] = parsePair(alternative_pair); filtered_phrases.add(pair_arr[0]+":"+pair_arr[1]); filter_count++; } val_iter = phrase_frequencies.get(filter3).iterator(); while (val_iter.hasNext() && filter_count < 3) { String alternative_pair = val_iter.next().toString(); String pair_arr[] = parsePair(alternative_pair); filtered_phrases.add(pair_arr[0]+":"+pair_arr[1]); filter_count++; } //throw in the original pair also filtered_phrases.add(A+":"+B); return filtered_phrases; } }
public class class_name { public static ArrayList<String> filterPhrases (String INDEX_DIR, String A, String B, Synset[] A_prime, Synset[] B_prime) { HashMultiMap<Float,Pair<String>> phrase_frequencies = new HashMultiMap<Float,Pair<String>>(); //Search corpus... A:B //phrase_frequencies.put(new Float(countPhraseFrequencies(INDEX_DIR, A, B)),new Pair<String>(A,B)); //System.err.println("Top 10 Similar words:"); int count = 0; for (int i = 0; (i < NUM_SIM && i < A_prime.length); i++) { String[] wordForms = A_prime[i].getWordForms(); for (int j = 0; j < wordForms.length; j++) { if (wordForms[j].compareTo(A) != 0) { //Search corpus... A':B Float score = new Float(countPhraseFrequencies(INDEX_DIR, wordForms[j], B)); phrase_frequencies.put(score,new Pair<String>(wordForms[j],B)); // depends on control dependency: [if], data = [none] count++; // depends on control dependency: [if], data = [none] } if(count >= NUM_SIM) break; } if(count >= NUM_SIM) break; } count = 0; for (int i = 0; (i < NUM_SIM && i < B_prime.length); i++) { String[] wordForms = B_prime[i].getWordForms(); for (int j = 0; j < wordForms.length; j++) { if (wordForms[j].compareTo(B) != 0) { //Search corpus... A:B' Float score = new Float(countPhraseFrequencies(INDEX_DIR,A, wordForms[j])); phrase_frequencies.put(score,new Pair<String>(A,wordForms[j])); // depends on control dependency: [if], data = [none] count++; // depends on control dependency: [if], data = [none] } if(count >= NUM_SIM) break; } if(count >= NUM_SIM) break; } // filter out the phrases and add the top 3 to the ArrayList, and return it Iterator iter = phrase_frequencies.keySet().iterator(); //TODO: make number of filters dynamic //create Array with size = num filters ArrayList<String> filtered_phrases = new ArrayList<String>(); Float filter1 = new Float(0.0); Float filter2 = new Float(0.0); Float filter3 = new Float(0.0); while (iter.hasNext()) { Float curr_key = (Float)iter.next(); //this will bump the filters up each time a greater value comes along //so that filter1 will be the greatest key and filter3 the 3rd greatest if (curr_key > filter1) { filter3 = filter2; // depends on control dependency: [if], data = [none] filter2 = filter1; // depends on control dependency: [if], data = [none] filter1 = curr_key; // depends on control dependency: [if], data = [none] } else if (curr_key > filter2) { filter3 = filter2; // depends on control dependency: [if], data = [none] filter2 = curr_key; // depends on control dependency: [if], data = [none] } else if (curr_key > filter3) { filter3 = curr_key; // depends on control dependency: [if], data = [none] } } int filter_count = 0; Iterator val_iter = phrase_frequencies.get(filter1).iterator(); while (val_iter.hasNext() && filter_count < 3) { String alternative_pair = val_iter.next().toString(); String pair_arr[] = parsePair(alternative_pair); filtered_phrases.add(pair_arr[0]+":"+pair_arr[1]); // depends on control dependency: [while], data = [none] filter_count++; // depends on control dependency: [while], data = [none] } val_iter = phrase_frequencies.get(filter2).iterator(); while (val_iter.hasNext() && filter_count < 3) { String alternative_pair = val_iter.next().toString(); String pair_arr[] = parsePair(alternative_pair); filtered_phrases.add(pair_arr[0]+":"+pair_arr[1]); // depends on control dependency: [while], data = [none] filter_count++; // depends on control dependency: [while], data = [none] } val_iter = phrase_frequencies.get(filter3).iterator(); while (val_iter.hasNext() && filter_count < 3) { String alternative_pair = val_iter.next().toString(); String pair_arr[] = parsePair(alternative_pair); filtered_phrases.add(pair_arr[0]+":"+pair_arr[1]); // depends on control dependency: [while], data = [none] filter_count++; // depends on control dependency: [while], data = [none] } //throw in the original pair also filtered_phrases.add(A+":"+B); return filtered_phrases; } }
public class class_name { public static void appendPath(StringBuilder buffer, String... segments) { for (int i = 0; i < segments.length; i++) { String s = segments[i]; if (i > 0) { buffer.append(SEPARATOR); } buffer.append(s); } } }
public class class_name { public static void appendPath(StringBuilder buffer, String... segments) { for (int i = 0; i < segments.length; i++) { String s = segments[i]; if (i > 0) { buffer.append(SEPARATOR); // depends on control dependency: [if], data = [none] } buffer.append(s); // depends on control dependency: [for], data = [none] } } }
public class class_name { private boolean shouldIgnoreCase(final Part part) { final Class<?> propertyClass = part.getProperty().getLeafProperty().getType(); final boolean isLowerable = String.class.isAssignableFrom(propertyClass); final boolean shouldIgnoreCase = part.shouldIgnoreCase() != Part.IgnoreCaseType.NEVER && isLowerable && !UNSUPPORTED_IGNORE_CASE.contains(part.getType()); if (part.shouldIgnoreCase() == Part.IgnoreCaseType.ALWAYS && (!isLowerable || UNSUPPORTED_IGNORE_CASE.contains(part.getType()))) { LOGGER.debug("Ignoring case for \"{}\" type is meaningless", propertyClass); } return shouldIgnoreCase; } }
public class class_name { private boolean shouldIgnoreCase(final Part part) { final Class<?> propertyClass = part.getProperty().getLeafProperty().getType(); final boolean isLowerable = String.class.isAssignableFrom(propertyClass); final boolean shouldIgnoreCase = part.shouldIgnoreCase() != Part.IgnoreCaseType.NEVER && isLowerable && !UNSUPPORTED_IGNORE_CASE.contains(part.getType()); if (part.shouldIgnoreCase() == Part.IgnoreCaseType.ALWAYS && (!isLowerable || UNSUPPORTED_IGNORE_CASE.contains(part.getType()))) { LOGGER.debug("Ignoring case for \"{}\" type is meaningless", propertyClass); // depends on control dependency: [if], data = [none] } return shouldIgnoreCase; } }
public class class_name { public boolean keyMatch(String lookupKey) { if (key.isEmpty()) { return technicalName.contains(lookupKey); } else { return key.contains(lookupKey); } } }
public class class_name { public boolean keyMatch(String lookupKey) { if (key.isEmpty()) { return technicalName.contains(lookupKey); // depends on control dependency: [if], data = [none] } else { return key.contains(lookupKey); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void marshall(CancelSimulationJobRequest cancelSimulationJobRequest, ProtocolMarshaller protocolMarshaller) { if (cancelSimulationJobRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(cancelSimulationJobRequest.getJob(), JOB_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(CancelSimulationJobRequest cancelSimulationJobRequest, ProtocolMarshaller protocolMarshaller) { if (cancelSimulationJobRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(cancelSimulationJobRequest.getJob(), JOB_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 marshall(ResourceError resourceError, ProtocolMarshaller protocolMarshaller) { if (resourceError == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(resourceError.getErrorCode(), ERRORCODE_BINDING); protocolMarshaller.marshall(resourceError.getErrorMessage(), ERRORMESSAGE_BINDING); protocolMarshaller.marshall(resourceError.getErrorTimestamp(), ERRORTIMESTAMP_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(ResourceError resourceError, ProtocolMarshaller protocolMarshaller) { if (resourceError == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(resourceError.getErrorCode(), ERRORCODE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(resourceError.getErrorMessage(), ERRORMESSAGE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(resourceError.getErrorTimestamp(), ERRORTIMESTAMP_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 free() { if (m_mapNameValue != null) { Iterator iterator = m_mapNameValue.values().iterator(); while (iterator.hasNext()) { ((NameValue)iterator.next()).free(); } } m_mapNameValue = null; if (m_filter != null) { // Should be empty } m_filter = null; m_strName = null; m_objValue = null; } }
public class class_name { public void free() { if (m_mapNameValue != null) { Iterator iterator = m_mapNameValue.values().iterator(); while (iterator.hasNext()) { ((NameValue)iterator.next()).free(); // depends on control dependency: [while], data = [none] } } m_mapNameValue = null; if (m_filter != null) { // Should be empty } m_filter = null; m_strName = null; m_objValue = null; } }
public class class_name { public void setLocalName (int index, String localName) { if (index >= 0 && index < length) { data[index*5+1] = localName; } else { badIndex(index); } } }
public class class_name { public void setLocalName (int index, String localName) { if (index >= 0 && index < length) { data[index*5+1] = localName; // depends on control dependency: [if], data = [none] } else { badIndex(index); // depends on control dependency: [if], data = [(index] } } }
public class class_name { public static List<LatLng> decode(final String encodedPath) { int len = encodedPath.length(); final List<LatLng> path = new ArrayList<>(len / 2); int index = 0; int lat = 0; int lng = 0; while (index < len) { int result = 1; int shift = 0; int b; do { b = encodedPath.charAt(index++) - 63 - 1; result += b << shift; shift += 5; } while (b >= 0x1f); lat += (result & 1) != 0 ? ~(result >> 1) : (result >> 1); result = 1; shift = 0; do { b = encodedPath.charAt(index++) - 63 - 1; result += b << shift; shift += 5; } while (b >= 0x1f); lng += (result & 1) != 0 ? ~(result >> 1) : (result >> 1); path.add(new LatLng(lat * 1e-5, lng * 1e-5)); } return path; } }
public class class_name { public static List<LatLng> decode(final String encodedPath) { int len = encodedPath.length(); final List<LatLng> path = new ArrayList<>(len / 2); int index = 0; int lat = 0; int lng = 0; while (index < len) { int result = 1; int shift = 0; int b; do { b = encodedPath.charAt(index++) - 63 - 1; result += b << shift; shift += 5; } while (b >= 0x1f); lat += (result & 1) != 0 ? ~(result >> 1) : (result >> 1); // depends on control dependency: [while], data = [none] result = 1; // depends on control dependency: [while], data = [none] shift = 0; // depends on control dependency: [while], data = [none] do { b = encodedPath.charAt(index++) - 63 - 1; result += b << shift; shift += 5; } while (b >= 0x1f); lng += (result & 1) != 0 ? ~(result >> 1) : (result >> 1); // depends on control dependency: [while], data = [none] path.add(new LatLng(lat * 1e-5, lng * 1e-5)); // depends on control dependency: [while], data = [none] } return path; } }
public class class_name { protected static Map<String, String> parseAuthHeader(String authHeader) { if (authHeader == null || authHeader.length() == 0) return null; Map<String, String> challenge = new HashMap<String, String>(); Matcher m = re.matcher(authHeader); while (m.find()) { String scheme = m.group(1); String key = m.group(2); String value = m.group(4); if (value == null || value.length() == 0) value = m.group(5); challenge.put(key, value); challenge.put("Scheme", scheme); } challenge.put("WWW-Authenticate", authHeader); return challenge; } }
public class class_name { protected static Map<String, String> parseAuthHeader(String authHeader) { if (authHeader == null || authHeader.length() == 0) return null; Map<String, String> challenge = new HashMap<String, String>(); Matcher m = re.matcher(authHeader); while (m.find()) { String scheme = m.group(1); String key = m.group(2); String value = m.group(4); if (value == null || value.length() == 0) value = m.group(5); challenge.put(key, value); // depends on control dependency: [while], data = [none] challenge.put("Scheme", scheme); // depends on control dependency: [while], data = [none] } challenge.put("WWW-Authenticate", authHeader); return challenge; } }
public class class_name { public List<JAXBElement<Object>> get_GenericApplicationPropertyOfIntBuildingInstallation() { if (_GenericApplicationPropertyOfIntBuildingInstallation == null) { _GenericApplicationPropertyOfIntBuildingInstallation = new ArrayList<JAXBElement<Object>>(); } return this._GenericApplicationPropertyOfIntBuildingInstallation; } }
public class class_name { public List<JAXBElement<Object>> get_GenericApplicationPropertyOfIntBuildingInstallation() { if (_GenericApplicationPropertyOfIntBuildingInstallation == null) { _GenericApplicationPropertyOfIntBuildingInstallation = new ArrayList<JAXBElement<Object>>(); // depends on control dependency: [if], data = [none] } return this._GenericApplicationPropertyOfIntBuildingInstallation; } }
public class class_name { public void select(Item item, boolean considerSelectableFlag) { if (considerSelectableFlag && !item.isSelectable()) { return; } item.withSetSelected(true); if (mSelectionListener != null) { mSelectionListener.onSelectionChanged(item, true); } } }
public class class_name { public void select(Item item, boolean considerSelectableFlag) { if (considerSelectableFlag && !item.isSelectable()) { return; // depends on control dependency: [if], data = [none] } item.withSetSelected(true); if (mSelectionListener != null) { mSelectionListener.onSelectionChanged(item, true); // depends on control dependency: [if], data = [none] } } }
public class class_name { public boolean stream(int bufferId) { try { int count = audio.read(buffer); if (count != -1) { bufferData.clear(); bufferData.put(buffer,0,count); bufferData.flip(); int format = audio.getChannels() > 1 ? AL10.AL_FORMAT_STEREO16 : AL10.AL_FORMAT_MONO16; try { AL10.alBufferData(bufferId, format, bufferData, audio.getRate()); } catch (OpenALException e) { Log.error("Failed to loop buffer: "+bufferId+" "+format+" "+count+" "+audio.getRate(), e); return false; } } else { if (loop) { initStreams(); stream(bufferId); } else { done = true; return false; } } return true; } catch (IOException e) { Log.error(e); return false; } } }
public class class_name { public boolean stream(int bufferId) { try { int count = audio.read(buffer); if (count != -1) { bufferData.clear(); // depends on control dependency: [if], data = [none] bufferData.put(buffer,0,count); // depends on control dependency: [if], data = [none] bufferData.flip(); // depends on control dependency: [if], data = [none] int format = audio.getChannels() > 1 ? AL10.AL_FORMAT_STEREO16 : AL10.AL_FORMAT_MONO16; try { AL10.alBufferData(bufferId, format, bufferData, audio.getRate()); // depends on control dependency: [try], data = [none] } catch (OpenALException e) { Log.error("Failed to loop buffer: "+bufferId+" "+format+" "+count+" "+audio.getRate(), e); return false; } // depends on control dependency: [catch], data = [none] } else { if (loop) { initStreams(); // depends on control dependency: [if], data = [none] stream(bufferId); // depends on control dependency: [if], data = [none] } else { done = true; // depends on control dependency: [if], data = [none] return false; // depends on control dependency: [if], data = [none] } } return true; // depends on control dependency: [try], data = [none] } catch (IOException e) { Log.error(e); return false; } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static IntTuple zero(int size) { if (size >= 0 && size < ZERO_POOL_SIZE) { return ZEROS[size]; } return createZero(size); } }
public class class_name { public static IntTuple zero(int size) { if (size >= 0 && size < ZERO_POOL_SIZE) { return ZEROS[size]; // depends on control dependency: [if], data = [none] } return createZero(size); } }
public class class_name { public FacesConfigNavigationRuleType<FacesConfigType<T>> getOrCreateNavigationRule() { List<Node> nodeList = childNode.get("navigation-rule"); if (nodeList != null && nodeList.size() > 0) { return new FacesConfigNavigationRuleTypeImpl<FacesConfigType<T>>(this, "navigation-rule", childNode, nodeList.get(0)); } return createNavigationRule(); } }
public class class_name { public FacesConfigNavigationRuleType<FacesConfigType<T>> getOrCreateNavigationRule() { List<Node> nodeList = childNode.get("navigation-rule"); if (nodeList != null && nodeList.size() > 0) { return new FacesConfigNavigationRuleTypeImpl<FacesConfigType<T>>(this, "navigation-rule", childNode, nodeList.get(0)); // depends on control dependency: [if], data = [none] } return createNavigationRule(); } }
public class class_name { private List<DataDescriptor> replicate(List<DataDescriptor> keys) { List<DataDescriptor> tree = new ArrayList<DataDescriptor>(); Iterator<DataDescriptor> dkIter = keys.iterator(); while (dkIter.hasNext()) { DataDescriptor dk = dkIter.next(); if (dk.f == 1) { dk.subKeys = new ArrayList<DataDescriptor>(); dk.replication = dk.y; // replication count if (dk.replication == 0) { // delayed replication root.isVarLength = true; // variable sized data == deferred replication == sequence data // the next one is the replication count size : does not count in field count (x) DataDescriptor replication = dkIter.next(); if (replication.y == 0) dk.replicationCountSize = 1; // ?? else if (replication.y == 1) dk.replicationCountSize = 8; else if (replication.y == 2) dk.replicationCountSize = 16; else if (replication.y == 11) dk.repetitionCountSize = 8; else if (replication.y == 12) dk.repetitionCountSize = 16; else log.error("Unknown replication type= "+replication); } // transfer to the subKey list for (int j = 0; j < dk.x && dkIter.hasNext(); j++) { dk.subKeys.add( dkIter.next()); } // recurse dk.subKeys = replicate(dk.subKeys); } else if ((dk.f == 3) && (dk.subKeys != null)) { dk.subKeys = replicate( dk.subKeys); // do at all levels } tree.add(dk); } return tree; } }
public class class_name { private List<DataDescriptor> replicate(List<DataDescriptor> keys) { List<DataDescriptor> tree = new ArrayList<DataDescriptor>(); Iterator<DataDescriptor> dkIter = keys.iterator(); while (dkIter.hasNext()) { DataDescriptor dk = dkIter.next(); if (dk.f == 1) { dk.subKeys = new ArrayList<DataDescriptor>(); // depends on control dependency: [if], data = [none] dk.replication = dk.y; // replication count // depends on control dependency: [if], data = [none] if (dk.replication == 0) { // delayed replication root.isVarLength = true; // variable sized data == deferred replication == sequence data // depends on control dependency: [if], data = [none] // the next one is the replication count size : does not count in field count (x) DataDescriptor replication = dkIter.next(); if (replication.y == 0) dk.replicationCountSize = 1; // ?? else if (replication.y == 1) dk.replicationCountSize = 8; else if (replication.y == 2) dk.replicationCountSize = 16; else if (replication.y == 11) dk.repetitionCountSize = 8; else if (replication.y == 12) dk.repetitionCountSize = 16; else log.error("Unknown replication type= "+replication); } // transfer to the subKey list for (int j = 0; j < dk.x && dkIter.hasNext(); j++) { dk.subKeys.add( dkIter.next()); // depends on control dependency: [for], data = [none] } // recurse dk.subKeys = replicate(dk.subKeys); // depends on control dependency: [if], data = [none] } else if ((dk.f == 3) && (dk.subKeys != null)) { dk.subKeys = replicate( dk.subKeys); // do at all levels // depends on control dependency: [if], data = [none] } tree.add(dk); // depends on control dependency: [while], data = [none] } return tree; } }
public class class_name { public void addFuzzySensorEvents(FuzzySensorEvent... events) { for (FuzzySensorEvent e : events) updateSensorData(e); for (int i = 0; i < solver.getVariables().length; i++) { groundActivity.add((FuzzyActivity) solver.getVariables()[i]); } setCrispCons(); } }
public class class_name { public void addFuzzySensorEvents(FuzzySensorEvent... events) { for (FuzzySensorEvent e : events) updateSensorData(e); for (int i = 0; i < solver.getVariables().length; i++) { groundActivity.add((FuzzyActivity) solver.getVariables()[i]); // depends on control dependency: [for], data = [i] } setCrispCons(); } }
public class class_name { private Object processClosure(final Closure<?> closure) { if (! methodsInvoked.contains(closure)) { methodsInvoked.add(closure); return closure.call(); } return null; } }
public class class_name { private Object processClosure(final Closure<?> closure) { if (! methodsInvoked.contains(closure)) { methodsInvoked.add(closure); // depends on control dependency: [if], data = [none] return closure.call(); // depends on control dependency: [if], data = [none] } return null; } }
public class class_name { @Override public boolean mkdirs(Path f) throws IOException, FileAlreadyExistsException { LOG.debug("mkdirs: {}", f.toString()); validateBracketSupport(f.toString()); if (stocatorPath.isTemporaryPathTarget(f.getParent())) { final Path path = storageClient.qualify(f); String objNameModified = stocatorPath.extractFinalKeyFromTemporaryPath(path,true, storageClient.getDataRoot(), true); final Path pathToObj = new Path(objNameModified); LOG.trace("mkdirs {} modified name", objNameModified); // make sure there is no overwrite of existing data // if we here, means getfilestatus() returned false and // fileoutputcomitter is about to create job temp folder // in this case there is no need to check wether base directory exists // as it was already checked in getfilestatus() method /* try { String directoryToExpect = stocatorPath.getBaseDirectory(f.toString()); FileStatus fileStatus = getFileStatus(new Path(directoryToExpect)); if (fileStatus != null) { LOG.debug("mkdirs found {} as exists. Directory : {}", directoryToExpect, fileStatus.isDirectory()); throw new FileAlreadyExistsException("mkdir on existing directory " + directoryToExpect); } } catch (FileNotFoundException e) { LOG.debug("mkdirs {} - not exists. Proceed", pathToObj.getParent().toString()); } */ String plainObjName = pathToObj.getParent().toString(); LOG.debug("Going to create identifier {}", plainObjName); final Map<String, String> metadata = new HashMap<>(); metadata.put("Data-Origin", "stocator"); FSDataOutputStream outStream = storageClient.createObject(plainObjName, Constants.APPLICATION_DIRECTORY, metadata, statistics); outStream.close(); } else { LOG.debug("mkdirs on non temp object. Create {}", f.toString()); String objName = stocatorPath.extractFinalKeyFromTemporaryPath(f, false, storageClient.getDataRoot(), true); if (!objName.endsWith("/")) { objName = objName + "/"; } LOG.trace("mkdirs to create directory {}", objName); FSDataOutputStream outStream = storageClient.createObject(objName, Constants.APPLICATION_DIRECTORY, null, statistics); outStream.close(); } return true; } }
public class class_name { @Override public boolean mkdirs(Path f) throws IOException, FileAlreadyExistsException { LOG.debug("mkdirs: {}", f.toString()); validateBracketSupport(f.toString()); if (stocatorPath.isTemporaryPathTarget(f.getParent())) { final Path path = storageClient.qualify(f); String objNameModified = stocatorPath.extractFinalKeyFromTemporaryPath(path,true, storageClient.getDataRoot(), true); final Path pathToObj = new Path(objNameModified); LOG.trace("mkdirs {} modified name", objNameModified); // make sure there is no overwrite of existing data // if we here, means getfilestatus() returned false and // fileoutputcomitter is about to create job temp folder // in this case there is no need to check wether base directory exists // as it was already checked in getfilestatus() method /* try { String directoryToExpect = stocatorPath.getBaseDirectory(f.toString()); FileStatus fileStatus = getFileStatus(new Path(directoryToExpect)); if (fileStatus != null) { LOG.debug("mkdirs found {} as exists. Directory : {}", directoryToExpect, fileStatus.isDirectory()); throw new FileAlreadyExistsException("mkdir on existing directory " + directoryToExpect); } } catch (FileNotFoundException e) { LOG.debug("mkdirs {} - not exists. Proceed", pathToObj.getParent().toString()); } */ String plainObjName = pathToObj.getParent().toString(); LOG.debug("Going to create identifier {}", plainObjName); final Map<String, String> metadata = new HashMap<>(); metadata.put("Data-Origin", "stocator"); FSDataOutputStream outStream = storageClient.createObject(plainObjName, Constants.APPLICATION_DIRECTORY, metadata, statistics); outStream.close(); } else { LOG.debug("mkdirs on non temp object. Create {}", f.toString()); String objName = stocatorPath.extractFinalKeyFromTemporaryPath(f, false, storageClient.getDataRoot(), true); if (!objName.endsWith("/")) { objName = objName + "/"; // depends on control dependency: [if], data = [none] } LOG.trace("mkdirs to create directory {}", objName); FSDataOutputStream outStream = storageClient.createObject(objName, Constants.APPLICATION_DIRECTORY, null, statistics); outStream.close(); } return true; } }
public class class_name { public void marshall(SnapshotDetails snapshotDetails, ProtocolMarshaller protocolMarshaller) { if (snapshotDetails == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(snapshotDetails.getSnapshotName(), SNAPSHOTNAME_BINDING); protocolMarshaller.marshall(snapshotDetails.getSnapshotStatus(), SNAPSHOTSTATUS_BINDING); protocolMarshaller.marshall(snapshotDetails.getApplicationVersionId(), APPLICATIONVERSIONID_BINDING); protocolMarshaller.marshall(snapshotDetails.getSnapshotCreationTimestamp(), SNAPSHOTCREATIONTIMESTAMP_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(SnapshotDetails snapshotDetails, ProtocolMarshaller protocolMarshaller) { if (snapshotDetails == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(snapshotDetails.getSnapshotName(), SNAPSHOTNAME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(snapshotDetails.getSnapshotStatus(), SNAPSHOTSTATUS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(snapshotDetails.getApplicationVersionId(), APPLICATIONVERSIONID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(snapshotDetails.getSnapshotCreationTimestamp(), SNAPSHOTCREATIONTIMESTAMP_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { protected String findValue(HTTPResponse httpResponse,String path) { String value=null; if((path!=null)&&(httpResponse!=null)) { //parse output T object=this.convertToObject(httpResponse); if(object!=null) { //look for an error String errorMessage=this.findError(object); if(errorMessage!=null) { throw new FaxException("Error found in response: "+errorMessage); } //find value value=this.findValue(object,path); } } return value; } }
public class class_name { protected String findValue(HTTPResponse httpResponse,String path) { String value=null; if((path!=null)&&(httpResponse!=null)) { //parse output T object=this.convertToObject(httpResponse); if(object!=null) { //look for an error String errorMessage=this.findError(object); if(errorMessage!=null) { throw new FaxException("Error found in response: "+errorMessage); } //find value value=this.findValue(object,path); // depends on control dependency: [if], data = [(object] } } return value; } }
public class class_name { private void writeUid(File uidFile, String uid) { BufferedWriter bw = null; try { bw = new BufferedWriter(new FileWriter(uidFile)); bw.write(uid); } catch (IOException ioe) {} finally { if (bw != null) { try { bw.close(); } catch (IOException ioe) {} } } } }
public class class_name { private void writeUid(File uidFile, String uid) { BufferedWriter bw = null; try { bw = new BufferedWriter(new FileWriter(uidFile)); // depends on control dependency: [try], data = [none] bw.write(uid); // depends on control dependency: [try], data = [none] } catch (IOException ioe) {} // depends on control dependency: [catch], data = [none] finally { if (bw != null) { try { bw.close(); } catch (IOException ioe) {} } } // depends on control dependency: [try], data = [none] // depends on control dependency: [catch], data = [none] } }
public class class_name { private static void appendFormatted( StringBuilder out, Object value, FormatChar format, FormatOptions options) { // Fast path switch statement for commonest cases (we could handle upper-case as a post // processing step but it's so uncommon it doesn't seem worth it). switch (format) { case STRING: // String formatting is by far and away the most common case. if (!(value instanceof Formattable)) { if (options.isDefault()) { // %s on a non-Formattable instance is the single most common case by far. out.append(safeToString(value)); return; } break; } // Rare but easy to deal with efficiently, and a can support wrapped arguments nicely. safeFormatTo((Formattable) value, out, options); return; // Some other types are really easy when they don't have special format options. case DECIMAL: case BOOLEAN: if (options.isDefault()) { out.append(value); return; } break; case HEX: // Check that if the format options are compatible with "easy" hex formatting. This could // be expanded to include width, radix and zero padding (relatively common for hex). if (options.filter(FLAG_UPPER_CASE, false, false).equals(options)) { // Having called canFormat(), we know the value must be a Number. appendHex(out, (Number) value, options); return; } break; case CHAR: if (options.isDefault()) { if (value instanceof Character) { out.append(value); return; } int codePoint = ((Number) value).intValue(); if (Character.isBmpCodePoint(codePoint)) { out.append((char) codePoint); return; } out.append(Character.toChars(codePoint)); return; } break; default: // Fall through. } // Default handle for rare cases that need non-tivial formatting. String formatString = format.getDefaultFormatString(); if (!options.isDefault()) { char chr = format.getChar(); if (options.shouldUpperCase()) { // Clear 6th bit to convert lower case ASCII to upper case. chr &= (char) ~0x20; } formatString = options.appendPrintfOptions(new StringBuilder("%")).append(chr).toString(); } out.append(String.format(FORMAT_LOCALE, formatString, value)); } }
public class class_name { private static void appendFormatted( StringBuilder out, Object value, FormatChar format, FormatOptions options) { // Fast path switch statement for commonest cases (we could handle upper-case as a post // processing step but it's so uncommon it doesn't seem worth it). switch (format) { case STRING: // String formatting is by far and away the most common case. if (!(value instanceof Formattable)) { if (options.isDefault()) { // %s on a non-Formattable instance is the single most common case by far. out.append(safeToString(value)); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } break; } // Rare but easy to deal with efficiently, and a can support wrapped arguments nicely. safeFormatTo((Formattable) value, out, options); return; // Some other types are really easy when they don't have special format options. case DECIMAL: case BOOLEAN: if (options.isDefault()) { out.append(value); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } break; case HEX: // Check that if the format options are compatible with "easy" hex formatting. This could // be expanded to include width, radix and zero padding (relatively common for hex). if (options.filter(FLAG_UPPER_CASE, false, false).equals(options)) { // Having called canFormat(), we know the value must be a Number. appendHex(out, (Number) value, options); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } break; case CHAR: if (options.isDefault()) { if (value instanceof Character) { out.append(value); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } int codePoint = ((Number) value).intValue(); if (Character.isBmpCodePoint(codePoint)) { out.append((char) codePoint); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } out.append(Character.toChars(codePoint)); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } break; default: // Fall through. } // Default handle for rare cases that need non-tivial formatting. String formatString = format.getDefaultFormatString(); if (!options.isDefault()) { char chr = format.getChar(); if (options.shouldUpperCase()) { // Clear 6th bit to convert lower case ASCII to upper case. chr &= (char) ~0x20; // depends on control dependency: [if], data = [none] } formatString = options.appendPrintfOptions(new StringBuilder("%")).append(chr).toString(); // depends on control dependency: [if], data = [none] } out.append(String.format(FORMAT_LOCALE, formatString, value)); } }
public class class_name { public List <AddOn> getUpdatedAddOns(AddOnCollection aoc) { List<AddOn> updatedAddOns = new ArrayList<>(); for (AddOn ao : aoc.getAddOns()) { for (AddOn addOn : addOns) { try { if (ao.isSameAddOn(addOn) && ao.isUpdateTo(addOn)) { // Its an update to one in this collection updatedAddOns.add(ao); } } catch (Exception e) { logger.error(e.getMessage(), e); } } } return updatedAddOns; } }
public class class_name { public List <AddOn> getUpdatedAddOns(AddOnCollection aoc) { List<AddOn> updatedAddOns = new ArrayList<>(); for (AddOn ao : aoc.getAddOns()) { for (AddOn addOn : addOns) { try { if (ao.isSameAddOn(addOn) && ao.isUpdateTo(addOn)) { // Its an update to one in this collection updatedAddOns.add(ao); // depends on control dependency: [if], data = [none] } } catch (Exception e) { logger.error(e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } } return updatedAddOns; } }
public class class_name { protected void threadBegin() { // // Note the 'beforeCallbacks' list is not going to have a well-defined order, so it is of limited use. // We probably want to revisit this with some kind of priority/order based on ranking to make // it more useful. // // At the moment we treat the setting of the tran timeout separately, rather than as a IJobExecutionStartCallbackService, // to reflect the fact that this is provided by a required dependency. If we were to want this to function in SE mode, // say, we might want to factor this too as an "extension" that is provided by another layer, and so incorporate this into a // more generic, extensible "before" processing. try { tranMgr.setTransactionTimeout(0); if (beforeCallbacks != null) { for (IJobExecutionStartCallbackService callback : beforeCallbacks) { if (logger.isLoggable(Level.FINER)) { logger.logp(Level.FINER, CLASSNAME, "threadBegin", "Calling before callback", callback); } callback.jobStarted(runtimeWorkUnitExecution); } } } catch (Throwable t) { // Fail the execution if any of our before-work-unit callbacks failed. E.g. the joblog context setup // was unsuccessful. We may want to make it an option whether or not to fail here in the future. runtimeWorkUnitExecution.logExecutionFailedMessage(); throw new BatchContainerRuntimeException("An error occurred during thread initialization.", t); } } }
public class class_name { protected void threadBegin() { // // Note the 'beforeCallbacks' list is not going to have a well-defined order, so it is of limited use. // We probably want to revisit this with some kind of priority/order based on ranking to make // it more useful. // // At the moment we treat the setting of the tran timeout separately, rather than as a IJobExecutionStartCallbackService, // to reflect the fact that this is provided by a required dependency. If we were to want this to function in SE mode, // say, we might want to factor this too as an "extension" that is provided by another layer, and so incorporate this into a // more generic, extensible "before" processing. try { tranMgr.setTransactionTimeout(0); // depends on control dependency: [try], data = [none] if (beforeCallbacks != null) { for (IJobExecutionStartCallbackService callback : beforeCallbacks) { if (logger.isLoggable(Level.FINER)) { logger.logp(Level.FINER, CLASSNAME, "threadBegin", "Calling before callback", callback); // depends on control dependency: [if], data = [none] } callback.jobStarted(runtimeWorkUnitExecution); // depends on control dependency: [for], data = [callback] } } } catch (Throwable t) { // Fail the execution if any of our before-work-unit callbacks failed. E.g. the joblog context setup // was unsuccessful. We may want to make it an option whether or not to fail here in the future. runtimeWorkUnitExecution.logExecutionFailedMessage(); throw new BatchContainerRuntimeException("An error occurred during thread initialization.", t); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void setConnectTimeout(int millis) { ClientHttpRequestFactory f = getRequestFactory(); if (f instanceof SimpleClientHttpRequestFactory) { ((SimpleClientHttpRequestFactory) f).setConnectTimeout(millis); } else { ((HttpComponentsClientHttpRequestFactory) f).setConnectTimeout(millis); } } }
public class class_name { public void setConnectTimeout(int millis) { ClientHttpRequestFactory f = getRequestFactory(); if (f instanceof SimpleClientHttpRequestFactory) { ((SimpleClientHttpRequestFactory) f).setConnectTimeout(millis); // depends on control dependency: [if], data = [none] } else { ((HttpComponentsClientHttpRequestFactory) f).setConnectTimeout(millis); // depends on control dependency: [if], data = [none] } } }
public class class_name { private static Integer[] int2DToInteger( int[][] dd ) { Integer[] d = new Integer[ dd.length*dd[0].length ]; for ( int n = 0; n < dd[0].length; n++ ) { for ( int m = 0; m < dd.length; m++ ) { d[ m+n*dd.length ] = dd[m][n]; } } return d; } }
public class class_name { private static Integer[] int2DToInteger( int[][] dd ) { Integer[] d = new Integer[ dd.length*dd[0].length ]; for ( int n = 0; n < dd[0].length; n++ ) { for ( int m = 0; m < dd.length; m++ ) { d[ m+n*dd.length ] = dd[m][n]; // depends on control dependency: [for], data = [m] } } return d; } }
public class class_name { public PatchFilterGroup withPatchFilters(PatchFilter... patchFilters) { if (this.patchFilters == null) { setPatchFilters(new com.amazonaws.internal.SdkInternalList<PatchFilter>(patchFilters.length)); } for (PatchFilter ele : patchFilters) { this.patchFilters.add(ele); } return this; } }
public class class_name { public PatchFilterGroup withPatchFilters(PatchFilter... patchFilters) { if (this.patchFilters == null) { setPatchFilters(new com.amazonaws.internal.SdkInternalList<PatchFilter>(patchFilters.length)); // depends on control dependency: [if], data = [none] } for (PatchFilter ele : patchFilters) { this.patchFilters.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { protected void setupRoadInterior(ZoomableGraphicsContext gc, RoadPolyline element) { final Color color; if (isSelected(element)) { color = gc.rgb(SELECTED_ROAD_COLOR); } else { color = gc.rgb(ROAD_COLOR); } gc.setStroke(color); if (element.isWidePolyline()) { gc.setLineWidthInMeters(element.getWidth()); } else { gc.setLineWidthInPixels(1); } } }
public class class_name { protected void setupRoadInterior(ZoomableGraphicsContext gc, RoadPolyline element) { final Color color; if (isSelected(element)) { color = gc.rgb(SELECTED_ROAD_COLOR); // depends on control dependency: [if], data = [none] } else { color = gc.rgb(ROAD_COLOR); // depends on control dependency: [if], data = [none] } gc.setStroke(color); if (element.isWidePolyline()) { gc.setLineWidthInMeters(element.getWidth()); // depends on control dependency: [if], data = [none] } else { gc.setLineWidthInPixels(1); // depends on control dependency: [if], data = [none] } } }
public class class_name { public FileListFromComputeNodeNextOptions withOcpDate(DateTime ocpDate) { if (ocpDate == null) { this.ocpDate = null; } else { this.ocpDate = new DateTimeRfc1123(ocpDate); } return this; } }
public class class_name { public FileListFromComputeNodeNextOptions withOcpDate(DateTime ocpDate) { if (ocpDate == null) { this.ocpDate = null; // depends on control dependency: [if], data = [none] } else { this.ocpDate = new DateTimeRfc1123(ocpDate); // depends on control dependency: [if], data = [(ocpDate] } return this; } }
public class class_name { @Override public CompletableFuture<Acknowledge> triggerCheckpoint( ExecutionAttemptID executionAttemptID, long checkpointId, long checkpointTimestamp, CheckpointOptions checkpointOptions, boolean advanceToEndOfEventTime) { log.debug("Trigger checkpoint {}@{} for {}.", checkpointId, checkpointTimestamp, executionAttemptID); final CheckpointType checkpointType = checkpointOptions.getCheckpointType(); if (advanceToEndOfEventTime && !(checkpointType.isSynchronous() && checkpointType.isSavepoint())) { throw new IllegalArgumentException("Only synchronous savepoints are allowed to advance the watermark to MAX."); } final Task task = taskSlotTable.getTask(executionAttemptID); if (task != null) { task.triggerCheckpointBarrier(checkpointId, checkpointTimestamp, checkpointOptions, advanceToEndOfEventTime); return CompletableFuture.completedFuture(Acknowledge.get()); } else { final String message = "TaskManager received a checkpoint request for unknown task " + executionAttemptID + '.'; log.debug(message); return FutureUtils.completedExceptionally(new CheckpointException(message)); } } }
public class class_name { @Override public CompletableFuture<Acknowledge> triggerCheckpoint( ExecutionAttemptID executionAttemptID, long checkpointId, long checkpointTimestamp, CheckpointOptions checkpointOptions, boolean advanceToEndOfEventTime) { log.debug("Trigger checkpoint {}@{} for {}.", checkpointId, checkpointTimestamp, executionAttemptID); final CheckpointType checkpointType = checkpointOptions.getCheckpointType(); if (advanceToEndOfEventTime && !(checkpointType.isSynchronous() && checkpointType.isSavepoint())) { throw new IllegalArgumentException("Only synchronous savepoints are allowed to advance the watermark to MAX."); } final Task task = taskSlotTable.getTask(executionAttemptID); if (task != null) { task.triggerCheckpointBarrier(checkpointId, checkpointTimestamp, checkpointOptions, advanceToEndOfEventTime); // depends on control dependency: [if], data = [none] return CompletableFuture.completedFuture(Acknowledge.get()); // depends on control dependency: [if], data = [none] } else { final String message = "TaskManager received a checkpoint request for unknown task " + executionAttemptID + '.'; // depends on control dependency: [if], data = [none] log.debug(message); // depends on control dependency: [if], data = [none] return FutureUtils.completedExceptionally(new CheckpointException(message)); // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override public DirectCompilerResult visitInterval(FEEL_1_1Parser.IntervalContext ctx) { DirectCompilerResult start = visit(ctx.start); DirectCompilerResult end = visit(ctx.end); Expression lowBoundary = expressionBoundaryOf( RangeNode.IntervalBoundary.low(ctx.low.getText())); Expression lowEndPoint = start.getExpression(); Expression highEndPoint = end.getExpression(); Expression highBoundary = expressionBoundaryOf( RangeNode.IntervalBoundary.high(ctx.up.getText())); // if this is a range of type i..j with i,j numbers: // then we make it a constant; otherwise we fallback // to the general case of creating the Range object at runtime if (isNumericConstant(start) && isNumericConstant(end)) { ObjectCreationExpr initializer = new ObjectCreationExpr() .setType(JavaParser.parseClassOrInterfaceType(RangeImpl.class.getCanonicalName())) .addArgument(lowBoundary) .addArgument(new CastExpr(TYPE_COMPARABLE, lowEndPoint)) .addArgument(new CastExpr(TYPE_COMPARABLE, highEndPoint)) .addArgument(highBoundary); FieldDeclaration rangeField = fieldDeclarationOf( "RANGE", ParserHelper.getOriginalText(ctx), initializer); Set<FieldDeclaration> fieldDeclarations = DirectCompilerResult.mergeFDs(start, end); fieldDeclarations.add(rangeField); return DirectCompilerResult.of( new NameExpr( rangeField.getVariable(0) .getName().asString()), BuiltInType.RANGE, fieldDeclarations); } else { MethodCallExpr initializer = new MethodCallExpr( null, "range", new NodeList<>( new NameExpr("feelExprCtx"), lowBoundary, lowEndPoint, highEndPoint, highBoundary)); return DirectCompilerResult.of( initializer, BuiltInType.RANGE, DirectCompilerResult.mergeFDs(start, end)); } } }
public class class_name { @Override public DirectCompilerResult visitInterval(FEEL_1_1Parser.IntervalContext ctx) { DirectCompilerResult start = visit(ctx.start); DirectCompilerResult end = visit(ctx.end); Expression lowBoundary = expressionBoundaryOf( RangeNode.IntervalBoundary.low(ctx.low.getText())); Expression lowEndPoint = start.getExpression(); Expression highEndPoint = end.getExpression(); Expression highBoundary = expressionBoundaryOf( RangeNode.IntervalBoundary.high(ctx.up.getText())); // if this is a range of type i..j with i,j numbers: // then we make it a constant; otherwise we fallback // to the general case of creating the Range object at runtime if (isNumericConstant(start) && isNumericConstant(end)) { ObjectCreationExpr initializer = new ObjectCreationExpr() .setType(JavaParser.parseClassOrInterfaceType(RangeImpl.class.getCanonicalName())) .addArgument(lowBoundary) .addArgument(new CastExpr(TYPE_COMPARABLE, lowEndPoint)) .addArgument(new CastExpr(TYPE_COMPARABLE, highEndPoint)) .addArgument(highBoundary); FieldDeclaration rangeField = fieldDeclarationOf( "RANGE", ParserHelper.getOriginalText(ctx), initializer); Set<FieldDeclaration> fieldDeclarations = DirectCompilerResult.mergeFDs(start, end); fieldDeclarations.add(rangeField); // depends on control dependency: [if], data = [none] return DirectCompilerResult.of( new NameExpr( rangeField.getVariable(0) .getName().asString()), BuiltInType.RANGE, fieldDeclarations); // depends on control dependency: [if], data = [none] } else { MethodCallExpr initializer = new MethodCallExpr( null, "range", new NodeList<>( new NameExpr("feelExprCtx"), lowBoundary, lowEndPoint, highEndPoint, highBoundary)); return DirectCompilerResult.of( initializer, BuiltInType.RANGE, DirectCompilerResult.mergeFDs(start, end)); // depends on control dependency: [if], data = [none] } } }
public class class_name { private static String getOS() { if (SystemUtils.IS_OS_WINDOWS) { return "Windows"; } if (SystemUtils.IS_OS_MAC_OSX) { return "Darwin"; } if (SystemUtils.IS_OS_LINUX) { return "Linux"; } throw new UnsupportedOperationException("Unknown OS " + SystemUtils.OS_NAME); } }
public class class_name { private static String getOS() { if (SystemUtils.IS_OS_WINDOWS) { return "Windows"; // depends on control dependency: [if], data = [none] } if (SystemUtils.IS_OS_MAC_OSX) { return "Darwin"; // depends on control dependency: [if], data = [none] } if (SystemUtils.IS_OS_LINUX) { return "Linux"; // depends on control dependency: [if], data = [none] } throw new UnsupportedOperationException("Unknown OS " + SystemUtils.OS_NAME); } }
public class class_name { public final static Sample append(List<Sample> samples) { if (samples.size() == 0) { return buildSample(0, new double[0]); } int sampleCount = 0; // append voices to each other double[] first = samples.get(0).getInterleavedSamples(); sampleCount += samples.get(0).getSampleCount(); double[][] samples_ary = new double[samples.size() - 1][]; for (int i = 0; i < samples_ary.length; i++) { samples_ary[i] = samples.get(i + 1).getInterleavedSamples(); sampleCount += samples.get(i + 1).getSampleCount(); } double[] appended = concatAll(first, samples_ary); return buildSample(sampleCount, appended); } }
public class class_name { public final static Sample append(List<Sample> samples) { if (samples.size() == 0) { return buildSample(0, new double[0]); // depends on control dependency: [if], data = [none] } int sampleCount = 0; // append voices to each other double[] first = samples.get(0).getInterleavedSamples(); sampleCount += samples.get(0).getSampleCount(); double[][] samples_ary = new double[samples.size() - 1][]; for (int i = 0; i < samples_ary.length; i++) { samples_ary[i] = samples.get(i + 1).getInterleavedSamples(); // depends on control dependency: [for], data = [i] sampleCount += samples.get(i + 1).getSampleCount(); // depends on control dependency: [for], data = [i] } double[] appended = concatAll(first, samples_ary); return buildSample(sampleCount, appended); } }
public class class_name { public boolean is(CommandOption option) { if (option == null) { return false; } return StringUtils.equals(getCommand(), option.getCommand()) || StringUtils.equals(getLongCommand(), option.getLongCommand()) || StringUtils.equals(getSetting(), option.getSetting()); } }
public class class_name { public boolean is(CommandOption option) { if (option == null) { return false; // depends on control dependency: [if], data = [none] } return StringUtils.equals(getCommand(), option.getCommand()) || StringUtils.equals(getLongCommand(), option.getLongCommand()) || StringUtils.equals(getSetting(), option.getSetting()); } }
public class class_name { protected void opts(String[] opts) { if(opts.length < 1) { sendResponse(501, "Missing parameters"); return; } String option = opts[0].toUpperCase(); if(!options.containsKey(option)) { sendResponse(501, "No option found"); } else if(opts.length < 2) { sendResponse(200, options.get(option)); } else { options.put(option, opts[1].toUpperCase()); sendResponse(200, "Option updated"); } } }
public class class_name { protected void opts(String[] opts) { if(opts.length < 1) { sendResponse(501, "Missing parameters"); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } String option = opts[0].toUpperCase(); if(!options.containsKey(option)) { sendResponse(501, "No option found"); // depends on control dependency: [if], data = [none] } else if(opts.length < 2) { sendResponse(200, options.get(option)); // depends on control dependency: [if], data = [none] } else { options.put(option, opts[1].toUpperCase()); // depends on control dependency: [if], data = [none] sendResponse(200, "Option updated"); // depends on control dependency: [if], data = [none] } } }
public class class_name { public synchronized void unregister(Object subscriber) { List<Class<?>> subscribedTypes = typesBySubscriber.get(subscriber); if (subscribedTypes != null) { for (Class<?> eventType : subscribedTypes) { unsubscribeByEventType(subscriber, eventType); } typesBySubscriber.remove(subscriber); } else { logger.log(Level.WARNING, "Subscriber to unregister was not registered before: " + subscriber.getClass()); } } }
public class class_name { public synchronized void unregister(Object subscriber) { List<Class<?>> subscribedTypes = typesBySubscriber.get(subscriber); if (subscribedTypes != null) { for (Class<?> eventType : subscribedTypes) { unsubscribeByEventType(subscriber, eventType); // depends on control dependency: [for], data = [eventType] } typesBySubscriber.remove(subscriber); // depends on control dependency: [if], data = [none] } else { logger.log(Level.WARNING, "Subscriber to unregister was not registered before: " + subscriber.getClass()); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void marshall(StorageGatewayError storageGatewayError, ProtocolMarshaller protocolMarshaller) { if (storageGatewayError == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(storageGatewayError.getErrorCode(), ERRORCODE_BINDING); protocolMarshaller.marshall(storageGatewayError.getErrorDetails(), ERRORDETAILS_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(StorageGatewayError storageGatewayError, ProtocolMarshaller protocolMarshaller) { if (storageGatewayError == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(storageGatewayError.getErrorCode(), ERRORCODE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(storageGatewayError.getErrorDetails(), ERRORDETAILS_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 { final boolean hasMQMDPropertiesSet() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "hasMQMDPropertiesSet"); boolean set = false; // If we have a fluffed up map, check it for size if (mqMdSetPropertiesMap != null) { if (mqMdSetPropertiesMap.size() > 0) { set = true; } } // Otherwise, see if the variant is set else if (getHdr2().getChoiceField(JsHdr2Access.MQMDPROPERTIES) == JsHdr2Access.IS_MQMDPROPERTIES_MAP) { set = true; } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "hasMQMDPropertiesSet", set); return set; } }
public class class_name { final boolean hasMQMDPropertiesSet() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "hasMQMDPropertiesSet"); boolean set = false; // If we have a fluffed up map, check it for size if (mqMdSetPropertiesMap != null) { if (mqMdSetPropertiesMap.size() > 0) { set = true; // depends on control dependency: [if], data = [none] } } // Otherwise, see if the variant is set else if (getHdr2().getChoiceField(JsHdr2Access.MQMDPROPERTIES) == JsHdr2Access.IS_MQMDPROPERTIES_MAP) { set = true; // depends on control dependency: [if], data = [none] } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "hasMQMDPropertiesSet", set); return set; } }
public class class_name { public static boolean isJavaxScriptingAvailable() { Object engine = null; try { Class<?> managerClass = Class.forName("javax.script.ScriptEngineManager"); Method m = managerClass.getMethod("getEngineByMimeType", String.class); engine = m.invoke(managerClass.newInstance(), "text/javascript"); } catch (ClassNotFoundException | NoSuchMethodException | IllegalAccessException | InvocationTargetException | InstantiationException e) { return false; } return engine != null; } }
public class class_name { public static boolean isJavaxScriptingAvailable() { Object engine = null; try { Class<?> managerClass = Class.forName("javax.script.ScriptEngineManager"); Method m = managerClass.getMethod("getEngineByMimeType", String.class); engine = m.invoke(managerClass.newInstance(), "text/javascript"); } catch (ClassNotFoundException | NoSuchMethodException | IllegalAccessException | InvocationTargetException | InstantiationException e) { return false; } // depends on control dependency: [catch], data = [none] return engine != null; } }
public class class_name { @RequestMapping(path="/{orderId}/status", method = RequestMethod.PUT) public ResponseEntity<Order> updateStatus(@PathVariable("orderId") Long orderId, @RequestParam("status") OrderStatus status){ Order order = orderService.updateStatus(orderId, status); if(order != null){ return new ResponseEntity<Order>(order, HttpStatus.OK); } return new ResponseEntity<Order>(HttpStatus.NOT_FOUND); } }
public class class_name { @RequestMapping(path="/{orderId}/status", method = RequestMethod.PUT) public ResponseEntity<Order> updateStatus(@PathVariable("orderId") Long orderId, @RequestParam("status") OrderStatus status){ Order order = orderService.updateStatus(orderId, status); if(order != null){ return new ResponseEntity<Order>(order, HttpStatus.OK); // depends on control dependency: [if], data = [(order] } return new ResponseEntity<Order>(HttpStatus.NOT_FOUND); } }
public class class_name { @SuppressWarnings("unchecked") public List<Repository> getAll(String projectName) { final Criteria crit = sessionService.getSession().createCriteria(Repository.class); if (projectName != null) { crit.createAlias("project", "p"); crit.add(Restrictions.eq("p.name", projectName)); } List<Repository> list = crit.list(); HibernateLazyInitializer.initCollection(list); return list; } }
public class class_name { @SuppressWarnings("unchecked") public List<Repository> getAll(String projectName) { final Criteria crit = sessionService.getSession().createCriteria(Repository.class); if (projectName != null) { crit.createAlias("project", "p"); // depends on control dependency: [if], data = [none] crit.add(Restrictions.eq("p.name", projectName)); // depends on control dependency: [if], data = [none] } List<Repository> list = crit.list(); HibernateLazyInitializer.initCollection(list); return list; } }
public class class_name { public static void refresh() { try { setContext(prop); } catch (NamingException e) { log.error("Unable to refresh the naming context"); throw new OJBRuntimeException("Refresh of context failed, used properties: " + (prop != null ? prop.toString() : "none"), e); } } }
public class class_name { public static void refresh() { try { setContext(prop); // depends on control dependency: [try], data = [none] } catch (NamingException e) { log.error("Unable to refresh the naming context"); throw new OJBRuntimeException("Refresh of context failed, used properties: " + (prop != null ? prop.toString() : "none"), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { @Override public boolean next() { boolean ok = idx.next(); if (ok) { RecordId rid = idx.getDataRecordId(); ts.moveToRecordId(rid); } return ok; } }
public class class_name { @Override public boolean next() { boolean ok = idx.next(); if (ok) { RecordId rid = idx.getDataRecordId(); ts.moveToRecordId(rid); // depends on control dependency: [if], data = [none] } return ok; } }
public class class_name { public static String getESIDependencies(Enumeration e1, Enumeration e2) { if ((e1 == null || !e1.hasMoreElements())) if ((e2 == null || !e2.hasMoreElements())) return null; StringBuffer sb = new StringBuffer("dependencies=\""); if (e1 != null) while (e1.hasMoreElements()) { sb.append(" "); sb.append((String) e1.nextElement()); } if (e2 != null) while (e2.hasMoreElements()) { sb.append(" "); sb.append((String) e2.nextElement()); } //don't append a trailing double quote, since we have to add the cache id later return sb.toString(); } }
public class class_name { public static String getESIDependencies(Enumeration e1, Enumeration e2) { if ((e1 == null || !e1.hasMoreElements())) if ((e2 == null || !e2.hasMoreElements())) return null; StringBuffer sb = new StringBuffer("dependencies=\""); if (e1 != null) while (e1.hasMoreElements()) { sb.append(" "); // depends on control dependency: [while], data = [none] sb.append((String) e1.nextElement()); // depends on control dependency: [while], data = [none] } if (e2 != null) while (e2.hasMoreElements()) { sb.append(" "); // depends on control dependency: [while], data = [none] sb.append((String) e2.nextElement()); // depends on control dependency: [while], data = [none] } //don't append a trailing double quote, since we have to add the cache id later return sb.toString(); } }
public class class_name { @Override public DescriptorValue calculate(IAtomContainer container) { IAtomContainer atomContainer; try { atomContainer = (IAtomContainer) container.clone(); } catch (CloneNotSupportedException e) { DoubleArrayResult kierValues = new DoubleArrayResult(3); kierValues.add(Double.NaN); kierValues.add(Double.NaN); kierValues.add(Double.NaN); return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), kierValues, getDescriptorNames()); } atomContainer = AtomContainerManipulator.removeHydrogens(atomContainer); //org.openscience.cdk.interfaces.IAtom[] atoms = atomContainer.getAtoms(); java.util.List firstAtomNeighboors; java.util.List secondAtomNeighboors; java.util.List thirdAtomNeighboors; DoubleArrayResult kierValues = new DoubleArrayResult(3); double bond1; double bond2; double bond3; double kier1; double kier2; double kier3; double atomsCount = atomContainer.getAtomCount(); ArrayList<Double> singlePaths = new ArrayList<Double>(); ArrayList<String> doublePaths = new ArrayList<String>(); ArrayList<String> triplePaths = new ArrayList<String>(); double[] sorterFirst = new double[2]; double[] sorterSecond = new double[3]; String tmpbond2; String tmpbond3; for (int a1 = 0; a1 < atomsCount; a1++) { bond1 = 0; firstAtomNeighboors = atomContainer.getConnectedAtomsList(atomContainer.getAtom(a1)); for (int a2 = 0; a2 < firstAtomNeighboors.size(); a2++) { bond1 = atomContainer.indexOf(atomContainer.getBond(atomContainer.getAtom(a1), (IAtom) firstAtomNeighboors.get(a2))); if (!singlePaths.contains(new Double(bond1))) { singlePaths.add(bond1); java.util.Collections.sort(singlePaths); } secondAtomNeighboors = atomContainer.getConnectedAtomsList((IAtom) firstAtomNeighboors.get(a2)); for (int a3 = 0; a3 < secondAtomNeighboors.size(); a3++) { bond2 = atomContainer.indexOf(atomContainer.getBond((IAtom) firstAtomNeighboors.get(a2), (IAtom) secondAtomNeighboors.get(a3))); if (!singlePaths.contains(new Double(bond2))) { singlePaths.add(bond2); } sorterFirst[0] = bond1; sorterFirst[1] = bond2; java.util.Arrays.sort(sorterFirst); tmpbond2 = sorterFirst[0] + "+" + sorterFirst[1]; if (!doublePaths.contains(tmpbond2) && (bond1 != bond2)) { doublePaths.add(tmpbond2); } thirdAtomNeighboors = atomContainer.getConnectedAtomsList((IAtom) secondAtomNeighboors.get(a3)); for (int a4 = 0; a4 < thirdAtomNeighboors.size(); a4++) { bond3 = atomContainer.indexOf(atomContainer.getBond((IAtom) secondAtomNeighboors.get(a3), (IAtom) thirdAtomNeighboors.get(a4))); if (!singlePaths.contains(new Double(bond3))) { singlePaths.add(bond3); } sorterSecond[0] = bond1; sorterSecond[1] = bond2; sorterSecond[2] = bond3; java.util.Arrays.sort(sorterSecond); tmpbond3 = sorterSecond[0] + "+" + sorterSecond[1] + "+" + sorterSecond[2]; if (!triplePaths.contains(tmpbond3)) { if ((bond1 != bond2) && (bond1 != bond3) && (bond2 != bond3)) { triplePaths.add(tmpbond3); } } } } } } if (atomsCount == 1) { kier1 = 0; kier2 = 0; kier3 = 0; } else { kier1 = (((atomsCount) * ((atomsCount - 1) * (atomsCount - 1))) / (singlePaths.size() * singlePaths.size())); if (atomsCount == 2) { kier2 = 0; kier3 = 0; } else { if (doublePaths.size() == 0) kier2 = Double.NaN; else kier2 = (((atomsCount - 1) * ((atomsCount - 2) * (atomsCount - 2))) / (doublePaths.size() * doublePaths .size())); if (atomsCount == 3) { kier3 = 0; } else { if (atomsCount % 2 != 0) { if (triplePaths.size() == 0) kier3 = Double.NaN; else kier3 = (((atomsCount - 1) * ((atomsCount - 3) * (atomsCount - 3))) / (triplePaths.size() * triplePaths .size())); } else { if (triplePaths.size() == 0) kier3 = Double.NaN; else kier3 = (((atomsCount - 3) * ((atomsCount - 2) * (atomsCount - 2))) / (triplePaths.size() * triplePaths .size())); } } } } kierValues.add(kier1); kierValues.add(kier2); kierValues.add(kier3); return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), kierValues, getDescriptorNames()); } }
public class class_name { @Override public DescriptorValue calculate(IAtomContainer container) { IAtomContainer atomContainer; try { atomContainer = (IAtomContainer) container.clone(); // depends on control dependency: [try], data = [none] } catch (CloneNotSupportedException e) { DoubleArrayResult kierValues = new DoubleArrayResult(3); kierValues.add(Double.NaN); kierValues.add(Double.NaN); kierValues.add(Double.NaN); return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), kierValues, getDescriptorNames()); } // depends on control dependency: [catch], data = [none] atomContainer = AtomContainerManipulator.removeHydrogens(atomContainer); //org.openscience.cdk.interfaces.IAtom[] atoms = atomContainer.getAtoms(); java.util.List firstAtomNeighboors; java.util.List secondAtomNeighboors; java.util.List thirdAtomNeighboors; DoubleArrayResult kierValues = new DoubleArrayResult(3); double bond1; double bond2; double bond3; double kier1; double kier2; double kier3; double atomsCount = atomContainer.getAtomCount(); ArrayList<Double> singlePaths = new ArrayList<Double>(); ArrayList<String> doublePaths = new ArrayList<String>(); ArrayList<String> triplePaths = new ArrayList<String>(); double[] sorterFirst = new double[2]; double[] sorterSecond = new double[3]; String tmpbond2; String tmpbond3; for (int a1 = 0; a1 < atomsCount; a1++) { bond1 = 0; // depends on control dependency: [for], data = [none] firstAtomNeighboors = atomContainer.getConnectedAtomsList(atomContainer.getAtom(a1)); // depends on control dependency: [for], data = [a1] for (int a2 = 0; a2 < firstAtomNeighboors.size(); a2++) { bond1 = atomContainer.indexOf(atomContainer.getBond(atomContainer.getAtom(a1), (IAtom) firstAtomNeighboors.get(a2))); // depends on control dependency: [for], data = [a2] if (!singlePaths.contains(new Double(bond1))) { singlePaths.add(bond1); // depends on control dependency: [if], data = [none] java.util.Collections.sort(singlePaths); // depends on control dependency: [if], data = [none] } secondAtomNeighboors = atomContainer.getConnectedAtomsList((IAtom) firstAtomNeighboors.get(a2)); // depends on control dependency: [for], data = [a2] for (int a3 = 0; a3 < secondAtomNeighboors.size(); a3++) { bond2 = atomContainer.indexOf(atomContainer.getBond((IAtom) firstAtomNeighboors.get(a2), (IAtom) secondAtomNeighboors.get(a3))); // depends on control dependency: [for], data = [none] if (!singlePaths.contains(new Double(bond2))) { singlePaths.add(bond2); // depends on control dependency: [if], data = [none] } sorterFirst[0] = bond1; // depends on control dependency: [for], data = [none] sorterFirst[1] = bond2; // depends on control dependency: [for], data = [none] java.util.Arrays.sort(sorterFirst); // depends on control dependency: [for], data = [none] tmpbond2 = sorterFirst[0] + "+" + sorterFirst[1]; // depends on control dependency: [for], data = [none] if (!doublePaths.contains(tmpbond2) && (bond1 != bond2)) { doublePaths.add(tmpbond2); // depends on control dependency: [if], data = [none] } thirdAtomNeighboors = atomContainer.getConnectedAtomsList((IAtom) secondAtomNeighboors.get(a3)); // depends on control dependency: [for], data = [a3] for (int a4 = 0; a4 < thirdAtomNeighboors.size(); a4++) { bond3 = atomContainer.indexOf(atomContainer.getBond((IAtom) secondAtomNeighboors.get(a3), (IAtom) thirdAtomNeighboors.get(a4))); // depends on control dependency: [for], data = [none] if (!singlePaths.contains(new Double(bond3))) { singlePaths.add(bond3); // depends on control dependency: [if], data = [none] } sorterSecond[0] = bond1; // depends on control dependency: [for], data = [none] sorterSecond[1] = bond2; // depends on control dependency: [for], data = [none] sorterSecond[2] = bond3; // depends on control dependency: [for], data = [none] java.util.Arrays.sort(sorterSecond); // depends on control dependency: [for], data = [none] tmpbond3 = sorterSecond[0] + "+" + sorterSecond[1] + "+" + sorterSecond[2]; // depends on control dependency: [for], data = [none] if (!triplePaths.contains(tmpbond3)) { if ((bond1 != bond2) && (bond1 != bond3) && (bond2 != bond3)) { triplePaths.add(tmpbond3); // depends on control dependency: [if], data = [none] } } } } } } if (atomsCount == 1) { kier1 = 0; // depends on control dependency: [if], data = [none] kier2 = 0; // depends on control dependency: [if], data = [none] kier3 = 0; // depends on control dependency: [if], data = [none] } else { kier1 = (((atomsCount) * ((atomsCount - 1) * (atomsCount - 1))) / (singlePaths.size() * singlePaths.size())); // depends on control dependency: [if], data = [(atomsCount] if (atomsCount == 2) { kier2 = 0; // depends on control dependency: [if], data = [none] kier3 = 0; // depends on control dependency: [if], data = [none] } else { if (doublePaths.size() == 0) kier2 = Double.NaN; else kier2 = (((atomsCount - 1) * ((atomsCount - 2) * (atomsCount - 2))) / (doublePaths.size() * doublePaths .size())); if (atomsCount == 3) { kier3 = 0; // depends on control dependency: [if], data = [none] } else { if (atomsCount % 2 != 0) { if (triplePaths.size() == 0) kier3 = Double.NaN; else kier3 = (((atomsCount - 1) * ((atomsCount - 3) * (atomsCount - 3))) / (triplePaths.size() * triplePaths .size())); } else { if (triplePaths.size() == 0) kier3 = Double.NaN; else kier3 = (((atomsCount - 3) * ((atomsCount - 2) * (atomsCount - 2))) / (triplePaths.size() * triplePaths .size())); } } } } kierValues.add(kier1); kierValues.add(kier2); kierValues.add(kier3); return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), kierValues, getDescriptorNames()); } }
public class class_name { private void onPublicKeysGroupRemoved(int uid, int keyGroupId) { UserKeys userKeys = getCachedUserKeys(uid); if (userKeys == null) { return; } UserKeys updatedUserKeys = userKeys.removeUserKeyGroup(keyGroupId); cacheUserKeys(updatedUserKeys); context().getEncryption().getEncryptedChatManager(uid) .send(new EncryptedPeerActor.KeyGroupUpdated(userKeys)); } }
public class class_name { private void onPublicKeysGroupRemoved(int uid, int keyGroupId) { UserKeys userKeys = getCachedUserKeys(uid); if (userKeys == null) { return; // depends on control dependency: [if], data = [none] } UserKeys updatedUserKeys = userKeys.removeUserKeyGroup(keyGroupId); cacheUserKeys(updatedUserKeys); context().getEncryption().getEncryptedChatManager(uid) .send(new EncryptedPeerActor.KeyGroupUpdated(userKeys)); } }
public class class_name { public void shutdown (final boolean waitForJobsToComplete) { synchronized (m_aNextRunnableLock) { if (LOGGER.isDebugEnabled ()) LOGGER.debug ("Shutting down threadpool..."); m_bIsShutdown = true; if (m_aWorkers == null) // case where the pool wasn't even initialize()ed return; // signal each worker thread to shut down Iterator <WorkerThread> workerThreads = m_aWorkers.iterator (); while (workerThreads.hasNext ()) { final WorkerThread wt = workerThreads.next (); wt.shutdown (); m_aAvailWorkers.remove (wt); } // Give waiting (wait(1000)) worker threads a chance to shut down. // Active worker threads will shut down after finishing their // current job. m_aNextRunnableLock.notifyAll (); if (waitForJobsToComplete == true) { boolean interrupted = false; try { // wait for hand-off in runInThread to complete... while (m_bHandoffPending) { try { m_aNextRunnableLock.wait (100); } catch (final InterruptedException ex) { interrupted = true; } } // Wait until all worker threads are shut down while (m_aBusyWorkers.size () > 0) { final WorkerThread wt = m_aBusyWorkers.get (0); try { if (LOGGER.isDebugEnabled ()) LOGGER.debug ("Waiting for thread " + wt.getName () + " to shut down"); // note: with waiting infinite time the // application may appear to 'hang'. m_aNextRunnableLock.wait (2000); } catch (final InterruptedException ex) { interrupted = true; } } workerThreads = m_aWorkers.iterator (); while (workerThreads.hasNext ()) { final WorkerThread wt = workerThreads.next (); try { wt.join (); workerThreads.remove (); } catch (final InterruptedException ex) { interrupted = true; } } } finally { if (interrupted) { Thread.currentThread ().interrupt (); } } if (LOGGER.isDebugEnabled ()) LOGGER.debug ("No executing jobs remaining, all threads stopped."); } if (LOGGER.isDebugEnabled ()) LOGGER.debug ("Shutdown of threadpool complete."); } } }
public class class_name { public void shutdown (final boolean waitForJobsToComplete) { synchronized (m_aNextRunnableLock) { if (LOGGER.isDebugEnabled ()) LOGGER.debug ("Shutting down threadpool..."); m_bIsShutdown = true; if (m_aWorkers == null) // case where the pool wasn't even initialize()ed return; // signal each worker thread to shut down Iterator <WorkerThread> workerThreads = m_aWorkers.iterator (); while (workerThreads.hasNext ()) { final WorkerThread wt = workerThreads.next (); wt.shutdown (); // depends on control dependency: [while], data = [none] m_aAvailWorkers.remove (wt); // depends on control dependency: [while], data = [none] } // Give waiting (wait(1000)) worker threads a chance to shut down. // Active worker threads will shut down after finishing their // current job. m_aNextRunnableLock.notifyAll (); if (waitForJobsToComplete == true) { boolean interrupted = false; try { // wait for hand-off in runInThread to complete... while (m_bHandoffPending) { try { m_aNextRunnableLock.wait (100); // depends on control dependency: [try], data = [none] } catch (final InterruptedException ex) { interrupted = true; } // depends on control dependency: [catch], data = [none] } // Wait until all worker threads are shut down while (m_aBusyWorkers.size () > 0) { final WorkerThread wt = m_aBusyWorkers.get (0); try { if (LOGGER.isDebugEnabled ()) LOGGER.debug ("Waiting for thread " + wt.getName () + " to shut down"); // note: with waiting infinite time the // application may appear to 'hang'. m_aNextRunnableLock.wait (2000); // depends on control dependency: [try], data = [none] } catch (final InterruptedException ex) { interrupted = true; } // depends on control dependency: [catch], data = [none] } workerThreads = m_aWorkers.iterator (); // depends on control dependency: [try], data = [none] while (workerThreads.hasNext ()) { final WorkerThread wt = workerThreads.next (); try { wt.join (); // depends on control dependency: [try], data = [none] workerThreads.remove (); // depends on control dependency: [try], data = [none] } catch (final InterruptedException ex) { interrupted = true; } // depends on control dependency: [catch], data = [none] } } finally { if (interrupted) { Thread.currentThread ().interrupt (); // depends on control dependency: [if], data = [none] } } if (LOGGER.isDebugEnabled ()) LOGGER.debug ("No executing jobs remaining, all threads stopped."); } if (LOGGER.isDebugEnabled ()) LOGGER.debug ("Shutdown of threadpool complete."); } } }
public class class_name { public static Collection<Class<?>> discover(final String scanPath) throws Exception { if (StringUtils.isBlank(scanPath)) { throw new IllegalStateException("Please specify the [scanPath]"); } LOGGER.debug("scanPath[" + scanPath + "]"); final Collection<Class<?>> ret = new HashSet<>(); final String[] splitPaths = scanPath.split(","); // Adds some built-in components final String[] paths = ArrayUtils.concatenate(splitPaths, BUILT_IN_COMPONENT_PKGS); final Set<URL> urls = new LinkedHashSet<>(); for (String path : paths) { /* * the being two types of the scanPath. * 1 package: org.b3log.xxx * 2 ant-style classpath: org/b3log/** /*process.class */ if (!AntPathMatcher.isPattern(path)) { path = path.replaceAll("\\.", "/") + "/**/*.class"; } urls.addAll(ClassPathResolver.getResources(path)); } for (final URL url : urls) { final DataInputStream classInputStream = new DataInputStream(url.openStream()); final ClassFile classFile = new ClassFile(classInputStream); final String className = classFile.getName(); final AnnotationsAttribute annotationsAttribute = (AnnotationsAttribute) classFile.getAttribute(AnnotationsAttribute.visibleTag); if (null == annotationsAttribute) { LOGGER.log(Level.TRACE, "The class [name={0}] is not a bean", className); continue; } final ConstPool constPool = classFile.getConstPool(); final Annotation[] annotations = annotationsAttribute.getAnnotations(); boolean maybeBeanClass = false; for (final Annotation annotation : annotations) { final String typeName = annotation.getTypeName(); if (typeName.equals(Singleton.class.getName())) { maybeBeanClass = true; break; } if (typeName.equals(RequestProcessor.class.getName()) || typeName.equals(Service.class.getName()) || typeName.equals(Repository.class.getName())) { final Annotation singletonAnnotation = new Annotation(Singleton.class.getName(), constPool); annotationsAttribute.addAnnotation(singletonAnnotation); classFile.addAttribute(annotationsAttribute); classFile.setVersionToJava5(); maybeBeanClass = true; break; } } if (maybeBeanClass) { Class<?> clz = null; try { clz = Thread.currentThread().getContextClassLoader().loadClass(className); } catch (final ClassNotFoundException e) { LOGGER.log(Level.ERROR, "Loads class [" + className + "] failed", e); } ret.add(clz); } } return ret; } }
public class class_name { public static Collection<Class<?>> discover(final String scanPath) throws Exception { if (StringUtils.isBlank(scanPath)) { throw new IllegalStateException("Please specify the [scanPath]"); } LOGGER.debug("scanPath[" + scanPath + "]"); final Collection<Class<?>> ret = new HashSet<>(); final String[] splitPaths = scanPath.split(","); // Adds some built-in components final String[] paths = ArrayUtils.concatenate(splitPaths, BUILT_IN_COMPONENT_PKGS); final Set<URL> urls = new LinkedHashSet<>(); for (String path : paths) { /* * the being two types of the scanPath. * 1 package: org.b3log.xxx * 2 ant-style classpath: org/b3log/** /*process.class */ if (!AntPathMatcher.isPattern(path)) { path = path.replaceAll("\\.", "/") + "/**/*.class"; // depends on control dependency: [if], data = [none] } urls.addAll(ClassPathResolver.getResources(path)); // depends on control dependency: [for], data = [path] } for (final URL url : urls) { final DataInputStream classInputStream = new DataInputStream(url.openStream()); final ClassFile classFile = new ClassFile(classInputStream); final String className = classFile.getName(); final AnnotationsAttribute annotationsAttribute = (AnnotationsAttribute) classFile.getAttribute(AnnotationsAttribute.visibleTag); if (null == annotationsAttribute) { LOGGER.log(Level.TRACE, "The class [name={0}] is not a bean", className); // depends on control dependency: [if], data = [none] continue; } final ConstPool constPool = classFile.getConstPool(); final Annotation[] annotations = annotationsAttribute.getAnnotations(); boolean maybeBeanClass = false; for (final Annotation annotation : annotations) { final String typeName = annotation.getTypeName(); if (typeName.equals(Singleton.class.getName())) { maybeBeanClass = true; // depends on control dependency: [if], data = [none] break; } if (typeName.equals(RequestProcessor.class.getName()) || typeName.equals(Service.class.getName()) || typeName.equals(Repository.class.getName())) { final Annotation singletonAnnotation = new Annotation(Singleton.class.getName(), constPool); annotationsAttribute.addAnnotation(singletonAnnotation); // depends on control dependency: [if], data = [none] classFile.addAttribute(annotationsAttribute); // depends on control dependency: [if], data = [none] classFile.setVersionToJava5(); // depends on control dependency: [if], data = [none] maybeBeanClass = true; // depends on control dependency: [if], data = [none] break; } } if (maybeBeanClass) { Class<?> clz = null; // depends on control dependency: [if], data = [none] try { clz = Thread.currentThread().getContextClassLoader().loadClass(className); // depends on control dependency: [try], data = [none] } catch (final ClassNotFoundException e) { LOGGER.log(Level.ERROR, "Loads class [" + className + "] failed", e); } // depends on control dependency: [catch], data = [none] ret.add(clz); // depends on control dependency: [if], data = [none] } } return ret; } }
public class class_name { public void processDialogTimeout(gov.nist.javax.sip.DialogTimeoutEvent timeoutEvent) { final Dialog d = timeoutEvent.getDialog(); if (d != null) { DialogWrapper dw = getDialogWrapper(d); if (dw != null) { final FireableEventType eventType = eventIdCache .getDialogTimeoutEventId(eventLookupFacility); final DialogTimeoutEvent event = new DialogTimeoutEvent(dw); if (!eventIDFilter.filterEvent(eventType)) { try { fireEvent(dw.getActivityHandle(), eventType, event, dw.getEventFiringAddress(), DEFAULT_EVENT_FLAGS); } catch (UnrecognizedActivityHandleException e) { tracer.warning("Failed to fire event " + eventType + ", the activity " + dw + " does not exists in the SLEE"); } catch (Throwable e) { tracer.severe("Failed to fire event", e); } } else { if (tracer.isFineEnabled()) { tracer.fine("Event " + eventType + " filtered."); } } } else { if (tracer.isFineEnabled()) { tracer.fine("DialogTimoutEvent dropped due to null app data."); } } } } }
public class class_name { public void processDialogTimeout(gov.nist.javax.sip.DialogTimeoutEvent timeoutEvent) { final Dialog d = timeoutEvent.getDialog(); if (d != null) { DialogWrapper dw = getDialogWrapper(d); if (dw != null) { final FireableEventType eventType = eventIdCache .getDialogTimeoutEventId(eventLookupFacility); final DialogTimeoutEvent event = new DialogTimeoutEvent(dw); if (!eventIDFilter.filterEvent(eventType)) { try { fireEvent(dw.getActivityHandle(), eventType, event, dw.getEventFiringAddress(), DEFAULT_EVENT_FLAGS); // depends on control dependency: [try], data = [none] } catch (UnrecognizedActivityHandleException e) { tracer.warning("Failed to fire event " + eventType + ", the activity " + dw + " does not exists in the SLEE"); } catch (Throwable e) { // depends on control dependency: [catch], data = [none] tracer.severe("Failed to fire event", e); } // depends on control dependency: [catch], data = [none] } else { if (tracer.isFineEnabled()) { tracer.fine("Event " + eventType + " filtered."); // depends on control dependency: [if], data = [none] } } } else { if (tracer.isFineEnabled()) { tracer.fine("DialogTimoutEvent dropped due to null app data."); // depends on control dependency: [if], data = [none] } } } } }
public class class_name { public String getMailServerIp() { Settings settings = getSettings(); if (settings.getMailServer() == null) { return "127.0.0.1"; } return settings.getMailServer().getIp(); } }
public class class_name { public String getMailServerIp() { Settings settings = getSettings(); if (settings.getMailServer() == null) { return "127.0.0.1"; // depends on control dependency: [if], data = [none] } return settings.getMailServer().getIp(); } }
public class class_name { private AbstractChainedGlobalProcessor<T> addOrCreateChain(AbstractChainedGlobalProcessor<T> chain, String key) { AbstractChainedGlobalProcessor<T> toAdd; if (customPostprocessors.get(key) == null) { toAdd = buildProcessorByKey(key); } else { toAdd = (AbstractChainedGlobalProcessor<T>) customPostprocessors.get(key); } if (toAdd instanceof BundlingProcessLifeCycleListener && !listeners.contains(toAdd)) { listeners.add((BundlingProcessLifeCycleListener) toAdd); } AbstractChainedGlobalProcessor<T> newChainResult = null; if (chain == null) { newChainResult = toAdd; } else { chain.addNextProcessor(toAdd); newChainResult = chain; } return newChainResult; } }
public class class_name { private AbstractChainedGlobalProcessor<T> addOrCreateChain(AbstractChainedGlobalProcessor<T> chain, String key) { AbstractChainedGlobalProcessor<T> toAdd; if (customPostprocessors.get(key) == null) { toAdd = buildProcessorByKey(key); // depends on control dependency: [if], data = [none] } else { toAdd = (AbstractChainedGlobalProcessor<T>) customPostprocessors.get(key); // depends on control dependency: [if], data = [none] } if (toAdd instanceof BundlingProcessLifeCycleListener && !listeners.contains(toAdd)) { listeners.add((BundlingProcessLifeCycleListener) toAdd); // depends on control dependency: [if], data = [none] } AbstractChainedGlobalProcessor<T> newChainResult = null; if (chain == null) { newChainResult = toAdd; // depends on control dependency: [if], data = [none] } else { chain.addNextProcessor(toAdd); // depends on control dependency: [if], data = [none] newChainResult = chain; // depends on control dependency: [if], data = [none] } return newChainResult; } }
public class class_name { public static <T, X, E extends Throwable> Collection<X> collect (Iterable<T> coll, APartialFunction<? super T, ? extends X, E> pf) throws E { final List<X> result = new ArrayList<>(); for (T o: coll) { if (pf.isDefinedAt (o)) { result.add (pf.apply (o)); } } return result; } }
public class class_name { public static <T, X, E extends Throwable> Collection<X> collect (Iterable<T> coll, APartialFunction<? super T, ? extends X, E> pf) throws E { final List<X> result = new ArrayList<>(); for (T o: coll) { if (pf.isDefinedAt (o)) { result.add (pf.apply (o)); // depends on control dependency: [if], data = [none] } } return result; } }
public class class_name { public void setResponseMessages(String pResponseMessages) { // Split string in type=filename pairs String[] mappings = StringUtil.toStringArray(pResponseMessages, ", \r\n\t"); List<String> types = new ArrayList<String>(); for (String pair : mappings) { // Split pairs on '=' String[] mapping = StringUtil.toStringArray(pair, "= "); // Test for wrong mapping if ((mapping == null) || (mapping.length < 2)) { log("Error in init param \"responseMessages\": " + pResponseMessages); continue; } types.add(mapping[0]); responseMessageNames.put(mapping[0], mapping[1]); } // Create arrays responseMessageTypes = types.toArray(new String[types.size()]); } }
public class class_name { public void setResponseMessages(String pResponseMessages) { // Split string in type=filename pairs String[] mappings = StringUtil.toStringArray(pResponseMessages, ", \r\n\t"); List<String> types = new ArrayList<String>(); for (String pair : mappings) { // Split pairs on '=' String[] mapping = StringUtil.toStringArray(pair, "= "); // Test for wrong mapping if ((mapping == null) || (mapping.length < 2)) { log("Error in init param \"responseMessages\": " + pResponseMessages); // depends on control dependency: [if], data = [none] continue; } types.add(mapping[0]); // depends on control dependency: [for], data = [none] responseMessageNames.put(mapping[0], mapping[1]); // depends on control dependency: [for], data = [none] } // Create arrays responseMessageTypes = types.toArray(new String[types.size()]); } }
public class class_name { private static void checkAccess(Channel c) { SecurityManager sm = System.getSecurityManager(); if (sm != null) { sm.checkPermission( new RuntimePermission("inheritedChannel") ); } } }
public class class_name { private static void checkAccess(Channel c) { SecurityManager sm = System.getSecurityManager(); if (sm != null) { sm.checkPermission( new RuntimePermission("inheritedChannel") ); // depends on control dependency: [if], data = [none] } } }
public class class_name { protected void outputLogSummary(int logId, ReadOnlyLogMetadata m) { if (m == null) { output("Log %d: No metadata.", logId); } else { output("Log %d: Epoch=%d, Version=%d, Enabled=%s, Ledgers=%d, Truncation={%s}", logId, m.getEpoch(), m.getUpdateVersion(), m.isEnabled(), m.getLedgers().size(), m.getTruncationAddress()); } } }
public class class_name { protected void outputLogSummary(int logId, ReadOnlyLogMetadata m) { if (m == null) { output("Log %d: No metadata.", logId); // depends on control dependency: [if], data = [none] } else { output("Log %d: Epoch=%d, Version=%d, Enabled=%s, Ledgers=%d, Truncation={%s}", logId, m.getEpoch(), m.getUpdateVersion(), m.isEnabled(), m.getLedgers().size(), m.getTruncationAddress()); // depends on control dependency: [if], data = [none] } } }
public class class_name { private void readFieldValues(Object obj, ObjectStreamClass classDesc) throws OptionalDataException, ClassNotFoundException, IOException { // Now we must read all fields and assign them to the receiver ObjectStreamField[] fields = classDesc.getLoadFields(); fields = (fields == null) ? ObjectStreamClass.NO_FIELDS : fields; Class<?> declaringClass = classDesc.forClass(); if (declaringClass == null && mustResolve) { throw new ClassNotFoundException(classDesc.getName()); } for (ObjectStreamField fieldDesc : fields) { Field field = classDesc.getReflectionField(fieldDesc); if (field != null && Modifier.isTransient(field.getModifiers())) { field = null; // No setting transient fields! (http://b/4471249) } // We may not have been able to find the field, or it may be transient, but we still // need to read the value and do the other checking... try { Class<?> type = fieldDesc.getTypeInternal(); if (type == byte.class) { byte b = input.readByte(); if (field != null) { field.setByte(obj, b); } } else if (type == char.class) { char c = input.readChar(); if (field != null) { field.setChar(obj, c); } } else if (type == double.class) { double d = input.readDouble(); if (field != null) { field.setDouble(obj, d); } } else if (type == float.class) { float f = input.readFloat(); if (field != null) { field.setFloat(obj, f); } } else if (type == int.class) { int i = input.readInt(); if (field != null) { field.setInt(obj, i); } } else if (type == long.class) { long j = input.readLong(); if (field != null) { field.setLong(obj, j); } } else if (type == short.class) { short s = input.readShort(); if (field != null) { field.setShort(obj, s); } } else if (type == boolean.class) { boolean z = input.readBoolean(); if (field != null) { field.setBoolean(obj, z); } } else { Object toSet = fieldDesc.isUnshared() ? readUnshared() : readObject(); if (toSet != null) { // Get the field type from the local field rather than // from the stream's supplied data. That's the field // we'll be setting, so that's the one that needs to be // validated. String fieldName = fieldDesc.getName(); ObjectStreamField localFieldDesc = classDesc.getField(fieldName); Class<?> fieldType = localFieldDesc.getTypeInternal(); Class<?> valueType = toSet.getClass(); if (!fieldType.isAssignableFrom(valueType)) { throw new ClassCastException(classDesc.getName() + "." + fieldName + " - " + fieldType + " not compatible with " + valueType); } if (field != null) { field.set(obj, toSet); } } } } catch (IllegalAccessException iae) { // ObjectStreamField should have called setAccessible(true). throw new AssertionError(iae); } catch (NoSuchFieldError ignored) { } } } }
public class class_name { private void readFieldValues(Object obj, ObjectStreamClass classDesc) throws OptionalDataException, ClassNotFoundException, IOException { // Now we must read all fields and assign them to the receiver ObjectStreamField[] fields = classDesc.getLoadFields(); fields = (fields == null) ? ObjectStreamClass.NO_FIELDS : fields; Class<?> declaringClass = classDesc.forClass(); if (declaringClass == null && mustResolve) { throw new ClassNotFoundException(classDesc.getName()); } for (ObjectStreamField fieldDesc : fields) { Field field = classDesc.getReflectionField(fieldDesc); if (field != null && Modifier.isTransient(field.getModifiers())) { field = null; // No setting transient fields! (http://b/4471249) // depends on control dependency: [if], data = [none] } // We may not have been able to find the field, or it may be transient, but we still // need to read the value and do the other checking... try { Class<?> type = fieldDesc.getTypeInternal(); if (type == byte.class) { byte b = input.readByte(); if (field != null) { field.setByte(obj, b); // depends on control dependency: [if], data = [none] } } else if (type == char.class) { char c = input.readChar(); if (field != null) { field.setChar(obj, c); // depends on control dependency: [if], data = [none] } } else if (type == double.class) { double d = input.readDouble(); if (field != null) { field.setDouble(obj, d); // depends on control dependency: [if], data = [none] } } else if (type == float.class) { float f = input.readFloat(); if (field != null) { field.setFloat(obj, f); // depends on control dependency: [if], data = [none] } } else if (type == int.class) { int i = input.readInt(); if (field != null) { field.setInt(obj, i); // depends on control dependency: [if], data = [none] } } else if (type == long.class) { long j = input.readLong(); if (field != null) { field.setLong(obj, j); // depends on control dependency: [if], data = [none] } } else if (type == short.class) { short s = input.readShort(); if (field != null) { field.setShort(obj, s); // depends on control dependency: [if], data = [none] } } else if (type == boolean.class) { boolean z = input.readBoolean(); if (field != null) { field.setBoolean(obj, z); // depends on control dependency: [if], data = [none] } } else { Object toSet = fieldDesc.isUnshared() ? readUnshared() : readObject(); if (toSet != null) { // Get the field type from the local field rather than // from the stream's supplied data. That's the field // we'll be setting, so that's the one that needs to be // validated. String fieldName = fieldDesc.getName(); ObjectStreamField localFieldDesc = classDesc.getField(fieldName); Class<?> fieldType = localFieldDesc.getTypeInternal(); Class<?> valueType = toSet.getClass(); if (!fieldType.isAssignableFrom(valueType)) { throw new ClassCastException(classDesc.getName() + "." + fieldName + " - " + fieldType + " not compatible with " + valueType); } if (field != null) { field.set(obj, toSet); // depends on control dependency: [if], data = [none] } } } } catch (IllegalAccessException iae) { // ObjectStreamField should have called setAccessible(true). throw new AssertionError(iae); } catch (NoSuchFieldError ignored) { // depends on control dependency: [catch], data = [none] } // depends on control dependency: [catch], data = [none] } } }
public class class_name { private static void printUsage(String cmd) { if ("-showConfig".equals(cmd)) { System.err.println("Usage: java RaidShell" + " [-showConfig]"); } else if ("-recover".equals(cmd)) { System.err.println("Usage: java RaidShell" + " [-recover srcPath1 corruptOffset]"); } else if ("-recoverBlocks".equals(cmd)) { System.err.println("Usage: java RaidShell" + " [-recoverBlocks path1 path2...]"); } else if ("-raidFile".equals(cmd)) { System.err.println( "Usage: java RaidShell -raidFile <path-to-file> <path-to-raidDir> <XOR|RS>"); } else if (DistRaidCommand.equals(cmd)) { System.err.println("Usage: java RaidShell " + DistRaidCommand + " <raid_policy_name> <path1> ... <pathn>"); } else if (FILE_CHECK_CMD.equals(cmd)) { System.err.println( "Usage: java RaidShell -fileCheck [-filesPerJob N] [-sourceOnly] <path-to-file>"); } else if ("-fsck".equals(cmd)) { System.err.println("Usage: java RaidShell [-fsck [path [-threads numthreads] [-count]] [-retNumStrpsMissingBlks] [-listrecoverablefiles]]"); } else if ("-usefulHar".equals(cmd)) { System.err.println("Usage: java RaidShell [-usefulHar <XOR|RS> [path-to-raid-har]]"); } else if ("-checkFile".equals(cmd)) { System.err.println("Usage: java RaidShell [-checkFile path]"); } else if ("-purgeParity".equals(cmd)) { System.err.println("Usage: java RaidShell -purgeParity path <XOR|RS>"); } else if ("-checkParity".equals(cmd)) { System.err.println("Usage: java RaidShell [-checkParity path]"); } else if ("-findMissingParityFiles".equals(cmd)) { System.err.println("Usage: java RaidShell -findMissingParityFiles [-r] rootPath"); } else if ("-verifyFile".equals(cmd)) { System.err.println("Usage: java RaidShell -verifyFile rootPath"); } else if ("-verifyParity".equals(cmd)) { System.err.println("Usage: java RaidShell -verifyParity -repl expectRepl" + " [-restore] parityRootPath"); } else if ("-rs_benchmark".equals(cmd)) { System.err.println("Usage: java RaidShell -rs_benchmark -verify -native" + " [-encode E] [-seed S] [-dpos P] [-dlen L] [-elen L]"); } else if ("-estimateSaving".equals(cmd)) { System.err.println("Usage: java RaidShell -estimateSaving xor:/x/y/xor,rs:/x/y/rs,dir-xor:/x/y/dir_xor " + "[-threads numthreads] [-debug]"); } else if ("-smoketest".equals(cmd)) { System.err.println("Usage: java RaidShell -smoketest"); } else { System.err.println("Usage: java RaidShell"); System.err.println(" [-showConfig ]"); System.err.println(" [-help [cmd]]"); System.err.println(" [-recover srcPath1 corruptOffset]"); System.err.println(" [-recoverBlocks path1 path2...]"); System.err.println(" [-raidFile <path-to-file> <path-to-raidDir> <XOR|RS>"); System.err.println(" [" + DistRaidCommand + " <raid_policy_name> <path1> ... <pathn>]"); System.err.println(" [-fsck [path [-threads numthreads] [-count]] [-retNumStrpsMissingBlks] [-listrecoverablefiles]]"); System.err.println(" [" + FILE_CHECK_CMD + " [-filesPerJob N] [-sourceOnly] <path-to-file>"); System.err.println(" [-usefulHar <XOR|RS> [path-to-raid-har]]"); System.err.println(" [-checkFile path]"); System.err.println(" [-purgeParity path <XOR|RS>]"); System.err.println(" [-findMissingParityFiles [-r] rootPath"); System.err.println(" [-verifyParity -repl expectRepl " + " [-restore] parityRootPath"); System.err.println(" [-checkParity path]"); System.err.println(" [-verifyFile rootPath]"); System.err.println(" [-rs_benchmark -verify -native" + " [-encode E] [-seed S] [-dpos P] [-dlen L] [-elen L]"); System.err.println(" [-estimateSaving xor:/x/y/xor,rs:/x/y/rs,dir-xor:/x/y/dir_xor " + "[-threads numthreads] [-debug]"); System.err.println(" [-smoketest]"); System.err.println(); ToolRunner.printGenericCommandUsage(System.err); } } }
public class class_name { private static void printUsage(String cmd) { if ("-showConfig".equals(cmd)) { System.err.println("Usage: java RaidShell" + " [-showConfig]"); // depends on control dependency: [if], data = [none] } else if ("-recover".equals(cmd)) { System.err.println("Usage: java RaidShell" + " [-recover srcPath1 corruptOffset]"); // depends on control dependency: [if], data = [none] } else if ("-recoverBlocks".equals(cmd)) { System.err.println("Usage: java RaidShell" + " [-recoverBlocks path1 path2...]"); // depends on control dependency: [if], data = [none] } else if ("-raidFile".equals(cmd)) { System.err.println( "Usage: java RaidShell -raidFile <path-to-file> <path-to-raidDir> <XOR|RS>"); // depends on control dependency: [if], data = [none] } else if (DistRaidCommand.equals(cmd)) { System.err.println("Usage: java RaidShell " + DistRaidCommand + " <raid_policy_name> <path1> ... <pathn>"); // depends on control dependency: [if], data = [none] } else if (FILE_CHECK_CMD.equals(cmd)) { System.err.println( "Usage: java RaidShell -fileCheck [-filesPerJob N] [-sourceOnly] <path-to-file>"); // depends on control dependency: [if], data = [none] } else if ("-fsck".equals(cmd)) { System.err.println("Usage: java RaidShell [-fsck [path [-threads numthreads] [-count]] [-retNumStrpsMissingBlks] [-listrecoverablefiles]]"); // depends on control dependency: [if], data = [none] } else if ("-usefulHar".equals(cmd)) { System.err.println("Usage: java RaidShell [-usefulHar <XOR|RS> [path-to-raid-har]]"); // depends on control dependency: [if], data = [none] } else if ("-checkFile".equals(cmd)) { System.err.println("Usage: java RaidShell [-checkFile path]"); // depends on control dependency: [if], data = [none] } else if ("-purgeParity".equals(cmd)) { System.err.println("Usage: java RaidShell -purgeParity path <XOR|RS>"); // depends on control dependency: [if], data = [none] } else if ("-checkParity".equals(cmd)) { System.err.println("Usage: java RaidShell [-checkParity path]"); // depends on control dependency: [if], data = [none] } else if ("-findMissingParityFiles".equals(cmd)) { System.err.println("Usage: java RaidShell -findMissingParityFiles [-r] rootPath"); // depends on control dependency: [if], data = [none] } else if ("-verifyFile".equals(cmd)) { System.err.println("Usage: java RaidShell -verifyFile rootPath"); // depends on control dependency: [if], data = [none] } else if ("-verifyParity".equals(cmd)) { System.err.println("Usage: java RaidShell -verifyParity -repl expectRepl" + " [-restore] parityRootPath"); // depends on control dependency: [if], data = [none] } else if ("-rs_benchmark".equals(cmd)) { System.err.println("Usage: java RaidShell -rs_benchmark -verify -native" + " [-encode E] [-seed S] [-dpos P] [-dlen L] [-elen L]"); // depends on control dependency: [if], data = [none] } else if ("-estimateSaving".equals(cmd)) { System.err.println("Usage: java RaidShell -estimateSaving xor:/x/y/xor,rs:/x/y/rs,dir-xor:/x/y/dir_xor " + "[-threads numthreads] [-debug]"); // depends on control dependency: [if], data = [none] } else if ("-smoketest".equals(cmd)) { System.err.println("Usage: java RaidShell -smoketest"); // depends on control dependency: [if], data = [none] } else { System.err.println("Usage: java RaidShell"); // depends on control dependency: [if], data = [none] System.err.println(" [-showConfig ]"); // depends on control dependency: [if], data = [none] System.err.println(" [-help [cmd]]"); // depends on control dependency: [if], data = [none] System.err.println(" [-recover srcPath1 corruptOffset]"); // depends on control dependency: [if], data = [none] System.err.println(" [-recoverBlocks path1 path2...]"); // depends on control dependency: [if], data = [none] System.err.println(" [-raidFile <path-to-file> <path-to-raidDir> <XOR|RS>"); // depends on control dependency: [if], data = [none] System.err.println(" [" + DistRaidCommand + " <raid_policy_name> <path1> ... <pathn>]"); // depends on control dependency: [if], data = [none] System.err.println(" [-fsck [path [-threads numthreads] [-count]] [-retNumStrpsMissingBlks] [-listrecoverablefiles]]"); // depends on control dependency: [if], data = [none] System.err.println(" [" + FILE_CHECK_CMD + " [-filesPerJob N] [-sourceOnly] <path-to-file>"); // depends on control dependency: [if], data = [none] System.err.println(" [-usefulHar <XOR|RS> [path-to-raid-har]]"); // depends on control dependency: [if], data = [none] System.err.println(" [-checkFile path]"); // depends on control dependency: [if], data = [none] System.err.println(" [-purgeParity path <XOR|RS>]"); // depends on control dependency: [if], data = [none] System.err.println(" [-findMissingParityFiles [-r] rootPath"); // depends on control dependency: [if], data = [none] System.err.println(" [-verifyParity -repl expectRepl " + " [-restore] parityRootPath"); // depends on control dependency: [if], data = [none] System.err.println(" [-checkParity path]"); // depends on control dependency: [if], data = [none] System.err.println(" [-verifyFile rootPath]"); // depends on control dependency: [if], data = [none] System.err.println(" [-rs_benchmark -verify -native" + " [-encode E] [-seed S] [-dpos P] [-dlen L] [-elen L]"); // depends on control dependency: [if], data = [none] System.err.println(" [-estimateSaving xor:/x/y/xor,rs:/x/y/rs,dir-xor:/x/y/dir_xor " + "[-threads numthreads] [-debug]"); // depends on control dependency: [if], data = [none] System.err.println(" [-smoketest]"); // depends on control dependency: [if], data = [none] System.err.println(); // depends on control dependency: [if], data = [none] ToolRunner.printGenericCommandUsage(System.err); // depends on control dependency: [if], data = [none] } } }
public class class_name { public <T extends AuthMethod> T getAuth(Class<T> type) throws NexmoUnacceptableAuthException { for (AuthMethod availableAuthMethod : this.authList) { if (type.isInstance(availableAuthMethod)) { return (T) availableAuthMethod; } } throw new NexmoUnacceptableAuthException(this.authList, new HashSet<>(Arrays.asList(new Class[]{type}))); } }
public class class_name { public <T extends AuthMethod> T getAuth(Class<T> type) throws NexmoUnacceptableAuthException { for (AuthMethod availableAuthMethod : this.authList) { if (type.isInstance(availableAuthMethod)) { return (T) availableAuthMethod; // depends on control dependency: [if], data = [none] } } throw new NexmoUnacceptableAuthException(this.authList, new HashSet<>(Arrays.asList(new Class[]{type}))); } }
public class class_name { final protected BagOfTokens asBagOfTokens(StringWrapper w) { if (w instanceof BagOfTokens) return (BagOfTokens)w; else { String s = w.unwrap(); Token[] toks = tokenizer.tokenize(s); return new BagOfTokens(s,toks); } } }
public class class_name { final protected BagOfTokens asBagOfTokens(StringWrapper w) { if (w instanceof BagOfTokens) return (BagOfTokens)w; else { String s = w.unwrap(); Token[] toks = tokenizer.tokenize(s); return new BagOfTokens(s,toks); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static String encodeUrl(String path) { if (path != null) { path = path.replaceAll(">", "%3E"); path = path.replaceAll("<", "%3C"); path = path.replaceAll(" ", "%20"); } return path; } }
public class class_name { public static String encodeUrl(String path) { if (path != null) { path = path.replaceAll(">", "%3E"); // depends on control dependency: [if], data = [none] path = path.replaceAll("<", "%3C"); // depends on control dependency: [if], data = [none] path = path.replaceAll(" ", "%20"); // depends on control dependency: [if], data = [none] } return path; } }
public class class_name { @Override public boolean next() { while (true) { if (rp.next()) return true; if (current == endBlkNum) return false; moveToBlock(current + 1); } } }
public class class_name { @Override public boolean next() { while (true) { if (rp.next()) return true; if (current == endBlkNum) return false; moveToBlock(current + 1); // depends on control dependency: [while], data = [none] } } }
public class class_name { public int getNodeByPosition(int position) { if (position > 0) { final int pos = isReverse() ? getLast() - position + 1 : position; int node; while ((node = next()) != DTMAxisIterator.END) { if (pos == getPosition()) { return node; } } } return END; } }
public class class_name { public int getNodeByPosition(int position) { if (position > 0) { final int pos = isReverse() ? getLast() - position + 1 : position; int node; while ((node = next()) != DTMAxisIterator.END) { if (pos == getPosition()) { return node; // depends on control dependency: [if], data = [none] } } } return END; } }
public class class_name { public static SimpleModule getModule(final ObjectMapper mapper) { SimpleModule module = new SimpleModule(); module.setSerializerModifier(new BeanSerializerModifier() { @Override public JsonSerializer<?> modifySerializer(SerializationConfig config, BeanDescription beanDesc, JsonSerializer<?> serializer) { if (BeanSerializer.class.isAssignableFrom(serializer.getClass())) { return new FlatteningSerializer(beanDesc.getBeanClass(), serializer, mapper); } return serializer; } }); return module; } }
public class class_name { public static SimpleModule getModule(final ObjectMapper mapper) { SimpleModule module = new SimpleModule(); module.setSerializerModifier(new BeanSerializerModifier() { @Override public JsonSerializer<?> modifySerializer(SerializationConfig config, BeanDescription beanDesc, JsonSerializer<?> serializer) { if (BeanSerializer.class.isAssignableFrom(serializer.getClass())) { return new FlatteningSerializer(beanDesc.getBeanClass(), serializer, mapper); // depends on control dependency: [if], data = [none] } return serializer; } }); return module; } }
public class class_name { private void generateFiveRandomTracesPerSecond() { logGeneratorThread = new Thread(new Runnable() { @Override public void run() { while (continueReading) { int traceLevel = traceCounter % 6; switch (traceLevel) { case 0: Log.d("Lynx", traceCounter + " - Debug trace generated automatically"); break; case 1: Log.w("Lynx", traceCounter + " - Warning trace generated automatically"); break; case 2: Log.e("Lynx", traceCounter + " - Error trace generated automatically"); break; case 3: Log.wtf("Lynx", traceCounter + " - WTF trace generated automatically"); break; case 4: Log.i("Lynx", traceCounter + " - Info trace generated automatically"); default: Log.v("Lynx", traceCounter + " - Verbose trace generated automatically"); } traceCounter++; try { Thread.sleep(200); } catch (InterruptedException e) { e.printStackTrace(); } } } }); logGeneratorThread.start(); } }
public class class_name { private void generateFiveRandomTracesPerSecond() { logGeneratorThread = new Thread(new Runnable() { @Override public void run() { while (continueReading) { int traceLevel = traceCounter % 6; switch (traceLevel) { case 0: Log.d("Lynx", traceCounter + " - Debug trace generated automatically"); break; case 1: Log.w("Lynx", traceCounter + " - Warning trace generated automatically"); break; case 2: Log.e("Lynx", traceCounter + " - Error trace generated automatically"); break; case 3: Log.wtf("Lynx", traceCounter + " - WTF trace generated automatically"); break; case 4: Log.i("Lynx", traceCounter + " - Info trace generated automatically"); default: Log.v("Lynx", traceCounter + " - Verbose trace generated automatically"); } traceCounter++; // depends on control dependency: [while], data = [none] try { Thread.sleep(200); // depends on control dependency: [try], data = [none] } catch (InterruptedException e) { e.printStackTrace(); } // depends on control dependency: [catch], data = [none] } } }); logGeneratorThread.start(); } }
public class class_name { public static InputStream inputStreamFromURL(URL url) throws IOException { if ("file".equals(url.getProtocol())) { /* As per [WSTX-82], can not do this if the path refers * to a network drive on windows. This fixes the problem; * might not be needed on all platforms (NFS?), but should not * matter a lot: performance penalty of extra wrapping is more * relevant when accessing local file system. */ String host = url.getHost(); if (host == null || host.length() == 0) { /* One more test: if there are quoted characters, need * to decoded [WSTX-207]: */ String path = url.getPath(); if (path.indexOf('%') >= 0) { path = URLDecoder.decode(path, "UTF-8"); } return new FileInputStream(path); } } return url.openStream(); } }
public class class_name { public static InputStream inputStreamFromURL(URL url) throws IOException { if ("file".equals(url.getProtocol())) { /* As per [WSTX-82], can not do this if the path refers * to a network drive on windows. This fixes the problem; * might not be needed on all platforms (NFS?), but should not * matter a lot: performance penalty of extra wrapping is more * relevant when accessing local file system. */ String host = url.getHost(); if (host == null || host.length() == 0) { /* One more test: if there are quoted characters, need * to decoded [WSTX-207]: */ String path = url.getPath(); if (path.indexOf('%') >= 0) { path = URLDecoder.decode(path, "UTF-8"); // depends on control dependency: [if], data = [none] } return new FileInputStream(path); } } return url.openStream(); } }
public class class_name { private static String getSymbolFromFormat(final Cell cell) { CellStyle style = cell.getCellStyle(); if (style == null) { return null; } String formatString = style.getDataFormatString(); if (formatString == null) { return null; } if (formatString.indexOf(TieConstants.CELL_ADDR_PRE_FIX) < 0) { return null; } int ipos = formatString.indexOf("[$"); if (ipos < 0) { // only $ found, then return default dollar symbol return "$"; } // return specified dollar symbol return formatString.substring(ipos + 2, formatString.indexOf(']', ipos)); } }
public class class_name { private static String getSymbolFromFormat(final Cell cell) { CellStyle style = cell.getCellStyle(); if (style == null) { return null; // depends on control dependency: [if], data = [none] } String formatString = style.getDataFormatString(); if (formatString == null) { return null; // depends on control dependency: [if], data = [none] } if (formatString.indexOf(TieConstants.CELL_ADDR_PRE_FIX) < 0) { return null; // depends on control dependency: [if], data = [none] } int ipos = formatString.indexOf("[$"); if (ipos < 0) { // only $ found, then return default dollar symbol return "$"; // depends on control dependency: [if], data = [none] } // return specified dollar symbol return formatString.substring(ipos + 2, formatString.indexOf(']', ipos)); } }
public class class_name { @Override // @FFDCIgnore(ClassCastException.class) public void processCounter(Event event) { Object[] methodParams = (Object[]) event.getContextInfo(); if (methodParams != null && methodParams.length > 0) { if ((methodParams[0].toString()).equals("JMX_NOTIFICATION_01")) { auditEventJMXNotification01(methodParams); } else if ((methodParams[0].toString()).equals("JMX_MBEAN_01")) { auditEventJMXMBean01(methodParams); } else if ((methodParams[0].toString()).equals("JMX_MBEAN_ATTRIBUTES_01")) { auditEventJMXMBeanAttributes01(methodParams); } else if ((methodParams[0].toString()).equals("JMX_MBEAN_REGISTER_01")) { auditEventJMXMBeanRegister01(methodParams); } else { switch ((Audit.EventID) methodParams[0]) { case SECURITY_AUTHN_01: auditEventAuthn01(methodParams); break; case SECURITY_AUTHZ_01: auditEventAuthz01(methodParams); break; case SECURITY_AUTHZ_02: auditEventAuthz02(methodParams); break; case SECURITY_AUTHZ_03: auditEventAuthz03(methodParams); break; case SECURITY_AUTHZ_04: auditEventAuthz04(methodParams); break; case SECURITY_AUDIT_MGMT_01: auditEventAuditMgmt01(methodParams); break; case SECURITY_AUDIT_MGMT_02: auditEventAuditMgmt02(methodParams); break; case SECURITY_AUTHN_DELEGATION_01: auditEventAuthnDelegation01(methodParams); break; case SECURITY_AUTHZ_DELEGATION_01: auditEventAuthzDelegation01(methodParams); break; case SECURITY_API_AUTHN_01: auditEventApiAuthn01(methodParams); break; case SECURITY_API_AUTHN_TERMINATE_01: auditEventApiAuthnTerminate01(methodParams); break; case SECURITY_AUTHN_TERMINATE_01: auditEventAuthnTerminate01(methodParams); break; case SECURITY_AUTHN_FAILOVER_01: auditEventAuthnFailover01(methodParams); break; case SECURITY_MEMBER_MGMT_01: auditEventMemberMgmt01(methodParams); break; case SECURITY_JMS_AUTHN_01: auditEventJMSAuthn01(methodParams); break; case SECURITY_JMS_AUTHZ_01: auditEventJMSAuthz01(methodParams); break; case SECURITY_JMS_AUTHN_TERMINATE_01: auditEventJMSAuthnTerm01(methodParams); break; case SECURITY_SAF_AUTHZ_DETAILS: auditEventSafAuthDetails(methodParams); break; case APPLICATION_PASSWORD_TOKEN_01: auditEventApplicationPasswordToken(methodParams); break; default: // TODO: emit error message break; } } } } }
public class class_name { @Override // @FFDCIgnore(ClassCastException.class) public void processCounter(Event event) { Object[] methodParams = (Object[]) event.getContextInfo(); if (methodParams != null && methodParams.length > 0) { if ((methodParams[0].toString()).equals("JMX_NOTIFICATION_01")) { auditEventJMXNotification01(methodParams); // depends on control dependency: [if], data = [none] } else if ((methodParams[0].toString()).equals("JMX_MBEAN_01")) { auditEventJMXMBean01(methodParams); // depends on control dependency: [if], data = [none] } else if ((methodParams[0].toString()).equals("JMX_MBEAN_ATTRIBUTES_01")) { auditEventJMXMBeanAttributes01(methodParams); // depends on control dependency: [if], data = [none] } else if ((methodParams[0].toString()).equals("JMX_MBEAN_REGISTER_01")) { auditEventJMXMBeanRegister01(methodParams); // depends on control dependency: [if], data = [none] } else { switch ((Audit.EventID) methodParams[0]) { case SECURITY_AUTHN_01: auditEventAuthn01(methodParams); break; case SECURITY_AUTHZ_01: auditEventAuthz01(methodParams); break; case SECURITY_AUTHZ_02: auditEventAuthz02(methodParams); break; case SECURITY_AUTHZ_03: auditEventAuthz03(methodParams); break; case SECURITY_AUTHZ_04: auditEventAuthz04(methodParams); break; case SECURITY_AUDIT_MGMT_01: auditEventAuditMgmt01(methodParams); break; case SECURITY_AUDIT_MGMT_02: auditEventAuditMgmt02(methodParams); break; case SECURITY_AUTHN_DELEGATION_01: auditEventAuthnDelegation01(methodParams); break; case SECURITY_AUTHZ_DELEGATION_01: auditEventAuthzDelegation01(methodParams); break; case SECURITY_API_AUTHN_01: auditEventApiAuthn01(methodParams); break; case SECURITY_API_AUTHN_TERMINATE_01: auditEventApiAuthnTerminate01(methodParams); break; case SECURITY_AUTHN_TERMINATE_01: auditEventAuthnTerminate01(methodParams); break; case SECURITY_AUTHN_FAILOVER_01: auditEventAuthnFailover01(methodParams); break; case SECURITY_MEMBER_MGMT_01: auditEventMemberMgmt01(methodParams); break; case SECURITY_JMS_AUTHN_01: auditEventJMSAuthn01(methodParams); break; case SECURITY_JMS_AUTHZ_01: auditEventJMSAuthz01(methodParams); break; case SECURITY_JMS_AUTHN_TERMINATE_01: auditEventJMSAuthnTerm01(methodParams); break; case SECURITY_SAF_AUTHZ_DETAILS: auditEventSafAuthDetails(methodParams); break; case APPLICATION_PASSWORD_TOKEN_01: auditEventApplicationPasswordToken(methodParams); break; default: // TODO: emit error message break; } } } } }
public class class_name { public final static void readBytesRef(BytesRef src, BytesRef dst) { int length = Bytes.readVInt(src); if (length == 0) { dst.offset = dst.length = 0; return; } if (dst.bytes.length < length) { dst.bytes = new byte[length]; } System.arraycopy(src.bytes, src.offset, dst.bytes, 0, length); src.offset += length; dst.offset = 0; dst.length = length; } }
public class class_name { public final static void readBytesRef(BytesRef src, BytesRef dst) { int length = Bytes.readVInt(src); if (length == 0) { dst.offset = dst.length = 0; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } if (dst.bytes.length < length) { dst.bytes = new byte[length]; // depends on control dependency: [if], data = [none] } System.arraycopy(src.bytes, src.offset, dst.bytes, 0, length); src.offset += length; dst.offset = 0; dst.length = length; } }
public class class_name { public void setReservedElasticsearchInstances(java.util.Collection<ReservedElasticsearchInstance> reservedElasticsearchInstances) { if (reservedElasticsearchInstances == null) { this.reservedElasticsearchInstances = null; return; } this.reservedElasticsearchInstances = new java.util.ArrayList<ReservedElasticsearchInstance>(reservedElasticsearchInstances); } }
public class class_name { public void setReservedElasticsearchInstances(java.util.Collection<ReservedElasticsearchInstance> reservedElasticsearchInstances) { if (reservedElasticsearchInstances == null) { this.reservedElasticsearchInstances = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.reservedElasticsearchInstances = new java.util.ArrayList<ReservedElasticsearchInstance>(reservedElasticsearchInstances); } }
public class class_name { public SecurityController getSecurityController(String id) { SecurityController sc = (SecurityController) securityControllerMap.get( id ); if( sc == null ) { // Try for a named bean try { sc = applicationContext.getBean( id, SecurityController.class ); } catch( NoSuchBeanDefinitionException e ) { // Try for a fallback sc = getFallbackSecurityController(); } } return sc; } }
public class class_name { public SecurityController getSecurityController(String id) { SecurityController sc = (SecurityController) securityControllerMap.get( id ); if( sc == null ) { // Try for a named bean try { sc = applicationContext.getBean( id, SecurityController.class ); // depends on control dependency: [try], data = [none] } catch( NoSuchBeanDefinitionException e ) { // Try for a fallback sc = getFallbackSecurityController(); } // depends on control dependency: [catch], data = [none] } return sc; } }
public class class_name { public List<ClassDoc> allSubs(ClassDoc cd, boolean isEnum) { List<ClassDoc> list = subs(cd, isEnum); for (int i = 0; i < list.size(); i++) { cd = list.get(i); List<ClassDoc> tlist = subs(cd, isEnum); for (int j = 0; j < tlist.size(); j++) { ClassDoc tcd = tlist.get(j); if (!list.contains(tcd)) { list.add(tcd); } } } Collections.sort(list); return list; } }
public class class_name { public List<ClassDoc> allSubs(ClassDoc cd, boolean isEnum) { List<ClassDoc> list = subs(cd, isEnum); for (int i = 0; i < list.size(); i++) { cd = list.get(i); // depends on control dependency: [for], data = [i] List<ClassDoc> tlist = subs(cd, isEnum); for (int j = 0; j < tlist.size(); j++) { ClassDoc tcd = tlist.get(j); if (!list.contains(tcd)) { list.add(tcd); // depends on control dependency: [if], data = [none] } } } Collections.sort(list); return list; } }
public class class_name { protected static DisConfCommonModel makeDisConfCommonModel(String app, String env, String version) { DisConfCommonModel disConfCommonModel = new DisConfCommonModel(); // app if (!app.isEmpty()) { disConfCommonModel.setApp(app); } else { disConfCommonModel.setApp(DisClientConfig.getInstance().APP); } // env if (!env.isEmpty()) { disConfCommonModel.setEnv(env); } else { disConfCommonModel.setEnv(DisClientConfig.getInstance().ENV); } // version if (!version.isEmpty()) { disConfCommonModel.setVersion(version); } else { disConfCommonModel.setVersion(DisClientConfig.getInstance().VERSION); } return disConfCommonModel; } }
public class class_name { protected static DisConfCommonModel makeDisConfCommonModel(String app, String env, String version) { DisConfCommonModel disConfCommonModel = new DisConfCommonModel(); // app if (!app.isEmpty()) { disConfCommonModel.setApp(app); // depends on control dependency: [if], data = [none] } else { disConfCommonModel.setApp(DisClientConfig.getInstance().APP); // depends on control dependency: [if], data = [none] } // env if (!env.isEmpty()) { disConfCommonModel.setEnv(env); // depends on control dependency: [if], data = [none] } else { disConfCommonModel.setEnv(DisClientConfig.getInstance().ENV); // depends on control dependency: [if], data = [none] } // version if (!version.isEmpty()) { disConfCommonModel.setVersion(version); // depends on control dependency: [if], data = [none] } else { disConfCommonModel.setVersion(DisClientConfig.getInstance().VERSION); // depends on control dependency: [if], data = [none] } return disConfCommonModel; } }
public class class_name { public static Optional<Double> toDouble(Object arg) { if ( arg instanceof Number ) { return Optional.of( ( (Number) arg ).doubleValue() ); } else if(arg instanceof String) { Optional<? extends Number> optional = toNumber( arg ); if ( optional.isPresent() ) { return Optional.of( optional.get().doubleValue() ); } else { return Optional.empty(); } } else { return Optional.empty(); } } }
public class class_name { public static Optional<Double> toDouble(Object arg) { if ( arg instanceof Number ) { return Optional.of( ( (Number) arg ).doubleValue() ); // depends on control dependency: [if], data = [none] } else if(arg instanceof String) { Optional<? extends Number> optional = toNumber( arg ); // depends on control dependency: [if], data = [none] if ( optional.isPresent() ) { return Optional.of( optional.get().doubleValue() ); // depends on control dependency: [if], data = [none] } else { return Optional.empty(); // depends on control dependency: [if], data = [none] } } else { return Optional.empty(); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static Map<String,Object> stringToProperties(String strProperties) { Properties properties = new Properties(); if ((strProperties != null) && (strProperties.length() > 0)) { ByteArrayOutputStream baOut = new ByteArrayOutputStream(); OutputStreamWriter osOut = new OutputStreamWriter(baOut); try { osOut.write(strProperties); // Char->Byte osOut.flush(); baOut.flush(); ByteArrayInputStream baIn = new ByteArrayInputStream(baOut.toByteArray()); properties.load(baIn); } catch (IOException ex) { ex.printStackTrace(); } } Map<String,Object> map = Utility.propertiesToMap(properties); // This is okay. return map; } }
public class class_name { public static Map<String,Object> stringToProperties(String strProperties) { Properties properties = new Properties(); if ((strProperties != null) && (strProperties.length() > 0)) { ByteArrayOutputStream baOut = new ByteArrayOutputStream(); OutputStreamWriter osOut = new OutputStreamWriter(baOut); try { osOut.write(strProperties); // Char->Byte // depends on control dependency: [try], data = [none] osOut.flush(); // depends on control dependency: [try], data = [none] baOut.flush(); // depends on control dependency: [try], data = [none] ByteArrayInputStream baIn = new ByteArrayInputStream(baOut.toByteArray()); properties.load(baIn); // depends on control dependency: [try], data = [none] } catch (IOException ex) { ex.printStackTrace(); } // depends on control dependency: [catch], data = [none] } Map<String,Object> map = Utility.propertiesToMap(properties); // This is okay. return map; } }
public class class_name { @Override public void execute() throws MojoExecutionException, MojoFailureException { validateConfiguration(); try { // set git flow configuration initGitFlowConfig(); // check uncommitted changes checkUncommittedChanges(); String branchName = gitFlowConfig.getProductionBranch(); // find support branches final String supportBranchesStr = gitFindBranches(gitFlowConfig.getSupportBranchPrefix(), false); final String[] supportBranches; if (StringUtils.isNotBlank(supportBranchesStr)) { supportBranches = supportBranchesStr.split("\\r?\\n"); } else { supportBranches = null; } if (settings.isInteractiveMode()) { if (supportBranches != null && supportBranches.length > 0) { String[] branches = new String[supportBranches.length + 1]; for (int i = 0; i < supportBranches.length; i++) { branches[i] = supportBranches[i]; } // add production branch to the list branches[supportBranches.length] = gitFlowConfig .getProductionBranch(); List<String> numberedList = new ArrayList<String>(); StringBuilder str = new StringBuilder("Branches:") .append(LS); for (int i = 0; i < branches.length; i++) { str.append((i + 1) + ". " + branches[i] + LS); numberedList.add(String.valueOf(i + 1)); } str.append("Choose branch to hotfix"); String branchNumber = null; try { while (StringUtils.isBlank(branchNumber)) { branchNumber = prompter.prompt(str.toString(), numberedList); } } catch (PrompterException e) { throw new MojoFailureException("hotfix-start", e); } if (branchNumber != null) { int num = Integer.parseInt(branchNumber); branchName = branches[num - 1]; } if (StringUtils.isBlank(branchName)) { throw new MojoFailureException("Branch name is blank."); } } } else if (StringUtils.isNotBlank(fromBranch)) { if (fromBranch.equals(gitFlowConfig.getProductionBranch()) || contains(supportBranches, fromBranch)) { branchName = fromBranch; } else { throw new MojoFailureException("The fromBranch is not production or support branch."); } } // need to be in master to get correct project version // git checkout master gitCheckout(branchName); // fetch and check remote if (fetchRemote) { gitFetchRemoteAndCompare(branchName); } // get current project version from pom final String currentVersion = getCurrentProjectVersion(); // get default hotfix version final String defaultVersion = new GitFlowVersionInfo(currentVersion) .hotfixVersion(tychoBuild); if (defaultVersion == null) { throw new MojoFailureException( "Cannot get default project version."); } String version = null; if (settings.isInteractiveMode()) { try { while (version == null) { version = prompter .prompt("What is the hotfix version? [" + defaultVersion + "]"); if (!"".equals(version) && (!GitFlowVersionInfo.isValidVersion(version) || !validBranchName(version))) { getLog().info("The version is not valid."); version = null; } } } catch (PrompterException e) { throw new MojoFailureException("hotfix-start", e); } } else { if (StringUtils.isNotBlank(hotfixVersion) && (!GitFlowVersionInfo.isValidVersion(hotfixVersion) || !validBranchName(hotfixVersion))) { throw new MojoFailureException("The hotfix version '" + hotfixVersion + "' is not valid."); } else { version = hotfixVersion; } } if (StringUtils.isBlank(version)) { getLog().info("Version is blank. Using default version."); version = defaultVersion; } // to finish hotfix on support branch String branchVersionPart = version.replace('/', '_'); String hotfixBranchName = gitFlowConfig.getHotfixBranchPrefix() + branchVersionPart; if (!gitFlowConfig.getProductionBranch().equals(branchName)) { hotfixBranchName = gitFlowConfig.getHotfixBranchPrefix() + branchName + "/" + branchVersionPart; } // git for-each-ref refs/heads/hotfix/... final boolean hotfixBranchExists = gitCheckBranchExists( hotfixBranchName); if (hotfixBranchExists) { throw new MojoFailureException( "Hotfix branch with that name already exists. Cannot start hotfix."); } // git checkout -b hotfix/... master gitCreateAndCheckout(hotfixBranchName, branchName); // execute if version changed if (!version.equals(currentVersion)) { String projectVersion = version; if (useSnapshotInHotfix && !ArtifactUtils.isSnapshot(version)) { projectVersion = version + "-" + Artifact.SNAPSHOT_VERSION; } if (useSnapshotInHotfix && mavenSession.getUserProperties().get("useSnapshotInHotfix") != null) { getLog().warn( "The useSnapshotInHotfix parameter is set from the command line. Don't forget to use it in the finish goal as well." + " It is better to define it in the project's pom file."); } // mvn versions:set -DnewVersion=... -DgenerateBackupPoms=false mvnSetVersions(projectVersion); Map<String, String> properties = new HashMap<String, String>(); properties.put("version", projectVersion); // git commit -a -m updating versions for hotfix gitCommit(commitMessages.getHotfixStartMessage(), properties); } if (installProject) { // mvn clean install mvnCleanInstall(); } if (pushRemote) { gitPush(hotfixBranchName, false); } } catch (CommandLineException e) { throw new MojoFailureException("hotfix-start", e); } catch (VersionParseException e) { throw new MojoFailureException("hotfix-start", e); } } }
public class class_name { @Override public void execute() throws MojoExecutionException, MojoFailureException { validateConfiguration(); try { // set git flow configuration initGitFlowConfig(); // check uncommitted changes checkUncommittedChanges(); String branchName = gitFlowConfig.getProductionBranch(); // find support branches final String supportBranchesStr = gitFindBranches(gitFlowConfig.getSupportBranchPrefix(), false); final String[] supportBranches; if (StringUtils.isNotBlank(supportBranchesStr)) { supportBranches = supportBranchesStr.split("\\r?\\n"); // depends on control dependency: [if], data = [none] } else { supportBranches = null; // depends on control dependency: [if], data = [none] } if (settings.isInteractiveMode()) { if (supportBranches != null && supportBranches.length > 0) { String[] branches = new String[supportBranches.length + 1]; for (int i = 0; i < supportBranches.length; i++) { branches[i] = supportBranches[i]; // depends on control dependency: [for], data = [i] } // add production branch to the list branches[supportBranches.length] = gitFlowConfig .getProductionBranch(); // depends on control dependency: [if], data = [none] List<String> numberedList = new ArrayList<String>(); StringBuilder str = new StringBuilder("Branches:") .append(LS); for (int i = 0; i < branches.length; i++) { str.append((i + 1) + ". " + branches[i] + LS); // depends on control dependency: [for], data = [i] numberedList.add(String.valueOf(i + 1)); // depends on control dependency: [for], data = [i] } str.append("Choose branch to hotfix"); // depends on control dependency: [if], data = [none] String branchNumber = null; try { while (StringUtils.isBlank(branchNumber)) { branchNumber = prompter.prompt(str.toString(), numberedList); // depends on control dependency: [while], data = [none] } } catch (PrompterException e) { throw new MojoFailureException("hotfix-start", e); } // depends on control dependency: [catch], data = [none] if (branchNumber != null) { int num = Integer.parseInt(branchNumber); branchName = branches[num - 1]; // depends on control dependency: [if], data = [none] } if (StringUtils.isBlank(branchName)) { throw new MojoFailureException("Branch name is blank."); } } } else if (StringUtils.isNotBlank(fromBranch)) { if (fromBranch.equals(gitFlowConfig.getProductionBranch()) || contains(supportBranches, fromBranch)) { branchName = fromBranch; // depends on control dependency: [if], data = [none] } else { throw new MojoFailureException("The fromBranch is not production or support branch."); } } // need to be in master to get correct project version // git checkout master gitCheckout(branchName); // fetch and check remote if (fetchRemote) { gitFetchRemoteAndCompare(branchName); // depends on control dependency: [if], data = [none] } // get current project version from pom final String currentVersion = getCurrentProjectVersion(); // get default hotfix version final String defaultVersion = new GitFlowVersionInfo(currentVersion) .hotfixVersion(tychoBuild); if (defaultVersion == null) { throw new MojoFailureException( "Cannot get default project version."); } String version = null; if (settings.isInteractiveMode()) { try { while (version == null) { version = prompter .prompt("What is the hotfix version? [" + defaultVersion + "]"); // depends on control dependency: [while], data = [none] if (!"".equals(version) && (!GitFlowVersionInfo.isValidVersion(version) || !validBranchName(version))) { getLog().info("The version is not valid."); // depends on control dependency: [if], data = [none] version = null; // depends on control dependency: [if], data = [none] } } } catch (PrompterException e) { throw new MojoFailureException("hotfix-start", e); } // depends on control dependency: [catch], data = [none] } else { if (StringUtils.isNotBlank(hotfixVersion) && (!GitFlowVersionInfo.isValidVersion(hotfixVersion) || !validBranchName(hotfixVersion))) { throw new MojoFailureException("The hotfix version '" + hotfixVersion + "' is not valid."); } else { version = hotfixVersion; // depends on control dependency: [if], data = [none] } } if (StringUtils.isBlank(version)) { getLog().info("Version is blank. Using default version."); // depends on control dependency: [if], data = [none] version = defaultVersion; // depends on control dependency: [if], data = [none] } // to finish hotfix on support branch String branchVersionPart = version.replace('/', '_'); String hotfixBranchName = gitFlowConfig.getHotfixBranchPrefix() + branchVersionPart; if (!gitFlowConfig.getProductionBranch().equals(branchName)) { hotfixBranchName = gitFlowConfig.getHotfixBranchPrefix() + branchName + "/" + branchVersionPart; // depends on control dependency: [if], data = [none] } // git for-each-ref refs/heads/hotfix/... final boolean hotfixBranchExists = gitCheckBranchExists( hotfixBranchName); if (hotfixBranchExists) { throw new MojoFailureException( "Hotfix branch with that name already exists. Cannot start hotfix."); } // git checkout -b hotfix/... master gitCreateAndCheckout(hotfixBranchName, branchName); // execute if version changed if (!version.equals(currentVersion)) { String projectVersion = version; if (useSnapshotInHotfix && !ArtifactUtils.isSnapshot(version)) { projectVersion = version + "-" + Artifact.SNAPSHOT_VERSION; // depends on control dependency: [if], data = [none] } if (useSnapshotInHotfix && mavenSession.getUserProperties().get("useSnapshotInHotfix") != null) { getLog().warn( "The useSnapshotInHotfix parameter is set from the command line. Don't forget to use it in the finish goal as well." + " It is better to define it in the project's pom file."); // depends on control dependency: [if], data = [none] } // mvn versions:set -DnewVersion=... -DgenerateBackupPoms=false mvnSetVersions(projectVersion); // depends on control dependency: [if], data = [none] Map<String, String> properties = new HashMap<String, String>(); properties.put("version", projectVersion); // depends on control dependency: [if], data = [none] // git commit -a -m updating versions for hotfix gitCommit(commitMessages.getHotfixStartMessage(), properties); // depends on control dependency: [if], data = [none] } if (installProject) { // mvn clean install mvnCleanInstall(); // depends on control dependency: [if], data = [none] } if (pushRemote) { gitPush(hotfixBranchName, false); // depends on control dependency: [if], data = [none] } } catch (CommandLineException e) { throw new MojoFailureException("hotfix-start", e); } catch (VersionParseException e) { throw new MojoFailureException("hotfix-start", e); } } }
public class class_name { @Before public void setUp() { defineApplicationLocales(); clearKeys(); List<Key> keys = new ArrayList<>(); keys.add(createKey(KEY_DEFAULT, false, false, false)); Key outdatedKey = createKey(KEY_OUTDATED, false, false, false); outdatedKey.setOutdated(); keys.add(outdatedKey); keys.add(createKey(KEY_TLN_APPROX, true, false, false)); keys.add(createKey(KEY_TLN_OUTDATED, false, true, false)); keys.add(createKey(KEY_TLN_MISSING, false, false, true)); Key key = keyFactory.createKey(KEY_WITH_MISSING_TRANSLATION); key.addTranslation(FR, TRANSLATION_FR); keys.add(key); for (Key keyToPersist : keys) { keyRepository.add(keyToPersist); } } }
public class class_name { @Before public void setUp() { defineApplicationLocales(); clearKeys(); List<Key> keys = new ArrayList<>(); keys.add(createKey(KEY_DEFAULT, false, false, false)); Key outdatedKey = createKey(KEY_OUTDATED, false, false, false); outdatedKey.setOutdated(); keys.add(outdatedKey); keys.add(createKey(KEY_TLN_APPROX, true, false, false)); keys.add(createKey(KEY_TLN_OUTDATED, false, true, false)); keys.add(createKey(KEY_TLN_MISSING, false, false, true)); Key key = keyFactory.createKey(KEY_WITH_MISSING_TRANSLATION); key.addTranslation(FR, TRANSLATION_FR); keys.add(key); for (Key keyToPersist : keys) { keyRepository.add(keyToPersist); // depends on control dependency: [for], data = [keyToPersist] } } }
public class class_name { public void marshall(DescribedServer describedServer, ProtocolMarshaller protocolMarshaller) { if (describedServer == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(describedServer.getArn(), ARN_BINDING); protocolMarshaller.marshall(describedServer.getEndpointDetails(), ENDPOINTDETAILS_BINDING); protocolMarshaller.marshall(describedServer.getEndpointType(), ENDPOINTTYPE_BINDING); protocolMarshaller.marshall(describedServer.getHostKeyFingerprint(), HOSTKEYFINGERPRINT_BINDING); protocolMarshaller.marshall(describedServer.getIdentityProviderDetails(), IDENTITYPROVIDERDETAILS_BINDING); protocolMarshaller.marshall(describedServer.getIdentityProviderType(), IDENTITYPROVIDERTYPE_BINDING); protocolMarshaller.marshall(describedServer.getLoggingRole(), LOGGINGROLE_BINDING); protocolMarshaller.marshall(describedServer.getServerId(), SERVERID_BINDING); protocolMarshaller.marshall(describedServer.getState(), STATE_BINDING); protocolMarshaller.marshall(describedServer.getTags(), TAGS_BINDING); protocolMarshaller.marshall(describedServer.getUserCount(), USERCOUNT_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(DescribedServer describedServer, ProtocolMarshaller protocolMarshaller) { if (describedServer == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(describedServer.getArn(), ARN_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(describedServer.getEndpointDetails(), ENDPOINTDETAILS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(describedServer.getEndpointType(), ENDPOINTTYPE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(describedServer.getHostKeyFingerprint(), HOSTKEYFINGERPRINT_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(describedServer.getIdentityProviderDetails(), IDENTITYPROVIDERDETAILS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(describedServer.getIdentityProviderType(), IDENTITYPROVIDERTYPE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(describedServer.getLoggingRole(), LOGGINGROLE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(describedServer.getServerId(), SERVERID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(describedServer.getState(), STATE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(describedServer.getTags(), TAGS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(describedServer.getUserCount(), USERCOUNT_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { static Map<String, Object> valueAsMap(Map<String, Object> map, Key key, Map<String, Object> defaultValue) { if (map.containsKey(key.key)) { Object rawOrMap = map.get(key.key); if (rawOrMap instanceof Map) { @SuppressWarnings("unchecked") Map<String, Object> submap = (Map<String, Object>) rawOrMap; return submap; } else { return defaultValue; } } return defaultValue; } }
public class class_name { static Map<String, Object> valueAsMap(Map<String, Object> map, Key key, Map<String, Object> defaultValue) { if (map.containsKey(key.key)) { Object rawOrMap = map.get(key.key); if (rawOrMap instanceof Map) { @SuppressWarnings("unchecked") Map<String, Object> submap = (Map<String, Object>) rawOrMap; return submap; // depends on control dependency: [if], data = [none] } else { return defaultValue; // depends on control dependency: [if], data = [none] } } return defaultValue; } }
public class class_name { private Chat createChat(Message message) { Jid from = message.getFrom(); // According to RFC6120 8.1.2.1 4. messages without a 'from' attribute are valid, but they // are of no use in this case for ChatManager if (from == null) { return null; } EntityJid userJID = from.asEntityJidIfPossible(); if (userJID == null) { LOGGER.warning("Message from JID without localpart: '" + message.toXML() + "'"); return null; } String threadID = message.getThread(); if (threadID == null) { threadID = nextID(); } return createChat(userJID, threadID, false); } }
public class class_name { private Chat createChat(Message message) { Jid from = message.getFrom(); // According to RFC6120 8.1.2.1 4. messages without a 'from' attribute are valid, but they // are of no use in this case for ChatManager if (from == null) { return null; // depends on control dependency: [if], data = [none] } EntityJid userJID = from.asEntityJidIfPossible(); if (userJID == null) { LOGGER.warning("Message from JID without localpart: '" + message.toXML() + "'"); // depends on control dependency: [if], data = [none] return null; // depends on control dependency: [if], data = [none] } String threadID = message.getThread(); if (threadID == null) { threadID = nextID(); // depends on control dependency: [if], data = [none] } return createChat(userJID, threadID, false); } }
public class class_name { void handleReportPage(HttpServletRequest request, HttpServletResponse response) { try { String report = ReportMaker.liveReport(); response.setContentType(HTML_CONTENT_TYPE); response.setStatus(HttpServletResponse.SC_OK); response.getWriter().print(report); } catch (IOException ex) { m_log.warn("Failed to get catalog report.", ex); } } }
public class class_name { void handleReportPage(HttpServletRequest request, HttpServletResponse response) { try { String report = ReportMaker.liveReport(); response.setContentType(HTML_CONTENT_TYPE); // depends on control dependency: [try], data = [none] response.setStatus(HttpServletResponse.SC_OK); // depends on control dependency: [try], data = [none] response.getWriter().print(report); // depends on control dependency: [try], data = [none] } catch (IOException ex) { m_log.warn("Failed to get catalog report.", ex); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public JQueryElement getDropdownResultElement() { String dropdownId = getDropdownContainerElement().attr("id").toString(); if (dropdownId != null && !(dropdownId.isEmpty())) { dropdownId = dropdownId.replace("container", "results"); return $("#" + dropdownId); } else { GWT.log("The element dropdown-result ul element is undefined.", new NullPointerException()); } return null; } }
public class class_name { public JQueryElement getDropdownResultElement() { String dropdownId = getDropdownContainerElement().attr("id").toString(); if (dropdownId != null && !(dropdownId.isEmpty())) { dropdownId = dropdownId.replace("container", "results"); // depends on control dependency: [if], data = [none] return $("#" + dropdownId); // depends on control dependency: [if], data = [none] } else { GWT.log("The element dropdown-result ul element is undefined.", new NullPointerException()); // depends on control dependency: [if], data = [none] } return null; } }
public class class_name { public Bbox getBounds() { Bbox bounds = null; if (!isEmpty()) { for (Polygon polygon : polygons) { if (bounds == null) { bounds = polygon.getBounds(); } else { bounds = bounds.union(polygon.getBounds()); } } } return bounds; } }
public class class_name { public Bbox getBounds() { Bbox bounds = null; if (!isEmpty()) { for (Polygon polygon : polygons) { if (bounds == null) { bounds = polygon.getBounds(); // depends on control dependency: [if], data = [none] } else { bounds = bounds.union(polygon.getBounds()); // depends on control dependency: [if], data = [none] } } } return bounds; } }
public class class_name { public Map<String, OriginTrackedValue> load(boolean expandLists) throws IOException { try (CharacterReader reader = new CharacterReader(this.resource)) { Map<String, OriginTrackedValue> result = new LinkedHashMap<>(); StringBuilder buffer = new StringBuilder(); while (reader.read()) { String key = loadKey(buffer, reader).trim(); if (expandLists && key.endsWith("[]")) { key = key.substring(0, key.length() - 2); int index = 0; do { OriginTrackedValue value = loadValue(buffer, reader, true); put(result, key + "[" + (index++) + "]", value); if (!reader.isEndOfLine()) { reader.read(); } } while (!reader.isEndOfLine()); } else { OriginTrackedValue value = loadValue(buffer, reader, false); put(result, key, value); } } return result; } } }
public class class_name { public Map<String, OriginTrackedValue> load(boolean expandLists) throws IOException { try (CharacterReader reader = new CharacterReader(this.resource)) { Map<String, OriginTrackedValue> result = new LinkedHashMap<>(); StringBuilder buffer = new StringBuilder(); while (reader.read()) { String key = loadKey(buffer, reader).trim(); if (expandLists && key.endsWith("[]")) { key = key.substring(0, key.length() - 2); int index = 0; do { OriginTrackedValue value = loadValue(buffer, reader, true); put(result, key + "[" + (index++) + "]", value); if (!reader.isEndOfLine()) { reader.read(); // depends on control dependency: [if], data = [none] } } while (!reader.isEndOfLine()); } else { OriginTrackedValue value = loadValue(buffer, reader, false); put(result, key, value); } } return result; } } }
public class class_name { public void initialize(CmsUUID id, Locale initialComparisonLocale) throws CmsException { removeAllComponents(); CmsObject cms = A_CmsUI.getCmsObject(); CmsResource res = cms.readResource(id); m_currentRoot = res; CmsSite site = OpenCms.getSiteManager().getSiteForRootPath(res.getRootPath()); Locale rootLocale = OpenCms.getLocaleManager().getDefaultLocale(cms, res); m_rootLocale = rootLocale; Locale mainLocale = site.getMainTranslationLocale(null); List<Locale> secondaryLocales = site.getSecondaryTranslationLocales(); List<Locale> possibleLocaleSelections = getMainLocaleSelectOptions(cms, res, mainLocale, secondaryLocales); m_rootLocaleSelector = new ComboBox(); m_rootLocaleSelector.addStyleName("o-sitemap-localeselect"); m_rootLocaleSelector.setNullSelectionAllowed(false); for (Locale selectableLocale : possibleLocaleSelections) { m_rootLocaleSelector.addItem(selectableLocale); m_rootLocaleSelector.setItemIcon(selectableLocale, FontOpenCms.SPACE); m_rootLocaleSelector.setItemCaption( selectableLocale, selectableLocale.getDisplayName(A_CmsUI.get().getLocale())); } m_rootLocaleSelector.setItemIcon(mainLocale, MAIN_LOCALE_ICON); m_rootLocaleSelector.setValue(m_rootLocale); m_rootLocaleSelector.addValueChangeListener(new ValueChangeListener() { private static final long serialVersionUID = 1L; @SuppressWarnings("synthetic-access") public void valueChange(ValueChangeEvent event) { if (!m_handlingLocaleChange) { m_handlingLocaleChange = true; try { Locale newLocale = (Locale)(event.getProperty().getValue()); switchToLocale(newLocale); } catch (Exception e) { LOG.error(e.getLocalizedMessage(), e); CmsErrorDialog.showErrorDialog(e); } finally { m_handlingLocaleChange = false; } } } }); m_comparisonLocaleSelector = new ComboBox(); m_comparisonLocaleSelector.addStyleName("o-sitemap-localeselect"); m_comparisonLocaleSelector.setNullSelectionAllowed(false); List<Locale> comparisonLocales = getComparisonLocales(); Locale selectedComparisonLocale = null; for (Locale comparisonLocale : comparisonLocales) { m_comparisonLocaleSelector.addItem(comparisonLocale); m_comparisonLocaleSelector.setItemIcon(comparisonLocale, FontOpenCms.SPACE); m_comparisonLocaleSelector.setItemCaption( comparisonLocale, comparisonLocale.getDisplayName(A_CmsUI.get().getLocale())); if ((selectedComparisonLocale == null) && !comparisonLocale.equals(m_rootLocale)) { selectedComparisonLocale = comparisonLocale; } if ((initialComparisonLocale != null) && comparisonLocale.equals(initialComparisonLocale) && !comparisonLocale.equals(m_rootLocale)) { // if an initial comparison locale is given, it should have priority over the first comparison locale selectedComparisonLocale = comparisonLocale; } } m_comparisonLocale = selectedComparisonLocale; m_comparisonLocaleSelector.setValue(selectedComparisonLocale); m_comparisonLocaleSelector.setItemIcon(mainLocale, MAIN_LOCALE_ICON); m_comparisonLocaleSelector.addValueChangeListener(new ValueChangeListener() { private static final long serialVersionUID = 1L; @SuppressWarnings("synthetic-access") public void valueChange(ValueChangeEvent event) { if (!m_handlingLocaleChange) { m_handlingLocaleChange = true; try { Locale locale = (Locale)(event.getProperty().getValue()); if (m_rootLocale.equals(locale)) { Locale oldComparisonLocale = m_comparisonLocale; if (getLocaleGroup().getResourcesByLocale().keySet().contains(oldComparisonLocale)) { m_comparisonLocale = locale; switchToLocale(oldComparisonLocale); updateLocaleWidgets(); } else { Notification.show( CmsVaadinUtils.getMessageText( Messages.GUI_LOCALECOMPARE_CANNOT_SWITCH_COMPARISON_LOCALE_0)); m_comparisonLocaleSelector.setValue(oldComparisonLocale); } } else { m_comparisonLocale = locale; updateLocaleWidgets(); initTree(m_currentRoot); } } catch (Exception e) { LOG.error(e.getLocalizedMessage(), e); CmsErrorDialog.showErrorDialog(e); } finally { m_handlingLocaleChange = false; } } } }); CssLayout localeSelectors = new CssLayout(); localeSelectors.addStyleName(OpenCmsTheme.SITEMAP_LOCALE_BAR); m_rootLocaleSelector.setCaption(CmsVaadinUtils.getMessageText(Messages.GUI_LOCALECOMPARE_MAIN_LOCALE_0)); m_comparisonLocaleSelector.setCaption( CmsVaadinUtils.getMessageText(Messages.GUI_LOCALECOMPARE_COMPARISON_LOCALE_0)); localeSelectors.setWidth("100%"); localeSelectors.addComponent(m_rootLocaleSelector); localeSelectors.addComponent(m_comparisonLocaleSelector); // localeSelectors.setComponentAlignment(wrapper2, Alignment.MIDDLE_RIGHT); setSpacing(true); addComponent(localeSelectors); addComponent(m_treeContainer); m_treeContainer.setWidth("100%"); initTree(res); } }
public class class_name { public void initialize(CmsUUID id, Locale initialComparisonLocale) throws CmsException { removeAllComponents(); CmsObject cms = A_CmsUI.getCmsObject(); CmsResource res = cms.readResource(id); m_currentRoot = res; CmsSite site = OpenCms.getSiteManager().getSiteForRootPath(res.getRootPath()); Locale rootLocale = OpenCms.getLocaleManager().getDefaultLocale(cms, res); m_rootLocale = rootLocale; Locale mainLocale = site.getMainTranslationLocale(null); List<Locale> secondaryLocales = site.getSecondaryTranslationLocales(); List<Locale> possibleLocaleSelections = getMainLocaleSelectOptions(cms, res, mainLocale, secondaryLocales); m_rootLocaleSelector = new ComboBox(); m_rootLocaleSelector.addStyleName("o-sitemap-localeselect"); m_rootLocaleSelector.setNullSelectionAllowed(false); for (Locale selectableLocale : possibleLocaleSelections) { m_rootLocaleSelector.addItem(selectableLocale); m_rootLocaleSelector.setItemIcon(selectableLocale, FontOpenCms.SPACE); m_rootLocaleSelector.setItemCaption( selectableLocale, selectableLocale.getDisplayName(A_CmsUI.get().getLocale())); } m_rootLocaleSelector.setItemIcon(mainLocale, MAIN_LOCALE_ICON); m_rootLocaleSelector.setValue(m_rootLocale); m_rootLocaleSelector.addValueChangeListener(new ValueChangeListener() { private static final long serialVersionUID = 1L; @SuppressWarnings("synthetic-access") public void valueChange(ValueChangeEvent event) { if (!m_handlingLocaleChange) { m_handlingLocaleChange = true; // depends on control dependency: [if], data = [none] try { Locale newLocale = (Locale)(event.getProperty().getValue()); switchToLocale(newLocale); // depends on control dependency: [try], data = [none] } catch (Exception e) { LOG.error(e.getLocalizedMessage(), e); CmsErrorDialog.showErrorDialog(e); } finally { // depends on control dependency: [catch], data = [none] m_handlingLocaleChange = false; } } } }); m_comparisonLocaleSelector = new ComboBox(); m_comparisonLocaleSelector.addStyleName("o-sitemap-localeselect"); m_comparisonLocaleSelector.setNullSelectionAllowed(false); List<Locale> comparisonLocales = getComparisonLocales(); Locale selectedComparisonLocale = null; for (Locale comparisonLocale : comparisonLocales) { m_comparisonLocaleSelector.addItem(comparisonLocale); m_comparisonLocaleSelector.setItemIcon(comparisonLocale, FontOpenCms.SPACE); m_comparisonLocaleSelector.setItemCaption( comparisonLocale, comparisonLocale.getDisplayName(A_CmsUI.get().getLocale())); if ((selectedComparisonLocale == null) && !comparisonLocale.equals(m_rootLocale)) { selectedComparisonLocale = comparisonLocale; // depends on control dependency: [if], data = [none] } if ((initialComparisonLocale != null) && comparisonLocale.equals(initialComparisonLocale) && !comparisonLocale.equals(m_rootLocale)) { // if an initial comparison locale is given, it should have priority over the first comparison locale selectedComparisonLocale = comparisonLocale; // depends on control dependency: [if], data = [none] } } m_comparisonLocale = selectedComparisonLocale; m_comparisonLocaleSelector.setValue(selectedComparisonLocale); m_comparisonLocaleSelector.setItemIcon(mainLocale, MAIN_LOCALE_ICON); m_comparisonLocaleSelector.addValueChangeListener(new ValueChangeListener() { private static final long serialVersionUID = 1L; @SuppressWarnings("synthetic-access") public void valueChange(ValueChangeEvent event) { if (!m_handlingLocaleChange) { m_handlingLocaleChange = true; // depends on control dependency: [if], data = [none] try { Locale locale = (Locale)(event.getProperty().getValue()); if (m_rootLocale.equals(locale)) { Locale oldComparisonLocale = m_comparisonLocale; if (getLocaleGroup().getResourcesByLocale().keySet().contains(oldComparisonLocale)) { m_comparisonLocale = locale; // depends on control dependency: [if], data = [none] switchToLocale(oldComparisonLocale); // depends on control dependency: [if], data = [none] updateLocaleWidgets(); // depends on control dependency: [if], data = [none] } else { Notification.show( CmsVaadinUtils.getMessageText( Messages.GUI_LOCALECOMPARE_CANNOT_SWITCH_COMPARISON_LOCALE_0)); // depends on control dependency: [if], data = [none] m_comparisonLocaleSelector.setValue(oldComparisonLocale); // depends on control dependency: [if], data = [none] } } else { m_comparisonLocale = locale; // depends on control dependency: [if], data = [none] updateLocaleWidgets(); // depends on control dependency: [if], data = [none] initTree(m_currentRoot); // depends on control dependency: [if], data = [none] } } catch (Exception e) { LOG.error(e.getLocalizedMessage(), e); CmsErrorDialog.showErrorDialog(e); } finally { // depends on control dependency: [catch], data = [none] m_handlingLocaleChange = false; } } } }); CssLayout localeSelectors = new CssLayout(); localeSelectors.addStyleName(OpenCmsTheme.SITEMAP_LOCALE_BAR); m_rootLocaleSelector.setCaption(CmsVaadinUtils.getMessageText(Messages.GUI_LOCALECOMPARE_MAIN_LOCALE_0)); m_comparisonLocaleSelector.setCaption( CmsVaadinUtils.getMessageText(Messages.GUI_LOCALECOMPARE_COMPARISON_LOCALE_0)); localeSelectors.setWidth("100%"); localeSelectors.addComponent(m_rootLocaleSelector); localeSelectors.addComponent(m_comparisonLocaleSelector); // localeSelectors.setComponentAlignment(wrapper2, Alignment.MIDDLE_RIGHT); setSpacing(true); addComponent(localeSelectors); addComponent(m_treeContainer); m_treeContainer.setWidth("100%"); initTree(res); } }
public class class_name { public AnnotatedTypeBuilder<X> removeFromField(Field field, Class<? extends Annotation> annotationType) { if (fields.get(field) == null) { throw new IllegalArgumentException("Field not present " + field + " on " + javaClass); } else { fields.get(field).remove(annotationType); } return this; } }
public class class_name { public AnnotatedTypeBuilder<X> removeFromField(Field field, Class<? extends Annotation> annotationType) { if (fields.get(field) == null) { throw new IllegalArgumentException("Field not present " + field + " on " + javaClass); } else { fields.get(field).remove(annotationType); // depends on control dependency: [if], data = [none] } return this; } }
public class class_name { private void addLastOfType() { for (Node node : nodes) { Node n = DOMHelper.getNextSiblingElement(node); while (n != null) { if (DOMHelper.getNodeName(n).equals(DOMHelper.getNodeName(node))) { break; } n = DOMHelper.getNextSiblingElement(n); } if (n == null) { result.add(node); } } } }
public class class_name { private void addLastOfType() { for (Node node : nodes) { Node n = DOMHelper.getNextSiblingElement(node); while (n != null) { if (DOMHelper.getNodeName(n).equals(DOMHelper.getNodeName(node))) { break; } n = DOMHelper.getNextSiblingElement(n); // depends on control dependency: [while], data = [(n] } if (n == null) { result.add(node); // depends on control dependency: [if], data = [(n] } } } }
public class class_name { public static void hijackJDKLogging() { JUL_HIJACKING_LOCK.lock(); try { if (!julHijacked) { SLF4JBridgeHandler.removeHandlersForRootLogger(); SLF4JBridgeHandler.install(); julHijacked = true; } } finally { JUL_HIJACKING_LOCK.unlock(); } } }
public class class_name { public static void hijackJDKLogging() { JUL_HIJACKING_LOCK.lock(); try { if (!julHijacked) { SLF4JBridgeHandler.removeHandlersForRootLogger(); // depends on control dependency: [if], data = [none] SLF4JBridgeHandler.install(); // depends on control dependency: [if], data = [none] julHijacked = true; // depends on control dependency: [if], data = [none] } } finally { JUL_HIJACKING_LOCK.unlock(); } } }
public class class_name { static <T> Maybe<T> wrap( MaybeSource<T> source, Collection<ReactiveInstrumenter> instrumentations) { if (source instanceof Callable) { return new RxInstrumentedCallableMaybe<>(source, instrumentations); } return new RxInstrumentedMaybe<>(source, instrumentations); } }
public class class_name { static <T> Maybe<T> wrap( MaybeSource<T> source, Collection<ReactiveInstrumenter> instrumentations) { if (source instanceof Callable) { return new RxInstrumentedCallableMaybe<>(source, instrumentations); // depends on control dependency: [if], data = [none] } return new RxInstrumentedMaybe<>(source, instrumentations); } }
public class class_name { static public void put(String key, Object o) { if (setContext()) { m_context.put(key, o); } else { m_defaultContext.put(key, o); } } }
public class class_name { static public void put(String key, Object o) { if (setContext()) { m_context.put(key, o); // depends on control dependency: [if], data = [none] } else { m_defaultContext.put(key, o); // depends on control dependency: [if], data = [none] } } }